Merge "Always generate network ifcfg files with label"

This commit is contained in:
Zuul 2024-05-13 20:53:37 +00:00 committed by Gerrit Code Review
commit 8b8b761be1
2 changed files with 163 additions and 106 deletions

View File

@ -1547,7 +1547,9 @@ def process_interface_labels(config, context):
#
# Rules for label adjustment:
# 1) if the interface have just one label:
# - move the content of label to interface
# - keep the label as it can receive dual-stack configuration later
# - if part of pxeboot network, move the content of label to interface,
# keeping compatibility with MTCE operation (pxeboot is single-stack only)
# 2) if the interface have more that one label
# - if the family is inet
# - just keep the labeling
@ -1560,6 +1562,7 @@ def process_interface_labels(config, context):
# - a post-up operation will be added to remove this flag in one
# of the interfaces
# - the selected label interface will follow the precedence
# - oam
# - mgmt
# - admin
# - cluster-host
@ -1583,45 +1586,54 @@ def process_interface_labels(config, context):
# no need to change the loopback
continue
if not label_map[intf]:
continue
# process main ipv6 address
for label in label_map[intf].keys():
intf_data = label_map[intf][label]
if (intf_data['family'] == 'inet6') and (intf_data['method'] == 'static'):
name_net = intf_data['options']['stx-description'].split(',')
ifname = (name_net[0].split(":"))[1]
networktypelist = context['interfaces'][ifname].networktypelist
undeprecate = "ip -6 addr replace" + \
f" {intf_data['ipaddress']}/{intf_data['netmask']}" + \
f" dev {intf} preferred_lft forever"
if constants.NETWORK_TYPE_OAM in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_MGMT in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_ADMIN in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_CLUSTER_HOST in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_PXEBOOT in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_STORAGE in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
if len(label_map[intf]) == 1:
label = next(iter(label_map[intf]))
merge_interface_operations(config, intf, label)
# replace the base interface with the labeled one
config[NETWORK_CONFIG_RESOURCE][intf] = config[NETWORK_CONFIG_RESOURCE][label]
del config[NETWORK_CONFIG_RESOURCE][label]
elif len(label_map[intf]) > 1:
# process main ipv6 address
for label in label_map[intf].keys():
intf_data = label_map[intf][label]
if (intf_data['family'] == 'inet6') and (intf_data['method'] == 'static'):
name_net = intf_data['options']['stx-description'].split(',')
ifname = (name_net[0].split(":"))[1]
networktypelist = context['interfaces'][ifname].networktypelist
undeprecate = "ip -6 addr replace" + \
f" {intf_data['ipaddress']}/{intf_data['netmask']}" + \
f" dev {intf} preferred_lft forever"
if constants.NETWORK_TYPE_MGMT in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_ADMIN in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_CLUSTER_HOST in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_PXEBOOT in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
elif constants.NETWORK_TYPE_STORAGE in networktypelist:
fill_interface_config_option_operation(intf_data['options'],
IFACE_POST_UP_OP, undeprecate)
break
if 'options' in config[NETWORK_CONFIG_RESOURCE][label].keys():
options = config[NETWORK_CONFIG_RESOURCE][label]['options']
if ('stx-description' in options.keys()):
if (f"net:{constants.NETWORK_TYPE_PXEBOOT}" in options['stx-description']):
merge_interface_operations(config, intf, label)
# replace the base interface with the labeled one
config[NETWORK_CONFIG_RESOURCE][intf] = config[NETWORK_CONFIG_RESOURCE][label]
del config[NETWORK_CONFIG_RESOURCE][label]
# process DHCPv6, needs to be in the base interface
for label in label_map[intf].keys():

View File

