Merge "Generate network interface config with single default gateway"

This commit is contained in:
Zuul 2024-05-15 20:48:37 +00:00 committed by Gerrit Code Review
commit 1ebc8e714e
2 changed files with 97 additions and 61 deletions

View File

@ -151,6 +151,8 @@ class InterfacePuppet(base.BasePuppet):
'address_pools': address_pools, 'address_pools': address_pools,
'floatingips': self._get_floating_ip_index(networks, address_pools, 'floatingips': self._get_floating_ip_index(networks, address_pools,
network_address_pools), network_address_pools),
'gateways': self._get_default_gateway_index(host, addresses, address_pools,
network_address_pools),
'datanets': self._get_datanetworks(host), 'datanets': self._get_datanetworks(host),
'vswitchtype': self._vswitch_type(), 'vswitchtype': self._vswitch_type(),
} }
@ -330,6 +332,55 @@ class InterfacePuppet(base.BasePuppet):
return floating_ips return floating_ips
GATEWAY_PRECEDENCE_LIST = [constants.NETWORK_TYPE_OAM,
constants.NETWORK_TYPE_MGMT,
constants.NETWORK_TYPE_ADMIN]
def _get_addrpool_gateway_field(self, host_personality, network_type):
if host_personality in [constants.STORAGE, constants.WORKER] and \
network_type == constants.NETWORK_TYPE_MGMT:
return 'floating_address'
return 'gateway_address'
def _get_default_gateway_index(self, host, addresses, address_pools, network_address_pools):
'''
Gets a dictionary containing the default gateway addresses indexed by the corresponding
address pools. There can be only one default gateway per address family, so if there are
multiple address pools with gateways, the default one will follow the precedence order
OAM -> Management -> Admin. Only address pools which have an address assigned to an
interface in the current host are considered.
'''
assigned_addrpools = set()
for address_list in addresses.values():
for address in address_list:
if address.forihostid == host.id and address.pool_uuid:
assigned_addrpools.add(address.pool_uuid)
nw_addrpool_index = {}
for nw_addrpool in network_address_pools.values():
if nw_addrpool.network_type not in self.GATEWAY_PRECEDENCE_LIST:
continue
if nw_addrpool.address_pool_uuid not in assigned_addrpools:
continue
addrpools = nw_addrpool_index.setdefault(nw_addrpool.network_type, [])
addrpools.append(address_pools[nw_addrpool.address_pool_uuid])
gateway_index = {}
for nw_type in self.GATEWAY_PRECEDENCE_LIST:
addrpools = nw_addrpool_index.get(nw_type, None)
if not addrpools:
continue
field = self._get_addrpool_gateway_field(host.personality, nw_type)
for addrpool in addrpools:
gateway = getattr(addrpool, field)
if gateway:
gateway_index[addrpool.uuid] = gateway
if gateway_index:
break
return gateway_index
def _get_datanetworks(self, host): def _get_datanetworks(self, host):
dnets = {} dnets = {}
if constants.WORKER in utils.get_personalities(host): if constants.WORKER in utils.get_personalities(host):
@ -664,23 +715,11 @@ def _set_address_netmask(address):
return address return address
def get_gateway_address(context, network, address): def get_gateway_address(context, address):
""" """
Gets the corresponding gateway for the provided address Gets the corresponding gateway for the provided address
""" """
return context['gateways'].get(address.pool_uuid, None)
addrpool = context['address_pools'].get(address.pool_uuid, None)
if not addrpool:
return None
if (network and network.type == constants.NETWORK_TYPE_MGMT and
context['personality'] in [constants.WORKER, constants.STORAGE]):
gateway_address = addrpool.floating_address
else:
gateway_address = addrpool.gateway_address
return gateway_address
def get_interface_address_method(context, iface, network=None, address=None): def get_interface_address_method(context, iface, network=None, address=None):
@ -1265,7 +1304,7 @@ def get_common_network_config(context, iface, config, network=None, address=None
config['ipaddress'] = address['address'] config['ipaddress'] = address['address']
config['netmask'] = address['netmask'] config['netmask'] = address['netmask']
gateway = get_gateway_address(context, network, address) gateway = get_gateway_address(context, address)
if gateway: if gateway:
config['options']['gateway'] = gateway config['options']['gateway'] = gateway
return config return config

View File

@ -668,7 +668,7 @@ class InterfaceTestCase2(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
constants.NETWORK_TYPE_OAM) constants.NETWORK_TYPE_OAM)
network, address = self._create_address_for_interface(self.iface) network, address = self._create_address_for_interface(self.iface)
self._do_update_context() self._do_update_context()
gateway = interface.get_gateway_address(self.context, network, address) gateway = interface.get_gateway_address(self.context, address)
expected = str(self.oam_subnet[1]) expected = str(self.oam_subnet[1])
self.assertEqual(gateway, expected) self.assertEqual(gateway, expected)
@ -678,7 +678,7 @@ class InterfaceTestCase2(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
constants.NETWORK_TYPE_MGMT) constants.NETWORK_TYPE_MGMT)
network, address = self._create_address_for_interface(self.iface) network, address = self._create_address_for_interface(self.iface)
self._do_update_context() self._do_update_context()
gateway = interface.get_gateway_address(self.context, network, address) gateway = interface.get_gateway_address(self.context, address)
expected = str(self.mgmt_subnet[1]) expected = str(self.mgmt_subnet[1])
self.assertEqual(gateway, expected) self.assertEqual(gateway, expected)
@ -1375,8 +1375,7 @@ class InterfaceTestCase2(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
ipv6_autocnf_off = self._get_ipv6_autoconf_off(self.port['name']) ipv6_autocnf_off = self._get_ipv6_autoconf_off(self.port['name'])
options = {'stx-description': 'ifname:mgmt0,net:cluster-host', options = {'stx-description': 'ifname:mgmt0,net:cluster-host',
'post-up': '{}'.format(ipv6_autocnf_off), 'post-up': '{}'.format(ipv6_autocnf_off),
'mtu': '1500', 'mtu': '1500'}
'gateway': '192.168.206.1'}
expected = self._get_static_network_config_ifupdown( expected = self._get_static_network_config_ifupdown(
ipaddress='192.168.206.10', ipaddress='192.168.206.10',
ifname=f"{self.port['name']}:{network.id}-{address.id}", options=options) ifname=f"{self.port['name']}:{network.id}-{address.id}", options=options)
@ -1835,8 +1834,7 @@ class InterfaceTestCase2(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
ipv6_autocnf_off = self._get_ipv6_autoconf_off(self.port['name']) ipv6_autocnf_off = self._get_ipv6_autoconf_off(self.port['name'])
options = {'post-up': '%s' % ipv6_autocnf_off, options = {'post-up': '%s' % ipv6_autocnf_off,
'mtu': '1500', 'mtu': '1500',
'stx-description': 'ifname:mgmt0,net:cluster-host', 'stx-description': 'ifname:mgmt0,net:cluster-host'}
'gateway': '192.168.206.1'}
expected = self._get_static_network_config_ifupdown( expected = self._get_static_network_config_ifupdown(
ipaddress='192.168.206.10', ipaddress='192.168.206.10',
ifname=f"{self.port['name']}:{clhost_network.id}-{clhost_address.id}", options=options) ifname=f"{self.port['name']}:{clhost_network.id}-{clhost_address.id}", options=options)
@ -1894,7 +1892,6 @@ class InterfaceTestCase2(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
ipv6_autocnf_off = self._get_ipv6_autoconf_off(self.port['name']) ipv6_autocnf_off = self._get_ipv6_autoconf_off(self.port['name'])
options = {'stx-description': 'ifname:mgmt0,net:cluster-host', options = {'stx-description': 'ifname:mgmt0,net:cluster-host',
'mtu': '1500', 'mtu': '1500',
'gateway': '192.168.206.1',
'post-up': '{}'.format(ipv6_autocnf_off)} 'post-up': '{}'.format(ipv6_autocnf_off)}
expected = self._get_static_network_config_ifupdown( expected = self._get_static_network_config_ifupdown(
ipaddress='192.168.206.10', ipaddress='192.168.206.10',
@ -4117,7 +4114,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL, {NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
@ -4129,16 +4126,16 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4], {MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6], {MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}, OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}], OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4153,7 +4150,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL, {NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
@ -4162,10 +4159,10 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6, DS_IPV4, DS_IPV6], {MODES: [SS_IPV6, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}], OPTIONS: {POST_UP: [IPV6_CFG]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4181,7 +4178,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL, {NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
@ -4190,10 +4187,10 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6, DS_IPV4, DS_IPV6], {MODES: [SS_IPV6, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}], OPTIONS: {POST_UP: [IPV6_CFG]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4208,7 +4205,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
expected = { expected = {
'pxe0': [ 'pxe0': [
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}], OPTIONS: {POST_UP: [IPV6_CFG]}}],
'mgmt0': [ 'mgmt0': [
{NET: None, FAMILY: INET, METHOD: MANUAL, {NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
@ -4220,10 +4217,10 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6, DS_IPV4, DS_IPV6], {MODES: [SS_IPV6, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}], OPTIONS: {POST_UP: [IPV6_CFG]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4238,7 +4235,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
expected = { expected = {
'pxe0': [ 'pxe0': [
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'bond-lacp-rate': 'fast', 'bond-miimon': '100', OPTIONS: {'bond-lacp-rate': 'fast', 'bond-miimon': '100',
'bond-mode': '802.3ad', 'bond-slaves': True, 'bond-mode': '802.3ad', 'bond-slaves': True,
'bond-xmit-hash-policy': 'layer2', 'hwaddress': True, 'bond-xmit-hash-policy': 'layer2', 'hwaddress': True,
POST_UP: [SET_TC, IPV6_CFG], UP: [SLEEP]}}], POST_UP: [SET_TC, IPV6_CFG], UP: [SLEEP]}}],
@ -4274,19 +4271,19 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
POST_UP: [SET_MTU, IPV6_CFG]}}, POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [SS_IPV4], {MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD], OPTIONS: {'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG]}}, POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD], OPTIONS: {'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG]}}, POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [SS_IPV6], {MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD], OPTIONS: {'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}, POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD], OPTIONS: {'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}], POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4305,7 +4302,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL, {NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {PRE_UP: [DIS_DAD], POST_UP: [SET_TC, IPV6_CFG]}}, OPTIONS: {PRE_UP: [DIS_DAD], POST_UP: [SET_TC, IPV6_CFG]}},
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
@ -4317,16 +4314,16 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {PRE_UP: [DIS_DAD], POST_UP: [IPV6_CFG]}}, OPTIONS: {PRE_UP: [DIS_DAD], POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4], {MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6], {MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}], OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4344,7 +4341,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
expected = { expected = {
'pxe0': [ 'pxe0': [
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC, {NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}], OPTIONS: {POST_UP: [IPV6_CFG]}}],
'mgmt0': [ 'mgmt0': [
{NET: None, FAMILY: INET, METHOD: MANUAL, {NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {'bond-lacp-rate': 'fast', 'bond-miimon': '100', OPTIONS: {'bond-lacp-rate': 'fast', 'bond-miimon': '100',
@ -4392,21 +4389,21 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
POST_DOWN: [VLAN_DEL]}}, POST_DOWN: [VLAN_DEL]}},
{MODES: [SS_IPV4], {MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, OPTIONS: {'vlan-raw-device': True,
PRE_UP: [VLAN_MOD], PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG]}}, POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, OPTIONS: {'vlan-raw-device': True,
PRE_UP: [VLAN_MOD], POST_UP: [SET_MTU, IPV6_CFG]}}, PRE_UP: [VLAN_MOD], POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [SS_IPV6], {MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, OPTIONS: {'vlan-raw-device': True,
PRE_UP: [VLAN_MOD], PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}, POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, OPTIONS: {'vlan-raw-device': True,
PRE_UP: [VLAN_MOD], POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}], PRE_UP: [VLAN_MOD], POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4435,16 +4432,16 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{MODES: [SS_IPV4], {MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6], {MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}}, OPTIONS: {POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}], OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4472,16 +4469,16 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4], {MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6], {MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}, OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6], {MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}], OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)
@ -4514,10 +4511,10 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6], {MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}, OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6, DS_IPV4, DS_IPV6], {MODES: [SS_IPV6, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC, NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}], OPTIONS: {POST_UP: [IPV6_CFG, UNDEPR]}}],
} }
self._validate_config(expected) self._validate_config(expected)