def test_merge_host_and_network_ip_valid(self): self.assertEqual(utils.merge_host_and_network_ip('10.10.10.0/24', '0.0.0.9'), '10.10.10.9') self.assertEqual(utils.merge_host_and_network_ip('10.10.10.0/24', '0.0.0.9'), '10.10.10.9') self.assertEqual(utils.merge_host_and_network_ip('10.10.0.0/16', '0.0.11.9'), '10.10.11.9')
def _get_patched_ve_ip(self, ve_ip): ve_ip = ve_ip.lstrip('.') octets = ve_ip.split('.') for idx in range(4 - len(octets)): octets.insert(0, '0') ve_ip = '.'.join(octets) return a10_utils.merge_host_and_network_ip(self._subnet.cidr, ve_ip)