Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions networking_generic_switch/devices/netmiko_devices/dell.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,73 @@ class DellOS10(netmiko_devices.NetmikoSwitch):
"exit",
)

PLUG_BOND_TO_NETWORK = (
"interface {bond}",
"switchport mode access",
"switchport access vlan {segmentation_id}",
"exit",
)

DELETE_PORT = (
"interface {port}",
"no switchport access vlan",
"exit",
)

UNPLUG_BOND_FROM_NETWORK = (
"interface {bond}",
"no switchport access vlan",
"exit",
)

ADD_NETWORK_TO_TRUNK = (
"interface {port}",
"switchport mode trunk",
"switchport trunk allowed vlan {segmentation_id}",
"exit",
)

ADD_NETWORK_TO_BOND_TRUNK = (
"interface {bond}",
"switchport mode trunk",
"switchport trunk allowed vlan {segmentation_id}",
"exit",
)

REMOVE_NETWORK_FROM_TRUNK = (
"interface {port}",
"no switchport trunk allowed vlan {segmentation_id}",
"exit",
)

DELETE_NETWORK_ON_BOND_TRUNK = (
"interface {bond}",
"no switchport trunk allowed vlan {segmentation_id}",
"exit",
)

SET_NATIVE_VLAN = (
'interface {port}',
'switchport mode trunk',
'switchport access vlan {segmentation_id}',
)

SET_NATIVE_VLAN_BOND = (
'interface {bond}',
'switchport mode trunk',
'switchport access vlan {segmentation_id}',
)

DELETE_NATIVE_VLAN = (
'interface {port}',
'no switchport access vlan',
)

DELETE_NATIVE_VLAN_BOND = (
'interface {bond}',
'no switchport access vlan',
)

ENABLE_PORT = (
"interface {port}",
"no shutdown",
Expand Down
9 changes: 5 additions & 4 deletions networking_generic_switch/generic_switch_mech.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,17 @@ def update_port_postcommit(self, context):
if (trunk_details and not
switch.support_trunk_on_bond_ports):
raise ngs_exc.GenericSwitchNotSupported(
"Trunks are not supported by "
"networking-generic-switch %s.",
switch.device_name)
feature="trunks",
switch=switch.device_name,
error="Trunks are not supported on bond ports.")
switch.plug_bond_to_network(port_id, segmentation_id,
**plug_kwargs)
else:
if trunk_details and not switch.support_trunk_on_ports:
raise ngs_exc.GenericSwitchNotSupported(
feature="trunks",
switch=switch.device_name)
switch=switch.device_name,
error="Trunks are not supported on ports.")
switch.plug_port_to_network(port_id, segmentation_id,
**plug_kwargs)
LOG.info("Successfully plugged port %(port_id)s in segment "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,12 @@ def test_update_port_postcommit_trunk_not_supported(self, m_pc, m_list):
self.switch_mock.support_trunk_on_bond_ports = False
self.switch_mock.support_trunk_on_ports = False

with self.assertRaises(exceptions.GenericSwitchNotSupported):
exception_regex = (
'Requested feature trunks is not supported by '
'networking-generic-switch on the .*. Trunks are not supported on '
'ports.')
with self.assertRaisesRegex(exceptions.GenericSwitchNotSupported,
exception_regex):
driver.update_port_postcommit(mock_context)
self.switch_mock.plug_port_to_network.assert_not_called()
m_pc.assert_not_called()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Add bond trunk commands so LACP bond trunk ports are supported on Dell OS10
switches.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
fixes:
- |
Fixes incorrect instantiations of GenericSwitchNotSupported exceptions. See
`LP#2147055
<https://bugs.launchpad.net/networking-generic-switch/+bug/2147055>`__ for
details.
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ deps =
bashate~=2.1.0 # Apache-2.0
pycodestyle>=2.0.0,<3.0.0 # MIT
doc8~=1.1.0 # Apache-2.0
setuptools<81.0.0
allowlist_externals = bash
{toxinidir}/tools/run_bashate.sh
commands =
Expand Down
Loading