def test_valid_ipv6_config_many_addr(self): addr = 'fd::' context = self._make_context({ 'inventory_hostname': 'primary', 'hostvars': { 'primary': { 'enable_haproxy': 'yes', 'api_address_family': 'ipv6', 'api_interface': 'fake-interface', 'ansible_facts': { 'fake_interface': { 'ipv6': [ { 'address': addr, 'scope': 'global', 'prefix': 64, }, { 'address': addr + '1', 'scope': 'link', 'prefix': 64, }, { 'address': addr + '2', 'scope': 'global', 'prefix': 64, }, ], }, }, }, }, }) self.assertEqual(addr, kolla_address(context, 'api'))
def test_valid_ipv6_config_do_not_ignore_any_vip_address(self): addr = 'fd::' context = self._make_context({ 'inventory_hostname': 'primary', 'hostvars': { 'primary': { 'enable_haproxy': 'no', 'kolla_external_vip_address': addr, 'kolla_internal_vip_address': addr, 'api_address_family': 'ipv6', 'api_interface': 'fake-interface', 'ansible_facts': { 'fake_interface': { 'ipv6': [ { 'address': addr, 'scope': 'global', 'prefix': 128, }, ], }, }, }, }, }) self.assertEqual(addr, kolla_address(context, 'api'))
def test_valid_ipv4_config(self): addr = '192.0.2.1' context = self._make_context({ 'inventory_hostname': 'primary', 'hostvars': { 'primary': { 'api_address_family': 'ipv4', 'api_interface': 'fake-interface', 'ansible_fake_interface': { 'ipv4': { 'address': addr, }, }, }, }, }) self.assertEqual(addr, kolla_address(context, 'api'))