networktocode / yangify

Library to help parsing/translating YANG models from/to native text/structures
Apache License 2.0
114 stars 24 forks source link

Best method to implement arp configuration #13

Closed raddessi closed 5 years ago

raddessi commented 5 years ago

Hi,

I want to be able to set some minimal arp configuration on interfaces (expiry-time in ietf-arp) but there doesn't appear to be any model for that in openconfig yet, at least from what I've looked at. If I want to use yangify and ntc-rosetta to build switch config does it make more sense to try to use the ietf and openconfig models at the same time or try to build our own augmentations on to openconfig to support just what we need?

The relevant ietf-arp config I would use is something like:

{
  "ietf-interfaces:interfaces": {
      "interface": [
          {
              "name": "Ethernet1",
              "description": "This is Eth1",
              "ietf-ip:ipv4": {
                  "ietf-arp:arp": {
                      "expiry-time": 300
                  }
              }
          }
      ]
  }
}

But that would have to get merged with the openconfig-interfaces:interfaces config for ip addresses/mtu/desc/channel group etc.

  1. Would it even be supported to mix ietf/openconfig models with yangify/rosetta? The examples in docs only use openconfig
  2. What is your recommended approach?

Thank you :)

dbarrosop commented 5 years ago

First, with yangify, you can pick an match as you want, the idea of the Root{Parser, Translator} is that you can combine things as you wish. For instance:

class MyPickAndMixParser(RootParser):
    arp = CustomArpModelParser
    interfaces = OpenconfigIOSInterfacesParser
    vlans = IETFIOSVlanParser

Re rosetta, a few comments:

  1. Worst case, you could follow the same pattern above. You could write your own root object leveraging the parsers and translators from rosetta and add your own.
  2. We have plans for your exact use case, we are going to be opensourcing ntc-models and ARP is actually one of the first things we want to add.
  3. In the long term we may need a plan to make rosetta extensible, I don't know how that will look like yet or what that will mean exactly, my preference here would be to wait for more use cases and check what makes sense.

My recommendation at this point would be to wait a bit so we have the time to opensource the ntc-models and integrate them into rosetta and then we can take this discussion from there

raddessi commented 5 years ago

Nice, I didn't realize you could mix and match in yangify that way.

For now I'll wait and see what you guys put out with ntc-models, it looks like you all have been moving pretty quickly on these projects so far. Thanks

dbarrosop commented 5 years ago

For reference:

https://github.com/networktocode/ntc-yang-models/ https://ntc-yang-models.readthedocs.io/en/latest/

raddessi commented 5 years ago

Ahh, thank you :) I joined the ntc slack as well

jathanism commented 5 years ago

Seems like this is a good opportunity to improve the docs a little?

dbarrosop commented 5 years ago

Is there anything left to do here? Otherwise I will proceed to close it.

raddessi commented 5 years ago

No, I think you can close this one out. Thank you again for all the feedback and work! Have a good week