mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-31 00:10:43 +00:00
ospf6d: ASBR summarisation per VRF
Added code to support the ASBR summarisation per VRF. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
This commit is contained in:
parent
22813fdb86
commit
ad21f6c285
@ -2978,7 +2978,7 @@ static void ospf6_aggr_handle_external_info(void *data)
|
|||||||
__func__,
|
__func__,
|
||||||
&rt->prefix);
|
&rt->prefix);
|
||||||
|
|
||||||
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
|
ospf6 = rt->ospf6;
|
||||||
assert(ospf6);
|
assert(ospf6);
|
||||||
|
|
||||||
aggr = ospf6_external_aggr_match(ospf6,
|
aggr = ospf6_external_aggr_match(ospf6,
|
||||||
|
@ -1941,6 +1941,26 @@ ospf6_print_json_external_routes_walkcb(struct hash_bucket *bucket, void *arg)
|
|||||||
return HASHWALK_CONTINUE;
|
return HASHWALK_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ospf6_show_vrf_name(struct vty *vty, struct ospf6 *ospf6,
|
||||||
|
json_object *json)
|
||||||
|
{
|
||||||
|
if (json) {
|
||||||
|
if (ospf6->vrf_id == VRF_DEFAULT)
|
||||||
|
json_object_string_add(json, "vrfName",
|
||||||
|
"default");
|
||||||
|
else
|
||||||
|
json_object_string_add(json, "vrfName",
|
||||||
|
ospf6->name);
|
||||||
|
json_object_int_add(json, "vrfId", ospf6->vrf_id);
|
||||||
|
} else {
|
||||||
|
if (ospf6->vrf_id == VRF_DEFAULT)
|
||||||
|
vty_out(vty, "VRF Name: %s\n", "default");
|
||||||
|
else if (ospf6->name)
|
||||||
|
vty_out(vty, "VRF Name: %s\n", ospf6->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,
|
ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,
|
||||||
json_object *json,
|
json_object *json,
|
||||||
@ -1948,16 +1968,23 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,
|
|||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
static const char header[] = "Summary-address Metric-type Metric Tag External_Rt_count\n";
|
static const char header[] = "Summary-address Metric-type Metric Tag External_Rt_count\n";
|
||||||
|
json_object *json_vrf = NULL;
|
||||||
|
|
||||||
if (!uj) {
|
if (!uj) {
|
||||||
|
ospf6_show_vrf_name(vty, ospf6, json_vrf);
|
||||||
vty_out(vty, "aggregation delay interval :%d(in seconds)\n\n",
|
vty_out(vty, "aggregation delay interval :%d(in seconds)\n\n",
|
||||||
ospf6->aggr_delay_interval);
|
ospf6->aggr_delay_interval);
|
||||||
vty_out(vty, "%s\n", header);
|
vty_out(vty, "%s\n", header);
|
||||||
} else {
|
} else {
|
||||||
json_object_int_add(json, "aggregation delay interval",
|
json_vrf = json_object_new_object();
|
||||||
|
|
||||||
|
ospf6_show_vrf_name(vty, ospf6, json_vrf);
|
||||||
|
|
||||||
|
json_object_int_add(json_vrf, "aggregation delay interval",
|
||||||
ospf6->aggr_delay_interval);
|
ospf6->aggr_delay_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
for (rn = route_top(ospf6->rt_aggr_tbl); rn; rn = route_next(rn)) {
|
||||||
if (!rn->info)
|
if (!rn->info)
|
||||||
continue;
|
continue;
|
||||||
@ -1972,7 +1999,7 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,
|
|||||||
|
|
||||||
json_aggr = json_object_new_object();
|
json_aggr = json_object_new_object();
|
||||||
|
|
||||||
json_object_object_add(json,
|
json_object_object_add(json_vrf,
|
||||||
buf,
|
buf,
|
||||||
json_aggr);
|
json_aggr);
|
||||||
|
|
||||||
@ -2036,15 +2063,21 @@ ospf6_show_summary_address(struct vty *vty, struct ospf6 *ospf6,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uj)
|
||||||
|
json_object_object_add(json, ospf6->name,
|
||||||
|
json_vrf);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ipv6_ospf6_external_aggregator,
|
DEFPY (show_ipv6_ospf6_external_aggregator,
|
||||||
show_ipv6_ospf6_external_aggregator_cmd,
|
show_ipv6_ospf6_external_aggregator_cmd,
|
||||||
"show ipv6 ospf6 summary-address [detail$detail] [json]",
|
"show ipv6 ospf6 [vrf <NAME|all>] summary-address [detail$detail] [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP6_STR
|
IP6_STR
|
||||||
OSPF6_STR
|
OSPF6_STR
|
||||||
|
VRF_CMD_HELP_STR
|
||||||
|
"All VRFs\n"
|
||||||
"Show external summary addresses\n"
|
"Show external summary addresses\n"
|
||||||
"detailed informtion\n"
|
"detailed informtion\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
@ -2052,25 +2085,27 @@ DEFPY (show_ipv6_ospf6_external_aggregator,
|
|||||||
bool uj = use_json(argc, argv);
|
bool uj = use_json(argc, argv);
|
||||||
struct ospf6 *ospf6 = NULL;
|
struct ospf6 *ospf6 = NULL;
|
||||||
json_object *json = NULL;
|
json_object *json = NULL;
|
||||||
|
const char *vrf_name = NULL;
|
||||||
|
struct listnode *node;
|
||||||
|
bool all_vrf = false;
|
||||||
|
int idx_vrf = 0;
|
||||||
|
|
||||||
if (uj)
|
if (uj)
|
||||||
json = json_object_new_object();
|
json = json_object_new_object();
|
||||||
|
|
||||||
/* Default Vrf */
|
OSPF6_CMD_CHECK_RUNNING();
|
||||||
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
|
OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
|
||||||
if (ospf6 == NULL) {
|
|
||||||
if (uj) {
|
|
||||||
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, "OSPFv3 is not running\n");
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
|
||||||
|
if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) {
|
||||||
|
|
||||||
|
ospf6_show_summary_address(vty, ospf6, json, uj,
|
||||||
|
detail);
|
||||||
|
|
||||||
|
if (!all_vrf)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ospf6_show_summary_address(vty, ospf6, json, uj, detail);
|
|
||||||
|
|
||||||
if (uj) {
|
if (uj) {
|
||||||
vty_out(vty, "%s\n", json_object_to_json_string_ext(
|
vty_out(vty, "%s\n", json_object_to_json_string_ext(
|
||||||
|
Loading…
Reference in New Issue
Block a user