cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

605
Views
5
Helpful
4
Replies
lweddewer
Contributor

Selecting a NED-ID in a service or an action

Hello,

I want to select a specific ned-id of the Cisco-IOS NED in a service and an action.
Found this pattern:

 

leaf default-ned-id {
    type string;
    tailf:non-strict-leafref {
       path "/ncs:packages/ncs:package/ncs:name";
    }
    must "starts-with(.,'cisco-ios-cli')";
}

This works fine in the service.

 

When using this in input of a action this doesn't work.

 

I've also tryed to find a workaround by using a pattern for the string but it looks like it is not possible to combine string pattern and tailf:non-strict-leafref! Is that "works at designed?"

 

Using NSO 5.2.1.2.

 

Regards

Lothar

4 REPLIES 4
tsiemers1
Beginner

Looks like an open issue with yang 1.1

 

http://svn.tools.ietf.org/svn/wg/netmod/yang-1.1/issues.html#sec-3

 

Can't find if it was ever moved from REVIEW to DONE. I wasn't able to get it to work with action input as well so thinking its still in REVIEW.

gmuloche
Cisco Employee

Hello,

 

Looking at RFCs it looks like it made it to the standard (at least in the RPC section and the Notification section):

YANG 1.0: https://tools.ietf.org/html/rfc6020#section-7.13.2

YANG 1.1: https://tools.ietf.org/html/rfc7950#section-7.14.2

 

The new action sectionhttps://tools.ietf.org/html/rfc7950#section-7.15 uses input/output from the RCP section so similarly I am led to understand that it should be supported.

 

If you look inside your NSO install you can get the man page for ncsc and at the end you have a section about YANG 1.1 support (NSO 5.2.1.2 example below):

user@server# man ncsc
[... truncated...] YANG 1.1 NCS supports YANG 1.1, as defined in RFC 7950, with the following exceptions: o Type empty in unions and in list keys is not supported. o Type leafref in unions are not validated, and treated as a string internally. o anydata is not supported. o The new scoping rules for submodules are not implemented. Specifically, a submodule must still include other submodules in order to access definitions defined there. o The new XPath functions derived-from() and derived-from-or-self() can only be used with literal strings in the second argument. o Leafref paths without prefixes in top-level typedefs are handled as in YANG 1.

I have made a dummy action (NSO 5.2.1.2) to try this out (notice the use of yang-version 1.1 at the top):

 

module must-input-action-1-1 {

  yang-version 1.1;
  namespace "http://example.com/must-input-action-1-1";
  prefix must-input-action-1-1;

  import ietf-inet-types {
    prefix inet;
  }
  import tailf-common {
    prefix tailf;
  }
  import tailf-ncs {
    prefix ncs;
  }

  description
    "Bla bla...";

  revision 2016-01-01 {
    description
      "Initial revision.";
  }

  container action {
    tailf:action double {
      tailf:actionpoint must-input-action-1-1-action;
      input {
        leaf test {
          type string;
          must "starts-with(., 'TEST')";
        }
      }
      output {
        leaf result {
          type string;
        }
      }
    }
  }
}

And when I try it in the CLI:

 

admin@ncs# action double test SOMETHING
Error: 'action double test' (value "SOMETHING"): the 'must' expression "starts-with(., 'TEST')" failed
admin@ncs# action double test TEST
result TEST_TEST

So it seems to be working here..

 

Maybe that can help ?

 

Regards

rogaglia
Cisco Employee

Just adding to this thread, I took the simple-mpls-vpn example where device/name is a leafref to the device name and got this to work in a teamplate:

 

<?if {derived-from-or-self(deref(device)/../ncs:device-type/ncs:cli/ncs:ned-id,'cisco-ios-cli:cisco-ios-cli') ?>

 

This matches any cisco-ios-cli NED.

Now in NSO5.8, a new option was added too " if-ned-id-match" where you can use a regexp.

 

Nabsch
Beginner

Hello ,

 

if you are using NSO 5.4 and later . You can use supported-ned-id. You need to specify list of the  supported-bed-is in the package-meta-data.xml