]> git.puffer.fish Git - mirror/frr.git/commitdiff
tools/frr-reload.py: support -N pathspace
authorDavid Lamparter <equinox@diac24.net>
Thu, 8 Aug 2019 18:20:33 +0000 (20:20 +0200)
committerDavid Lamparter <equinox@diac24.net>
Wed, 22 Jul 2020 10:56:04 +0000 (12:56 +0200)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tools/frr-reload.py

index 9e86cf2156784dcfac2111daf2c189590952f719..0ed2a8312f2b2cdeeac114ffe5461ecca485f73b 100755 (executable)
@@ -63,14 +63,17 @@ class VtyshException(Exception):
     pass
 
 class Vtysh(object):
-    def __init__(self, bindir=None, confdir=None, sockdir=None):
+    def __init__(self, bindir=None, confdir=None, sockdir=None, pathspace=None):
         self.bindir = bindir
         self.confdir = confdir
+        self.pathspace = pathspace
         self.common_args = [os.path.join(bindir or '', 'vtysh')]
         if confdir:
             self.common_args.extend(['--config_dir', confdir])
         if sockdir:
             self.common_args.extend(['--vty_socket', sockdir])
+        if pathspace:
+            self.common_args.extend(['-N', pathspace])
 
     def _call(self, args, stdin=None, stdout=None, stderr=None):
         kwargs = {}
@@ -1171,6 +1174,7 @@ if __name__ == '__main__':
     group.add_argument('--test', action='store_true', help='Show the deltas', default=False)
     parser.add_argument('--debug', action='store_true', help='Enable debugs', default=False)
     parser.add_argument('--stdout', action='store_true', help='Log to STDOUT', default=False)
+    parser.add_argument('--pathspace', '-N', metavar='NAME', help='Reload specified path/namespace', default=None)
     parser.add_argument('filename', help='Location of new frr config file')
     parser.add_argument('--overwrite', action='store_true', help='Overwrite frr.conf with running config output', default=False)
     parser.add_argument('--bindir', help='path to the vtysh executable', default='/usr/bin')
@@ -1246,10 +1250,13 @@ if __name__ == '__main__':
         log.error(msg)
         sys.exit(1)
 
-    vtysh = Vtysh(args.bindir, args.confdir, args.vty_socket)
+    vtysh = Vtysh(args.bindir, args.confdir, args.vty_socket, args.pathspace)
 
     # Verify that 'service integrated-vtysh-config' is configured
-    vtysh_filename = args.confdir + '/vtysh.conf'
+    if args.pathspace:
+        vtysh_filename = args.confdir + '/' + args.pathspace + '/vtysh.conf'
+    else:
+        vtysh_filename = args.confdir + '/vtysh.conf'
     service_integrated_vtysh_config = True
 
     if os.path.isfile(vtysh_filename):