]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: add zebra api to shutdown an interface
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 24 Jul 2018 16:20:08 +0000 (18:20 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:14 +0000 (20:22 -0500)
this function operates on vtysh, and performs a shutdown on an
interface.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
tests/topotests/lib/topotest.py

index 84b185d7ea53ba6001c0739bd1cf8b492b289d6d..dc67342fc13017902f190bdb9d2b7db33653616a 100644 (file)
@@ -404,6 +404,17 @@ def version_cmp(v1, v2):
             return -1
     return 0
 
+def interface_set_status(node, ifacename, ifaceaction=False, vrf_name=None):
+    if ifaceaction:
+        str_ifaceaction = 'no shutdown'
+    else:
+        str_ifaceaction = 'shutdown'
+    if vrf_name == None:
+        cmd = 'vtysh -c \"configure terminal\" -c \"interface {0}\" -c \"{1}\"'.format(ifacename, str_ifaceaction)
+    else:
+        cmd = 'vtysh -c \"configure terminal\" -c \"interface {0} vrf {1}\" -c \"{2}\"'.format(ifacename, vrf_name, str_ifaceaction)
+    node.run(cmd)
+
 def ip4_route_zebra(node, vrf_name=None):
     """
     Gets an output of 'show ip route' command. It can be used