-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zebra: Cl to frr upstream zebra json #17532
base: master
Are you sure you want to change the base?
Changes from 7 commits
f159940
2899964
a389731
b57ad60
aa12b80
c5488c9
5f458b3
7b1ac8b
5dde8e1
e7eb1a1
293833d
5238553
45f7229
26a7352
b90814a
9712936
4cdbdc8
f0a5e78
3d4e007
92756e2
fa317c3
a6fe1ff
b1ba753
f51c537
e5e59a1
2479d74
5547663
1cacc25
65187ff
35056d0
a7aacf6
01d289f
b519572
c2079f2
e0d6005
719f6e2
9bce8f0
4e253c6
b2440cd
93ea727
fe5e066
1b5ce05
1b64d76
85b502e
33dc89a
fdab494
bd14767
1276e8f
430d7cb
5779690
31572eb
3d70b9e
b8979fb
e6028d0
f61dde2
35f77c5
b43750e
805aaec
4be15e5
69ea3eb
0589950
3db9117
7fc110a
6288ffd
d11bded
7d19912
b868757
336fb43
c5087cb
c55bc29
02939de
613956a
f28c740
c8b7a5f
8df3572
9dcf9d8
34d8770
f7b0f6f
0a20ef9
6a3e1e3
ff0e1f2
e5596dd
b1f199d
07fbbb8
29a0680
880d019
1dac801
c90c58f
396bc3e
1b8b747
a2ee9db
bb5632b
3e2a0f3
8f2f7f6
f8ba744
dcf33d0
c9d6ea7
78c5bb9
c7d3e19
f0f2940
f4af5fe
31cbe16
02d336d
3049a63
b131abf
b43c276
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2530,42 +2530,58 @@ static inline bool if_is_protodown_applicable(struct interface *ifp) | |
return true; | ||
} | ||
|
||
static void zebra_vxlan_if_vni_dump_vty(struct vty *vty, | ||
static void zebra_vxlan_if_vni_dump_vty(struct vty *vty, json_object *json_if, | ||
struct zebra_vxlan_vni *vni) | ||
{ | ||
char str[INET6_ADDRSTRLEN]; | ||
json_object *json_vni; | ||
char vni_str[VNI_STR_LEN]; | ||
char buf[PREFIX_STRLEN]; | ||
|
||
vty_out(vty, " VxLAN Id %u", vni->vni); | ||
if (vni->access_vlan) | ||
vty_out(vty, " Access VLAN Id %u\n", vni->access_vlan); | ||
if (vty) { | ||
vty_out(vty, "\n VxLAN Id %u", vni->vni); | ||
if (vni->access_vlan) | ||
vty_out(vty, " Access VLAN Id %u", vni->access_vlan); | ||
|
||
if (vni->mcast_grp.s_addr != INADDR_ANY) | ||
vty_out(vty, " Mcast Group %s", | ||
inet_ntop(AF_INET, &vni->mcast_grp, str, sizeof(str))); | ||
if (vni->mcast_grp.s_addr != INADDR_ANY && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you're going to change this, please use %pI4 newline change - again? |
||
inet_ntop(AF_INET, &vni->mcast_grp, buf, sizeof(buf)) != NULL) | ||
vty_out(vty, "\n Mcast Group %s", buf); | ||
} else if (json_if) { | ||
json_vni = json_object_new_object(); | ||
snprintf(vni_str, sizeof(vni_str), "%u", vni->vni); | ||
json_object_int_add(json_vni, "accessVlan", vni->access_vlan); | ||
json_object_string_addf(json_vni, "mcastGroup", "%pI4", | ||
&vni->mcast_grp); | ||
json_object_object_add(json_if, vni_str, json_vni); | ||
} | ||
} | ||
|
||
static void zebra_vxlan_if_vni_hash_dump_vty(struct hash_bucket *bucket, | ||
void *ctxt) | ||
void **args) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, don't change the signature of this callback - you can do the interpretation of the void* inside the function. if you need to pass more context, then you may need to ... pass a context struct, as is done in many places |
||
{ | ||
struct vty *vty; | ||
struct zebra_vxlan_vni *vni; | ||
struct vty *vty; | ||
json_object *json_if; | ||
|
||
vni = (struct zebra_vxlan_vni *)bucket->data; | ||
vty = (struct vty *)ctxt; | ||
vty = (struct vty *)args[0]; | ||
json_if = (json_object *)args[1]; | ||
|
||
zebra_vxlan_if_vni_dump_vty(vty, vni); | ||
zebra_vxlan_if_vni_dump_vty(vty, json_if, vni); | ||
} | ||
|
||
static void zebra_vxlan_if_dump_vty(struct vty *vty, struct zebra_if *zebra_if) | ||
{ | ||
struct zebra_l2info_vxlan *vxlan_info; | ||
struct zebra_vxlan_vni_info *vni_info; | ||
void *args[2]; | ||
char buf[PREFIX_STRLEN]; | ||
|
||
vxlan_info = &zebra_if->l2info.vxl; | ||
vni_info = &vxlan_info->vni_info; | ||
|
||
if (vxlan_info->vtep_ip.s_addr != INADDR_ANY) | ||
vty_out(vty, " VTEP IP: %pI4", &vxlan_info->vtep_ip); | ||
if (vxlan_info->vtep_ip.s_addr != INADDR_ANY && | ||
inet_ntop(AF_INET, &vxlan_info->vtep_ip, buf, sizeof(buf)) != NULL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, the existing code is correct |
||
vty_out(vty, " VTEP IP: %s", buf); | ||
|
||
if (vxlan_info->ifindex_link && (vxlan_info->link_nsid != NS_UNKNOWN)) { | ||
struct interface *ifp; | ||
|
@@ -2578,10 +2594,14 @@ static void zebra_vxlan_if_dump_vty(struct vty *vty, struct zebra_if *zebra_if) | |
} | ||
|
||
if (IS_ZEBRA_VXLAN_IF_VNI(zebra_if)) { | ||
zebra_vxlan_if_vni_dump_vty(vty, &vni_info->vni); | ||
zebra_vxlan_if_vni_dump_vty(vty, NULL, &vni_info->vni); | ||
} else { | ||
args[0] = vty; | ||
args[1] = NULL; | ||
hash_iterate(vni_info->vni_table, | ||
zebra_vxlan_if_vni_hash_dump_vty, vty); | ||
(void (*)(struct hash_bucket *, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, don't need to do this |
||
void *))zebra_vxlan_if_vni_hash_dump_vty, | ||
args); | ||
} | ||
|
||
vty_out(vty, "\n"); | ||
|
@@ -2910,23 +2930,14 @@ static void zebra_vxlan_if_vni_dump_vty_json(json_object *json_if, | |
&vni->mcast_grp); | ||
} | ||
|
||
static void zebra_vxlan_if_vni_hash_dump_vty_json(struct hash_bucket *bucket, | ||
void *ctxt) | ||
{ | ||
json_object *json_if; | ||
struct zebra_vxlan_vni *vni; | ||
|
||
vni = (struct zebra_vxlan_vni *)bucket->data; | ||
json_if = (json_object *)ctxt; | ||
|
||
zebra_vxlan_if_vni_dump_vty_json(json_if, vni); | ||
} | ||
|
||
static void zebra_vxlan_if_dump_vty_json(json_object *json_if, | ||
struct zebra_if *zebra_if) | ||
{ | ||
struct zebra_l2info_vxlan *vxlan_info; | ||
struct zebra_vxlan_vni_info *vni_info; | ||
json_object *json_vnis = NULL; | ||
uint32_t num_vnis; | ||
void *args[2]; | ||
|
||
vxlan_info = &zebra_if->l2info.vxl; | ||
vni_info = &vxlan_info->vni_info; | ||
|
@@ -2944,12 +2955,23 @@ static void zebra_vxlan_if_dump_vty_json(json_object *json_if, | |
json_object_string_add(json_if, "linkInterface", | ||
ifp == NULL ? "Unknown" : ifp->name); | ||
} | ||
|
||
json_vnis = json_object_new_object(); | ||
if (IS_ZEBRA_VXLAN_IF_VNI(zebra_if)) { | ||
zebra_vxlan_if_vni_dump_vty_json(json_if, &vni_info->vni); | ||
} else { | ||
hash_iterate(vni_info->vni_table, | ||
zebra_vxlan_if_vni_hash_dump_vty_json, json_if); | ||
num_vnis = hashcount(vni_info->vni_table); | ||
if (num_vnis) { | ||
args[0] = NULL; | ||
args[1] = json_vnis; | ||
hash_iterate(vni_info->vni_table, | ||
(void (*)(struct hash_bucket *, void *)) | ||
zebra_vxlan_if_vni_hash_dump_vty, | ||
args); | ||
} | ||
} | ||
|
||
json_object_object_add(json_if, "vxlanId", json_vnis); | ||
} | ||
|
||
static void if_dump_vty_json(struct vty *vty, struct interface *ifp, | ||
|
@@ -3091,7 +3113,6 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp, | |
json_object_int_add(json_if, "vlanId", vlan_info->vid); | ||
} else if (IS_ZEBRA_IF_VXLAN(ifp)) { | ||
zebra_vxlan_if_dump_vty_json(json_if, zebra_if); | ||
|
||
} else if (IS_ZEBRA_IF_GRE(ifp)) { | ||
struct zebra_l2info_gre *gre_info; | ||
|
||
|
@@ -3104,8 +3125,8 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp, | |
json_if, "vtepRemoteIp", "%pI4", | ||
&gre_info->vtep_ip_remote); | ||
} | ||
if (gre_info->ifindex_link | ||
&& (gre_info->link_nsid != NS_UNKNOWN)) { | ||
if (gre_info->ifindex_link && | ||
(gre_info->link_nsid != NS_UNKNOWN)) { | ||
struct interface *ifp; | ||
|
||
ifp = if_lookup_by_index_per_ns( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3101,6 +3101,9 @@ static void zebra_evpn_es_show_entry(struct vty *vty, struct zebra_evpn_es *es, | |
json_array_string_add(json_flags, "local"); | ||
if (es->flags & ZEBRA_EVPNES_REMOTE) | ||
json_array_string_add(json_flags, "remote"); | ||
if (es->flags & ZEBRA_EVPNES_LOCAL && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit concerned about this: the two flags involved are already represented - do we need to capture this semantic in this way, explicitly? can't the operator decide what the presence or absence of the two flags means? |
||
!(es->flags & ZEBRA_EVPNES_NON_DF)) | ||
json_array_string_add(json_flags, "df"); | ||
if (es->flags & ZEBRA_EVPNES_NON_DF) | ||
json_array_string_add(json_flags, "nonDF"); | ||
if (es->flags & ZEBRA_EVPNES_BYPASS) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,13 @@ struct zebra_l2_bridge_vlan { | |
struct zebra_evpn_access_bd *access_bd; | ||
}; | ||
|
||
struct zebra_l2_brvlan_mac { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. umm - this commit adds data structures, but ... where's the code that updates them? |
||
struct interface *br_if; | ||
vlanid_t vid; | ||
struct ethaddr macaddr; | ||
ifindex_t ifindex; | ||
}; | ||
|
||
struct zebra_l2_bridge_if_ctx { | ||
/* input */ | ||
struct zebra_if *zif; | ||
|
@@ -48,10 +55,23 @@ struct zebra_l2_bridge_if_ctx { | |
void *arg; | ||
}; | ||
|
||
struct zebra_l2_brvlan_mac_ctx { | ||
/* input */ | ||
struct interface *br_if; | ||
vlanid_t vid; | ||
int (*func)(struct interface *br_if, vlanid_t vid, | ||
struct ethaddr *macaddr, ifindex_t ifidx, void *arg); | ||
|
||
/* input-output */ | ||
void *arg; | ||
struct json_object *json; /* Used for JSON Output */ | ||
}; | ||
|
||
struct zebra_l2_bridge_if { | ||
uint8_t vlan_aware; | ||
struct zebra_if *br_zif; | ||
struct hash *vlan_table; | ||
struct hash *mac_table[VLANID_MAX]; | ||
}; | ||
|
||
/* zebra L2 interface information - bridge interface */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you changing the newlines?