Skip to content

Commit 4394fa7

Browse files
committed
Add minimal Dell SONiC driver
A Dell SONiC driver has been added upstream: https://review.opendev.org/c/openstack/networking-generic-switch/+/955252 This change adds a minimal Dell SONiC driver downstream. This is essentially the existing SONiC driver, but with a slightly different enable mode command. The change to the enable mode may not be required by the time we end up using the upstream driver. This is because the upstream driver has been developed against SONiC 4.5 which is more recent than the version used to develop this patch. This driver requires the switch to be configured to use the standard or standard-extended naming mode. Change-Id: Id263aa2757152012afdd6facb9f5fcd78fcc7ad8
1 parent b73f5a9 commit 4394fa7

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

networking_generic_switch/devices/netmiko_devices/fake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def send_config_set(self, config_commands, cmd_verify):
4444
if self.device.ngs_config.get('ngs_fake_failure_prob'):
4545
failure_prob = self.device.ngs_config['ngs_fake_failure_prob']
4646
if random.random() < float(failure_prob):
47-
raise Exception("Random failure!")
47+
raise Exception("Random failure!") # noqa
4848

4949
for cmd in config_commands:
5050
LOG.info("%s", cmd)

networking_generic_switch/devices/netmiko_devices/sonic.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,27 @@ def send_config_set(self, net_connect, cmd_set):
8484
return net_connect.send_config_set(config_commands=cmd_set,
8585
cmd_verify=False,
8686
exit_config_mode=False)
87+
88+
89+
class DellEnterpriseSonic(Sonic):
90+
"""Netmiko device driver for Dell Enterprise switches.
91+
92+
Developed against SONiC-OS-4.2.3-Edge_Standard.
93+
94+
This driver must be used with the switch set to
95+
standard or standard-extended naming mode. Do
96+
not use the default setting of native.
97+
"""
98+
99+
def send_config_set(self, net_connect, cmd_set):
100+
# Netmiko tries to use 'sudo -s' to open a root shell
101+
# which doesn't work. It fails with:
102+
# FATAL: root cannot launch CLI
103+
net_connect.config_mode(config_command='sudo -i')
104+
105+
# Don't exit configuration mode, as config save requires
106+
# root permissions.
107+
# Verify commands have run before moving on
108+
return net_connect.send_config_set(config_commands=cmd_set,
109+
cmd_verify=True,
110+
exit_config_mode=False)

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ generic_switch.devices =
5151
netmiko_cumulus_nvue = networking_generic_switch.devices.netmiko_devices.cumulus:CumulusNVUE
5252
netmiko_sonic = networking_generic_switch.devices.netmiko_devices.sonic:Sonic
5353
netmiko_supermicro_smis = networking_generic_switch.devices.netmiko_devices.smc:SupermicroSmis
54+
netmiko_dell_enterprise_sonic = networking_generic_switch.devices.netmiko_devices.sonic:DellEnterpriseSonic
5455
netmiko_nokia_srl = networking_generic_switch.devices.netmiko_devices.nokia:NokiaSRL
5556
netmiko_pluribus = networking_generic_switch.devices.netmiko_devices.pluribus:Pluribus
5657
netmiko_aruba_os = networking_generic_switch.devices.netmiko_devices.aruba:ArubaOSCX

0 commit comments

Comments
 (0)