{ for (VmNicVO nic : self.getVmNics()) { l3NicMacMap.put(nic.getL3NetworkUuid(), nic.getMac()); } SimpleQuery<ApplianceVmFirewallRuleVO> q = dbf.createQuery(ApplianceVmFirewallRuleVO.class); q.add(ApplianceVmFirewallRuleVO_.applianceVmUuid, Op.EQ, self.getUuid()); total = q.count(); }
private void checkNic(VmInstanceVO vm, List<DhcpInfo> info) { VmNicVO nic = vm.getVmNics().iterator().next(); DhcpInfo target = null; for (DhcpInfo i : info) { if (i.mac.equals(nic.getMac())) { target = i; break; } } Assert.assertNotNull(target); Assert.assertEquals(nic.getIp(), target.ip); Assert.assertEquals(nic.getNetmask(), target.netmask); Assert.assertEquals(nic.getGateway(), target.gateway); Assert.assertEquals(true, target.isDefaultL3Network); Assert.assertEquals( VmSystemTags.HOSTNAME.getTokenByResourceUuid(vm.getUuid(), VmSystemTags.HOSTNAME_TOKEN), target.hostname); L3NetworkVO l3 = dbf.findByUuid(nic.getL3NetworkUuid(), L3NetworkVO.class); Assert.assertEquals(l3.getDnsDomain(), target.dnsDomain); Assert.assertNotNull(target.dns); List<String> dns = CollectionUtils.transformToList( l3.getDns(), new Function<String, L3NetworkDnsVO>() { @Override public String call(L3NetworkDnsVO arg) { return arg.getDns(); } }); Assert.assertTrue(dns.containsAll(target.dns)); Assert.assertTrue(target.dns.containsAll(dns)); }