napalm-automation / napalm-yang

Bindings for napalm based on YANG models
Apache License 2.0
54 stars 44 forks source link

Junos Subinterfaces issue #171

Closed rdpravin1895 closed 5 years ago

rdpravin1895 commented 5 years ago

We are trying to validate the junos interfaces napalm-yang config data with the openconfig-interfaces yang, but faced some issues when doing so. Junos openconfig-interfaces parser for config data has the following structure:

            subinterface:
                _process:
                    - path: "unit"
                      key: name
                index:
                    _process: unnecessary
                config:
                    _process: unnecessary
                    index:
                        _process: not_implemented
                    name:
                        _process:
                            - pre: "{{ subinterface_key }}"
                    enabled:
                        _process:
                            - path: "disable"
                              present: no
                    description:
                        _process:
                            - path: description

But according to the openconfig-interfaces yang, there is no "name" key inside the config part of subinterface list.

grouping interface-common-config {

    leaf description {
      type string;
      reference
        "RFC 2863: The Interfaces Group MIB - ifAlias";
    }

    leaf enabled {
      type boolean;
      default "true";
      reference
        "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
    }

}

grouping subinterfaces-config {
    description
      "Configuration data for subinterfaces";

    leaf index {
      type uint32;
      default 0;
    }
    uses interface-common-config;
}

list subinterface {
        key "index";

        description
          "The list of subinterfaces (logical interfaces) associated
          with a physical interface";

        leaf index {
          type leafref {
            path "../config/index";
          }
          description
            "The index number of the subinterface -- used to address
            the logical interface";
        }

        container config {
          description
            "Configurable items at the subinterface level";
          oc-ext:telemetry-on-change;

          uses subinterfaces-config;
         }
}

The key "name" is present only in the operational data. Due to this, the data validation fails. Should this be fixed?

dbarrosop commented 5 years ago

Unfortunately napalm-yang is using an older revision of the model.

In addition, I don't have the cycles to keep maintaining this project but if someone wants to step in and fork the project I will gladly hand it over. Otherwise, I'd suggest tuning in into some of the work networktocode is releasing as it overlaps with this project (which I also developed).

https://www.networktocode.com/blog/post/open-source-model-driven-network-programmability/ https://www.networktocode.com/blog/post/yangify-is-released/

dbarrosop commented 5 years ago

Unfortunately I don't have the cycles to keep maintaining this project so as of now it's officially abandoned. If someone wants to fork the project and maintain it don't hesitate to contact me to add a link to the fork and direct existing and new users to the new fork. However, I'd recommend checking the following alternative:

Yangify has a cleaner interface that is easier to maintain and happens to be orders of magnitude faster and also more memory efficient.

If you are an existing user of napalm-yang and are worried about this announcement and/or want help migrating to some other project don't hesitate to contact me.