]> git.proxmox.com Git - mirror_frr.git/blobdiff - tools/frr-reload.py
Merge pull request #5285 from ton31337/fix/send_BGP_NOTIFY_CEASE_PEER_UNCONFIG_after_...
[mirror_frr.git] / tools / frr-reload.py
index c48c8b97ad07b46e19ba12d405a04efe87b49038..f5784b7ecdcfda728965874f837bfb6a7af1c2f0 100755 (executable)
@@ -300,13 +300,11 @@ class Config(object):
 
         '''
           More fixups in user specification and what running config shows.
-          "null0" in routes must be replaced by Null0, and "blackhole" must
-          be replaced by Null0 as well.
+          "null0" in routes must be replaced by Null0.
         '''
         if (key[0].startswith('ip route') or key[0].startswith('ipv6 route') and
-                'null0' in key[0] or 'blackhole' in key[0]):
+                'null0' in key[0]):
             key[0] = re.sub(r'\s+null0(\s*$)', ' Null0', key[0])
-            key[0] = re.sub(r'\s+blackhole(\s*$)', ' Null0', key[0])
 
         if lines:
             if tuple(key) not in self.contexts:
@@ -395,8 +393,10 @@ end
         # is not the main router bgp block, but enabling multi-instance
         oneline_ctx_keywords = ("access-list ",
                                 "agentx",
+                                "allow-external-route-update",
                                 "bgp ",
                                 "debug ",
+                                "domainname ",
                                 "dump ",
                                 "enable ",
                                 "frr ",
@@ -412,7 +412,8 @@ end
                                 "service ",
                                 "table ",
                                 "username ",
-                                "zebra ")
+                                "zebra ",
+                                "vrrp autoconfigure")
 
         for line in self.lines:
 
@@ -435,7 +436,7 @@ end
                 self.save_contexts(ctx_keys, current_context_lines)
                 new_ctx = True
 
-            elif line in ["end", "exit-vrf"]:
+            elif line == "end":
                 self.save_contexts(ctx_keys, current_context_lines)
                 log.debug('LINE %-50s: exiting old context, %-50s', line, ctx_keys)
 
@@ -445,6 +446,17 @@ end
                 ctx_keys = []
                 current_context_lines = []
 
+            elif line == "exit-vrf":
+                self.save_contexts(ctx_keys, current_context_lines)
+                current_context_lines.append(line)
+                log.debug('LINE %-50s: append to current_context_lines, %-50s', line, ctx_keys)
+
+                #Start a new context
+                new_ctx = True
+                main_ctx_key = []
+                ctx_keys = []
+                current_context_lines = []
+
             elif line in ["exit-address-family", "exit", "exit-vnc"]:
                 # if this exit is for address-family ipv4 unicast, ignore the pop
                 if main_ctx_key:
@@ -732,6 +744,27 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del):
                         lines_to_add_to_del.append((ctx_keys, swpx_interface))
                         lines_to_add_to_del.append((tmp_ctx_keys, swpx_peergroup))
 
+                '''
+                Changing the bfd timers on neighbors is allowed without doing
+                a delete/add process. Since doing a "no neighbor blah bfd ..."
+                will cause the peer to bounce unnecessarily, just skip the delete
+                and just do the add.
+                '''
+                re_nbr_bfd_timers = re.search(r'neighbor (\S+) bfd (\S+) (\S+) (\S+)', line)
+
+                if re_nbr_bfd_timers:
+                    nbr = re_nbr_bfd_timers.group(1)
+                    bfd_nbr = "neighbor %s" % nbr
+
+                    for (ctx_keys, add_line) in lines_to_add:
+                        re_add_nbr_bfd_timers = re.search(r'neighbor bfd_nbr bfd (\S+) (\S+) (\S+)', add_line)
+
+                        if re_add_nbr_bfd_timers:
+                            found_add_bfd_nbr = line_exist(lines_to_add, ctx_keys, bfd_nbr, False)
+
+                            if found_add_bfd_nbr:
+                                lines_to_del_to_del.append((ctx_keys, line))
+
                 '''
                 We changed how we display the neighbor interface command. Older
                 versions of frr would display the following: