Skip to content

Commit f810370

Browse files
committed
Add Dell Enterprise Sonic-CLI driver
This driver uses the sonic-cli rather than Linux userspace to configure the switch. This is because LLDP advertises switch ports based on the naming from the sonic-cli, which is not the same as Linux userspace. There remains an exercise to push this upstream. Note the existing Dell Sonic driver on main is using the Linux namespace netmiko driver, which is not suitable [1]. [1] https://github.com/openstack/networking-generic-switch/tree/master/networking_generic_switch/devices/netmiko_devices
1 parent d6fba83 commit f810370

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

networking_generic_switch/devices/netmiko_devices/dell.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,70 @@ class DellNos(netmiko_devices.NetmikoSwitch):
133133
)
134134

135135

136+
class DellEnterpriseSonicCli(netmiko_devices.NetmikoSwitch):
137+
"""Netmiko device driver for Dell Enterprise switches.
138+
139+
Developed against SONiC-OS-4.2.3-Edge_Standard.
140+
141+
This driver uses the sonic-cli rather than Linux userspace to
142+
configure the switch. This is because LLDP advertises switch
143+
ports based on the naming from the sonic-cli, which is not the
144+
same as Linux userspace.
145+
"""
146+
147+
NETMIKO_DEVICE_TYPE = "dell_sonic_ssh"
148+
149+
ADD_NETWORK = (
150+
'interface Vlan {segmentation_id}',
151+
)
152+
153+
DELETE_NETWORK = (
154+
'no interface Vlan {segmentation_id}',
155+
)
156+
157+
PLUG_PORT_TO_NETWORK = (
158+
'interface {port}',
159+
'switchport access Vlan {segmentation_id}',
160+
)
161+
162+
DELETE_PORT = (
163+
'interface {port}',
164+
'no switchport access Vlan',
165+
)
166+
167+
SAVE_CONFIGURATION = (
168+
'copy running-configuration startup-configuration',
169+
)
170+
171+
# TODO(dougszu): We need some typical failures to add here
172+
ERROR_MSG_PATTERNS = []
173+
174+
def save_configuration(self, net_connect):
175+
"""Try to save the device's configuration.
176+
177+
:param net_connect: a netmiko connection object.
178+
"""
179+
# NOTE(dougszu): We override this because they default
180+
# method tries 'copy running-config startup-config' which
181+
# is transformed by the switch to:
182+
# 'copy running-configuration startup-configuration'.
183+
for cmd in self.SAVE_CONFIGURATION:
184+
net_connect.send_command(cmd)
185+
186+
def send_config_set(self, net_connect, cmd_set):
187+
"""Send a set of configuration lines to the device.
188+
189+
:param net_connect: a netmiko connection object.
190+
:param cmd_set: a list of configuration lines to send.
191+
:returns: The output of the configuration commands.
192+
"""
193+
net_connect.enable()
194+
# NOTE(dougszu): We override this so that we wait for commands
195+
# to run before moving on.
196+
return net_connect.send_config_set(config_commands=cmd_set,
197+
cmd_verify=True)
198+
199+
136200
class DellPowerConnect(netmiko_devices.NetmikoSwitch):
137201
"""Netmiko device driver for Dell PowerConnect switches."""
138202

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ generic_switch.devices =
3838
netmiko_huawei_vrpv8 = networking_generic_switch.devices.netmiko_devices.huawei_vrpv8:Huawei
3939
netmiko_arista_eos = networking_generic_switch.devices.netmiko_devices.arista:AristaEos
4040
netmiko_dell_os10 = networking_generic_switch.devices.netmiko_devices.dell:DellOS10
41+
netmiko_dell_enterprise_sonic_cli = networking_generic_switch.devices.netmiko_devices.dell:DellEnterpriseSonicCli
4142
netmiko_dell_force10 = networking_generic_switch.devices.netmiko_devices.dell:DellNos
4243
netmiko_dell_powerconnect = networking_generic_switch.devices.netmiko_devices.dell:DellPowerConnect
4344
netmiko_brocade_fastiron = networking_generic_switch.devices.netmiko_devices.brocade:BrocadeFastIron

0 commit comments

Comments
 (0)