Ejemplo n.º 1
0
 def test_get_device_plugin_tag(self):
     meta_interface = interface.MetaInterfaceDriver(self.conf)
     self.ip_dev().link.alias = 'fake1'
     plugin_tag0 = meta_interface._get_device_plugin_tag('tap0',
                                                         namespace=None)
     expected = [mock.call('tap0', 'sudo', None)]
     self.ip_dev.assert_has_calls(expected)
     self.assertEqual('fake1', plugin_tag0)
     namespace = '01234567-1234-1234-99'
     expected = [mock.call('tap1', 'sudo', '01234567-1234-1234-99')]
     plugin_tag1 = meta_interface._get_device_plugin_tag(
         'tap1', namespace=namespace)
     self.ip_dev.assert_has_calls(expected)
     self.assertEqual('fake1', plugin_tag1)
Ejemplo n.º 2
0
 def test_set_device_plugin_tag(self):
     meta_interface = interface.MetaInterfaceDriver(self.conf)
     driver = meta_interface._get_driver_by_network_id('test')
     meta_interface._set_device_plugin_tag(driver,
                                           'tap0',
                                           namespace=None)
     expected = [mock.call('tap0', 'sudo', None),
                 mock.call().link.set_alias('fake1')]
     self.ip_dev.assert_has_calls(expected)
     namespace = '01234567-1234-1234-99'
     meta_interface._set_device_plugin_tag(driver,
                                           'tap1',
                                           namespace=namespace)
     expected = [mock.call('tap1', 'sudo', '01234567-1234-1234-99'),
                 mock.call().link.set_alias('fake1')]
     self.ip_dev.assert_has_calls(expected)
Ejemplo n.º 3
0
 def test_get_driver_by_network_id(self):
     meta_interface = interface.MetaInterfaceDriver(self.conf)
     driver = meta_interface._get_driver_by_network_id('test')
     self.assertIsInstance(driver, interface.OVSInterfaceDriver)