From 0601e689b3a01b06edf02102d6c780f419933488 Mon Sep 17 00:00:00 2001 From: Yamato Sugawara Date: Wed, 3 Nov 2021 07:44:14 +0000 Subject: [PATCH] zebra: apply the suggestion from frrbot Signed-off-by: Yamato Sugawara --- bgpd/bgp_vty.c | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 018c5cf614fb..e3bd845cab41 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -9213,14 +9213,10 @@ DEFPY (no_bgp_srv6_locator, return CMD_SUCCESS; } -DEFPY (show_bgp_srv6, - show_bgp_srv6_cmd, - "show bgp segment-routing srv6 [json]", - SHOW_STR - BGP_STR - "BGP Segment Routing\n" - "BGP Segment Routing SRv6\n" - JSON_STR) +DEFPY(show_bgp_srv6, show_bgp_srv6_cmd, "show bgp segment-routing srv6 [json]", + SHOW_STR BGP_STR + "BGP Segment Routing\n" + "BGP Segment Routing SRv6\n" JSON_STR) { struct bgp *bgp; struct listnode *node; @@ -9251,13 +9247,15 @@ DEFPY (show_bgp_srv6, json_chunks = json_object_new_array(); json_functions = json_object_new_array(); json_bgps = json_object_new_array(); - json_object_string_add(json, "locatorName", bgp->srv6_locator_name); + json_object_string_add(json, "locatorName", + bgp->srv6_locator_name); json_object_object_add(json, "locatorChunks", json_chunks); json_object_object_add(json, "functions", json_functions); json_object_object_add(json, "bgps", json_bgps); /* collect all chunk to json array*/ - for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) { + for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, + chunk)) { prefix2str(chunk, buf, sizeof(buf)); json_array_string_add(json_chunks, buf); } @@ -9268,8 +9266,8 @@ DEFPY (show_bgp_srv6, json_object_array_add(json_functions, json_function); inet_ntop(AF_INET6, &func->sid, buf, sizeof(buf)); json_object_string_add(json_function, "Sid", buf); - json_object_string_add(json_function, "locator", - func->locator_name); + json_object_string_add(json_function, "locator", + func->locator_name); } /* collect all bgp instance to json array*/ @@ -9277,14 +9275,18 @@ DEFPY (show_bgp_srv6, json_bgp = json_object_new_object(); json_object_array_add(json_bgps, json_bgp); json_object_string_add(json_bgp, "name", - bgp->name ? bgp->name : "default"); + bgp->name ? bgp->name + : "default"); json_vpn_policy = json_object_new_object(); json_vpn_policy_ip = json_object_new_object(); json_vpn_policy_ip6 = json_object_new_object(); - json_object_object_add(json_bgp, "vpnPolicy", json_vpn_policy); - json_object_object_add(json_vpn_policy, "ip", json_vpn_policy_ip); - json_object_object_add(json_vpn_policy, "ip6", json_vpn_policy_ip6); + json_object_object_add(json_bgp, "vpnPolicy", + json_vpn_policy); + json_object_object_add(json_vpn_policy, "ip", + json_vpn_policy_ip); + json_object_object_add(json_vpn_policy, "ip6", + json_vpn_policy_ip6); tovpn4_sid = bgp->vpn_policy[AFI_IP].tovpn_sid; tovpn6_sid = bgp->vpn_policy[AFI_IP6].tovpn_sid; @@ -9294,20 +9296,24 @@ DEFPY (show_bgp_srv6, if (tovpn6_sid) inet_ntop(AF_INET6, tovpn6_sid, buf_tovpn6_sid, sizeof(buf_tovpn6_sid)); - + json_object_string_add(json_vpn_policy_ip, "toVpnSid", - tovpn4_sid ? buf_tovpn4_sid : "none"); + tovpn4_sid ? buf_tovpn4_sid + : "none"); json_object_string_add(json_vpn_policy_ip6, "toVpnSid", - tovpn6_sid ? buf_tovpn6_sid : "none"); + tovpn6_sid ? buf_tovpn6_sid + : "none"); } - vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); json_object_free(json); } else { vty_out(vty, "locator_name: %s\n", bgp->srv6_locator_name); vty_out(vty, "locator_chunks:\n"); - for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) { + for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, + chunk)) { prefix2str(chunk, buf, sizeof(buf)); vty_out(vty, "- %s\n", buf); }