From 6e0e3f2e2fb05ab8d1a6710e8b9a655e145b35eb Mon Sep 17 00:00:00 2001 From: Matt Peters Date: Wed, 30 Jan 2019 15:44:28 -0500 Subject: [PATCH] Fix multi-net interface configuration On the worker and storage nodes, the mgmt interface should be set to DHCP and the cluster host alias should be set to use static IP. However, the recent fix for this added DHCP to an alias interface which is not supported. This was causing the management network to not be configured after the host was rebooted and the interfaces were reconfigured by Puppet. The interface configuration has been updated to ensure that DHCP networks are configured against the parent device and all additional static addresses will be configured as alias interfaces. There is also a few additional issues that have been fixed: - multinetting with different address families - traffic controls applied to parent interface - address scope for aliases on AIO-SX with dedicated interfaces - setting of the gateway address on multi-net interfaces Story: 2004273 Task: 27826 Change-Id: If8e354bf41cbc1c11966a4b43b8a058c33580c49 Signed-off-by: Matt Peters --- .../sysinv/sysinv/sysinv/puppet/interface.py | 113 ++--- .../sysinv/tests/puppet/test_interface.py | 450 +++++++++++------- 2 files changed, 340 insertions(+), 223 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py index 2af759f40b..4423422fac 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py @@ -50,6 +50,9 @@ MELLANOX_DRIVERS = [DRIVER_MLX_CX3, LOOPBACK_IFNAME = 'lo' LOOPBACK_METHOD = 'loopback' +STATIC_METHOD = 'static' +MANUAL_METHOD = 'manual' +DHCP_METHOD = 'dhcp' NETWORK_CONFIG_RESOURCE = 'platform::interfaces::network_config' ROUTE_CONFIG_RESOURCE = 'platform::interfaces::route_config' @@ -593,13 +596,13 @@ def get_interface_primary_address(context, iface, network_id=None): return _set_address_netmask(address) -def get_interface_address_family(context, iface): +def get_interface_address_family(context, iface, network_id=None): """ Determine the IP family/version of the interface primary address. If there is no address then the IPv4 family identifier is returned so that an appropriate default is always present in interface configurations. """ - address = get_interface_primary_address(context, iface) + address = get_interface_primary_address(context, iface, network_id) if not address: return 'inet' # default to ipv4 elif IPAddress(address['address']).version == 4: @@ -615,55 +618,55 @@ def get_interface_gateway_address(context, networktype): return context['gateways'].get(networktype, None) -def get_interface_address_method(context, iface): +def get_interface_address_method(context, iface, network_id=None): """ Determine what type of interface to configure for each network type. """ + networktype = find_networktype_by_network_id(context, network_id) if not iface.ifclass or iface.ifclass == constants.INTERFACE_CLASS_NONE \ - or not iface.networktype: + or not networktype: # Interfaces that are configured purely as a dependency from other # interfaces (i.e., vlan lower interface, bridge member, bond slave) # should be left as manual config - return 'manual' + return MANUAL_METHOD elif iface.ifclass == constants.INTERFACE_CLASS_DATA: # All data interfaces configured in the kernel because they are not # natively supported in vswitch or need to be shared with the kernel # because of a platform VLAN should be left as manual config - return 'manual' + return MANUAL_METHOD elif iface.ifclass in PCI_INTERFACE_CLASSES: - return 'manual' + return MANUAL_METHOD else: if is_controller(context): # All other interface types that exist on a controller are setup # statically since the controller themselves run the DHCP server. - return 'static' - elif iface.networktype == constants.NETWORK_TYPE_CLUSTER_HOST: - return 'static' - elif iface.networktype == constants.NETWORK_TYPE_PXEBOOT: + return STATIC_METHOD + elif networktype == constants.NETWORK_TYPE_CLUSTER_HOST: + return STATIC_METHOD + elif networktype == constants.NETWORK_TYPE_PXEBOOT: # All pxeboot interfaces that exist on non-controller nodes are set # to manual as they are not needed/used once the install is done. # They exist only in support of the vlan mgmt interface above it. - return 'manual' + return MANUAL_METHOD else: # All other types get their addresses from the controller - return 'dhcp' + return DHCP_METHOD def get_interface_traffic_classifier(context, iface, network_id=None): """ Get the interface traffic classifier command line (if any) """ - if (iface.networktype and - iface.networktype in [constants.NETWORK_TYPE_MGMT, - constants.NETWORK_TYPE_INFRA]): + networktype = find_networktype_by_network_id(context, network_id) + if (networktype and + networktype in [constants.NETWORK_TYPE_MGMT, + constants.NETWORK_TYPE_INFRA]): networkspeed = constants.LINK_SPEED_10G ifname = get_interface_os_ifname(context, iface) - if network_id: - ifname = ifname + ':' + str(network_id) return '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' \ % (ifname, - iface.networktype, + networktype, networkspeed) return None @@ -915,8 +918,8 @@ def get_common_network_config(context, iface, config, network_id=None): if traffic_classifier: config['options']['post_up'] = traffic_classifier - method = get_interface_address_method(context, iface) - if method == 'static': + method = get_interface_address_method(context, iface, network_id) + if method == STATIC_METHOD: address = get_interface_primary_address(context, iface, network_id) if address: config['ipaddress'] = address['address'] @@ -924,12 +927,10 @@ def get_common_network_config(context, iface, config, network_id=None): else: LOG.info("Interface %s has no primary address" % iface['ifname']) - if network_id is None and len(iface.networks) > 0: - networktype = find_networktype_by_network_id( - context, int(iface.networks[0])) - gateway = get_interface_gateway_address(context, networktype) - if gateway: - config['gateway'] = gateway + networktype = find_networktype_by_network_id(context, network_id) + gateway = get_interface_gateway_address(context, networktype) + if gateway: + config['gateway'] = gateway return config @@ -939,15 +940,28 @@ def get_interface_network_config(context, iface, network_id=None): """ # Create a basic network config resource os_ifname = get_interface_os_ifname(context, iface) - method = get_interface_address_method(context, iface) - family = get_interface_address_family(context, iface) + method = get_interface_address_method(context, iface, network_id) + family = get_interface_address_family(context, iface, network_id) + + # setup an alias interface if there are multiple addresses assigned + # NOTE: DHCP will only operate over a non-alias interface + if len(iface.networks) > 1 and network_id and method != DHCP_METHOD: + ifname = "%s:%d" % (os_ifname, network_id) + else: + ifname = os_ifname + mtu = get_interface_mtu(context, iface) config = get_basic_network_config( - os_ifname, method=method, family=family, mtu=mtu) + ifname, method=method, family=family, mtu=mtu) # Add options common to all top level interfaces config = get_common_network_config(context, iface, config, network_id) + # ensure addresses have host scope when configured against the loopback + if os_ifname == LOOPBACK_IFNAME: + options = {'SCOPE': 'scope host'} + config['options'].update(options) + # Add type specific options if iface['iftype'] == constants.INTERFACE_TYPE_VLAN: config = get_vlan_network_config(context, iface, config) @@ -966,38 +980,25 @@ def generate_network_config(context, config, iface): resource, while in other cases it will emit multiple resources to create a bridge, or to add additional route resources. """ - if len(iface.networks) == 1: - # get the network type of the single network - iface.networktype = find_networktype_by_network_id( - context, int(iface.networks[0])) - else: - # Either no network assigned to the interface or multiple networks - iface.networktype = None + ifname = get_interface_os_ifname(context, iface) - # Set up the interface network config or the parent of alias interfaces - network_config = get_interface_network_config(context, iface) + # Setup the default device configuration for the interface. This will be + # overridden if there is a specific network type configuration, otherwise + # it will act as the parent device for the aliases + net_config = get_interface_network_config(context, iface) config[NETWORK_CONFIG_RESOURCE].update({ - network_config['ifname']: format_network_config(network_config) + net_config['ifname']: format_network_config(net_config) }) - if len(iface.networks) > 1: - # Loop over the networks to create network config for each - # alias interface - for net_id in iface.networks: - iface.networktype = find_networktype_by_network_id( - context, int(net_id)) - net_config = get_interface_network_config(context, iface, - int(net_id)) - ifname = net_config['ifname'] + ':' + net_id - if context['system_mode'] == constants.SYSTEM_MODE_SIMPLEX: - options = {'SCOPE': 'scope host'} - net_config['options'].update(options) - config[NETWORK_CONFIG_RESOURCE].update({ - ifname: format_network_config(net_config) - }) + + for net_id in iface.networks: + net_config = get_interface_network_config(context, iface, int(net_id)) + config[NETWORK_CONFIG_RESOURCE].update({ + net_config['ifname']: format_network_config(net_config) + }) # Add complementary puppet resource definitions (if needed) for route in get_interface_routes(context, iface): - route_config = get_route_config(route, network_config['ifname']) + route_config = get_route_config(route, ifname) config[ROUTE_CONFIG_RESOURCE].update({ route_config['name']: route_config }) diff --git a/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py b/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py index 94be8584d1..732f67b468 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/puppet/test_interface.py @@ -31,11 +31,6 @@ NETWORKTYPES_WITH_V4_ROUTES = [constants.NETWORK_TYPE_DATA] NETWORKTYPES_WITH_V6_ROUTES = [constants.NETWORK_TYPE_DATA] -PLATFORM_INTERFACE_CLASSES = [constants.NETWORK_TYPE_PXEBOOT, - constants.NETWORK_TYPE_MGMT, - constants.NETWORK_TYPE_INFRA, - constants.NETWORK_TYPE_OAM] - class BaseTestCase(dbbase.DbTestCase): @@ -49,6 +44,7 @@ class BaseTestCase(dbbase.DbTestCase): self.addresses = [] self.routes = [] self.networks = [] + self.address_pools = [] def assertIn(self, needle, haystack, message=''): """Custom assertIn that handles object comparison""" @@ -111,25 +107,47 @@ class BaseTestCase(dbbase.DbTestCase): 'metric': '1'} self.routes.append(dbutils.create_test_route(**route)) - def _create_ethernet_test(self, ifname=None, ifclass=None, - networktype=None, **kwargs): - if not isinstance(networktype, list): + def _find_network_by_type(self, networktype): + for network in self.networks: + if network['type'] == networktype: + return network + + def _find_address_pool_by_uuid(self, pool_uuid): + for pool in self.address_pools: + if pool['uuid'] == pool_uuid: + return pool + + def _get_network_ids_by_type(self, networktype): + if isinstance(networktype, list): + networktypelist = networktype + elif networktype: networktypelist = [networktype] else: - networktypelist = networktype - networktype = ','.join(networktype) - interface_id = len(self.interfaces) + networktypelist = [] networks = [] + for network_type in networktypelist: + network = self._find_network_by_type(networktype) + networks.append(str(network['id'])) + return networks + + def _update_interface_address_pool(self, iface, networktype): + network = self._find_network_by_type(networktype) + pool = self._find_address_pool_by_uuid(network['pool_uuid']) + addresses = self.context['addresses'].get(iface['ifname'], []) + for address in addresses: + address['pool_uuid'] = pool['uuid'] + + def _create_ethernet_test(self, ifname=None, ifclass=None, + networktype=None, **kwargs): + interface_id = len(self.interfaces) if not ifname: ifname = (networktype or 'eth') + str(interface_id) - if all(network_type in constants.PLATFORM_NETWORK_TYPES - for network_type in networktypelist): - ifclass = constants.INTERFACE_CLASS_PLATFORM - for network_type in networktypelist: - network = self.dbapi.network_get_by_type(network_type) - networks.append(str(network.id)) - if not ifclass and networktype: - ifclass = networktype + if not ifclass: + ifclass = constants.INTERFACE_CLASS_NONE + if ifclass == constants.INTERFACE_CLASS_PLATFORM: + networks = self._get_network_ids_by_type(networktype) + else: + networks = [] interface = {'id': interface_id, 'uuid': str(uuid.uuid4()), 'forihostid': self.host.id, @@ -165,24 +183,16 @@ class BaseTestCase(dbbase.DbTestCase): def _create_vlan_test(self, ifname, ifclass, networktype, vlan_id, lower_iface=None): - if not isinstance(networktype, list): - networktypelist = [networktype] - else: - networktypelist = networktype - networktype = ','.join(networktype) if not lower_iface: lower_port, lower_iface = self._create_ethernet_test() if not ifname: ifname = 'vlan' + str(vlan_id) - networks = [] - if all(network_type in constants.PLATFORM_NETWORK_TYPES - for network_type in networktypelist): - ifclass = constants.INTERFACE_CLASS_PLATFORM - for network_type in networktypelist: - network = self.dbapi.network_get_by_type(network_type) - networks.append(str(network.id)) - if not ifclass and networktype: - ifclass = networktype + if not ifclass: + ifclass = constants.INTERFACE_CLASS_NONE + if ifclass == constants.INTERFACE_CLASS_PLATFORM: + networks = self._get_network_ids_by_type(networktype) + else: + networks = [] interface_id = len(self.interfaces) interface = {'id': interface_id, 'uuid': str(uuid.uuid4()), @@ -204,27 +214,17 @@ class BaseTestCase(dbbase.DbTestCase): return db_interface def _create_bond_test(self, ifname, ifclass=None, networktype=None): - if not isinstance(networktype, list): - networktypelist = [networktype] - else: - networktypelist = networktype - networktype = ','.join(networktype) port1, iface1 = self._create_ethernet_test() port2, iface2 = self._create_ethernet_test() interface_id = len(self.interfaces) if not ifname: ifname = 'bond' + str(interface_id) - - networks = [] - if all(network_type in constants.PLATFORM_NETWORK_TYPES - for network_type in networktypelist): - ifclass = constants.INTERFACE_CLASS_PLATFORM - for network_type in networktypelist: - network = self.dbapi.network_get_by_type(network_type) - networks.append(str(network.id)) - if not ifclass and networktype: - ifclass = networktype - + if not ifclass: + ifclass = constants.INTERFACE_CLASS_NONE + if ifclass == constants.INTERFACE_CLASS_PLATFORM: + networks = self._get_network_ids_by_type(networktype) + else: + networks = [] interface = {'id': interface_id, 'uuid': str(uuid.uuid4()), 'forihostid': self.host.id, @@ -259,24 +259,28 @@ class BaseTestCase(dbbase.DbTestCase): name='management', ranges=[['192.168.204.2', '192.168.204.254']], prefix=24) + self.address_pools.append(mgmt_pool) pxeboot_pool = dbutils.create_test_address_pool( network='192.168.202.0', name='pxeboot', ranges=[['192.168.202.2', '192.168.202.254']], prefix=24) + self.address_pools.append(pxeboot_pool) infra_pool = dbutils.create_test_address_pool( network='192.168.205.0', name='infrastructure', ranges=[['192.168.205.2', '192.168.205.254']], prefix=24) + self.address_pools.append(infra_pool) oam_pool = dbutils.create_test_address_pool( network='10.10.10.0', name='oam', ranges=[['10.10.10.2', '10.10.10.254']], prefix=24) + self.address_pools.append(oam_pool) self.networks.append(dbutils.create_test_network( type=constants.NETWORK_TYPE_MGMT, @@ -434,7 +438,8 @@ class InterfaceTestCase(BaseTestCase): self._create_test_common() self._create_test_host(constants.CONTROLLER) self.port, self.iface = self._create_ethernet_test( - "mgmt0", None, constants.NETWORK_TYPE_MGMT) + "mgmt0", constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) def _update_context(self): # ensure DB entries are updated prior to updating the context which @@ -451,6 +456,8 @@ class InterfaceTestCase(BaseTestCase): def test_is_platform_network_type_true(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) result = interface.is_platform_network_type(self.iface) self.assertTrue(result) @@ -622,6 +629,8 @@ class InterfaceTestCase(BaseTestCase): def test_get_interface_gateway_address_oam(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_OAM + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_OAM) gateway = interface.get_interface_gateway_address( self.context, constants.NETWORK_TYPE_OAM) expected = str(self.oam_gateway_address.ip) @@ -630,6 +639,8 @@ class InterfaceTestCase(BaseTestCase): def test_get_interface_gateway_address_mgmt(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) gateway = interface.get_interface_gateway_address( self.context, constants.NETWORK_TYPE_MGMT) expected = str(self.mgmt_gateway_address.ip) @@ -644,7 +655,6 @@ class InterfaceTestCase(BaseTestCase): def test_get_interface_address_method_for_none(self): self.iface['ifclass'] = None - self.iface['networktype'] = None method = interface.get_interface_address_method( self.context, self.iface) self.assertEqual(method, 'manual') @@ -673,102 +683,154 @@ class InterfaceTestCase(BaseTestCase): def test_get_interface_address_method_for_pxeboot_worker(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_PXEBOOT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_PXEBOOT) self.host['personality'] = constants.WORKER self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_PXEBOOT) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_PXEBOOT) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'manual') def test_get_interface_address_method_for_pxeboot_storage(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_PXEBOOT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_PXEBOOT) self.host['personality'] = constants.STORAGE self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_PXEBOOT) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_PXEBOOT) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'manual') def test_get_interface_address_method_for_pxeboot_controller(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_PXEBOOT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_PXEBOOT) self.host['personality'] = constants.CONTROLLER self._update_context() + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_PXEBOOT) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'static') def test_get_interface_address_method_for_mgmt_worker(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) self.host['personality'] = constants.WORKER self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_MGMT) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_MGMT) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'dhcp') def test_get_interface_address_method_for_mgmt_storage(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) self.host['personality'] = constants.STORAGE self._update_context() + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_MGMT) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'dhcp') def test_get_interface_address_method_for_mgmt_controller(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) self.host['personality'] = constants.CONTROLLER self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_MGMT) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_MGMT) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'static') def test_get_interface_address_method_for_infra_worker(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) self.host['personality'] = constants.WORKER self._update_context() + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_INFRA) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'dhcp') def test_get_interface_address_method_for_infra_storage(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) self.host['personality'] = constants.STORAGE self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_INFRA) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_INFRA) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'dhcp') def test_get_interface_address_method_for_infra_controller(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) self.host['personality'] = constants.CONTROLLER self._update_context() + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_INFRA) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'static') def test_get_interface_address_method_for_oam_controller(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_OAM + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_OAM) self.host['personality'] = constants.CONTROLLER self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_OAM) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_OAM) method = interface.get_interface_address_method( - self.context, self.iface) + self.context, self.iface, network.id) self.assertEqual(method, 'static') def test_get_interface_traffic_classifier_for_mgmt(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_MGMT: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_MGMT) classifier = interface.get_interface_traffic_classifier( - self.context, self.iface) + self.context, self.iface, network.id) print(self.context) expected = ('/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % (self.port['name'], constants.NETWORK_TYPE_MGMT, @@ -779,12 +841,12 @@ class InterfaceTestCase(BaseTestCase): self.iface['ifname'] = 'infra0' self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_INFRA: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_INFRA) classifier = interface.get_interface_traffic_classifier( - self.context, self.iface) + self.context, self.iface, network.id) expected = ('/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % (self.port['name'], constants.NETWORK_TYPE_INFRA, constants.LINK_SPEED_10G)) @@ -793,16 +855,15 @@ class InterfaceTestCase(BaseTestCase): def test_get_interface_traffic_classifier_for_oam(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_OAM - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_OAM: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_OAM) + network = self.dbapi.network_get_by_type( + constants.NETWORK_TYPE_OAM) classifier = interface.get_interface_traffic_classifier( - self.context, self.iface) + self.context, self.iface, network.id) self.assertIsNone(classifier) def test_get_interface_traffic_classifier_for_none(self): - self.iface['networktype'] = None classifier = interface.get_interface_traffic_classifier( self.context, self.iface) self.assertIsNone(classifier) @@ -818,6 +879,8 @@ class InterfaceTestCase(BaseTestCase): def test_get_bridge_interface_name_none_not_data(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) ifname = interface.get_bridge_interface_name(self.context, self.iface) self.assertIsNone(ifname) @@ -832,6 +895,8 @@ class InterfaceTestCase(BaseTestCase): def test_needs_interface_config_kernel_mgmt(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) self.host['personality'] = constants.CONTROLLER self._update_context() needed = interface.needs_interface_config(self.context, self.iface) @@ -840,6 +905,8 @@ class InterfaceTestCase(BaseTestCase): def test_needs_interface_config_kernel_infra(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) self.host['personality'] = constants.CONTROLLER self._update_context() needed = interface.needs_interface_config(self.context, self.iface) @@ -848,6 +915,8 @@ class InterfaceTestCase(BaseTestCase): def test_needs_interface_config_kernel_oam(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_OAM + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_OAM) self.host['personality'] = constants.CONTROLLER self._update_context() needed = interface.needs_interface_config(self.context, self.iface) @@ -1055,13 +1124,14 @@ class InterfaceTestCase(BaseTestCase): def test_get_controller_ethernet_config_oam(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_OAM - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_OAM: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_OAM) self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_OAM) + network = self.dbapi.network_get_by_type(constants.NETWORK_TYPE_OAM) config = interface.get_interface_network_config( - self.context, self.iface) + self.context, self.iface, network.id) options = {'LINKDELAY': '20'} expected = self._get_static_network_config( ifname=self.port['name'], mtu=1500, gateway='10.10.10.1', @@ -1072,13 +1142,14 @@ class InterfaceTestCase(BaseTestCase): def test_get_controller_ethernet_config_mgmt(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_MGMT: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_MGMT) + network = self.dbapi.network_get_by_type(constants.NETWORK_TYPE_MGMT) config = interface.get_interface_network_config( - self.context, self.iface) + self.context, self.iface, network.id) options = {'LINKDELAY': '20', 'post_up': '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % @@ -1093,13 +1164,14 @@ class InterfaceTestCase(BaseTestCase): def test_get_controller_ethernet_config_infra(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_INFRA: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_INFRA) + network = self.dbapi.network_get_by_type(constants.NETWORK_TYPE_INFRA) config = interface.get_interface_network_config( - self.context, self.iface) + self.context, self.iface, network.id) options = {'LINKDELAY': '20', 'post_up': '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % @@ -1195,14 +1267,15 @@ class InterfaceTestCase(BaseTestCase): def test_get_worker_ethernet_config_mgmt(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_MGMT + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_MGMT) self.host['personality'] = constants.WORKER - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_MGMT: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_MGMT) + network = self.dbapi.network_get_by_type(constants.NETWORK_TYPE_MGMT) config = interface.get_interface_network_config( - self.context, self.iface) + self.context, self.iface, network.id) options = {'LINKDELAY': '20', 'post_up': '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % @@ -1216,14 +1289,15 @@ class InterfaceTestCase(BaseTestCase): def test_get_worker_ethernet_config_infra(self): self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['networktype'] = constants.NETWORK_TYPE_INFRA + self.iface['networks'] = self._get_network_ids_by_type( + constants.NETWORK_TYPE_INFRA) self.host['personality'] = constants.WORKER - for network in self.networks: - if network['type'] == constants.NETWORK_TYPE_INFRA: - net_id = network['id'] - self.iface['networks'] = [str(net_id)] self._update_context() + self._update_interface_address_pool( + self.iface, constants.NETWORK_TYPE_INFRA) + network = self.dbapi.network_get_by_type(constants.NETWORK_TYPE_INFRA) config = interface.get_interface_network_config( - self.context, self.iface) + self.context, self.iface, network.id) options = {'LINKDELAY': '20', 'post_up': '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % @@ -1531,9 +1605,12 @@ class InterfaceControllerEthernet(InterfaceHostTestCase): # ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER) - self._create_ethernet_test('oam', None, constants.NETWORK_TYPE_OAM) - self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) + self._create_ethernet_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM) + self._create_ethernet_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_ethernet_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) self._create_ethernet_test('none') def setUp(self): @@ -1548,9 +1625,12 @@ class InterfaceControllerBond(InterfaceHostTestCase): # aggregated ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER) - self._create_bond_test('oam', None, constants.NETWORK_TYPE_OAM) - self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_bond_test('infra', None, constants.NETWORK_TYPE_INFRA) + self._create_bond_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM) + self._create_bond_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_bond_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) def setUp(self): super(InterfaceControllerBond, self).setUp() @@ -1569,11 +1649,15 @@ class InterfaceControllerVlanOverBond(InterfaceHostTestCase): # vlan interfaces over aggregated ethernet interfaces self._create_test_common() self._create_test_host(constants.CONTROLLER) - bond = self._create_bond_test('pxeboot', None, + bond = self._create_bond_test('pxeboot', + constants.INTERFACE_CLASS_PLATFORM, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, bond) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, bond) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3, bond) self._create_ethernet_test('none') @@ -1592,12 +1676,14 @@ class InterfaceControllerVlanOverEthernet(InterfaceHostTestCase): self._create_test_common() self._create_test_host(constants.CONTROLLER) port, iface = self._create_ethernet_test( - 'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, iface) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, - iface) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, - iface) + 'pxeboot', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_PXEBOOT) + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, iface) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, iface) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3, iface) self._create_ethernet_test('none') def setUp(self): @@ -1613,10 +1699,11 @@ class InterfaceComputeEthernet(InterfaceHostTestCase): # worker and all interfaces are ethernet interfaces. self._create_test_common() self._create_test_host(constants.WORKER) - self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) - self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA, - constants.NETWORK_TYPE_DATA) + self._create_ethernet_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_ethernet_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) + self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, constants.NETWORK_TYPE_PCI_SRIOV) self._create_ethernet_test('pthru', constants.INTERFACE_CLASS_PCI_PASSTHROUGH, @@ -1655,10 +1742,12 @@ class InterfaceComputeVlanOverEthernet(InterfaceHostTestCase): self._create_test_common() self._create_test_host(constants.WORKER) port, iface = self._create_ethernet_test( - 'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, - iface) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3) + 'pxeboot', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_PXEBOOT) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, iface) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3) self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA, 5) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, @@ -1681,8 +1770,10 @@ class InterfaceComputeBond(InterfaceHostTestCase): self._create_test_common() # worker and all interfaces are aggregated ethernet interfaces. self._create_test_host(constants.WORKER) - self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_bond_test('infra', None, constants.NETWORK_TYPE_INFRA) + self._create_bond_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_bond_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) self._create_bond_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA) self._create_ethernet_test('sriov', @@ -1712,16 +1803,18 @@ class InterfaceComputeVlanOverBond(InterfaceHostTestCase): # interfaces. self._create_test_common() self._create_test_host(constants.WORKER) - bond = self._create_bond_test('pxeboot', None, + bond = self._create_bond_test('pxeboot', + constants.INTERFACE_CLASS_PLATFORM, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, - bond) + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, bond) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, bond) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3, bond) bond2 = self._create_bond_test('bond2') self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, - constants.NETWORK_TYPE_DATA, 5, - bond2) + constants.NETWORK_TYPE_DATA, 5, bond2) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, constants.NETWORK_TYPE_PCI_SRIOV) @@ -1748,9 +1841,12 @@ class InterfaceCpeEthernet(InterfaceHostTestCase): # ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER) - self._create_ethernet_test('oam', None, constants.NETWORK_TYPE_OAM) - self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) + self._create_ethernet_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM) + self._create_ethernet_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_ethernet_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, @@ -1791,11 +1887,14 @@ class InterfaceCpeVlanOverEthernet(InterfaceHostTestCase): self._create_test_common() self._create_test_host(constants.CONTROLLER) port, iface = self._create_ethernet_test( - 'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, iface) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, - iface) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3) + 'pxeboot', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_PXEBOOT) + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, iface) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, iface) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3) self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA, 5) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, @@ -1819,9 +1918,12 @@ class InterfaceCpeBond(InterfaceHostTestCase): # aggregated ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER) - self._create_bond_test('oam', None, constants.NETWORK_TYPE_OAM) - self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_bond_test('infra', None, constants.NETWORK_TYPE_INFRA) + self._create_bond_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM) + self._create_bond_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_bond_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) self._create_bond_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, @@ -1849,12 +1951,14 @@ class InterfaceCpeVlanOverBond(InterfaceHostTestCase): # vlan interfaces over aggregated ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER) - bond = self._create_bond_test('pxeboot', None, + bond = self._create_bond_test('pxeboot', constants.INTERFACE_CLASS_PLATFORM, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, - bond) + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, bond) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, bond) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3, bond) bond2 = self._create_bond_test('bond4') self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA, 5, @@ -1881,15 +1985,18 @@ class InterfaceCpeComputeEthernet(InterfaceHostTestCase): # ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER, constants.WORKER) - self._create_ethernet_test('oam', None, constants.NETWORK_TYPE_OAM) - self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, constants.NETWORK_TYPE_PCI_SRIOV) self._create_ethernet_test('pthru', constants.INTERFACE_CLASS_PCI_PASSTHROUGH, constants.NETWORK_TYPE_PCI_PASSTHROUGH) + self._create_ethernet_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM) + self._create_ethernet_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_ethernet_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) port, iface = ( self._create_ethernet_test('slow', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA, @@ -1924,11 +2031,14 @@ class InterfaceCpeComputeVlanOverEthernet(InterfaceHostTestCase): self._create_test_common() self._create_test_host(constants.CONTROLLER, constants.WORKER) port, iface = self._create_ethernet_test( - 'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, iface) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, - iface) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3) + 'pxeboot', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_PXEBOOT) + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, iface) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, iface) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3) self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA, 5) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, @@ -1952,9 +2062,12 @@ class InterfaceCpeComputeBond(InterfaceHostTestCase): # aggregated ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER, constants.WORKER) - self._create_bond_test('oam', None, constants.NETWORK_TYPE_OAM) - self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) - self._create_bond_test('infra', None, constants.NETWORK_TYPE_INFRA) + self._create_bond_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM) + self._create_bond_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT) + self._create_bond_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA) self._create_bond_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA) self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, @@ -1982,12 +2095,15 @@ class InterfaceCpeComputeVlanOverBond(InterfaceHostTestCase): # vlan interfaces over aggregated ethernet interfaces. self._create_test_common() self._create_test_host(constants.CONTROLLER, constants.WORKER) - bond = self._create_bond_test('pxeboot', None, + bond = self._create_bond_test('pxeboot', + constants.INTERFACE_CLASS_PLATFORM, constants.NETWORK_TYPE_PXEBOOT) - self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) - self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) - self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, - bond) + self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_OAM, 1, bond) + self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_MGMT, 2, bond) + self._create_vlan_test('infra', constants.INTERFACE_CLASS_PLATFORM, + constants.NETWORK_TYPE_INFRA, 3, bond) bond2 = self._create_bond_test('bond2') self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, constants.NETWORK_TYPE_DATA, 5,