tap_name = device_name.replace(prefix, 'tap')
else:
tap_name = device_name.replace(self.DEV_NAME_PREFIX, 'tap')
- root_veth, dhcp_veth = ip.add_veth(tap_name, device_name)
- root_veth.link.set_address(mac_address)
+ root_veth, ns_veth = ip.add_veth(tap_name, device_name)
+ ns_veth.link.set_address(mac_address)
if self.conf.network_device_mtu:
root_veth.link.set_mtu(self.conf.network_device_mtu)
- dhcp_veth.link.set_mtu(self.conf.network_device_mtu)
+ ns_veth.link.set_mtu(self.conf.network_device_mtu)
if namespace:
namespace_obj = ip.ensure_namespace(namespace)
- namespace_obj.add_device_to_namespace(dhcp_veth)
+ namespace_obj.add_device_to_namespace(ns_veth)
root_veth.link.set_up()
- dhcp_veth.link.set_up()
+ ns_veth.link.set_up()
else:
LOG.warn(_("Device %s already exists") % device_name)
self.ip().add_veth = mock.Mock(return_value=(root_veth, ns_veth))
- expected = [mock.call(c, 'sudo') for c in [
- ['ip', 'tuntap', 'add', 'tap0', 'mode', 'tap'],
- ['ip', 'link', 'set', 'tap0', 'address', 'aa:bb:cc:dd:ee:ff'],
- ['ip', 'link', 'set', 'tap0', 'up']]
- ]
-
self.device_exists.side_effect = device_exists
br = interface.BridgeInterfaceDriver(self.conf)
+ mac_address = 'aa:bb:cc:dd:ee:ff'
br.plug('01234567-1234-1234-99',
'port-1234',
'ns-0',
- 'aa:bb:cc:dd:ee:ff',
+ mac_address,
namespace=namespace)
ip_calls = [mock.call('sudo'), mock.call().add_veth('tap0', 'ns-0')]
+ ns_veth.assert_has_calls([mock.call.link.set_address(mac_address)])
if namespace:
ip_calls.extend([
mock.call().ensure_namespace('01234567-1234-1234-99'),