cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
33
Views
1
Helpful
2
Replies
Cisco Employee

How to cope with interface name start with a digital in YANG?

 

Hi, Experts

 

 

We got a request from a customer to test NSO to provision Huawei device.

 

An odd part of Huawei config is it names TenGigaEthernet interface with ‘10GE<x/x/x/x>’ , like below.

 

 

interface 10GE1/1/0/0

 

eth-trunk 10

 

device transceiver 10GBASE-FIBER

 

 

As in huawei-vrp NED, the interface container identifies the kind of the interface with a list data type as the below snippet shows.

 

But according to my understanding, YANG should not allow a list with a name start with a digital. So how can I write the YANG model to support this kind of interface?

 

 

container interface {

 

        presence "In NCS this node is optional";

 

        tailf:info "Specify the interface configuration view";

 

 

        // interface Aux *

 

        list Aux {

 

            tailf:info "Aux interface";

 

            min-elements 0;

 

            max-elements 1;

 

            tailf:cli-full-command;

 

            tailf:cli-allow-join-with-key {

 

                tailf:cli-display-joined;

 

            }

 

            tailf:callpoint interface-remove-hook { tailf:set-hook node; }

 

            key name;

 

 

            leaf name {

 

                tailf:cli-full-command;

 

                type string {

 

                    pattern "0/0/1";

 

                    tailf:info "<0-0>;;Aux interface slot number";

 

                }

 

            }

 

 

        // interface  Eth-Trunk *

 

        list Eth-Trunk {

 

}

 

}

 

 

 

Thanks in advance.

 

 

Best regards.

 

 

 

He Chang /

 

2 REPLIES 2
Highlighted
Cisco Employee

Re: How to cope with interface name start with a digital in YANG?

 

Hi He Chang,

 

 

That seems to be the case:

 

     typedef yang-identifier {
       type string {
         length "1..max";
         pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
         pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
       }
       description
         "A YANG identifier string as defined by the 'identifier'
          rule in Section 12 of RFC 6020.  An identifier must
          start with an alphabetic character or an underscore
          followed by an arbitrary sequence of alphabetic or
          numeric characters, underscores, hyphens, or dots.
 
          A YANG identifier MUST NOT start with any possible
          combination of the lowercase or uppercase character
          sequence 'xml'.";
       reference
         "RFC 6020: YANG - A Data Modeling Language for the Network
                    Configuration Protocol (NETCONF)";
     }

 

 

You will have to get a ticket raised to investigate this. I see two ways around it:

 

  1. We use a proper yang-identifier and then in the NED java code we search/replace it before sending to the device.
  2. Introduce some new annotation which can take an encoded yang-identifier and the CLI engine can do an automatic conversion towards the device.

  

 

Either way, the NED engineer would need to evaluate the best way forward.

 

 

Thanks,

 

  1. Bilal.

 

Highlighted
Cisco Employee

Re: How to cope with interface name start with a digital in YANG?

 

Bilal, thanks for your reply.

 

 

We will investigate on the tricks you suggest.

 

 

Regarding the second suggestion about tail-f annotation, is it possible for us to develop new annotation?

 

I am curious that the annotation is inside NSO or belong to an NED?

 

 

Best regards.

 

 

 

He Chang /

 

This widget could not be displayed.