cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
429
Views
5
Helpful
2
Replies

Yanger showing more output than expected

Muhammad Rafi
Level 1
Level 1

Hi Guys, 

I am wondering why I am getting more output than it should really do when I ran either pyang or yanger, here is the output for yanger but pyang is same. 

root@nso:~/ncs-instance# yanger -f tree packages/loopback-service/src/yang/loopback-service.yang 
module: loopback-service
  +--rw loopback-service* [name]
     +---x check-sync                  
     |  +---w input     
     |  |  +---w outformat?                  outformat4
     |  |  +---w (depth)?
     |  |  |  +--:(deep)
     |  |  |  |  +---w deep?                 empty
     |  |  |  +--:(shallow)
     |  |  |     +---w shallow?              empty
     |  |  +---w suppress-positive-result?   empty
     |  |  +---w (choice-lsa)?
     |  |     +--:(use-lsa)
     |  |     |  +---w use-lsa?              empty
     |  |     +--:(no-lsa)
     |  |        +---w no-lsa?               empty
     |  +--ro output    
     |     +--ro (outformat)?
     |        +--:(in-sync)
     |        |  +--ro in-sync?      boolean
     |        +--:(case-xml)
     |        |  +--ro result-xml
     |        |     +--ro local-node
     |        |     |  +--ro data?   <anyxml>
     |        |     +--ro lsa-node* []
     |        |        +--ro name?   string
     |        |        +--ro data?   <anyxml>
     |        +--:(case-cli)
     |        |  +--ro cli
     |        |     +--ro local-node
     |        |     |  +--ro data?   string
     |        |     +--ro lsa-node* []
     |        |        +--ro name?   string
     |        |        +--ro data?   string
     |        +--:(case-native)
     |           +--ro native
     |              +--ro device* [name]
     |                 +--ro name    string
     |                 +--ro data?   string
     +---x deep-check-sync             
     |  +---w input     
     |  |  +---w outformat?                  outformat-deep-check-sync
     |  |  +---w suppress-positive-result?   empty
     |  |  +---w (choice-lsa)?
     |  |  |  +--:(use-lsa)
     |  |  |  |  +---w use-lsa?              empty
     |  |  |  +--:(no-lsa)
     |  |  |     +---w no-lsa?               empty
     |  |  +---w (wait-for-lock-choice)?
     |  |     +--:(no-wait-for-lock)
     |  |     |  +---w no-wait-for-lock?     empty
     |  |     +--:(wait-for-lock)
     |  |        +---w wait-for-lock!
     |  |           +---w (timeout-choice)?
     |  |              +--:(timeout)
     |  |              |  +---w timeout?    uint32
     |  |              +--:(infinity)
     |  |                 +---w infinity?   empty
     |  +--ro output    
     |     +--ro (outformat)?
     |        +--:(case-xml)
     |        |  +--ro result-xml
     |        |     +--ro local-node
     |        |     |  +--ro data?   <anyxml>
     |        |     +--ro lsa-service* [service-id]
     |        |        +--ro service-id    instance-identifier
     |        |        +--ro data?         <anyxml>
     |        +--:(case-cli)
     |        |  +--ro cli
     |        |     +--ro local-node
     |        |     |  +--ro data?   string
     |        |     +--ro lsa-service* [service-id]
     |        |        +--ro service-id    instance-identifier
     |        |        +--ro data?         string
     |        +--:(case-sync)
     |           +--ro sync-result
     |              +--ro local-node
     |              |  +--ro in-sync?   boolean
     |              +--ro lsa-service* [service-id]
     |                 +--ro service-id    instance-identifier
     |                 +--ro in-sync?      boolean
     +---x re-deploy                   
     |  +---w input     
     |  |  +---w dry-run!
     |  |  |  +---w outformat?   outformat3
     |  |  +---w no-revision-drop?             empty
     |  |  +---w no-networking?                empty
     |  |  +---w (choice-sync-check)?
     |  |  |  +--:(no-overwrite)
     |  |  |  |  +---w no-overwrite?           empty
     |  |  |  +--:(no-out-of-sync-check)
     |  |  |     +---w no-out-of-sync-check?   empty
     |  |  +---w commit-queue!
     |  |  |  +---w tag?            string
     |  |  |  +---w (operation-mode)?
     |  |  |  |  +--:(async)
     |  |  |  |  |  +---w async?    empty
     |  |  |  |  +--:(sync)
     |  |  |  |  |  +---w sync!
     |  |  |  |  |     +---w (timeout-choice)?
     |  |  |  |  |        +--:(timeout)
     |  |  |  |  |        |  +---w timeout?    uint32
     |  |  |  |  |        +--:(infinity)
     |  |  |  |  |           +---w infinity?   empty
     |  |  |  |  +--:(bypass)
     |  |  |  |     +---w bypass?   empty
     |  |  |  +---w block-others?   empty
     |  |  |  +---w lock?           empty
     |  |  |  +---w atomic?         boolean
     |  |  |  +---w error-option?   enumeration
     |  |  |  +---w unlock!
     |  |  |     +---w (choice-unlock-id)?
     |  |  |        +--:(id)
     |  |  |        |  +---w id?    uint64
     |  |  |        +--:(tag)
     |  |  |           +---w tag?   string
     |  |  +---w (choice-lsa)?
     |  |  |  +--:(use-lsa)
     |  |  |  |  +---w use-lsa?                empty
     |  |  |  +--:(no-lsa)
     |  |  |     +---w no-lsa?                 empty
     |  |  +---w wait-device*                  -> /ncs:devices/device/name
     |  |  +---w trace-id?                     string
     |  |  +---w (depth)?
     |  |  |  +--:(deep)
     |  |  |  |  +---w deep?                   empty
     |  |  |  +--:(shallow)
     |  |  |     +---w shallow?                empty
     |  |  +---w reconcile!
     |  |     +---w (c-non-service-config)?
     |  |        +--:(keep-non-service-config)
     |  |        |  +---w keep-non-service-config?      empty
     |  |        +--:(discard-non-service-config)
     |  |           +---w discard-non-service-config?   empty
     |  +--ro output    
     |     +--ro (outformat)?
     |     |  +--:(case-xml)
     |     |  |  +--ro result-xml
     |     |  |     +--ro local-node
     |     |  |     |  +--ro data?   <anyxml>
     |     |  |     +--ro lsa-node* []
     |     |  |        +--ro name?   string
     |     |  |        +--ro data?   <anyxml>
     |     |  +--:(case-cli)
     |     |  |  +--ro cli
     |     |  |     +--ro local-node
     |     |  |     |  +--ro data?   string
     |     |  |     +--ro lsa-node* []
     |     |  |        +--ro name?   string
     |     |  |        +--ro data?   string
     |     |  +--:(case-native)
     |     |     +--ro native
     |     |        +--ro device* [name]
     |     |           +--ro name    string
     |     |           +--ro data?   string
     |     +--ro commit-queue
     |        +--ro id?              -> /ncs:devices/commit-queue/queue-item/id
     |        +--ro status?          enumeration
     |        +--ro failed-device* [name]
     |           +--ro name      -> /ncs:devices/device/name
     |           +--ro reason?   string
     +---x reactive-re-deploy          
     |  +---w input     
     |  |  +---w sync?   empty
     |  +--ro output    
     |     +--ro commit-queue
     |        +--ro id?              -> /ncs:devices/commit-queue/queue-item/id
     |        +--ro status?          enumeration
     |        +--ro failed-device* [name]
     |           +--ro name      -> /ncs:devices/device/name
     |           +--ro reason?   string
     +---x touch                       
     +--ro modified
     |  +--ro devices*        -> /ncs:devices/device/name
     |  +--ro services*       instance-identifier
     |  +--ro lsa-services*   instance-identifier
     +--ro directly-modified
     |  +--ro devices*        -> /ncs:devices/device/name
     |  +--ro services*       instance-identifier
     |  +--ro lsa-services*   instance-identifier
     +---x get-modifications           
     |  +---w input     
     |  |  +---w outformat?       outformat2
     |  |  +---w reverse?         empty
     |  |  +---w (depth)?
     |  |  |  +--:(deep)
     |  |  |  |  +---w deep?      empty
     |  |  |  +--:(shallow)
     |  |  |     +---w shallow?   empty
     |  |  +---w (choice-lsa)?
     |  |     +--:(use-lsa)
     |  |     |  +---w use-lsa?   empty
     |  |     +--:(no-lsa)
     |  |        +---w no-lsa?    empty
     |  +--ro output    
     |     +--ro (outformat)?
     |        +--:(case-xml)
     |        |  +--ro result-xml
     |        |     +--ro local-node
     |        |     |  +--ro data?   <anyxml>
     |        |     +--ro lsa-service* [service-id]
     |        |        +--ro service-id    instance-identifier
     |        |        +--ro data?         <anyxml>
     |        +--:(case-cli)
     |           +--ro cli
     |              +--ro local-node
     |              |  +--ro data?   string
     |              +--ro lsa-service* [service-id]
     |                 +--ro service-id    instance-identifier
     |                 +--ro data?         string
     o--ro device-list*                string
     +---x un-deploy                   
     |  +---w input     
     |  |  +---w dry-run!
     |  |  |  +---w outformat?   outformat3
     |  |  +---w no-revision-drop?             empty
     |  |  +---w no-networking?                empty
     |  |  +---w (choice-sync-check)?
     |  |  |  +--:(no-overwrite)
     |  |  |  |  +---w no-overwrite?           empty
     |  |  |  +--:(no-out-of-sync-check)
     |  |  |     +---w no-out-of-sync-check?   empty
     |  |  +---w commit-queue!
     |  |  |  +---w tag?            string
     |  |  |  +---w (operation-mode)?
     |  |  |  |  +--:(async)
     |  |  |  |  |  +---w async?    empty
     |  |  |  |  +--:(sync)
     |  |  |  |  |  +---w sync!
     |  |  |  |  |     +---w (timeout-choice)?
     |  |  |  |  |        +--:(timeout)
     |  |  |  |  |        |  +---w timeout?    uint32
     |  |  |  |  |        +--:(infinity)
     |  |  |  |  |           +---w infinity?   empty
     |  |  |  |  +--:(bypass)
     |  |  |  |     +---w bypass?   empty
     |  |  |  +---w block-others?   empty
     |  |  |  +---w lock?           empty
     |  |  |  +---w atomic?         boolean
     |  |  |  +---w error-option?   enumeration
     |  |  |  +---w unlock!
     |  |  |     +---w (choice-unlock-id)?
     |  |  |        +--:(id)
     |  |  |        |  +---w id?    uint64
     |  |  |        +--:(tag)
     |  |  |           +---w tag?   string
     |  |  +---w (choice-lsa)?
     |  |  |  +--:(use-lsa)
     |  |  |  |  +---w use-lsa?                empty
     |  |  |  +--:(no-lsa)
     |  |  |     +---w no-lsa?                 empty
     |  |  +---w wait-device*                  -> /ncs:devices/device/name
     |  |  +---w trace-id?                     string
     |  |  +---w ignore-refcount?              empty
     |  +--ro output    
     |     +--ro (outformat)?
     |     |  +--:(case-xml)
     |     |  |  +--ro result-xml
     |     |  |     +--ro local-node
     |     |  |     |  +--ro data?   <anyxml>
     |     |  |     +--ro lsa-node* []
     |     |  |        +--ro name?   string
     |     |  |        +--ro data?   <anyxml>
     |     |  +--:(case-cli)
     |     |  |  +--ro cli
     |     |  |     +--ro local-node
     |     |  |     |  +--ro data?   string
     |     |  |     +--ro lsa-node* []
     |     |  |        +--ro name?   string
     |     |  |        +--ro data?   string
     |     |  +--:(case-native)
     |     |     +--ro native
     |     |        +--ro device* [name]
     |     |           +--ro name    string
     |     |           +--ro data?   string
     |     +--ro commit-queue
     |        +--ro id?              -> /ncs:devices/commit-queue/queue-item/id
     |        +--ro status?          enumeration
     |        +--ro failed-device* [name]
     |           +--ro name      -> /ncs:devices/device/name
     |           +--ro reason?   string
     +--ro used-by-customer-service*   -> /ncs:services/customer-service/object-id
     +--ro commit-queue
     |  +---x clear         
     |  +--ro queue-item* [id]
     |     +--ro id                         uint64
     |     +--ro status?                    enumeration
     |     +--ro cleared-by-admin?          empty
     |     +--ro no-of-impacted-services?   uint32
     |     +--ro failed-device* [name]
     |     |  +--ro name           -> /ncs:devices/device/name
     |     |  +--ro time?          yang:date-and-time
     |     |  +--ro config-data?   string
     |     |  +--ro error?         string
     |     +---x admin-clear                
     |     +---x delete                     
     +--rw private
     |  +--rw diff-set?               binary
     |  +--rw forward-diff-set?       binary
     |  +--rw device-list*            string
     |  +--rw ned-id-list*            string
     |  +--rw service-list*           instance-identifier
     |  +--rw lsa-service-list*       yang:xpath1.0
     |  +--rw property-list
     |  |  +--rw property* [name]
     |  |     +--rw name     string
     |  |     +--rw value?   string
     |  +--rw re-deploy-counter?      int32
     |  +--rw latest-commit-params?   binary
     |  +--rw latest-u-info?          binary
     +--ro plan-location?              instance-identifier
     +--ro log
     |  +---x purge        
     |  |  +---w input     
     |  |  |  +---w type?         log-entry-t
     |  |  |  +---w level?        log-entry-level-t
     |  |  |  +---w older-than!
     |  |  |     +---w (age-spec)?
     |  |  |        +--:(seconds)
     |  |  |        |  +---w seconds?   uint16
     |  |  |        +--:(minutes)
     |  |  |        |  +---w minutes?   uint16
     |  |  |        +--:(hours)
     |  |  |        |  +---w hours?     uint16
     |  |  |        +--:(days)
     |  |  |        |  +---w days?      uint16
     |  |  |        +--:(weeks)
     |  |  |           +---w weeks?     uint16
     |  |  +--ro output    
     |  |     +--ro purged-log-entries?   uint16
     |  +--ro log-entry* [when]
     |     +--ro when       yang:date-and-time
     |     +--ro type       log-entry-t
     |     +--ro level      log-entry-level-t
     |     +--ro message?   string
     +--rw name                        string
     +--rw device*                     -> /ncs:devices/device/name
     +--rw intf-name?                  uint16
     +--rw ip-addr?                    inet:ipv4-address
     +--rw net-mask?                   inet:ipv4-address
     +--rw enabled?                    boolean

