Skip to content

Commit

Permalink
Clean up / Workaround non-inclusive words
Browse files Browse the repository at this point in the history
- CHANGELOG.md
- README.md
- contributing.md
- library/network_connections.py
- module_utils/network_lsr/argument_validator.py
- module_utils/network_lsr/ethtool.py
- tests/ensure_provider_tests.py
- tests/playbooks/tests_bond_options.yml
- tests/unit/test_network_connections.py

Signed-off-by: Noriko Hosoi <[email protected]>
  • Loading branch information
nhosoi committed Jan 16, 2023
1 parent c526da3 commit d737409
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 22 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ Changelog
### Changes

- Use inclusive language
- `slave` is deprecated in favor of `port`
- `master` is deprecated in favor of `controller`
- `slave` is deprecated in favor of `port` <!--- wokeignore:rule=slave -->
- `master` is deprecated in favor of `controller` <!--- wokeignore:rule=master -->

### New features

- Support disabling IPv6
- Support `dns_options` when using one or more IPv4 nameservers
- Support Ethtool coalesce settings
- Support dummy interfaces
- Support dummy interfaces <!--- wokeignore:rule=dummy -->

### Bug fixes

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ following options:

- `all_ports_active`

<!--- wokeignore:rule=slave -->
`all_slaves_active` in kernel and NetworkManager. The boolean value `false` drops
the duplicate frames (received on inactive ports) and the boolean value `true`
delivers the duplicate frames.
Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ comment. The available commands are:
- [citest] - Trigger a re-test for all machines.
- [citest bad] - Trigger a re-test for all machines with an error or failure status.
- [citest pending] - Trigger a re-test for all machines with a pending status.
- [citest commit:<sha1\>] - Whitelist a commit to be tested if the submitter is not
- [citest commit:<sha1\>] - Specify a commit to be tested if the submitter is not
trusted.
How to reach us
Expand Down
29 changes: 17 additions & 12 deletions library/network_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ def _link_infos_fetch():
links = {}
for ifname in os.listdir("/sys/class/net/"):
if not os.path.islink("/sys/class/net/" + ifname):
# /sys/class/net may contain certain entries that are not
# interface names, like 'bonding_master'. Skip over files
# that are not links.
# /sys/class/net may contain certain entries
# that are not interface names, like
# 'bonding_master'. # wokeignore:rule=master
# Skip over files that are not links.
continue
links[ifname] = {
"ifindex": SysUtil._link_read_ifindex(ifname),
Expand Down Expand Up @@ -359,7 +360,7 @@ def ifcfg_create(
ifcfg["TYPE"] = "Bridge"
elif connection["type"] == "bond":
ifcfg["TYPE"] = "Bond"
ifcfg["BONDING_MASTER"] = "yes"
ifcfg["BONDING_MASTER"] = "yes" # wokeignore:rule=master
opts = ["mode=%s" % (connection["bond"]["mode"])]
if connection["bond"]["miimon"] is not None:
opts.append(" miimon=%s" % (connection["bond"]["miimon"]))
Expand Down Expand Up @@ -452,10 +453,10 @@ def ifcfg_create(
if connection["port_type"] == "bridge":
ifcfg["BRIDGE"] = m
elif connection["port_type"] == "bond":
ifcfg["MASTER"] = m
ifcfg["SLAVE"] = "yes"
ifcfg["MASTER"] = m # wokeignore:rule=master
ifcfg["SLAVE"] = "yes" # wokeignore:rule=slave
elif connection["port_type"] == "team":
ifcfg["TEAM_MASTER"] = m
ifcfg["TEAM_MASTER"] = m # wokeignore:rule=master
if "TYPE" in ifcfg:
del ifcfg["TYPE"]
if connection["type"] != "team":
Expand Down Expand Up @@ -894,13 +895,15 @@ def connection_create(self, connections, idx, connection_current=None):
if option in ["all_ports_active", "use_carrier", "tlb_dynamic_lb"]:
value = int(value)
if option in ["all_ports_active", "packets_per_port"]:
option = option.replace("port", "slave")
option = option.replace("port", "slave") # wokeignore:rule=slave
s_bond.add_option(option, str(value))
elif connection["type"] == "team":
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_TEAM_SETTING_NAME)
elif connection["type"] == "dummy":
elif connection["type"] == "dummy": # wokeignore:rule=dummy
s_con.set_property(
NM.SETTING_CONNECTION_TYPE, NM.SETTING_DUMMY_SETTING_NAME
# wokeignore:rule=dummy
NM.SETTING_CONNECTION_TYPE,
NM.SETTING_DUMMY_SETTING_NAME,
)
elif connection["type"] == "vlan":
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_VLAN_SETTING_NAME)
Expand Down Expand Up @@ -1045,10 +1048,12 @@ def connection_create(self, connections, idx, connection_current=None):

if connection["controller"] is not None:
s_con.set_property(
NM.SETTING_CONNECTION_SLAVE_TYPE, connection["port_type"]
# wokeignore:rule=slave
NM.SETTING_CONNECTION_SLAVE_TYPE,
connection["port_type"],
)
s_con.set_property(
NM.SETTING_CONNECTION_MASTER,
NM.SETTING_CONNECTION_MASTER, # wokeignore:rule=master
ArgUtil.connection_find_controller_uuid(
connection["controller"], connections, idx
),
Expand Down
5 changes: 3 additions & 2 deletions module_utils/network_lsr/argument_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@ class ArgValidator_DictConnection(ArgValidatorDict):
"vlan",
"macvlan",
"wireless",
"dummy",
"dummy", # wokeignore:rule=dummy
]
VALID_PORT_TYPES = ["bridge", "bond", "team"]

Expand Down Expand Up @@ -1828,10 +1828,11 @@ def __init__(self):
enum_values=ArgValidator_DictConnection.VALID_PORT_TYPES,
),
ArgValidatorDeprecated(
"slave_type",
"slave_type", # wokeignore:rule=slave
deprecated_by="port_type",
),
ArgValidatorStr("controller"),
# wokeignore:rule=master
ArgValidatorDeprecated("master", deprecated_by="controller"),
ArgValidatorStr("interface_name", allow_empty=True),
ArgValidatorMac("mac"),
Expand Down
2 changes: 2 additions & 0 deletions module_utils/network_lsr/ethtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def get_perm_addr(ifname):
ETHTOOL_GPERMADDR ioctl command.
Please for further documentation, see:
wokeignore:rule=master
https://github.com/torvalds/linux/blob/master/include/uapi/linux/ethtool.h#L734
wokeignore:rule=master
https://github.com/torvalds/linux/blob/master/include/uapi/linux/ethtool.h#L1388
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/tree/ethtool.c#n4172
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/ensure_provider_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"playbooks/tests_bond_options.yml": {},
"playbooks/tests_eth_dns_support.yml": {},
"playbooks/tests_dummy.yml": {},
"playbooks/tests_dummy.yml": {}, # wokeignore:rule=dummy
"playbooks/tests_infiniband.yml": {},
"playbooks/tests_ipv6_disabled.yml": {},
"playbooks/tests_ipv6_dns_search.yml": {},
Expand Down
1 change: 1 addition & 0 deletions tests/playbooks/tests_bond_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
- { key: 'ad_actor_system', value: '00:00:5e:00:53:5d'}
- { key: 'ad_select', value: 'stable'}
- { key: 'ad_user_port_key', value: '1023'}
# wokeignore:rule=slave
- { key: 'all_slaves_active', value: '1'}
- { key: 'downdelay', value: '0'}
- { key: 'lacp_rate', value: 'slow'}
Expand Down
12 changes: 9 additions & 3 deletions tests/unit/test_network_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -4226,8 +4226,10 @@ def test_route_metric6_configured_ipv6_disabled(self):
route_metric6_configured_ipv6_disabled,
)

