@@ -87,3 +87,93 @@ class Cumulus(netmiko_devices.NetmikoSwitch):
8787 re .compile (r'command not found' ),
8888 re .compile (r'is not a physical interface on this switch' ),
8989 ]
90+
91+
92+ class CumulusNVUE (netmiko_devices .NetmikoSwitch ):
93+ """Built for Cumulus 5.x
94+
95+ Note for this switch you want config like this,
96+ where secret is the password needed for sudo su:
97+
98+ [genericswitch:<hostname>]
99+ device_type = netmiko_cumulus
100+ ip = <ip>
101+ username = <username>
102+ password = <password>
103+ secret = <password for sudo>
104+ ngs_physical_networks = physnet1
105+ ngs_max_connections = 1
106+ ngs_port_default_vlan = 123
107+ ngs_disable_inactive_ports = False
108+ """
109+ NETMIKO_DEVICE_TYPE = "linux"
110+
111+ ADD_NETWORK = [
112+ 'nv set bridge domain br_default vlan {segmentation_id}' ,
113+ ]
114+
115+ DELETE_NETWORK = [
116+ 'nv unset bridge domain br_default vlan {segmentation_id}' ,
117+ ]
118+
119+ PLUG_PORT_TO_NETWORK = [
120+ 'nv unset interface {port} bridge domain br_default vlan' ,
121+ 'nv unset interface {port} bridge domain br_default untagged' ,
122+ 'nv set interface {port} bridge domain br_default access '
123+ '{segmentation_id}' ,
124+ ]
125+
126+ DELETE_PORT = [
127+ 'nv unset interface {port} bridge domain br_default access' ,
128+ ]
129+
130+ ENABLE_PORT = [
131+ 'nv set interface {port} link state up' ,
132+ ]
133+
134+ DISABLE_PORT = [
135+ 'nv set interface {port} link state down' ,
136+ ]
137+
138+ SAVE_CONFIGURATION = [
139+ 'nv config save' ,
140+ ]
141+
142+ SET_NATIVE_VLAN = [
143+ 'nv unset interface {port} bridge domain br_default access' ,
144+ 'nv set interface {port} bridge domain br_default untagged '
145+ '{segmentation_id}' ,
146+ 'nv set interface {port} bridge domain br_default vlan '
147+ '{segmentation_id}'
148+ ]
149+ ALLOW_NETWORK_ON_TRUNK = [
150+ 'nv set interface {port} bridge domain br_default vlan '
151+ '{segmentation_id}'
152+ ]
153+
154+ ERROR_MSG_PATTERNS = [
155+ # Its tempting to add this error message, but as only one
156+ # bridge-access is allowed, we ignore that error for now:
157+ # re.compile(r'configuration does not have "bridge-access')
158+ re .compile (r'Invalid config' ),
159+ re .compile (r'Config invalid at' ),
160+ re .compile (r'ERROR: Command not found.' ),
161+ re .compile (r'command not found' ),
162+ re .compile (r'is not a physical interface on this switch' ),
163+ re .compile (r'Error: Invalid parameter' ),
164+ ]
165+
166+ def send_config_set (self , net_connect , cmd_set ):
167+ """Send a set of configuration lines to the device.
168+
169+ :param net_connect: a netmiko connection object.
170+ :param cmd_set: a list of configuration lines to send.
171+ :returns: The output of the configuration commands.
172+ """
173+ cmd_set .append ('nv config apply --assume-yes' )
174+ # NOTE: Do not exit config mode because save needs elevated
175+ # privileges
176+ return net_connect .send_config_set (config_commands = cmd_set ,
177+ cmd_verify = False ,
178+ enter_config_mode = False ,
179+ exit_config_mode = False )
0 commit comments