def test_private_ipv6(self): """Make sure ipv6 is OK""" if FLAGS.use_ipv6: instance_ref = self._create_instance(0) address = self._create_address(0, instance_ref['id']) network_ref = db.project_get_network( context.get_admin_context(), self.context.project_id) address_v6 = db.instance_get_fixed_address_v6( context.get_admin_context(), instance_ref['id']) self.assertEqual(instance_ref['mac_address'], ipv6.to_mac(address_v6)) instance_ref2 = db.fixed_ip_get_instance_v6( context.get_admin_context(), address_v6) self.assertEqual(instance_ref['id'], instance_ref2['id']) self.assertEqual(address_v6, ipv6.to_global(network_ref['cidr_v6'], instance_ref['mac_address'], 'test')) self._deallocate_address(0, address) db.instance_destroy(context.get_admin_context(), instance_ref['id'])
def test_to_mac(self): mac = ipv6.to_mac('2001:db8::a94a:8fe5:ff33:4455') self.assertEquals(mac, '02:16:3e:33:44:55')
def test_to_mac(self): mac = ipv6.to_mac('2001:db8::216:3eff:fe33:4455') self.assertEquals(mac, '00:16:3e:33:44:55')