Skip to content

Commit cc165ea

Browse files
authored
Merge pull request #137 from stackhpc/dell-os10-bond-trunk
Add Dell OS10 bond trunk support
2 parents 2d1ec18 + a88a7fa commit cc165ea

File tree

6 files changed

+61
-5
lines changed

6 files changed

+61
-5
lines changed

networking_generic_switch/devices/netmiko_devices/dell.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,73 @@ class DellOS10(netmiko_devices.NetmikoSwitch):
3939
"exit",
4040
)
4141

42+
PLUG_BOND_TO_NETWORK = (
43+
"interface {bond}",
44+
"switchport mode access",
45+
"switchport access vlan {segmentation_id}",
46+
"exit",
47+
)
48+
4249
DELETE_PORT = (
4350
"interface {port}",
4451
"no switchport access vlan",
4552
"exit",
4653
)
4754

55+
UNPLUG_BOND_FROM_NETWORK = (
56+
"interface {bond}",
57+
"no switchport access vlan",
58+
"exit",
59+
)
60+
4861
ADD_NETWORK_TO_TRUNK = (
4962
"interface {port}",
5063
"switchport mode trunk",
5164
"switchport trunk allowed vlan {segmentation_id}",
5265
"exit",
5366
)
5467

68+
ADD_NETWORK_TO_BOND_TRUNK = (
69+
"interface {bond}",
70+
"switchport mode trunk",
71+
"switchport trunk allowed vlan {segmentation_id}",
72+
"exit",
73+
)
74+
5575
REMOVE_NETWORK_FROM_TRUNK = (
5676
"interface {port}",
5777
"no switchport trunk allowed vlan {segmentation_id}",
5878
"exit",
5979
)
6080

81+
DELETE_NETWORK_ON_BOND_TRUNK = (
82+
"interface {bond}",
83+
"no switchport trunk allowed vlan {segmentation_id}",
84+
"exit",
85+
)
86+
6187
SET_NATIVE_VLAN = (
6288
'interface {port}',
6389
'switchport mode trunk',
6490
'switchport access vlan {segmentation_id}',
6591
)
6692

93+
SET_NATIVE_VLAN_BOND = (
94+
'interface {bond}',
95+
'switchport mode trunk',
96+
'switchport access vlan {segmentation_id}',
97+
)
98+
6799
DELETE_NATIVE_VLAN = (
68100
'interface {port}',
69101
'no switchport access vlan',
70102
)
71103

104+
DELETE_NATIVE_VLAN_BOND = (
105+
'interface {bond}',
106+
'no switchport access vlan',
107+
)
108+
72109
ENABLE_PORT = (
73110
"interface {port}",
74111
"no shutdown",

networking_generic_switch/generic_switch_mech.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,17 @@ def update_port_postcommit(self, context):
394394
if (trunk_details and not
395395
switch.support_trunk_on_bond_ports):
396396
raise ngs_exc.GenericSwitchNotSupported(
397-
"Trunks are not supported by "
398-
"networking-generic-switch %s.",
399-
switch.device_name)
397+
feature="trunks",
398+
switch=switch.device_name,
399+
error="Trunks are not supported on bond ports.")
400400
switch.plug_bond_to_network(port_id, segmentation_id,
401401
**plug_kwargs)
402402
else:
403403
if trunk_details and not switch.support_trunk_on_ports:
404404
raise ngs_exc.GenericSwitchNotSupported(
405405
feature="trunks",
406-
switch=switch.device_name)
406+
switch=switch.device_name,
407+
error="Trunks are not supported on ports.")
407408
switch.plug_port_to_network(port_id, segmentation_id,
408409
**plug_kwargs)
409410
LOG.info("Successfully plugged port %(port_id)s in segment "

networking_generic_switch/tests/unit/test_generic_switch_mech.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,12 @@ def test_update_port_postcommit_trunk_not_supported(self, m_pc, m_list):
854854
self.switch_mock.support_trunk_on_bond_ports = False
855855
self.switch_mock.support_trunk_on_ports = False
856856

857-
with self.assertRaises(exceptions.GenericSwitchNotSupported):
857+
exception_regex = (
858+
'Requested feature trunks is not supported by '
859+
'networking-generic-switch on the .*. Trunks are not supported on '
860+
'ports.')
861+
with self.assertRaisesRegex(exceptions.GenericSwitchNotSupported,
862+
exception_regex):
858863
driver.update_port_postcommit(mock_context)
859864
self.switch_mock.plug_port_to_network.assert_not_called()
860865
m_pc.assert_not_called()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Add bond trunk commands so LACP bond trunk ports are supported on Dell OS10
5+
switches.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes incorrect instantiations of GenericSwitchNotSupported exceptions. See
5+
`LP#2147055
6+
<https://bugs.launchpad.net/networking-generic-switch/+bug/2147055>`__ for
7+
details.

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ deps =
3535
bashate~=2.1.0 # Apache-2.0
3636
pycodestyle>=2.0.0,<3.0.0 # MIT
3737
doc8~=1.1.0 # Apache-2.0
38+
setuptools<81.0.0
3839
allowlist_externals = bash
3940
{toxinidir}/tools/run_bashate.sh
4041
commands =

0 commit comments

Comments
 (0)