Here is my yang model 

root@nso:~/ncs-instance# cat  packages/loopback-service/src/yang/loopback-service.yang 
module loopback-service {
  namespace "http://com/example/loopbackservice";
  prefix loopback-service;

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

  organization
    "Muhammad Rafi";
  contact
    "murafi@cisco.com";
  description
    "This yang model for the Loopback interface Configuration";
  
  revision 2022-06-03 {
      description
        "Initial revision.";
  }

  list loopback-service {
    key name;

    uses ncs:service-data;
    ncs:servicepoint "loopback-service";

    leaf name {
      type string;
    }

    // may replace this with other ways of refering to the devices.
    leaf-list device {
      type leafref {
        path "/ncs:devices/ncs:device/ncs:name";
      }
    }

    leaf intf-name {
      tailf:info " loopback interface name, e.g 100";
      default "0";
      type uint16;
    }

    leaf ip-addr {
      tailf:info "ipv4 address, e.g 10.0.0.1";
      type inet:ipv4-address;
    }

    leaf net-mask {
      tailf:info "ipv4 subnet mask, e.g 255.255.255.0";
      type inet:ipv4-address;
    }

    leaf enabled {
      tailf:info "interface status, enabled by default";
      type boolean;
      default "true";
    }
  }
}

 

2 Replies 2

