Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vlan aware VMs support (backport nvue) #95

Merged
merged 1 commit into from
Oct 29, 2024
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
14 changes: 14 additions & 0 deletions networking_generic_switch/devices/netmiko_devices/cumulus.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class CumulusNVUE(netmiko_devices.NetmikoSwitch):
]

PLUG_PORT_TO_NETWORK = [
'nv unset interface {port} bridge domain br_default vlan',
'nv unset interface {port} bridge domain br_default untagged',
'nv set interface {port} bridge domain br_default access '
'{segmentation_id}',
]
Expand All @@ -137,6 +139,18 @@ class CumulusNVUE(netmiko_devices.NetmikoSwitch):
'nv config save',
]

SET_NATIVE_VLAN = [
'nv unset interface {port} bridge domain br_default access',
'nv set interface {port} bridge domain br_default untagged '
'{segmentation_id}',
'nv set interface {port} bridge domain br_default vlan '
'{segmentation_id}'
]
ALLOW_NETWORK_ON_TRUNK = [
'nv set interface {port} bridge domain br_default vlan '
'{segmentation_id}'
]

ERROR_MSG_PATTERNS = [
# Its tempting to add this error message, but as only one
# bridge-access is allowed, we ignore that error for now:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def test_plug_port_to_network(self, mock_exec):
mock_exec.assert_called_with(
['nv set interface 3333 link state up',
'nv unset interface 3333 bridge domain br_default access',
'nv unset interface 3333 bridge domain br_default vlan',
'nv unset interface 3333 bridge domain br_default untagged',
'nv set interface 3333 bridge domain br_default access 33'])

@mock.patch('networking_generic_switch.devices.netmiko_devices.'
Expand Down Expand Up @@ -85,7 +87,9 @@ def test_plug_port_simple(self, mock_exec):
})
switch.plug_port_to_network(3333, 33)
mock_exec.assert_called_with(
['nv set interface 3333 bridge domain br_default access 33'])
['nv unset interface 3333 bridge domain br_default vlan',
'nv unset interface 3333 bridge domain br_default untagged',
'nv set interface 3333 bridge domain br_default access 33'])

@mock.patch('networking_generic_switch.devices.netmiko_devices.'
'NetmikoSwitch.send_commands_to_device',
Expand All @@ -95,6 +99,8 @@ def test_delete_port(self, mock_exec):
mock_exec.assert_called_with(
['nv unset interface 3333 bridge domain br_default access',
'nv set bridge domain br_default vlan 123',
'nv unset interface 3333 bridge domain br_default vlan',
'nv unset interface 3333 bridge domain br_default untagged',
'nv set interface 3333 bridge domain br_default access 123',
'nv set interface 3333 link state down'])

Expand All @@ -118,6 +124,8 @@ def test_plug_bond_to_network(self, mock_exec):
mock_exec.assert_called_with(
['nv set interface 3333 link state up',
'nv unset interface 3333 bridge domain br_default access',
'nv unset interface 3333 bridge domain br_default vlan',
'nv unset interface 3333 bridge domain br_default untagged',
'nv set interface 3333 bridge domain br_default access 33'])

@mock.patch('networking_generic_switch.devices.netmiko_devices.'
Expand All @@ -130,7 +138,9 @@ def test_plug_bond_simple(self, mock_exec):
})
switch.plug_bond_to_network(3333, 33)
mock_exec.assert_called_with(
['nv set interface 3333 bridge domain br_default access 33'])
['nv unset interface 3333 bridge domain br_default vlan',
'nv unset interface 3333 bridge domain br_default untagged',
'nv set interface 3333 bridge domain br_default access 33'])

@mock.patch('networking_generic_switch.devices.netmiko_devices.'
'NetmikoSwitch.send_commands_to_device',
Expand All @@ -140,6 +150,8 @@ def test_unplug_bond_from_network(self, mock_exec):
mock_exec.assert_called_with(
['nv unset interface 3333 bridge domain br_default access',
'nv set bridge domain br_default vlan 123',
'nv unset interface 3333 bridge domain br_default vlan',
'nv unset interface 3333 bridge domain br_default untagged',
'nv set interface 3333 bridge domain br_default access 123',
'nv set interface 3333 link state down'])

Expand Down