Skip to content

Commit 03c280e

Browse files
dougszumskicityofships
authored andcommitted
Update Juniper driver
Recent release of JunOS have changed the command line syntax which breaks the old driver. This change updates the driver to use the new syntax. A further improvement would be to detect the JunOS version and set the syntax accordingly. This patch also adds some additional clean up to ports.
1 parent 79aa400 commit 03c280e

File tree

1 file changed

+9
-7
lines changed
  • networking_generic_switch/devices/netmiko_devices

1 file changed

+9
-7
lines changed

networking_generic_switch/devices/netmiko_devices/juniper.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,34 @@ class Juniper(netmiko_devices.NetmikoSwitch):
4343
PLUG_PORT_TO_NETWORK = (
4444
# Delete any existing VLAN associations - only one VLAN may be
4545
# associated with an access mode port.
46-
'delete interface {port} unit 0 family ethernet-switching '
46+
'delete interfaces {port} unit 0 family ethernet-switching '
4747
'vlan members',
48-
'set interface {port} unit 0 family ethernet-switching '
48+
'delete interfaces {port} native-vlan-id',
49+
'set interfaces {port} unit 0 family ethernet-switching '
50+
'interface-mode access',
4951
'vlan members {segmentation_id}',
5052
)
5153

5254
DELETE_PORT = (
53-
'delete interface {port} unit 0 family ethernet-switching '
55+
'delete interfaces {port} unit 0 family ethernet-switching '
5456
'vlan members',
5557
)
5658

5759
ENABLE_PORT = (
58-
'delete interface {port} disable',
60+
'delete interfaces {port} disable',
5961
)
6062

6163
DISABLE_PORT = (
62-
'set interface {port} disable',
64+
'set interfaces {port} disable',
6365
)
6466

6567
ADD_NETWORK_TO_TRUNK = (
66-
'set interface {port} unit 0 family ethernet-switching '
68+
'set interfaces {port} unit 0 family ethernet-switching '
6769
'vlan members {segmentation_id}',
6870
)
6971

7072
REMOVE_NETWORK_FROM_TRUNK = (
71-
'delete interface {port} unit 0 family ethernet-switching '
73+
'delete interfaces {port} unit 0 family ethernet-switching '
7274
'vlan members {segmentation_id}',
7375
)
7476

0 commit comments

Comments
 (0)