Giter VIP home page Giter VIP logo

iproute2-sysrepo's People

Contributors

adaraiseh avatar ali-aqrabawi avatar vjardin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

iproute2-sysrepo's Issues

leafref dependency: iproute2 create dependency

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.

TODO: nested dependency might fail on delete.

in a corner case, the nested dependency might fail on delete in inter-module dependency scenario.

conditions:

  1. node x in module 1 has leafref to node y in same module.
  2. node z in module 2 has leafref to node x.
  3. change node of module 1 processed before module 2.
  4. operation is delete.

result:

  • node x will be added before node z, while node z should be added before.
  • in case of nexthop, if the dev that the nexthop is referencing is delete, iproute2 (or linux) will delete the nexthop as well.
  • this will result in config change failure, and when the iproute2-sysrepo try to delete the nexthop the 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

[BUG] veth links need special handling for add and delete

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.

[BUG] libyang data is not freed from after config load if runnings ds is empty.

to reproduce:

  • delete everything from sysrepo running ds.
  • run 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


rollback: rollback is not triggered when iproute2 exit()

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;
        }
    }

add support for loading startup config

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).

leafref dependency: handle ipuorte2 dependency deletion

this issue address the dependency for same starcmd,

there are two cases of deleting object will break iproute2-sysrepo:

  1. if we have vlan10@eth0 , and we delete eth0, iproute2 will automatically delete vlan10, however on sysrepo it's still there.
  2. if we have bond0 and eth1 is attached to that bond, iproute2 allows us to delete the bond0 even though it has eth1 member.
    this will break the rollback if bond0 deleted before eth1, example:
  • change cmd: ip link del bond0
  • change cmd: ip link del eth1
  • change cmd: <failed iproute2 cmd> -> any failed cmd which will trigger the rollback.
  • rollback cmd: ip link add eth1 master bond0 --> this will fail
  • rollback cmd: ip link add bond0 type bond -> will success.

[BUG] ip nexthop update fail.

(+) 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 

oper: memory leak issue only when sysrepo running ds is empty

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.

oper: config_load should handle dependencies

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.