From 03c280e89293c657c35438ecec0d26c5e82c433d Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Fri, 11 Dec 2020 15:43:07 +0000 Subject: [PATCH 1/2] 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. --- .../devices/netmiko_devices/juniper.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/networking_generic_switch/devices/netmiko_devices/juniper.py b/networking_generic_switch/devices/netmiko_devices/juniper.py index c46b8e4d..47550174 100644 --- a/networking_generic_switch/devices/netmiko_devices/juniper.py +++ b/networking_generic_switch/devices/netmiko_devices/juniper.py @@ -43,32 +43,34 @@ class Juniper(netmiko_devices.NetmikoSwitch): PLUG_PORT_TO_NETWORK = ( # Delete any existing VLAN associations - only one VLAN may be # associated with an access mode port. - 'delete interface {port} unit 0 family ethernet-switching ' + 'delete interfaces {port} unit 0 family ethernet-switching ' 'vlan members', - 'set interface {port} unit 0 family ethernet-switching ' + 'delete interfaces {port} native-vlan-id', + 'set interfaces {port} unit 0 family ethernet-switching ' + 'interface-mode access', 'vlan members {segmentation_id}', ) DELETE_PORT = ( - 'delete interface {port} unit 0 family ethernet-switching ' + 'delete interfaces {port} unit 0 family ethernet-switching ' 'vlan members', ) ENABLE_PORT = ( - 'delete interface {port} disable', + 'delete interfaces {port} disable', ) DISABLE_PORT = ( - 'set interface {port} disable', + 'set interfaces {port} disable', ) ADD_NETWORK_TO_TRUNK = ( - 'set interface {port} unit 0 family ethernet-switching ' + 'set interfaces {port} unit 0 family ethernet-switching ' 'vlan members {segmentation_id}', ) REMOVE_NETWORK_FROM_TRUNK = ( - 'delete interface {port} unit 0 family ethernet-switching ' + 'delete interfaces {port} unit 0 family ethernet-switching ' 'vlan members {segmentation_id}', ) From c8d7e00ceb5444a75eebe70c7b924f8ced574d06 Mon Sep 17 00:00:00 2001 From: Piotr Parczewski Date: Wed, 23 Dec 2020 15:06:08 +0100 Subject: [PATCH 2/2] Minor fix --- networking_generic_switch/devices/netmiko_devices/juniper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/networking_generic_switch/devices/netmiko_devices/juniper.py b/networking_generic_switch/devices/netmiko_devices/juniper.py index 47550174..c35b102f 100644 --- a/networking_generic_switch/devices/netmiko_devices/juniper.py +++ b/networking_generic_switch/devices/netmiko_devices/juniper.py @@ -45,9 +45,9 @@ class Juniper(netmiko_devices.NetmikoSwitch): # associated with an access mode port. 'delete interfaces {port} unit 0 family ethernet-switching ' 'vlan members', - 'delete interfaces {port} native-vlan-id', 'set interfaces {port} unit 0 family ethernet-switching ' 'interface-mode access', + 'set interfaces {port} unit 0 family ethernet-switching ' 'vlan members {segmentation_id}', )