Skip to content

Commit 9c9fe62

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add Fake device type"
2 parents dfbf9ce + 9005e19 commit 9c9fe62

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
from oslo_log import log as logging
14+
15+
from networking_generic_switch.devices import netmiko_devices
16+
17+
18+
LOG = logging.getLogger(__name__)
19+
20+
21+
class Fake(netmiko_devices.NetmikoSwitch):
22+
"""Netmiko device driver for Fake switches."""
23+
24+
NETMIKO_DEVICE_TYPE = "linux"
25+
26+
ADD_NETWORK = (
27+
"add network {segmentation_id}",
28+
)
29+
30+
DELETE_NETWORK = (
31+
"delete network {segmentation_id}",
32+
)
33+
34+
PLUG_PORT_TO_NETWORK = (
35+
"plug port {port} to network {segmentation_id}",
36+
)
37+
38+
DELETE_PORT = (
39+
"delete port {port}",
40+
)
41+
42+
ADD_NETWORK_TO_TRUNK = (
43+
"add network {segmentation_id} to trunk {port}",
44+
)
45+
46+
REMOVE_NETWORK_FROM_TRUNK = (
47+
"remove network {segmentation_id} from trunk {port}",
48+
)
49+
50+
ENABLE_PORT = (
51+
"enable {port}",
52+
)
53+
54+
DISABLE_PORT = (
55+
"disable {port}",
56+
)
57+
58+
ERROR_MSG_PATTERNS = ()
59+
"""Sequence of error message patterns.
60+
61+
Sequence of re.RegexObject objects representing patterns to check for in
62+
device output that indicate a failure to apply configuration.
63+
"""
64+
65+
def send_commands_to_device(self, cmd_set):
66+
if not cmd_set:
67+
LOG.debug("Nothing to execute")
68+
return
69+
70+
for cmd in cmd_set:
71+
LOG.info("%s", cmd)
72+
return "Success!"

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ generic_switch.devices =
5151
netmiko_nokia_srl = networking_generic_switch.devices.netmiko_devices.nokia:NokiaSRL
5252
netmiko_pluribus = networking_generic_switch.devices.netmiko_devices.pluribus:Pluribus
5353
netmiko_aruba_os = networking_generic_switch.devices.netmiko_devices.aruba:ArubaOSCX
54+
netmiko_fake = networking_generic_switch.devices.netmiko_devices.fake:Fake
5455
tempest.test_plugins =
5556
ngs_tests = tempest_plugin.plugin:NGSTempestPlugin

0 commit comments

Comments
 (0)