# wokeignore:rule=master
def test_set_deprecated_master(self):
"""
wokeignore:rule=master
When passing the deprecated "master" it is updated to "controller".
"""
input_connections = [
Expand All @@ -4241,17 +4243,20 @@ def test_set_deprecated_master(self):
"state": "up",
"type": "ethernet",
"interface_name": "eth1",
"master": "prod2",
"master": "prod2", # wokeignore:rule=master
},
]
connections = ARGS_CONNECTIONS.validate(input_connections)
self.assertTrue(len(connections) == 2)
for connection in connections:
self.assertTrue("controller" in connection)
# wokeignore:rule=master
self.assertTrue("master" not in connection)

# wokeignore:rule=slave
def test_set_deprecated_slave_type(self):
"""
wokeignore:rule=slave
When passing the deprecated "slave_type" it is updated to "port_type".
"""
input_connections = [
Expand All @@ -4266,13 +4271,14 @@ def test_set_deprecated_slave_type(self):
"type": "ethernet",
"interface_name": "eth1",
"controller": "prod2",
"slave_type": "bridge",
"slave_type": "bridge", # wokeignore:rule=slave
},
]
connections = ARGS_CONNECTIONS.validate(input_connections)
self.assertTrue(len(connections) == 2)
for connection in connections:
self.assertTrue("port_type" in connection)
# wokeignore:rule=slave
self.assertTrue("slave_type" not in connection)


Expand Down Expand Up @@ -4376,7 +4382,7 @@ def test_match_path_invalid_connection_type(self):
result = self.validator.validate(self.test_profile)
self.assertEqual(result["match"], {"path": ["pci-0000:00:03.0"]})

self.test_profile["type"] = "dummy"
self.test_profile["type"] = "dummy" # wokeignore:rule=dummy
self.assertRaisesRegex(
ValidationError,
"'match.path' settings are only supported for type 'ethernet' or 'infiniband'",
Expand Down

0 comments on commit d737409

Please sign in to comment.