Muhammad Rafi
Level 1
Level 1


 Just to add, I tried to run ds and this is output I get, I am still trying to understand why these errors, as I am still  a beginner  in NSO world, so wondering if someone can help, sorry 2 questions in one thread.

root@nso:~/ncs-instance# yang2dsdl -v packages/loopback-service/templates/loopback-service-template.xml packages/loopback-service/

load-dir/              package-meta-data.xml  src/                   templates/             test/

root@nso:~/ncs-instance# yang2dsdl -v packages/loopback-service/templates/loopback-service-template.xml packages/loopback-service/src/yang/loopback-service.yang 

/root/nso-5.5/src/ncs/yang/ietf-yang-schema-mount.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/ietf-yang-schema-mount.yang:9: error: unexpected keyword "reference"

/root/nso-5.5/src/ncs/yang/ietf-yang-schema-mount.yang:15: error: unexpected keyword "reference"

/root/nso-5.5/src/ncs/yang/tailf-ncs-cluster.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-common.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-compliance.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-customers.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-devices.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-devices.yang:4069: error: XPath function "derived-from-or-self" is not defined in the XPath context

/root/nso-5.5/src/ncs/yang/tailf-ncs-high-availability.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-java-vm.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-log.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-packages.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-plan.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-python-vm.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-service-progress-monitoring.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-services.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-smart-license.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-snmp-notification-receiver.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-software.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs-ssh.yang:2: error: bad value "1.1" (should be version)

/root/nso-5.5/src/ncs/yang/tailf-ncs.yang:2: error: bad value "1.1" (should be version)

DSDL translation needs a valid module

snovello
Cisco Employee
Cisco Employee

This looks about right, most of the output is from the 'uses ncs:service-data' which adds all the extra information and actions that an NSO service always exposes. I can't help on the yang2dsdl question and generally I would keep different questions separate.