Skip to content

Commit

Permalink
Merge pull request #145 from Ali-aqrabawi/vxlan_fixes
Browse files Browse the repository at this point in the history
[link,vxlan]: fixed vxlan learning,proxy,rsc update, changed on-node-…
  • Loading branch information
Ali-aqrabawi authored Jul 7, 2024
2 parents 37ebe71 + 5b693f8 commit 7ac2f36
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 50 deletions.
15 changes: 14 additions & 1 deletion src/lib/cmdgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ char *yang_ext_map[] = { [CMD_START_EXT] = "cmd-start",
[VALUE_ONLY_EXT] = "value-only",
[VALUE_ONLY_ON_UPDATE_EXT] = "value-only-on-update",
[AFTER_NODE_ADD_STATIC_ARG_EXT] = "after-node-add-static-arg",
[ON_NODE_DELETE_EXT] = "on-node-delete",
[ON_NODE_DELETE_EXT] = "on-node-delete-or-val-false",
[ADD_LEAF_AT_END] = "add_leaf_at_end",
[NOT_CMD_ARG_EXT] = "not-cmd-arg",

Expand Down Expand Up @@ -587,6 +587,19 @@ int create_cmd_arg_name(struct lyd_node *dnode, oper_t startcmd_op_val, char **a
if (get_extension(FLAG_EXT, dnode, NULL) == EXIT_SUCCESS) {
if (!strcmp("true", lyd_get_value(dnode)))
*arg_name = strdup(dnode->schema->name);
else if (!strcmp("false", lyd_get_value(dnode))) {
char *on_node_delete = NULL;
if (get_extension(ON_NODE_DELETE_EXT, dnode, &on_node_delete) == EXIT_SUCCESS) {
if (on_node_delete == NULL) {
fprintf(stderr,
"%s: ipr2cgen:on-leaf-delete extension found but failed to "
"get its arg value form node \"%s\"\n",
__func__, dnode->schema->name);
return EXIT_FAILURE;
}
*arg_name = on_node_delete;
}
}
return EXIT_SUCCESS;
}

Expand Down
3 changes: 3 additions & 0 deletions tests/cases/test_ip_link_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<id>20</id>
<dev>testIf2</dev>
<srcport>0 10</srcport>
<remote>1.1.1.4</remote>
<local>1.1.1.2</local>
<learning>true</learning>
</vxlan-info>
</vxlan>
<vlan>
Expand Down
2 changes: 1 addition & 1 deletion tests/run_startup_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ check_vxlan() {
fi

echo "Checking l3miss field"
if ! echo "$output" | grep -qP "<l3miss>on</l3miss>"; then
if ! echo "$output" | grep -qP "<l3miss>true</l3miss>"; then
echo "Error: VXLAN l3miss flag not found for VXLAN interface $1 (FAIL)."
delete_interfaces
exit 1
Expand Down
2 changes: 1 addition & 1 deletion yang/iproute2-cmdgen-extensions.yang
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ module iproute2-cmdgen-extensions {
"instruct iproute2 to add a static argument, to be used inside containers";
argument "static-arg";
}
extension on-node-delete{
extension on-node-delete-or-val-false{
description
"when the node is deleted the provided 'arg' will be added to cmd,
example is nomaster with removig vrf from link";
Expand Down
72 changes: 25 additions & 47 deletions yang/iproute2-ip-link.yang
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ module iproute2-ip-link {

grouping link-advance {
leaf master{
ipr2cgen:on-node-delete "nomaster";
ipr2cgen:on-node-delete-or-val-false "nomaster";
type union {
type bond-ref;
type bridge-ref;
Expand Down Expand Up @@ -785,7 +785,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "noencap-remcsum ";
ipr2cgen:on-node-delete-or-val-false "noencap-remcsum ";
ipr2cgen:flag;
description
"specifies if UDP checksums are enabled in the secondary encapsulation.";
Expand All @@ -794,7 +794,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "noencap-remcsum";
ipr2cgen:on-node-delete-or-val-false "noencap-remcsum";
ipr2cgen:flag;
description
"specifies if Remote Checksum Offload is enabled.
Expand Down Expand Up @@ -1124,69 +1124,53 @@ module iproute2-ip-link {
to communicate to the remote VXLAN tunnel endpoint. example: 7770 7779";
}
leaf learning {
ipr2cgen:on-node-delete "nolearning";
ipr2cgen:on-node-delete-or-val-false "nolearning";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on;false:off";
type enumeration {
enum "on";
}
type boolean;
description
"specifies if unknown source link layer addresses and IP addresses are entered
into the VXLAN device forwarding database.";

}
leaf rsc {
ipr2cgen:on-node-delete "norsc";
ipr2cgen:on-node-delete-or-val-false "norsc";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies if route short circuit is turned on.";

}
leaf proxy {
ipr2cgen:on-node-delete "noproxy";
ipr2cgen:on-node-delete-or-val-false "noproxy";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies ARP proxy is turned on.";

}
leaf l2miss {
ipr2cgen:on-node-delete "nol2miss";
ipr2cgen:on-node-delete-or-val-false "nol2miss";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies if netlink LLADDR miss notifications are generated.";

}
leaf l3miss {
ipr2cgen:on-node-delete "nol3miss";
ipr2cgen:on-node-delete-or-val-false "nol3miss";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies if netlink IP ADDR miss notifications are generated.";

}
leaf udpcsum {
ipr2cgen:on-node-delete "noudpcsum";
ipr2cgen:on-node-delete-or-val-false "noudpcsum";
ipr2cgen:flag;
ipr2cgen:oper-arg-name "udp_csum";
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies if UDP checksum is calculated for transmitted packets over IPv4.";

Expand All @@ -1205,24 +1189,18 @@ module iproute2-ip-link {
"NUMBER - specifies the maximum number of FDB entries.";
}
leaf external {
ipr2cgen:on-node-delete "noexternal";
ipr2cgen:on-node-delete-or-val-false "noexternal";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies whether an external control plane (e.g. ip route encap)
or the internal FDB should be used.";

}
leaf vnifilter {
ipr2cgen:on-node-delete "novnifilter";
ipr2cgen:on-node-delete-or-val-false "novnifilter";
ipr2cgen:flag;
ipr2cgen:oper-value-map "true:on";
type enumeration {
enum "on";
}
type boolean;
description
"specifies whether the vxlan device is capable of vni filtering.
Only works with a vxlan device with external flag set. once enabled,
Expand Down Expand Up @@ -1409,7 +1387,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "noiseq";
ipr2cgen:on-node-delete-or-val-false "noiseq";
ipr2cgen:oper-value-map "true:on";
ipr2cgen:flag;
description
Expand All @@ -1419,7 +1397,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "nooseq";
ipr2cgen:on-node-delete-or-val-false "nooseq";
ipr2cgen:oper-value-map "true:on";
ipr2cgen:flag;
description
Expand All @@ -1429,7 +1407,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "noicsum";
ipr2cgen:on-node-delete-or-val-false "noicsum";
ipr2cgen:oper-value-map "true:on";
ipr2cgen:flag;
description
Expand All @@ -1440,7 +1418,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "noocsum";
ipr2cgen:on-node-delete-or-val-false "noocsum";
ipr2cgen:oper-value-map "true:on";
ipr2cgen:flag;
description
Expand All @@ -1467,7 +1445,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "nopmtudisc";
ipr2cgen:on-node-delete-or-val-false "nopmtudisc";
ipr2cgen:oper-value-map "true:on";
ipr2cgen:flag;
description
Expand All @@ -1479,7 +1457,7 @@ module iproute2-ip-link {
type enumeration{
enum "on";
}
ipr2cgen:on-node-delete "noignore-df";
ipr2cgen:on-node-delete-or-val-false "noignore-df";
ipr2cgen:oper-value-map "true:on";
ipr2cgen:flag;
description
Expand Down

0 comments on commit 7ac2f36

Please sign in to comment.