cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
128
Views
0
Helpful
2
Replies
Highlighted
Beginner

NSO service not applied on netsim device

Hi everyone, I have the following problem:

I created a simple loopback-service to get myself familiar with NSO. I created the necessary YANG and XML files (see below). I compiled the YANG file, and reloaded the packages in the NSO CLI, so there shouldn't be a problem on that side. My device is a simple ios device which I created with netsim. However when I apply my loopback-service to that device and then do a "commit dry-run outformat native", the result is empty, which means the configuration is not going to be applied correctly. After commiting, I can't see the configured Loopback in the running-config of the device.

 

Here the YANG file:

 

module loopback-service {

  namespace "http://com/example/loopbackservice";

  prefix loopback-service;

 

  import ietf-inet-types {

    prefix inet;

  }

  import tailf-ncs {

    prefix ncs;

  }

 

  list loopback-service {

    key device;

 

    uses ncs:service-data;

    ncs:servicepoint "loopback-service";

    

    leaf device {

      type leafref {

        path "/ncs:devices/ncs:device/ncs:name";

       }

     }

        

    list Loopbacks {

      key loid;

          

      leaf loid {

        type uint32;

        description "Loopback Interface number";

      }

         

      leaf vrfname {

        type string;

        description "VRF Name";

      }

        

      leaf ipadd {

        type inet:ipv4-address;

        description "IP-Address";

        mandatory true;

      }

    }

  }

}

 
And here the XML file:
 

<config-template xmlns="http://tail-f.com/ns/config/1.0"

                 servicepoint="loopback-service">

  <devices xmlns="http://tail-f.com/ns/ncs">

    <device>

      <!--

          Select the devices from some data structure in the service

          model. In this skeleton the devices are specified in a leaf-list.

          Select all devices in that leaf-list:

      -->

      <name>{/device}</name>

      <config>

      <interface xmlns="urn:ios">

                     <Loopback>

                       <name>{/loid}</name>

                       <ip-vrf>

                         <ip>

                           <vrf>

                             <forwarding>{/vrfname}</forwarding>

                           </vrf>

                         </ip>

                       </ip-vrf>

                       <ip>

                         <address>

                           <primary>

                             <address>{/ipadd}</address>

                             <mask>255.255.255.255</mask>

                           </primary>

                         </address>

                       </ip>

                     </Loopback>

                   </interface>

            </config>

    </device>

  </devices>

</config-template>

 
I apply the service to my device (called c0) with the following command:
 

loopback-service c0 Loopbacks 123 ipadd 1.2.3.4 vrfname v-private

 

And the resulting dry-run outformat native is empty; the xml outformat looks like this:

 

result-xml {

    local-node {

        data <loopback-service xmlns="http://com/example/loopbackservice">

               <device>c0</device>

               <Loopbacks>

                 <loid>123</loid>

                 <vrfname>v-private</vrfname>

                 <ipadd>1.2.3.4</ipadd>

               </Loopbacks>

             </loopback-service>

    }

}

 

What am I missing? Why is the service not applied to my device?

 

Any help would be greatly appreciated, thanks in advance,

 

Robin

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Found already a solution, the problem was in my xml-file. The variables "loid", "ipadd" and "vrfname" are inside the list "Loopbacks" (see yang file), and when I want to reference those leafs in the xml file, I need to specify that list as well. For example, in the xml file I need to reference the leaf "loid" with /Loopbacks/loid and not only with /loid.

View solution in original post

2 REPLIES 2
Highlighted
Cisco Employee

I think you are missing to set a device in your loopback-service, you need to say which devices you want it applied ot.
Highlighted

Found already a solution, the problem was in my xml-file. The variables "loid", "ipadd" and "vrfname" are inside the list "Loopbacks" (see yang file), and when I want to reference those leafs in the xml file, I need to specify that list as well. For example, in the xml file I need to reference the leaf "loid" with /Loopbacks/loid and not only with /loid.

View solution in original post