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 <matt.peters@windriver.com>
This commit is contained in:
Matt Peters 2019-01-30 15:44:28 -05:00
parent 04cd68988f
commit 6e0e3f2e2f
2 changed files with 340 additions and 223 deletions

View File

@ -50,6 +50,9 @@ MELLANOX_DRIVERS = [DRIVER_MLX_CX3,
LOOPBACK_IFNAME = 'lo' LOOPBACK_IFNAME = 'lo'
LOOPBACK_METHOD = 'loopback' LOOPBACK_METHOD = 'loopback'
STATIC_METHOD = 'static'
MANUAL_METHOD = 'manual'
DHCP_METHOD = 'dhcp'
NETWORK_CONFIG_RESOURCE = 'platform::interfaces::network_config' NETWORK_CONFIG_RESOURCE = 'platform::interfaces::network_config'
ROUTE_CONFIG_RESOURCE = 'platform::interfaces::route_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) 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 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 is no address then the IPv4 family identifier is returned so that an
appropriate default is always present in interface configurations. 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: if not address:
return 'inet' # default to ipv4 return 'inet' # default to ipv4
elif IPAddress(address['address']).version == 4: elif IPAddress(address['address']).version == 4:
@ -615,55 +618,55 @@ def get_interface_gateway_address(context, networktype):
return context['gateways'].get(networktype, None) 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. 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 \ 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 that are configured purely as a dependency from other
# interfaces (i.e., vlan lower interface, bridge member, bond slave) # interfaces (i.e., vlan lower interface, bridge member, bond slave)
# should be left as manual config # should be left as manual config
return 'manual' return MANUAL_METHOD
elif iface.ifclass == constants.INTERFACE_CLASS_DATA: elif iface.ifclass == constants.INTERFACE_CLASS_DATA:
# All data interfaces configured in the kernel because they are not # All data interfaces configured in the kernel because they are not
# natively supported in vswitch or need to be shared with the kernel # natively supported in vswitch or need to be shared with the kernel
# because of a platform VLAN should be left as manual config # because of a platform VLAN should be left as manual config
return 'manual' return MANUAL_METHOD
elif iface.ifclass in PCI_INTERFACE_CLASSES: elif iface.ifclass in PCI_INTERFACE_CLASSES:
return 'manual' return MANUAL_METHOD
else: else:
if is_controller(context): if is_controller(context):
# All other interface types that exist on a controller are setup # All other interface types that exist on a controller are setup
# statically since the controller themselves run the DHCP server. # statically since the controller themselves run the DHCP server.
return 'static' return STATIC_METHOD
elif iface.networktype == constants.NETWORK_TYPE_CLUSTER_HOST: elif networktype == constants.NETWORK_TYPE_CLUSTER_HOST:
return 'static' return STATIC_METHOD
elif iface.networktype == constants.NETWORK_TYPE_PXEBOOT: elif networktype == constants.NETWORK_TYPE_PXEBOOT:
# All pxeboot interfaces that exist on non-controller nodes are set # All pxeboot interfaces that exist on non-controller nodes are set
# to manual as they are not needed/used once the install is done. # 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. # They exist only in support of the vlan mgmt interface above it.
return 'manual' return MANUAL_METHOD
else: else:
# All other types get their addresses from the controller # All other types get their addresses from the controller
return 'dhcp' return DHCP_METHOD
def get_interface_traffic_classifier(context, iface, network_id=None): def get_interface_traffic_classifier(context, iface, network_id=None):
""" """
Get the interface traffic classifier command line (if any) Get the interface traffic classifier command line (if any)
""" """
if (iface.networktype and networktype = find_networktype_by_network_id(context, network_id)
iface.networktype in [constants.NETWORK_TYPE_MGMT, if (networktype and
networktype in [constants.NETWORK_TYPE_MGMT,
constants.NETWORK_TYPE_INFRA]): constants.NETWORK_TYPE_INFRA]):
networkspeed = constants.LINK_SPEED_10G networkspeed = constants.LINK_SPEED_10G
ifname = get_interface_os_ifname(context, iface) 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' \ return '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' \
% (ifname, % (ifname,
iface.networktype, networktype,
networkspeed) networkspeed)
return None return None
@ -915,8 +918,8 @@ def get_common_network_config(context, iface, config, network_id=None):
if traffic_classifier: if traffic_classifier:
config['options']['post_up'] = traffic_classifier config['options']['post_up'] = traffic_classifier
method = get_interface_address_method(context, iface) method = get_interface_address_method(context, iface, network_id)
if method == 'static': if method == STATIC_METHOD:
address = get_interface_primary_address(context, iface, network_id) address = get_interface_primary_address(context, iface, network_id)
if address: if address:
config['ipaddress'] = address['address'] config['ipaddress'] = address['address']
@ -924,9 +927,7 @@ def get_common_network_config(context, iface, config, network_id=None):
else: else:
LOG.info("Interface %s has no primary address" % iface['ifname']) 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, network_id)
networktype = find_networktype_by_network_id(
context, int(iface.networks[0]))
gateway = get_interface_gateway_address(context, networktype) gateway = get_interface_gateway_address(context, networktype)
if gateway: if gateway:
config['gateway'] = gateway config['gateway'] = gateway
@ -939,15 +940,28 @@ def get_interface_network_config(context, iface, network_id=None):
""" """
# Create a basic network config resource # Create a basic network config resource
os_ifname = get_interface_os_ifname(context, iface) os_ifname = get_interface_os_ifname(context, iface)
method = get_interface_address_method(context, iface) method = get_interface_address_method(context, iface, network_id)
family = get_interface_address_family(context, iface) 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) mtu = get_interface_mtu(context, iface)
config = get_basic_network_config( 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 # Add options common to all top level interfaces
config = get_common_network_config(context, iface, config, network_id) 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 # Add type specific options
if iface['iftype'] == constants.INTERFACE_TYPE_VLAN: if iface['iftype'] == constants.INTERFACE_TYPE_VLAN:
config = get_vlan_network_config(context, iface, config) 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 resource, while in other cases it will emit multiple resources to create a
bridge, or to add additional route resources. bridge, or to add additional route resources.
""" """
if len(iface.networks) == 1: ifname = get_interface_os_ifname(context, iface)
# 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
# Set up the interface network config or the parent of alias interfaces # Setup the default device configuration for the interface. This will be
network_config = get_interface_network_config(context, iface) # 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({ 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: for net_id in iface.networks:
iface.networktype = find_networktype_by_network_id( net_config = get_interface_network_config(context, iface, int(net_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({ config[NETWORK_CONFIG_RESOURCE].update({
ifname: format_network_config(net_config) net_config['ifname']: format_network_config(net_config)
}) })
# Add complementary puppet resource definitions (if needed) # Add complementary puppet resource definitions (if needed)
for route in get_interface_routes(context, iface): 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({ config[ROUTE_CONFIG_RESOURCE].update({
route_config['name']: route_config route_config['name']: route_config
}) })

View File

@ -31,11 +31,6 @@ NETWORKTYPES_WITH_V4_ROUTES = [constants.NETWORK_TYPE_DATA]
NETWORKTYPES_WITH_V6_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): class BaseTestCase(dbbase.DbTestCase):
@ -49,6 +44,7 @@ class BaseTestCase(dbbase.DbTestCase):
self.addresses = [] self.addresses = []
self.routes = [] self.routes = []
self.networks = [] self.networks = []
self.address_pools = []
def assertIn(self, needle, haystack, message=''): def assertIn(self, needle, haystack, message=''):
"""Custom assertIn that handles object comparison""" """Custom assertIn that handles object comparison"""
@ -111,25 +107,47 @@ class BaseTestCase(dbbase.DbTestCase):
'metric': '1'} 'metric': '1'}
self.routes.append(dbutils.create_test_route(**route)) self.routes.append(dbutils.create_test_route(**route))
def _create_ethernet_test(self, ifname=None, ifclass=None, def _find_network_by_type(self, networktype):
networktype=None, **kwargs): for network in self.networks:
if not isinstance(networktype, list): 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] networktypelist = [networktype]
else: else:
networktypelist = networktype networktypelist = []
networktype = ','.join(networktype)
interface_id = len(self.interfaces)
networks = [] 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: if not ifname:
ifname = (networktype or 'eth') + str(interface_id) ifname = (networktype or 'eth') + str(interface_id)
if all(network_type in constants.PLATFORM_NETWORK_TYPES if not ifclass:
for network_type in networktypelist): ifclass = constants.INTERFACE_CLASS_NONE
ifclass = constants.INTERFACE_CLASS_PLATFORM if ifclass == constants.INTERFACE_CLASS_PLATFORM:
for network_type in networktypelist: networks = self._get_network_ids_by_type(networktype)
network = self.dbapi.network_get_by_type(network_type) else:
networks.append(str(network.id)) networks = []
if not ifclass and networktype:
ifclass = networktype
interface = {'id': interface_id, interface = {'id': interface_id,
'uuid': str(uuid.uuid4()), 'uuid': str(uuid.uuid4()),
'forihostid': self.host.id, 'forihostid': self.host.id,
@ -165,24 +183,16 @@ class BaseTestCase(dbbase.DbTestCase):
def _create_vlan_test(self, ifname, ifclass, networktype, vlan_id, def _create_vlan_test(self, ifname, ifclass, networktype, vlan_id,
lower_iface=None): lower_iface=None):
if not isinstance(networktype, list):
networktypelist = [networktype]
else:
networktypelist = networktype
networktype = ','.join(networktype)
if not lower_iface: if not lower_iface:
lower_port, lower_iface = self._create_ethernet_test() lower_port, lower_iface = self._create_ethernet_test()
if not ifname: if not ifname:
ifname = 'vlan' + str(vlan_id) ifname = 'vlan' + str(vlan_id)
if not ifclass:
ifclass = constants.INTERFACE_CLASS_NONE
if ifclass == constants.INTERFACE_CLASS_PLATFORM:
networks = self._get_network_ids_by_type(networktype)
else:
networks = [] 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
interface_id = len(self.interfaces) interface_id = len(self.interfaces)
interface = {'id': interface_id, interface = {'id': interface_id,
'uuid': str(uuid.uuid4()), 'uuid': str(uuid.uuid4()),
@ -204,27 +214,17 @@ class BaseTestCase(dbbase.DbTestCase):
return db_interface return db_interface
def _create_bond_test(self, ifname, ifclass=None, networktype=None): 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() port1, iface1 = self._create_ethernet_test()
port2, iface2 = self._create_ethernet_test() port2, iface2 = self._create_ethernet_test()
interface_id = len(self.interfaces) interface_id = len(self.interfaces)
if not ifname: if not ifname:
ifname = 'bond' + str(interface_id) ifname = 'bond' + str(interface_id)
if not ifclass:
ifclass = constants.INTERFACE_CLASS_NONE
if ifclass == constants.INTERFACE_CLASS_PLATFORM:
networks = self._get_network_ids_by_type(networktype)
else:
networks = [] 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
interface = {'id': interface_id, interface = {'id': interface_id,
'uuid': str(uuid.uuid4()), 'uuid': str(uuid.uuid4()),
'forihostid': self.host.id, 'forihostid': self.host.id,
@ -259,24 +259,28 @@ class BaseTestCase(dbbase.DbTestCase):
name='management', name='management',
ranges=[['192.168.204.2', '192.168.204.254']], ranges=[['192.168.204.2', '192.168.204.254']],
prefix=24) prefix=24)
self.address_pools.append(mgmt_pool)
pxeboot_pool = dbutils.create_test_address_pool( pxeboot_pool = dbutils.create_test_address_pool(
network='192.168.202.0', network='192.168.202.0',
name='pxeboot', name='pxeboot',
ranges=[['192.168.202.2', '192.168.202.254']], ranges=[['192.168.202.2', '192.168.202.254']],
prefix=24) prefix=24)
self.address_pools.append(pxeboot_pool)
infra_pool = dbutils.create_test_address_pool( infra_pool = dbutils.create_test_address_pool(
network='192.168.205.0', network='192.168.205.0',
name='infrastructure', name='infrastructure',
ranges=[['192.168.205.2', '192.168.205.254']], ranges=[['192.168.205.2', '192.168.205.254']],
prefix=24) prefix=24)
self.address_pools.append(infra_pool)
oam_pool = dbutils.create_test_address_pool( oam_pool = dbutils.create_test_address_pool(
network='10.10.10.0', network='10.10.10.0',
name='oam', name='oam',
ranges=[['10.10.10.2', '10.10.10.254']], ranges=[['10.10.10.2', '10.10.10.254']],
prefix=24) prefix=24)
self.address_pools.append(oam_pool)
self.networks.append(dbutils.create_test_network( self.networks.append(dbutils.create_test_network(
type=constants.NETWORK_TYPE_MGMT, type=constants.NETWORK_TYPE_MGMT,
@ -434,7 +438,8 @@ class InterfaceTestCase(BaseTestCase):
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
self.port, self.iface = self._create_ethernet_test( 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): def _update_context(self):
# ensure DB entries are updated prior to updating the context which # 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): def test_is_platform_network_type_true(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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) result = interface.is_platform_network_type(self.iface)
self.assertTrue(result) self.assertTrue(result)
@ -622,6 +629,8 @@ class InterfaceTestCase(BaseTestCase):
def test_get_interface_gateway_address_oam(self): def test_get_interface_gateway_address_oam(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_OAM 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( gateway = interface.get_interface_gateway_address(
self.context, constants.NETWORK_TYPE_OAM) self.context, constants.NETWORK_TYPE_OAM)
expected = str(self.oam_gateway_address.ip) expected = str(self.oam_gateway_address.ip)
@ -630,6 +639,8 @@ class InterfaceTestCase(BaseTestCase):
def test_get_interface_gateway_address_mgmt(self): def test_get_interface_gateway_address_mgmt(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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( gateway = interface.get_interface_gateway_address(
self.context, constants.NETWORK_TYPE_MGMT) self.context, constants.NETWORK_TYPE_MGMT)
expected = str(self.mgmt_gateway_address.ip) expected = str(self.mgmt_gateway_address.ip)
@ -644,7 +655,6 @@ class InterfaceTestCase(BaseTestCase):
def test_get_interface_address_method_for_none(self): def test_get_interface_address_method_for_none(self):
self.iface['ifclass'] = None self.iface['ifclass'] = None
self.iface['networktype'] = None
method = interface.get_interface_address_method( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface)
self.assertEqual(method, 'manual') self.assertEqual(method, 'manual')
@ -673,102 +683,154 @@ class InterfaceTestCase(BaseTestCase):
def test_get_interface_address_method_for_pxeboot_worker(self): def test_get_interface_address_method_for_pxeboot_worker(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_PXEBOOT 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.host['personality'] = constants.WORKER
self._update_context() 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( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'manual') self.assertEqual(method, 'manual')
def test_get_interface_address_method_for_pxeboot_storage(self): def test_get_interface_address_method_for_pxeboot_storage(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_PXEBOOT 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.host['personality'] = constants.STORAGE
self._update_context() 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( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'manual') self.assertEqual(method, 'manual')
def test_get_interface_address_method_for_pxeboot_controller(self): def test_get_interface_address_method_for_pxeboot_controller(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_PXEBOOT 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.host['personality'] = constants.CONTROLLER
self._update_context() self._update_context()
network = self.dbapi.network_get_by_type(
constants.NETWORK_TYPE_PXEBOOT)
method = interface.get_interface_address_method( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'static') self.assertEqual(method, 'static')
def test_get_interface_address_method_for_mgmt_worker(self): def test_get_interface_address_method_for_mgmt_worker(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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.host['personality'] = constants.WORKER
self._update_context() 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( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'dhcp') self.assertEqual(method, 'dhcp')
def test_get_interface_address_method_for_mgmt_storage(self): def test_get_interface_address_method_for_mgmt_storage(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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.host['personality'] = constants.STORAGE
self._update_context() self._update_context()
network = self.dbapi.network_get_by_type(
constants.NETWORK_TYPE_MGMT)
method = interface.get_interface_address_method( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'dhcp') self.assertEqual(method, 'dhcp')
def test_get_interface_address_method_for_mgmt_controller(self): def test_get_interface_address_method_for_mgmt_controller(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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.host['personality'] = constants.CONTROLLER
self._update_context() 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( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'static') self.assertEqual(method, 'static')
def test_get_interface_address_method_for_infra_worker(self): def test_get_interface_address_method_for_infra_worker(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA 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.host['personality'] = constants.WORKER
self._update_context() self._update_context()
network = self.dbapi.network_get_by_type(
constants.NETWORK_TYPE_INFRA)
method = interface.get_interface_address_method( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'dhcp') self.assertEqual(method, 'dhcp')
def test_get_interface_address_method_for_infra_storage(self): def test_get_interface_address_method_for_infra_storage(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA 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.host['personality'] = constants.STORAGE
self._update_context() 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( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'dhcp') self.assertEqual(method, 'dhcp')
def test_get_interface_address_method_for_infra_controller(self): def test_get_interface_address_method_for_infra_controller(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA 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.host['personality'] = constants.CONTROLLER
self._update_context() self._update_context()
network = self.dbapi.network_get_by_type(
constants.NETWORK_TYPE_INFRA)
method = interface.get_interface_address_method( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'static') self.assertEqual(method, 'static')
def test_get_interface_address_method_for_oam_controller(self): def test_get_interface_address_method_for_oam_controller(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_OAM 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.host['personality'] = constants.CONTROLLER
self._update_context() 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( method = interface.get_interface_address_method(
self.context, self.iface) self.context, self.iface, network.id)
self.assertEqual(method, 'static') self.assertEqual(method, 'static')
def test_get_interface_traffic_classifier_for_mgmt(self): def test_get_interface_traffic_classifier_for_mgmt(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT self.iface['networktype'] = constants.NETWORK_TYPE_MGMT
for network in self.networks: self.iface['networks'] = self._get_network_ids_by_type(
if network['type'] == constants.NETWORK_TYPE_MGMT: constants.NETWORK_TYPE_MGMT)
net_id = network['id'] network = self.dbapi.network_get_by_type(
self.iface['networks'] = [str(net_id)] constants.NETWORK_TYPE_MGMT)
classifier = interface.get_interface_traffic_classifier( classifier = interface.get_interface_traffic_classifier(
self.context, self.iface) self.context, self.iface, network.id)
print(self.context) print(self.context)
expected = ('/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % expected = ('/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' %
(self.port['name'], constants.NETWORK_TYPE_MGMT, (self.port['name'], constants.NETWORK_TYPE_MGMT,
@ -779,12 +841,12 @@ class InterfaceTestCase(BaseTestCase):
self.iface['ifname'] = 'infra0' self.iface['ifname'] = 'infra0'
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA self.iface['networktype'] = constants.NETWORK_TYPE_INFRA
for network in self.networks: self.iface['networks'] = self._get_network_ids_by_type(
if network['type'] == constants.NETWORK_TYPE_INFRA: constants.NETWORK_TYPE_INFRA)
net_id = network['id'] network = self.dbapi.network_get_by_type(
self.iface['networks'] = [str(net_id)] constants.NETWORK_TYPE_INFRA)
classifier = interface.get_interface_traffic_classifier( 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' % expected = ('/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' %
(self.port['name'], constants.NETWORK_TYPE_INFRA, (self.port['name'], constants.NETWORK_TYPE_INFRA,
constants.LINK_SPEED_10G)) constants.LINK_SPEED_10G))
@ -793,16 +855,15 @@ class InterfaceTestCase(BaseTestCase):
def test_get_interface_traffic_classifier_for_oam(self): def test_get_interface_traffic_classifier_for_oam(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_OAM self.iface['networktype'] = constants.NETWORK_TYPE_OAM
for network in self.networks: self.iface['networks'] = self._get_network_ids_by_type(
if network['type'] == constants.NETWORK_TYPE_OAM: constants.NETWORK_TYPE_OAM)
net_id = network['id'] network = self.dbapi.network_get_by_type(
self.iface['networks'] = [str(net_id)] constants.NETWORK_TYPE_OAM)
classifier = interface.get_interface_traffic_classifier( classifier = interface.get_interface_traffic_classifier(
self.context, self.iface) self.context, self.iface, network.id)
self.assertIsNone(classifier) self.assertIsNone(classifier)
def test_get_interface_traffic_classifier_for_none(self): def test_get_interface_traffic_classifier_for_none(self):
self.iface['networktype'] = None
classifier = interface.get_interface_traffic_classifier( classifier = interface.get_interface_traffic_classifier(
self.context, self.iface) self.context, self.iface)
self.assertIsNone(classifier) self.assertIsNone(classifier)
@ -818,6 +879,8 @@ class InterfaceTestCase(BaseTestCase):
def test_get_bridge_interface_name_none_not_data(self): def test_get_bridge_interface_name_none_not_data(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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) ifname = interface.get_bridge_interface_name(self.context, self.iface)
self.assertIsNone(ifname) self.assertIsNone(ifname)
@ -832,6 +895,8 @@ class InterfaceTestCase(BaseTestCase):
def test_needs_interface_config_kernel_mgmt(self): def test_needs_interface_config_kernel_mgmt(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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.host['personality'] = constants.CONTROLLER
self._update_context() self._update_context()
needed = interface.needs_interface_config(self.context, self.iface) needed = interface.needs_interface_config(self.context, self.iface)
@ -840,6 +905,8 @@ class InterfaceTestCase(BaseTestCase):
def test_needs_interface_config_kernel_infra(self): def test_needs_interface_config_kernel_infra(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA 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.host['personality'] = constants.CONTROLLER
self._update_context() self._update_context()
needed = interface.needs_interface_config(self.context, self.iface) needed = interface.needs_interface_config(self.context, self.iface)
@ -848,6 +915,8 @@ class InterfaceTestCase(BaseTestCase):
def test_needs_interface_config_kernel_oam(self): def test_needs_interface_config_kernel_oam(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_OAM 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.host['personality'] = constants.CONTROLLER
self._update_context() self._update_context()
needed = interface.needs_interface_config(self.context, self.iface) needed = interface.needs_interface_config(self.context, self.iface)
@ -1055,13 +1124,14 @@ class InterfaceTestCase(BaseTestCase):
def test_get_controller_ethernet_config_oam(self): def test_get_controller_ethernet_config_oam(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_OAM self.iface['networktype'] = constants.NETWORK_TYPE_OAM
for network in self.networks: self.iface['networks'] = self._get_network_ids_by_type(
if network['type'] == constants.NETWORK_TYPE_OAM: constants.NETWORK_TYPE_OAM)
net_id = network['id']
self.iface['networks'] = [str(net_id)]
self._update_context() 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( config = interface.get_interface_network_config(
self.context, self.iface) self.context, self.iface, network.id)
options = {'LINKDELAY': '20'} options = {'LINKDELAY': '20'}
expected = self._get_static_network_config( expected = self._get_static_network_config(
ifname=self.port['name'], mtu=1500, gateway='10.10.10.1', 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): def test_get_controller_ethernet_config_mgmt(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT self.iface['networktype'] = constants.NETWORK_TYPE_MGMT
for network in self.networks: self.iface['networks'] = self._get_network_ids_by_type(
if network['type'] == constants.NETWORK_TYPE_MGMT: constants.NETWORK_TYPE_MGMT)
net_id = network['id']
self.iface['networks'] = [str(net_id)]
self._update_context() 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( config = interface.get_interface_network_config(
self.context, self.iface) self.context, self.iface, network.id)
options = {'LINKDELAY': '20', options = {'LINKDELAY': '20',
'post_up': 'post_up':
'/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % '/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): def test_get_controller_ethernet_config_infra(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA self.iface['networktype'] = constants.NETWORK_TYPE_INFRA
for network in self.networks: self.iface['networks'] = self._get_network_ids_by_type(
if network['type'] == constants.NETWORK_TYPE_INFRA: constants.NETWORK_TYPE_INFRA)
net_id = network['id']
self.iface['networks'] = [str(net_id)]
self._update_context() 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( config = interface.get_interface_network_config(
self.context, self.iface) self.context, self.iface, network.id)
options = {'LINKDELAY': '20', options = {'LINKDELAY': '20',
'post_up': 'post_up':
'/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % '/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): def test_get_worker_ethernet_config_mgmt(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_MGMT 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.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_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( config = interface.get_interface_network_config(
self.context, self.iface) self.context, self.iface, network.id)
options = {'LINKDELAY': '20', options = {'LINKDELAY': '20',
'post_up': 'post_up':
'/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % '/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): def test_get_worker_ethernet_config_infra(self):
self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM self.iface['ifclass'] = constants.INTERFACE_CLASS_PLATFORM
self.iface['networktype'] = constants.NETWORK_TYPE_INFRA 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.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_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( config = interface.get_interface_network_config(
self.context, self.iface) self.context, self.iface, network.id)
options = {'LINKDELAY': '20', options = {'LINKDELAY': '20',
'post_up': 'post_up':
'/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' % '/usr/local/bin/cgcs_tc_setup.sh %s %s %s > /dev/null' %
@ -1531,9 +1605,12 @@ class InterfaceControllerEthernet(InterfaceHostTestCase):
# ethernet interfaces. # ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
self._create_ethernet_test('oam', None, constants.NETWORK_TYPE_OAM) self._create_ethernet_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) constants.NETWORK_TYPE_OAM)
self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) 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') self._create_ethernet_test('none')
def setUp(self): def setUp(self):
@ -1548,9 +1625,12 @@ class InterfaceControllerBond(InterfaceHostTestCase):
# aggregated ethernet interfaces. # aggregated ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
self._create_bond_test('oam', None, constants.NETWORK_TYPE_OAM) self._create_bond_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) constants.NETWORK_TYPE_OAM)
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)
def setUp(self): def setUp(self):
super(InterfaceControllerBond, self).setUp() super(InterfaceControllerBond, self).setUp()
@ -1569,11 +1649,15 @@ class InterfaceControllerVlanOverBond(InterfaceHostTestCase):
# vlan interfaces over aggregated ethernet interfaces # vlan interfaces over aggregated ethernet interfaces
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) 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) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) constants.NETWORK_TYPE_OAM, 1, bond)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, 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) bond)
self._create_ethernet_test('none') self._create_ethernet_test('none')
@ -1592,12 +1676,14 @@ class InterfaceControllerVlanOverEthernet(InterfaceHostTestCase):
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
port, iface = self._create_ethernet_test( port, iface = self._create_ethernet_test(
'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) 'pxeboot', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, iface) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
iface) constants.NETWORK_TYPE_OAM, 1, iface)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
iface) 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') self._create_ethernet_test('none')
def setUp(self): def setUp(self):
@ -1613,10 +1699,11 @@ class InterfaceComputeEthernet(InterfaceHostTestCase):
# worker and all interfaces are ethernet interfaces. # worker and all interfaces are ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.WORKER) self._create_test_host(constants.WORKER)
self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) self._create_ethernet_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) constants.NETWORK_TYPE_MGMT)
self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA, self._create_ethernet_test('infra', constants.INTERFACE_CLASS_PLATFORM,
constants.NETWORK_TYPE_DATA) constants.NETWORK_TYPE_INFRA)
self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
constants.NETWORK_TYPE_PCI_SRIOV) constants.NETWORK_TYPE_PCI_SRIOV)
self._create_ethernet_test('pthru', constants.INTERFACE_CLASS_PCI_PASSTHROUGH, self._create_ethernet_test('pthru', constants.INTERFACE_CLASS_PCI_PASSTHROUGH,
@ -1655,10 +1742,12 @@ class InterfaceComputeVlanOverEthernet(InterfaceHostTestCase):
self._create_test_common() self._create_test_common()
self._create_test_host(constants.WORKER) self._create_test_host(constants.WORKER)
port, iface = self._create_ethernet_test( port, iface = self._create_ethernet_test(
'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) 'pxeboot', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, constants.NETWORK_TYPE_PXEBOOT)
iface) self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3) 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, self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, 5) constants.NETWORK_TYPE_DATA, 5)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
@ -1681,8 +1770,10 @@ class InterfaceComputeBond(InterfaceHostTestCase):
self._create_test_common() self._create_test_common()
# worker and all interfaces are aggregated ethernet interfaces. # worker and all interfaces are aggregated ethernet interfaces.
self._create_test_host(constants.WORKER) self._create_test_host(constants.WORKER)
self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) self._create_bond_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
self._create_bond_test('infra', None, constants.NETWORK_TYPE_INFRA) 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, self._create_bond_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA) constants.NETWORK_TYPE_DATA)
self._create_ethernet_test('sriov', self._create_ethernet_test('sriov',
@ -1712,16 +1803,18 @@ class InterfaceComputeVlanOverBond(InterfaceHostTestCase):
# interfaces. # interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.WORKER) 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) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) constants.NETWORK_TYPE_OAM, 1, bond)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
bond) 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') bond2 = self._create_bond_test('bond2')
self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, 5, constants.NETWORK_TYPE_DATA, 5, bond2)
bond2)
self._create_ethernet_test('sriov', self._create_ethernet_test('sriov',
constants.INTERFACE_CLASS_PCI_SRIOV, constants.INTERFACE_CLASS_PCI_SRIOV,
constants.NETWORK_TYPE_PCI_SRIOV) constants.NETWORK_TYPE_PCI_SRIOV)
@ -1748,9 +1841,12 @@ class InterfaceCpeEthernet(InterfaceHostTestCase):
# ethernet interfaces. # ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
self._create_ethernet_test('oam', None, constants.NETWORK_TYPE_OAM) self._create_ethernet_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_ethernet_test('mgmt', None, constants.NETWORK_TYPE_MGMT) constants.NETWORK_TYPE_OAM)
self._create_ethernet_test('infra', None, constants.NETWORK_TYPE_INFRA) 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('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA) constants.NETWORK_TYPE_DATA)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
@ -1791,11 +1887,14 @@ class InterfaceCpeVlanOverEthernet(InterfaceHostTestCase):
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
port, iface = self._create_ethernet_test( port, iface = self._create_ethernet_test(
'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) 'pxeboot', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, iface) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
iface) constants.NETWORK_TYPE_OAM, 1, iface)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3) 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, self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, 5) constants.NETWORK_TYPE_DATA, 5)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
@ -1819,9 +1918,12 @@ class InterfaceCpeBond(InterfaceHostTestCase):
# aggregated ethernet interfaces. # aggregated ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) self._create_test_host(constants.CONTROLLER)
self._create_bond_test('oam', None, constants.NETWORK_TYPE_OAM) self._create_bond_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) constants.NETWORK_TYPE_OAM)
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, self._create_bond_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA) constants.NETWORK_TYPE_DATA)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
@ -1849,12 +1951,14 @@ class InterfaceCpeVlanOverBond(InterfaceHostTestCase):
# vlan interfaces over aggregated ethernet interfaces. # vlan interfaces over aggregated ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER) 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) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) constants.NETWORK_TYPE_OAM, 1, bond)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
bond) 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') bond2 = self._create_bond_test('bond4')
self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, 5, constants.NETWORK_TYPE_DATA, 5,
@ -1881,15 +1985,18 @@ class InterfaceCpeComputeEthernet(InterfaceHostTestCase):
# ethernet interfaces. # ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER, constants.WORKER) 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, self._create_ethernet_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA) constants.NETWORK_TYPE_DATA)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
constants.NETWORK_TYPE_PCI_SRIOV) constants.NETWORK_TYPE_PCI_SRIOV)
self._create_ethernet_test('pthru', constants.INTERFACE_CLASS_PCI_PASSTHROUGH, self._create_ethernet_test('pthru', constants.INTERFACE_CLASS_PCI_PASSTHROUGH,
constants.NETWORK_TYPE_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 = ( port, iface = (
self._create_ethernet_test('slow', constants.INTERFACE_CLASS_DATA, self._create_ethernet_test('slow', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, constants.NETWORK_TYPE_DATA,
@ -1924,11 +2031,14 @@ class InterfaceCpeComputeVlanOverEthernet(InterfaceHostTestCase):
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER, constants.WORKER) self._create_test_host(constants.CONTROLLER, constants.WORKER)
port, iface = self._create_ethernet_test( port, iface = self._create_ethernet_test(
'pxeboot', None, constants.NETWORK_TYPE_PXEBOOT) 'pxeboot', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, iface) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
iface) constants.NETWORK_TYPE_OAM, 1, iface)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3) 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, self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, 5) constants.NETWORK_TYPE_DATA, 5)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
@ -1952,9 +2062,12 @@ class InterfaceCpeComputeBond(InterfaceHostTestCase):
# aggregated ethernet interfaces. # aggregated ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER, constants.WORKER) self._create_test_host(constants.CONTROLLER, constants.WORKER)
self._create_bond_test('oam', None, constants.NETWORK_TYPE_OAM) self._create_bond_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_bond_test('mgmt', None, constants.NETWORK_TYPE_MGMT) constants.NETWORK_TYPE_OAM)
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, self._create_bond_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA) constants.NETWORK_TYPE_DATA)
self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV, self._create_ethernet_test('sriov', constants.INTERFACE_CLASS_PCI_SRIOV,
@ -1982,12 +2095,15 @@ class InterfaceCpeComputeVlanOverBond(InterfaceHostTestCase):
# vlan interfaces over aggregated ethernet interfaces. # vlan interfaces over aggregated ethernet interfaces.
self._create_test_common() self._create_test_common()
self._create_test_host(constants.CONTROLLER, constants.WORKER) 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) constants.NETWORK_TYPE_PXEBOOT)
self._create_vlan_test('oam', None, constants.NETWORK_TYPE_OAM, 1, bond) self._create_vlan_test('oam', constants.INTERFACE_CLASS_PLATFORM,
self._create_vlan_test('mgmt', None, constants.NETWORK_TYPE_MGMT, 2, bond) constants.NETWORK_TYPE_OAM, 1, bond)
self._create_vlan_test('infra', None, constants.NETWORK_TYPE_INFRA, 3, self._create_vlan_test('mgmt', constants.INTERFACE_CLASS_PLATFORM,
bond) 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') bond2 = self._create_bond_test('bond2')
self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA, self._create_vlan_test('data', constants.INTERFACE_CLASS_DATA,
constants.NETWORK_TYPE_DATA, 5, constants.NETWORK_TYPE_DATA, 5,