@ -2293,6 +2293,7 @@ class InterfaceHostTestCase(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
def test_generate_interface_config_ifupdown(self):
hieradata_directory = self._create_hieradata_directory()
config_filename = self._get_config_filename(hieradata_directory)
print(config_filename)
with open(config_filename, 'w') as config_file:
config = self.operator.interface.get_host_config(self.host) # pylint: disable=no-member
self.assertIsNotNone(config)
@ -2301,6 +2302,7 @@ class InterfaceHostTestCase(InterfaceTestCaseMixin, dbbase.BaseHostTestCase):
def test_interface_config_yaml_data_validation(self):
hieradata_directory = self._create_hieradata_directory()
config_filename = self._get_config_filename(hieradata_directory)
print(config_filename)
with open(config_filename, 'w') as config_file:
config = self.operator.interface.get_host_config(self.host) # pylint: disable=no-member
self.assertIsNotNone(config)
@ -2464,7 +2466,10 @@ class InterfaceControllerEthernet(InterfaceHostTestCase):
self.expected_bmc_interface = 'mgmt'
self.expected_platform_interfaces = ['oam', 'mgmt', 'cluster-host']
self.exp_yaml_config = {
"eth0": {'family': 'inet', 'method': 'static',
"eth0": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:oam,net:{None}',
'tc': False},
"eth0:3-11": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:oam,net:{constants.NETWORK_TYPE_OAM}',
'tc': False},
"eth1": {'family': 'inet', 'method': 'manual',
@ -2475,7 +2480,10 @@ class InterfaceControllerEthernet(InterfaceHostTestCase):
"eth1:2-7": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"eth2": {'family': 'inet', 'method': 'static',
"eth2": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,net:{None}',
'tc': False},
"eth2:4-15": {'family': 'inet', 'method': 'static',
'stx-description': 'ifname:cluster-host,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}',
'tc': False},
@ -2508,7 +2516,10 @@ class InterfaceControllerEthernetCfg2(InterfaceHostTestCase):
self.expected_bmc_interface = 'mgmt0'
self.expected_platform_interfaces = ['oam0', 'mgmt0']
self.exp_yaml_config = {
"eth0": {'family': 'inet', 'method': 'static',
"eth0": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:oam0,net:{None}',
'tc': False},
"eth0:3-11": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:oam0,net:{constants.NETWORK_TYPE_OAM}',
'tc': False},
"eth1": {'family': 'inet', 'method': 'manual',
@ -2553,7 +2564,10 @@ class InterfaceControllerEthernetCfg3(InterfaceHostTestCase):
self.expected_bmc_interface = 'mgmt0'
self.expected_platform_interfaces = ['oam0', 'mgmt0']
self.exp_yaml_config = {
"eth0": {'family': 'inet', 'method': 'static',
"eth0": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:oam0,net:{None}',
'tc': False},
"eth0:3-11": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:oam0,net:{constants.NETWORK_TYPE_OAM}',
'tc': False},
"eth1": {'family': 'inet', 'method': 'manual',
@ -2617,7 +2631,10 @@ class InterfaceControllerBond(InterfaceHostTestCase):
'stx-description': f'ifname:eth6,net:{None}', 'tc': False},
"eth5": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:eth7,net:{None}', 'tc': False},
"oam0": {'family': 'inet', 'method': 'static',
"oam0": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:oam0,net:{None}',
'tc': False},
"oam0:3-11": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:oam0,net:{constants.NETWORK_TYPE_OAM}',
'tc': False},
"mgmt0": {'family': 'inet', 'method': 'manual',
@ -2628,7 +2645,10 @@ class InterfaceControllerBond(InterfaceHostTestCase):
"mgmt0:2-7": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt0,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"cluster-host0": {'family': 'inet', 'method': 'static',
"cluster-host0": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host0,net:{None}',
'tc': False},
"cluster-host0:4-15": {'family': 'inet', 'method': 'static',
'stx-description': 'ifname:cluster-host0,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}',
'tc': False},
@ -2675,13 +2695,22 @@ class InterfaceControllerVlanOverBond(InterfaceHostTestCase):
"pxeboot0": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:pxeboot0,net:{constants.NETWORK_TYPE_PXEBOOT}',
'tc': False},
"vlan1": {'family': 'inet', 'method': 'static',
"vlan1": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:oam0,net:{None}',
'tc': False},
"vlan1:3-11": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:oam0,net:{constants.NETWORK_TYPE_OAM}',
'tc': False},
"vlan2": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt0,net:{constants.NETWORK_TYPE_MGMT}',
"vlan2": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:mgmt0,net:{None}',
'tc': True},
"vlan3": {'family': 'inet', 'method': 'static',
"vlan2:2-7": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt0,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"vlan3": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host0,net:{None}',
'tc': False},
"vlan3:4-15": {'family': 'inet', 'method': 'static',
'stx-description': 'ifname:cluster-host0,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}',
'tc': False},
@ -2774,7 +2803,10 @@ class InterfaceComputeEthernet(InterfaceHostTestCase):
"eth0:2-37": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"eth1": {'family': 'inet', 'method': 'static',
"eth1": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,'
f'net:{None}', 'tc': False},
"eth1:4-38": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:cluster-host,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}', 'tc': False},
"eth3": {'family': 'inet', 'method': 'manual',
@ -2844,7 +2876,10 @@ class InterfaceComputeEthernetCfg2(InterfaceHostTestCase):
"eth0:2-37": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"eth1": {'family': 'inet', 'method': 'static',
"eth1": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,'
f'net:{None}', 'tc': False},
"eth1:4-38": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:cluster-host,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}', 'tc': False},
"eth3": {'family': 'inet', 'method': 'manual',
@ -2906,9 +2941,12 @@ class InterfaceComputeEthernetCfg3(InterfaceHostTestCase):
self.expected_slave_interfaces = []
self.expected_mlx_interfaces = ['mlx5']
self.exp_yaml_config = {
"eth0": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
"eth0": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:mgmt,net:{None}',
'tc': True},
"eth0:2-37": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"eth1": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,net:{None}', 'tc': False},
"eth1:1": {'family': 'inet', 'method': 'dhcp',
@ -2964,10 +3002,16 @@ class InterfaceComputeVlanOverEthernet(InterfaceHostTestCase):
'tc': False},
"eth1": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:eth2,net:{None}', 'tc': False},
"vlan2": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
"vlan2": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:mgmt,net:{None}',
'tc': True},
"vlan3": {'family': 'inet', 'method': 'static',
"vlan2:2-0": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"vlan3": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,net:{None}',
'tc': False},
"vlan3:4-0": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:cluster-host,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}',
'tc': False},
@ -3124,7 +3168,10 @@ class InterfaceComputeBond(InterfaceHostTestCase):
'stx-description': f'ifname:eth3,net:{None}', 'tc': False},
"eth3": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:eth4,net:{None}', 'tc': False},
"cluster-host": {'family': 'inet', 'method': 'static',
"cluster-host": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,net:{None}',
'tc': False},
"cluster-host:4-38": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:cluster-host,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}',
'tc': False},
@ -3180,13 +3227,22 @@ class InterfaceComputeVlanOverBond(InterfaceHostTestCase):
"pxeboot": {'family': 'inet', 'method': 'dhcp',
'stx-description': f'ifname:pxeboot,net:{constants.NETWORK_TYPE_PXEBOOT}',
'tc': False},
"vlan1": {'family': 'inet', 'method': 'dhcp',
"vlan1": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:oam,net:{None}',
'tc': False},
"vlan1:3-0": {'family': 'inet', 'method': 'dhcp',
'stx-description': f'ifname:oam,net:{constants.NETWORK_TYPE_OAM}',
'tc': False},
"vlan2": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
"vlan2": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:mgmt,net:{None}',
'tc': True},
"vlan3": {'family': 'inet', 'method': 'static',
"vlan2:2-0": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:mgmt,net:{constants.NETWORK_TYPE_MGMT}',
'tc': False},
"vlan3": {'family': 'inet', 'method': 'manual',
'stx-description': f'ifname:cluster-host,net:{None}',
'tc': False},
"vlan3:4-0": {'family': 'inet', 'method': 'static',
'stx-description': f'ifname:cluster-host,'
f'net:{constants.NETWORK_TYPE_CLUSTER_HOST}',
'tc': False},
@ -4036,18 +4092,17 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
self._add_ethernet('oam0', constants.INTERFACE_CLASS_PLATFORM, constants.NETWORK_TYPE_OAM)
expected = {
'oam0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_OAM, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_OAM, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG]}},
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_OAM, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}],
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
}
self._validate_config(expected)
@ -4070,9 +4125,8 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
'clhost0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
@ -4081,7 +4135,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG]}},
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
@ -4195,14 +4249,13 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {ALLOW: True, 'bond-master': True, PRE_UP: [PROMISC_ON, IPV6_CFG]}}],
'mgmt0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_TC, SET_MTU, IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, SET_TC]}},
POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
@ -4210,20 +4263,19 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, SET_TC]}},
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}}],
'clhost0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_TC, SET_MTU, IPV6_CFG]}},
POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, SET_TC]}},
POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
@ -4231,7 +4283,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, SET_TC]}},
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True, PRE_UP: [VLAN_MOD],
@ -4261,18 +4313,17 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
'clhost0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {PRE_UP: [DIS_DAD], POST_UP: [SET_TC, IPV6_CFG]}},
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {PRE_UP: [DIS_DAD], POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, PRE_UP: [DIS_DAD], POST_UP: [IPV6_CFG]}},
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, PRE_UP: [DIS_DAD], POST_UP: [SET_TC, IPV6_CFG]}},
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
@ -4295,8 +4346,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}}],
'mgmt0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {'bond-lacp-rate': 'fast', 'bond-miimon': '100',
'bond-mode': '802.3ad', 'bond-slaves': True,
'bond-xmit-hash-policy': 'layer2', 'hwaddress': True,
@ -4307,7 +4357,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, 'bond-lacp-rate': 'fast', 'bond-miimon': '100',
'bond-mode': '802.3ad', 'bond-slaves': True,
'bond-xmit-hash-policy': 'layer2', 'hwaddress': True,
PRE_UP: [BOND_SETUP, DIS_DAD], POST_UP: [IPV6_CFG, SET_TC],
POST_UP: [IPV6_CFG],
UP: [SLEEP]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
@ -4320,7 +4370,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, 'bond-lacp-rate': 'fast', 'bond-miimon': '100',
'bond-mode': '802.3ad', 'bond-slaves': True,
'bond-xmit-hash-policy': 'layer2', 'hwaddress': True,
PRE_UP: [BOND_SETUP, DIS_DAD], POST_UP: [IPV6_CFG, SET_TC],
POST_UP: [IPV6_CFG, UNDEPR],
UP: [SLEEP]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
@ -4336,16 +4386,15 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {ALLOW: True, 'bond-master': True, PRE_UP: [PROMISC_ON, IPV6_CFG]}}],
'clhost0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {'vlan-raw-device': True,
PRE_UP: [VLAN_MOD, VLAN_ADD, DIS_DAD], POST_UP: [SET_MTU, IPV6_CFG],
POST_DOWN: [VLAN_DEL]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True,
PRE_UP: [VLAN_MOD, VLAN_ADD, DIS_DAD],
POST_UP: [SET_MTU, IPV6_CFG], POST_DOWN: [VLAN_DEL]}},
PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True,
@ -4353,8 +4402,8 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True,
PRE_UP: [VLAN_MOD, VLAN_ADD, DIS_DAD],
POST_UP: [SET_MTU, IPV6_CFG], POST_DOWN: [VLAN_DEL]}},
PRE_UP: [VLAN_MOD],
POST_UP: [SET_MTU, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, 'vlan-raw-device': True,
@ -4382,8 +4431,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
'clhost0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
@ -4393,7 +4441,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG]}},
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
@ -4420,9 +4468,8 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
'clhost0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
@ -4431,7 +4478,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [SET_TC, IPV6_CFG]}},
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_CLUSTER_HOST, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
@ -4446,24 +4493,23 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
self._add_ethernet('none')
expected = {
'mgmt0': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
{MODES: [SS_IPV4],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, SET_TC]}},
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, SET_TC]}},
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}},
{MODES: [DS_IPV4, DS_IPV6],
NET: constants.NETWORK_TYPE_MGMT, FAMILY: INET6, METHOD: STATIC,
OPTIONS: {GATEWAY: True, POST_UP: [IPV6_CFG, UNDEPR]}}],
'clhost0': [
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [SET_TC, IPV6_CFG]}},
OPTIONS: {POST_UP: [IPV6_CFG]}},
{NET: constants.NETWORK_TYPE_PXEBOOT, FAMILY: INET, METHOD: DHCP,
OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
@ -4548,8 +4594,7 @@ class InterfaceConfigTestMixin(InterfaceTestCaseMixin):
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [IPV6_CFG]}}],
'data3': [
{MODES: [DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: MANUAL,
{NET: None, FAMILY: INET, METHOD: MANUAL,
OPTIONS: {POST_UP: [IPV6_CFG]}},
{MODES: [SS_IPV4, DS_IPV4, DS_IPV6],
NET: None, FAMILY: INET, METHOD: STATIC,