Skip to content

Commit

Permalink
fixup! network: use consolidated s390 device configuration (#1802482,…
Browse files Browse the repository at this point in the history
…#1937049)
  • Loading branch information
steffen-maier committed Oct 18, 2023
1 parent 8b71596 commit 80c3a42
Showing 1 changed file with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ def test_get_ports_from_connections(self, get_iface_from_connection):
assert get_ports_from_connections(nm_client, "team", [TEAM1_UUID]) == \
set([("ens11", "ens11", ENS11_UUID)])

@patch("pyanaconda.modules.network.nm_client._get_dracut_znet_argument_from_connection")
@patch("pyanaconda.modules.network.nm_client.get_connections_available_for_iface")
@patch("pyanaconda.modules.network.nm_client.get_ports_from_connections")
@patch("pyanaconda.modules.network.nm_client.is_s390")
def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_connections_mock,
get_connections_available_for_iface):
get_connections_available_for_iface,
_get_dracut_znet_argument_from_connection):
nm_client = Mock()

CON_UUID = "44755f4c-ee12-45b4-ba5e-e10f83de51af"
Expand Down Expand Up @@ -162,6 +164,8 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn

# IPv4 config static, mac address not specified, s390
is_s390.return_value = True
_get_dracut_znet_argument_from_connection.return_value = \
"rd.znet=qeth,0.0.0900,0.0.0901,0.0.0902,layer2=1,portname=FOOBAR,portno=0"
address_attrs = {
"get_address.return_value": "10.34.39.44",
"get_prefix.return_value": 24,
Expand All @@ -176,11 +180,6 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn
ip4_config = self._get_mock_objects_from_attrs([ip4_config_attrs])[0]
wired_setting_attrs = {
"get_mac_address.return_value": None,
"get_s390_nettype.return_value": "qeth",
"get_s390_subchannels.return_value": ["0.0.0900", "0.0.0901", "0.0.0902"],
"get_property.return_value": {"layer2": "1",
"portname": "FOOBAR",
"portno": "0"},
}
wired_setting = self._get_mock_objects_from_attrs([wired_setting_attrs])[0]
cons_attrs = [
Expand All @@ -189,6 +188,7 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn
"get_setting_ip4_config.return_value": ip4_config,
"get_setting_wired.return_value": wired_setting,
"get_connection_type.return_value": NM_CONNECTION_TYPE_ETHERNET,
"get_interface_name": "ens4",
},
]
con = self._get_mock_objects_from_attrs(cons_attrs)[0]
Expand Down Expand Up @@ -279,6 +279,8 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn

# IPv4 config auto, vlan, s390, parent specified by interface name
is_s390.return_value = True
_get_dracut_znet_argument_from_connection.return_value = \
"rd.znet=qeth,0.0.0900,0.0.0901,0.0.0902,layer2=1,portname=FOOBAR,portno=0"
ip4_config_attrs = {
"get_method.return_value": NM.SETTING_IP4_CONFIG_METHOD_AUTO,
}
Expand All @@ -300,18 +302,14 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn
# Mock parent connection
wired_setting_attrs = {
"get_mac_address.return_value": None,
"get_s390_nettype.return_value": "qeth",
"get_s390_subchannels.return_value": ["0.0.0900", "0.0.0901", "0.0.0902"],
"get_property.return_value": {"layer2": "1",
"portname": "FOOBAR",
"portno": "0"},
}
wired_setting = self._get_mock_objects_from_attrs([wired_setting_attrs])[0]
parent_cons_attrs = [
{
"get_uuid.return_value": CON_UUID,
"get_setting_wired.return_value": wired_setting,
"get_connection_type.return_value": NM_CONNECTION_TYPE_ETHERNET,
"get_interface_name": "ens11",
},
]
parent_cons = self._get_mock_objects_from_attrs(parent_cons_attrs)
Expand Down Expand Up @@ -361,6 +359,8 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn
# IPv4 config auto, vlan, parent specified by connection uuid, s390 (we
# need the parent connection in s390 case, not only parent iface)
is_s390.return_value = True
_get_dracut_znet_argument_from_connection.return_value = \
"rd.znet=qeth,0.0.0900,0.0.0901,0.0.0902,layer2=1,portname=FOOBAR,portno=0"
ip4_config_attrs = {
"get_method.return_value": NM.SETTING_IP4_CONFIG_METHOD_AUTO,
}
Expand All @@ -382,11 +382,6 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn
# Mock parent connection
wired_setting_attrs = {
"get_mac_address.return_value": None,
"get_s390_nettype.return_value": "qeth",
"get_s390_subchannels.return_value": ["0.0.0900", "0.0.0901", "0.0.0902"],
"get_property.return_value": {"layer2": "1",
"portname": "FOOBAR",
"portno": "0"},
}
wired_setting = self._get_mock_objects_from_attrs([wired_setting_attrs])[0]
parent_cons_attrs = [
Expand All @@ -396,6 +391,7 @@ def test_get_dracut_arguments_from_connection(self, is_s390, get_ports_from_conn
"get_id.return_value": "ens13",
"get_setting_wired.return_value": wired_setting,
"get_connection_type.return_value": NM_CONNECTION_TYPE_ETHERNET,
"get_interface_name": "ens13",
},
]
parent_cons = self._get_mock_objects_from_attrs(parent_cons_attrs)
Expand Down

0 comments on commit 80c3a42

Please sign in to comment.