summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2022-11-04 19:28:04 +0100
committerCarmine Scarpitta <cscarpit@cisco.com>2023-12-14 14:58:35 +0100
commit0c9b4910356742c272c93cdb741d7c20efea3dfd (patch)
tree1ac9ead1a6705e1628ec890a3ff6097bbbc60c28 /zebra
parentzebra, lib, vtysh: Add CLI cmd to set/unset SRv6 encap source address (diff)
downloadfrr-0c9b4910356742c272c93cdb741d7c20efea3dfd.tar.xz
frr-0c9b4910356742c272c93cdb741d7c20efea3dfd.zip
zebra: Add CLI command to verify SRv6 Manager
Add a new CLI command `show segment-routing srv6 manager [json]` to verify the overall SRv6 state. The current output displays only the configured source address of outer encapsulating IPv6 header. The output can be extended in the future to show more information, including summary SRv6 information and supported capabilities. Example: ``` r1# show segment-routing srv6 manager Parameters: Encapsulation: Source Address: Configured: fc00:0:1::1 r1# show segment-routing srv6 manager json { "parameters":{ "encapsulation":{ "sourceAddress":{ "configured":"fc00:0:1::1" } } } } ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_srv6_vty.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/zebra/zebra_srv6_vty.c b/zebra/zebra_srv6_vty.c
index ffc67fc8a..417489fbc 100644
--- a/zebra/zebra_srv6_vty.c
+++ b/zebra/zebra_srv6_vty.c
@@ -68,6 +68,45 @@ static struct cmd_node srv6_encap_node = {
.prompt = "%s(config-srv6-encap)# "
};
+DEFPY (show_srv6_manager,
+ show_srv6_manager_cmd,
+ "show segment-routing srv6 manager [json]",
+ SHOW_STR
+ "Segment Routing\n"
+ "Segment Routing SRv6\n"
+ "Verify SRv6 Manager\n"
+ JSON_STR)
+{
+ const bool uj = use_json(argc, argv);
+ struct zebra_srv6 *srv6 = zebra_srv6_get_default();
+ json_object *json = NULL;
+ json_object *json_parameters = NULL;
+ json_object *json_encapsulation = NULL;
+ json_object *json_source_address = NULL;
+
+ if (uj) {
+ json = json_object_new_object();
+ json_parameters = json_object_new_object();
+ json_object_object_add(json, "parameters", json_parameters);
+ json_encapsulation = json_object_new_object();
+ json_object_object_add(json_parameters, "encapsulation",
+ json_encapsulation);
+ json_source_address = json_object_new_object();
+ json_object_object_add(json_encapsulation, "sourceAddress",
+ json_source_address);
+ json_object_string_addf(json_source_address, "configured",
+ "%pI6", &srv6->encap_src_addr);
+ vty_json(vty, json);
+ } else {
+ vty_out(vty, "Parameters:\n");
+ vty_out(vty, " Encapsulation:\n");
+ vty_out(vty, " Source Address:\n");
+ vty_out(vty, " Configured: %pI6\n", &srv6->encap_src_addr);
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (show_srv6_locator,
show_srv6_locator_cmd,
"show segment-routing srv6 locator [json]",
@@ -508,4 +547,5 @@ void zebra_srv6_vty_init(void)
/* Command for operation */
install_element(VIEW_NODE, &show_srv6_locator_cmd);
install_element(VIEW_NODE, &show_srv6_locator_detail_cmd);
+ install_element(VIEW_NODE, &show_srv6_manager_cmd);
}