def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.subnet_bridge_4 = objects.subnet.Subnet(cidr='101.168.1.0/24', dns=['8.8.8.8'], gateway='101.168.1.1', dhcp_server='191.168.1.1') self.subnet_bridge_6 = objects.subnet.Subnet(cidr='101:1db9::/64', gateway='101:1db9::1') self.subnets = objects.subnet.SubnetList( objects=[self.subnet_bridge_4, self.subnet_bridge_6]) self.network = objects.network.Network( id='437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7', subnets=self.subnets) self.vif = objects.vif.VIFGeneric( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network, vif_name='tap-xxx-yyy-zzz') self.instance = objects.instance_info.InstanceInfo( name='demo', uuid='f0000000-0000-0000-0000-000000000001')
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.instance = objects.instance_info.InstanceInfo( name='demo', uuid='f0000000-0000-0000-0000-000000000001')
def setUp(self): super(TestHostInfo, self).setUp() objects.register_all() self.host_info = objects.host_info.HostInfo(plugin_info=[ objects.host_info.HostPluginInfo( plugin_name=lb_constants.PLUGIN_NAME, vif_info=[ objects.host_info.HostVIFInfo(vif_object_name="VIFBridge", min_version="1.0", max_version="3.0"), ]), objects.host_info.HostPluginInfo( plugin_name=ovs_constants.PLUGIN_NAME, vif_info=[ objects.host_info.HostVIFInfo(vif_object_name="VIFBridge", min_version="2.0", max_version="7.0"), objects.host_info.HostVIFInfo( vif_object_name="VIFOpenVSwitch", min_version="1.0", max_version="2.0"), objects.host_info.HostVIFInfo( vif_object_name="VIFVHostUser", min_version="1.0", max_version="2.0"), ]) ]) # https://bugs.launchpad.net/oslo.versionedobjects/+bug/1563787 self.host_info.obj_reset_changes(recursive=True)
def setUp(self): super(TestHostInfo, self).setUp() objects.register_all() self.host_info = objects.host_info.HostInfo(plugin_info=[ objects.host_info.HostPluginInfo( plugin_name=lb_constants.PLUGIN_NAME, vif_info=[ objects.host_info.HostVIFInfo(vif_object_name="VIFBridge", min_version="1.0", max_version="3.0"), ]), objects.host_info.HostPluginInfo( plugin_name=ovs_constants.PLUGIN_NAME, vif_info=[ objects.host_info.HostVIFInfo(vif_object_name="VIFBridge", min_version="2.0", max_version="7.0"), objects.host_info.HostVIFInfo( vif_object_name="VIFOpenVSwitch", min_version="1.0", max_version="2.0"), objects.host_info.HostVIFInfo( vif_object_name="VIFVHostUser", min_version="1.0", max_version="2.0"), ]) ])
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.subnet_bridge_4 = objects.subnet.Subnet( cidr="101.168.1.0/24", dns=["8.8.8.8"], gateway="101.168.1.1", dhcp_server="191.168.1.1" ) self.subnet_bridge_6 = objects.subnet.Subnet(cidr="101:1db9::/64", gateway="101:1db9::1") self.subnets = objects.subnet.SubnetList(objects=[self.subnet_bridge_4, self.subnet_bridge_6]) self.network_ovs = objects.network.Network( id="437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7", bridge="br0", subnets=self.subnets, vlan=99 ) self.network_ovs_mtu = objects.network.Network( id="437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7", bridge="br0", subnets=self.subnets, vlan=99, mtu=1234 ) self.profile_ovs = objects.vif.VIFPortProfileOpenVSwitch(interface_id="e65867e0-9340-4a7f-a256-09af6eb7a3aa") self.vif_ovs_hybrid = objects.vif.VIFBridge( id="b679325f-ca89-4ee0-a8be-6db1409b69ea", address="ca:fe:de:ad:be:ef", network=self.network_ovs, dev_name="tap-xxx-yyy-zzz", bridge_name="qbrvif-xxx-yyy", port_profile=self.profile_ovs, ) self.vif_ovs = objects.vif.VIFOpenVSwitch( id="b679325f-ca89-4ee0-a8be-6db1409b69ea", address="ca:fe:de:ad:be:ef", network=self.network_ovs, dev_name="tap-xxx-yyy-zzz", port_profile=self.profile_ovs, ) self.vif_vhostuser = objects.vif.VIFVHostUser( id="b679325f-ca89-4ee0-a8be-6db1409b69ea", address="ca:fe:de:ad:be:ef", network=self.network_ovs, path="/var/run/openvswitch/vhub679325f-ca", mode="client", port_profile=self.profile_ovs, ) self.vif_vhostuser_client = objects.vif.VIFVHostUser( id="b679325f-ca89-4ee0-a8be-6db1409b69ea", address="ca:fe:de:ad:be:ef", network=self.network_ovs, path="/var/run/openvswitch/vhub679325f-ca", mode="server", # qemu server mode <=> ovs client mode port_profile=self.profile_ovs, ) self.instance = objects.instance_info.InstanceInfo(name="demo", uuid="f0000000-0000-0000-0000-000000000001")
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.subnet_bridge_4 = objects.subnet.Subnet( cidr='101.168.1.0/24', dns=['8.8.8.8'], gateway='101.168.1.1', dhcp_server='191.168.1.1') self.subnet_bridge_6 = objects.subnet.Subnet( cidr='101:1db9::/64', gateway='101:1db9::1') self.subnets = objects.subnet.SubnetList( objects=[self.subnet_bridge_4, self.subnet_bridge_6]) self.network_ovs = objects.network.Network( id='437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7', bridge='br0', subnets=self.subnets, vlan=99) self.profile_ovs = objects.vif.VIFPortProfileOVSRepresentor( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa', representor_name='repr_name', representor_address='0002:24:12.3') self.vif_virtioforwarder = objects.vif.VIFVHostUser( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, path='/var/run/openvswitch/vhub679325f-ca', mode='client', port_profile=self.profile_ovs) self.vif_passthrough = objects.vif.VIFHostDevice( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, dev_type=fields.VIFHostDeviceDevType.ETHERNET, dev_address='0002:24:12.3', bridge_name='br-int', port_profile=self.profile_ovs) self.instance = objects.instance_info.InstanceInfo( name='demo', uuid='f0000000-0000-0000-0000-000000000001')
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.subnet_bridge_4 = objects.subnet.Subnet(cidr='101.168.1.0/24', dns=['8.8.8.8'], gateway='101.168.1.1', dhcp_server='191.168.1.1') self.subnet_bridge_6 = objects.subnet.Subnet(cidr='101:1db9::/64', gateway='101:1db9::1') self.subnets = objects.subnet.SubnetList( objects=[self.subnet_bridge_4, self.subnet_bridge_6]) self.network_ovs = objects.network.Network( id='437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7', bridge='br0', subnets=self.subnets, vlan=99) self.profile_ovs = objects.vif.VIFPortProfileOpenVSwitch( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa') self.vif_ovs_hybrid = objects.vif.VIFBridge( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, dev_name='tap-xxx-yyy-zzz', bridge_name="qbrvif-xxx-yyy", port_profile=self.profile_ovs) self.vif_ovs = objects.vif.VIFOpenVSwitch( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, dev_name='tap-xxx-yyy-zzz', port_profile=self.profile_ovs) self.vif_vhostuser = objects.vif.VIFVHostUser( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, path='/var/run/openvswitch/vhub679325f-ca', mode='client', port_profile=self.profile_ovs) self.instance = objects.instance_info.InstanceInfo( name='demo', uuid='f0000000-0000-0000-0000-000000000001')
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.subnet_bridge_4 = objects.subnet.Subnet( cidr='101.168.1.0/24', dns=['8.8.8.8'], gateway='101.168.1.1', dhcp_server='191.168.1.1') self.subnet_bridge_6 = objects.subnet.Subnet( cidr='101:1db9::/64', gateway='101:1db9::1') self.subnets = objects.subnet.SubnetList( objects=[self.subnet_bridge_4, self.subnet_bridge_6]) self.network_ovs = objects.network.Network( id='437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7', bridge='br0', subnets=self.subnets, vlan=99) self.profile_ovs = objects.vif.VIFPortProfileOpenVSwitch( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa') self.vif_ovs = objects.vif.VIFBridge( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, dev_name='tap-xxx-yyy-zzz', bridge_name="qbrvif-xxx-yyy", port_profile=self.profile_ovs) self.instance = objects.instance_info.InstanceInfo( name='demo', uuid='f0000000-0000-0000-0000-000000000001')
import sys import contextlib import mock import six import testtools from oslo_concurrency import processutils from os_vif import objects from vif_plug_vrouter import privsep sys.modules['oslo_config'] = mock.Mock() from vif_plug_vrouter import vrouter objects.register_all() if six.PY2: nested = contextlib.nested else: @contextlib.contextmanager def nested(*contexts): with contextlib.ExitStack() as stack: yield [stack.enter_context(c) for c in contexts] class PluginTest(testtools.TestCase): def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) privsep.vif_plug.set_client_mode(False)
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.subnet_bridge_4 = objects.subnet.Subnet( cidr='101.168.1.0/24', dns=['8.8.8.8'], gateway='101.168.1.1', dhcp_server='191.168.1.1') self.subnet_bridge_6 = objects.subnet.Subnet( cidr='101:1db9::/64', gateway='101:1db9::1') self.subnets = objects.subnet.SubnetList( objects=[self.subnet_bridge_4, self.subnet_bridge_6]) self.network_ovs = objects.network.Network( id='437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7', bridge='br0', subnets=self.subnets, vlan=99) self.network_ovs_mtu = objects.network.Network( id='437c6db5-4e6f-4b43-b64b-ed6a11ee5ba7', bridge='br0', subnets=self.subnets, vlan=99, mtu=1234) self.profile_ovs = objects.vif.VIFPortProfileOpenVSwitch( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa', datapath_type='netdev') self.profile_ovs_system = objects.vif.VIFPortProfileOpenVSwitch( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa', datapath_type='system') self.profile_ovs_smart_nic = objects.vif.VIFPortProfileOpenVSwitch( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa', create_port=True) self.profile_ovs_no_datatype = objects.vif.VIFPortProfileOpenVSwitch( interface_id='e65867e0-9340-4a7f-a256-09af6eb7a3aa', datapath_type='') self.vif_ovs_hybrid = objects.vif.VIFBridge( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, vif_name='tap-xxx-yyy-zzz', bridge_name="qbrvif-xxx-yyy", port_profile=self.profile_ovs_no_datatype) self.vif_ovs = objects.vif.VIFOpenVSwitch( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, vif_name='tap-xxx-yyy-zzz', port_profile=self.profile_ovs) self.vif_ovs_smart_nic = objects.vif.VIFOpenVSwitch( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, vif_name='rep0-0', port_profile=self.profile_ovs_smart_nic) self.vif_vhostuser = objects.vif.VIFVHostUser( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, path='/var/run/openvswitch/vhub679325f-ca', mode='client', port_profile=self.profile_ovs) self.vif_vhostuser_client = objects.vif.VIFVHostUser( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, path='/var/run/openvswitch/vhub679325f-ca', mode='server', # qemu server mode <=> ovs client mode port_profile=self.profile_ovs) self.vif_ovs_vf_passthrough = objects.vif.VIFHostDevice( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, dev_type=fields.VIFHostDeviceDevType.ETHERNET, dev_address='0002:24:12.3', bridge_name='br-int', port_profile=self.profile_ovs_system) self.vif_ovs_vf_dpdk = objects.vif.VIFHostDevice( id='b679325f-ca89-4ee0-a8be-6db1409b69ea', address='ca:fe:de:ad:be:ef', network=self.network_ovs, dev_type=fields.VIFHostDeviceDevType.ETHERNET, dev_address='0002:24:12.3', port_profile=self.profile_ovs) self.instance = objects.instance_info.InstanceInfo( name='demo', uuid='f0000000-0000-0000-0000-000000000001')
def setUp(self): super(OSVIFUtilTestCase, self).setUp() osv_objects.register_all()
def __init__(self, *args, **kwargs): super(PluginTest, self).__init__(*args, **kwargs) objects.register_all() self.plugin = noop.NoOpPlugin.load("noop")
import testtools from oslo_concurrency import processutils from os_vif import objects from vif_plug_contrail_vrouter import vrouter from vif_plug_vrouter import privsep from vif_plug_vrouter.vrouter import VHOSTUSER_MODE_CLIENT from vif_plug_vrouter.vrouter import VHOSTUSER_MODE_SERVER sys.modules['oslo_config'] = mock.Mock() objects.register_all() if six.PY2: nested = contextlib.nested else: @contextlib.contextmanager def nested(*contexts): with contextlib.ExitStack() as stack: yield [stack.enter_context(c) for c in contexts] def _vhu_mode_to_int(mode): return VHOSTUSER_MODE_SERVER if mode == 'server' \ else VHOSTUSER_MODE_CLIENT