summaryrefslogtreecommitdiff
path: root/tools/frr-reload.py
diff options
context:
space:
mode:
authorSebastien Merle <sebastien@netdef.org>2020-10-16 16:55:51 +0200
committerSebastien Merle <sebastien@netdef.org>2020-12-18 16:47:52 +0100
commitefba0985fcddee80df257147f7e398b52dad089b (patch)
treec668019fceae6ee01caf43fd7fcacf3df58fccb4 /tools/frr-reload.py
parent4d7b695d3abe80fbb1b666aed8faa1b9e9387fdb (diff)
pathd: Add optional support for PCEP to pathd
This new dynamic module makes pathd behave as a PCC for dynamic candidate path using the external library pcpelib https://github.com/volta-networks/pceplib . The candidate paths defined as dynamic will trigger computation requests to the configured PCE, and the PCE response will be used to update the policy. It supports multiple PCE. The one with smaller precedence will be elected as the master PCE, and only if the connection repeatedly fails, the PCC will switch to another PCE. Example of configuration: segment-routing traffic-eng pcep pce-config CONF source-address ip 10.10.10.10 sr-draft07 ! pce PCE1 config CONF address ip 1.1.1.1 ! pce PCE2 config CONF address ip 2.2.2.2 ! pcc peer PCE1 precedence 10 peer PCE2 precedence 20 ! ! ! ! Co-authored-by: Brady Johnson <brady@voltanet.io> Co-authored-by: Emanuele Di Pascale <emanuele@voltanet.io> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Co-authored-by: Javier Garcia <javier.garcia@voltanet.io> Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: Sebastien Merle <sebastien@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
Diffstat (limited to 'tools/frr-reload.py')
-rwxr-xr-xtools/frr-reload.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py
index 137a3d5a03..21dc93954e 100755
--- a/tools/frr-reload.py
+++ b/tools/frr-reload.py
@@ -681,6 +681,27 @@ end
current_context_lines = []
new_ctx = False
log.debug("LINE %-50s: entering new context, %-50s", line, ctx_keys)
+
+ elif (
+ line.startswith("peer ")
+ and len(ctx_keys) == 4
+ and ctx_keys[0].startswith("segment-routing")
+ and ctx_keys[1].startswith("traffic-eng")
+ and ctx_keys[2].startswith("pcep")
+ and ctx_keys[3].startswith("pcc")
+ ):
+ # If there is no precedence, we add the default one (255) so
+ # the line is not removed and added back
+ m = re.search('peer ([^ ]*)', line)
+ if (m != None):
+ (name,) = m.groups()
+ line = "peer %s precedence 255" % (name,)
+
+ current_context_lines.append(line)
+ log.debug(
+ "LINE %-50s: append to current_context_lines, %-50s", line, ctx_keys
+ )
+
elif (
line.startswith("address-family ")
or line.startswith("vnc defaults")
@@ -805,6 +826,73 @@ end
)
ctx_keys.append(line)
+ elif (
+ line.startswith("pcep")
+ and len(ctx_keys) == 2
+ and ctx_keys[0].startswith("segment-routing")
+ and ctx_keys[1].startswith("traffic-eng")
+ ):
+
+ # Save old context first
+ self.save_contexts(ctx_keys, current_context_lines)
+ current_context_lines = []
+ main_ctx_key = copy.deepcopy(ctx_keys)
+ log.debug(
+ "LINE %-50s: entering pcep sub-context, append to ctx_keys", line
+ )
+ ctx_keys.append(line)
+
+ elif (
+ line.startswith("pce-config ")
+ and len(ctx_keys) == 3
+ and ctx_keys[0].startswith("segment-routing")
+ and ctx_keys[1].startswith("traffic-eng")
+ and ctx_keys[2].startswith("pcep")
+ ):
+
+ # Save old context first
+ self.save_contexts(ctx_keys, current_context_lines)
+ current_context_lines = []
+ main_ctx_key = copy.deepcopy(ctx_keys)
+ log.debug(
+ "LINE %-50s: entering pce-config sub-context, append to ctx_keys", line
+ )
+ ctx_keys.append(line)
+
+ elif (
+ line.startswith("pce ")
+ and len(ctx_keys) == 3
+ and ctx_keys[0].startswith("segment-routing")
+ and ctx_keys[1].startswith("traffic-eng")
+ and ctx_keys[2].startswith("pcep")
+ ):
+
+ # Save old context first
+ self.save_contexts(ctx_keys, current_context_lines)
+ current_context_lines = []
+ main_ctx_key = copy.deepcopy(ctx_keys)
+ log.debug(
+ "LINE %-50s: entering pce sub-context, append to ctx_keys", line
+ )
+ ctx_keys.append(line)
+
+ elif (
+ line.startswith("pcc")
+ and len(ctx_keys) == 3
+ and ctx_keys[0].startswith("segment-routing")
+ and ctx_keys[1].startswith("traffic-eng")
+ and ctx_keys[2].startswith("pcep")
+ ):
+
+ # Save old context first
+ self.save_contexts(ctx_keys, current_context_lines)
+ current_context_lines = []
+ main_ctx_key = copy.deepcopy(ctx_keys)
+ log.debug(
+ "LINE %-50s: entering pcc sub-context, append to ctx_keys", line
+ )
+ ctx_keys.append(line)
+
else:
# Continuing in an existing context, add non-commented lines to it
current_context_lines.append(line)
@@ -1415,6 +1503,14 @@ def compare_context_objects(newconf, running):
):
continue
+ # Neither the pcep command
+ elif (
+ len(running_ctx_keys) == 3
+ and running_ctx_keys[0].startswith('segment-routing')
+ and running_ctx_keys[2].startswith('pcep4')
+ ):
+ continue
+
# Segment lists can only be deleted after we removed all the candidate paths that
# use them, so add them to a separate array that is going to be appended at the end
elif (