]> git.proxmox.com Git - mirror_frr.git/commitdiff
tools, vtysh: improved fix for ldpd ifaces
authorEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 12 Nov 2019 14:36:15 +0000 (15:36 +0100)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 12 Nov 2019 14:36:15 +0000 (15:36 +0100)
instead of suppressing the 'exit' markers at the end of each
'interface XXX' clause in the mpls ldp configuration, mark
those with a special marker 'exit-ldp-if' and teach the
reload script to correctly recognize the new sub-subcontext

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
tools/frr-reload.py
vtysh/vtysh.c

index cf31da38b82177347484d7b2dd94f6a10d696de6..cc383e06d8acf4f3776ef8fd3f2da19a7344426c 100755 (executable)
@@ -473,7 +473,7 @@ end
                     current_context_lines = []
                     log.debug('LINE %-50s: popping from subcontext to ctx%-50s', line, ctx_keys)
 
-            elif line == "exit-vni":
+            elif line in ["exit-vni", "exit-ldp-if"]:
                 if sub_main_ctx_key:
                     self.save_contexts(ctx_keys, current_context_lines)
 
@@ -525,6 +525,18 @@ end
                 sub_main_ctx_key = copy.deepcopy(ctx_keys)
                 log.debug('LINE %-50s: entering sub-sub-context, append to ctx_keys', line)
                 ctx_keys.append(line)
+            
+            elif ((line.startswith("interface ") and
+                   len(ctx_keys) == 2 and
+                   ctx_keys[0].startswith('mpls ldp') and
+                   ctx_keys[1].startswith('address-family'))):
+
+                # Save old context first
+                self.save_contexts(ctx_keys, current_context_lines)
+                current_context_lines = []
+                sub_main_ctx_key = copy.deepcopy(ctx_keys)
+                log.debug('LINE %-50s: entering sub-sub-context, append to ctx_keys', line)
+                ctx_keys.append(line)
 
             else:
                 # Continuing in an existing context, add non-commented lines to it
index f8292c530f04aff2a3b3a3d3386a3babb8f7daa8..5c4e8a313b04de5cd840a24d40d60ce586172daf 100644 (file)
@@ -725,11 +725,13 @@ int vtysh_mark_file(const char *filename)
                switch (vty->node) {
                case LDP_IPV4_IFACE_NODE:
                        if (strncmp(vty_buf_copy, "   ", 3)) {
+                               vty_out(vty, " exit-ldp-if\n");
                                vty->node = LDP_IPV4_NODE;
                        }
                        break;
                case LDP_IPV6_IFACE_NODE:
                        if (strncmp(vty_buf_copy, "   ", 3)) {
+                               vty_out(vty, " exit-ldp-if\n");
                                vty->node = LDP_IPV6_NODE;
                        }
                        break;