okda-networks / iproute2-sysrepo Goto Github PK
View Code? Open in Web Editor NEWYANG-based iproute2 integrated with sysrepo datastore.
License: GNU General Public License v3.0
YANG-based iproute2 integrated with sysrepo datastore.
License: GNU General Public License v3.0
this issue address the dependency for same starcmd,
when creating bond0
and eth1
which has master bond0
.
in the change lyd_node
the eth1 might come before the bond0
, which will cause the cmd to fail as bond0
still not created.
Config change on multiple modules still not tested and most likely not working.
in a corner case, the nested dependency might fail on delete in inter-module dependency scenario.
conditions:
result:
do_cmd()
fail:ip_sr_config_change_cb_apply: executing command: ip link delete name eth1
ip_sr_config_change_cb_apply: executing command: ip link delete name eth2 type bond_slave
ip_sr_config_change_cb_apply: executing command: ip nexthop del id 11
RTNETLINK answers: No such file or directory
this need a fixed for the dependencies, the dependency is not properly working for none list key leafref.
veth links need special handling for add and delete as they are create with single command and deleted by single command,
if we create veth10
--> veth20
using the command:
ip -n red link add veth10 type veth peer name veth20
we will have the device
leaf set to the peer link, this create circular dependency issue in the yang module.
if we try to delete veth10
for instance, it will complain that veth20
has leafref to the veth you are trying to delete.
if we try to delete both veths iproute2-sysrepo
will crash due to max recurision depth at add_node_dependencies()
.
** suggested solution:
is to have veth link as separate list inside links
container, and set the device
type to string instead of leafref
.
list route {
ipr2cgen:cmd-add "ip route add";
ipr2cgen:cmd-update "ip route replace";
ipr2cgen:cmd-delete "ip route del";
ipr2cgen:cmd-start;
ipr2cgen:include-all-on-update;
ipr2cgen:oper-cmd "ip -4 route list table all";
ipr2cgen:oper-stop-if "{\"table\": [\"local\"]}"; <-----
to reproduce:
iproute2-sysrepo
sr_subscribe_operational_pull: Successfully subscribed to module (iproute2-ip-rule) operational data pull requests
sr_subscribe_operational_pull: Successfully subscribed to module (iproute2-ip-neighbor) operational data pull requests
sr_subscribe_operational_pull: Successfully subscribed to module (iproute2-tc-qdisc) operational data pull requests
sr_subscribe_operational_pull: Successfully subscribed to module (iproute2-tc-filter) operational data pull requests
^C
Sigint called, exiting...
libyang[1]: String "erspan0" not freed from the dictionary, refcount 8
libyang[1]: String "virbr0" not freed from the dictionary, refcount 12
libyang[1]: String "1" not freed from the dictionary, refcount 6
libyang[1]: String "lo" not freed from the dictionary, refcount 8
libyang[1]: String "red" not freed from the dictionary, refcount 4
libyang[1]: String "pqp" not freed from the dictionary, refcount 8
libyang[1]: String "veth10" not freed from the dictionary, refcount 8
libyang[1]: String "veth20" not freed from the dictionary, refcount 8
libyang[1]: String "uu" not freed from the dictionary, refcount 8
libyang[1]: String "gns3tap1-0" not freed from the dictionary, refcount 8
libyang[1]: String "wlp7s0" not freed from the dictionary, refcount 8
libyang[1]: String "gns3tap2-0" not freed from the dictionary, refcount 8
libyang[1]: String "docker0" not freed from the dictionary, refcount 12
libyang[1]: String "enp8s0" not freed from the dictionary, refcount 8
libyang[1]: String "gretap0" not freed from the dictionary, refcount 8
libyang[1]: String "gns3tap0-0" not freed from the dictionary, refcount 8
libyang[1]: String "iii" not freed from the dictionary, refcount 8
load_linux_running_config: Storing loaded data to sysrepo running datastore.
libyang[0]: Mandatory node "type" instance does not exist. (path: Data location "/iproute2-ip-link:links/link[name='lo']".)
when iproute2 exit()
we should set the ret to EXIT_FAILURE
and jump to if (ret != EXIT_SUCCESS)
for (int i = 0; ipr2_cmds[i] != NULL; i++) {
fprintf(stdout, "%s: executing command: ", __func__);
print_cmd_line(ipr2_cmds[i]->argc, ipr2_cmds[i]->argv);
jump_set = 1;
if (setjmp(jbuf)) {
// iproute2 exited, reset jump, and set exit callback.
free_cmds_info(ipr2_cmds);
atexit(exit_cb);
return SR_ERR_CALLBACK_FAILED; // <------- here we return on exit.
}
ret = do_cmd(ipr2_cmds[i]->argc, ipr2_cmds[i]->argv);
if (ret != EXIT_SUCCESS) {
fprintf(stderr, "%s: iproute2 command failed, cmd = ", __func__);
print_cmd_line(ipr2_cmds[i]->argc, ipr2_cmds[i]->argv);
// rollback on failure.
for (i--; i >= 0; i--) {
if (setjmp(jbuf)) {
// rollback cmd failed, continue with the reset rollback cmds.
atexit(exit_cb);
continue;
}
fprintf(stderr, "%s: executing rollback cmd: ", __func__);
print_cmd_line(ipr2_cmds[i]->rollback_argc, ipr2_cmds[i]->rollback_argv);
do_cmd(ipr2_cmds[i]->rollback_argc, ipr2_cmds[i]->rollback_argv);
}
ret = SR_ERR_CALLBACK_FAILED;
break;
}
}
On startup iproute2-sysrepo should check enable disabled features based on the installed linux modules.
For example: vrf, bonding, xfrm, tunnel .... etc
On iproute2-sysrepo app startup we need to preform the following:
1- load iproute2 running config to sr_running_ds (translate iproute2 operational data to sr_running_ds).
2- apply sr_startup_ds config to iproute2 (sr_startup_ds config gets copied to sr_running_ds at system boot).
this issue address the dependency for same starcmd,
there are two cases of deleting object will break iproute2-sysrepo:
vlan10@eth0
, and we delete eth0, iproute2 will automatically delete vlan10
, however on sysrepo it's still there.bond0
and eth1
is attached to that bond, iproute2 allows us to delete the bond0 even though it has eth1
member.bond0
deleted before eth1
, example:ip link del bond0
ip link del eth1
<failed iproute2 cmd>
-> any failed cmd which will trigger the rollback.ip link add eth1 master bond0
--> this will failip link add bond0 type bond
-> will success.(+) change request received:
<nexthops xmlns="urn:okda:iproute2:ip:nexthop" xmlns:yang="urn:ietf:params:xml:ns:yang:1" yang:operation="none">
<nexthop yang:operation="create">
<id>6666</id>
<group yang:operation="create">
<nh yang:operation="create">
<id>10199</id>
<weight>4</weight>
</nh>
<nh yang:operation="create">
<id>10191</id>
<weight>4</weight>
</nh>
</group>
<fdb yang:operation="create">true</fdb>
</nexthop>
</nexthops>
ip_sr_config_change_cb_apply: executing command: ip nexthop add id 6666 group 10199,4/10191,4 type mpath fdb
(+) change request received:
<nexthops xmlns="urn:okda:iproute2:ip:nexthop" xmlns:yang="urn:ietf:params:xml:ns:yang:1" yang:operation="none">
<nexthop yang:operation="none">
<id>6666</id>
<group yang:operation="none">
<nh yang:operation="delete">
<id>10199</id>
<weight>4</weight>
</nh>
</group>
</nexthop>
</nexthops>
ip_sr_config_change_cb_apply: executing command: ip nexthop replace id 6666 type mpath fdb
Error: Invalid address family.
ip_sr_config_change_cb_apply: iproute2 command failed, cmd = ip nexthop replace id 6666 type mpath fdb
When starting iproute2-sysrepo and running ds is empty, it loads the linux config successfully however there is some lyd_node not getting freed:
^C
Sigint called, exiting...
libyang[1]: String "br1" not freed from the dictionary, refcount 2
libyang[1]: String "testIf1" not freed from the dictionary, refcount 4
libyang[1]: String "enp0s3" not freed from the dictionary, refcount 4
libyang[1]: String "veth1" not freed from the dictionary, refcount 4
libyang[1]: String "lo" not freed from the dictionary, refcount 4
libyang[1]: String "docker0" not freed from the dictionary, refcount 2
libyang[1]: String "veth0" not freed from the dictionary, refcount 4
libyang[1]: String "testIf0" not freed from the dictionary, refcount 4
This only happens when running ds is empty (meaning next time you run the problem won't be seen)
Need to investigate further.
instead of
list ip {
}
container ip {
list address {
}
}
rollback support when multi modules changed.
currently the code defines a single command per-yang module, this limits us from using multiple show commands in the same yang module.
Adding the show commands at desired yang schema location will give us more flexibility to get the specific operational data required by that schema location.
libyang[0]: Invalid union value "br0" - no matching subtype found:
libyang 2 - leafref, version 1: Invalid leafref value "br0" - no target instance "/iplink:links/iplink:link/iplink:name" with the same value.
libyang 2 - leafref, version 1: Invalid leafref value "br0" - no target instance "/iplink:links/iplink:bridge/iplink:name" with the same value.
(path: Data location "/iproute2-ip-link:links/link[name='br-slave']/master".)
load_linux_running_config: Error by sr_apply_changes: Validation failed.
this will crash iproute2-sysrepo
process.
ipr2cgen:oper-stop-if "{\"info_kind\": [\"vti\", \"vlan\", \"vrf\"], \"bridge\"]}";
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.