<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: yanger: Correct formatting of swagger format? in NSO Developer Hub Discussions</title>
    <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yanger-correct-formatting-of-swagger-format/m-p/3918271#M4237</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you are augmenting the /ncs:services container in your model so you need to get the swagger output of this module to see your service.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is working using a package test:&lt;/P&gt;
&lt;PRE&gt;yanger --swagger-path-filter=/data/tailf-ncs-services:services/test:test --format=swagger -t expand --output=/tmp/testservice.swagger --swagger-host 127.0.0.1:8080  /var/nso-5.2.0.3/src/ncs/yang/tailf-ncs.yang /path/to/file/test.yang&lt;/PRE&gt;
&lt;P&gt;(Note with the current version of yanger - using yanger 1.0 coming with NSO 5.2.0.3 here this works for me because I don't have any "data" in my augmenting module as swagger currently accept only one data module for swagger plugin)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My package yang model looks like:&lt;/P&gt;
&lt;PRE&gt;module test {

  namespace "http://example.com/test";
  prefix test;

  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.";
  }

  augment "/ncs:services" {
    list test {
      description "This is an RFS skeleton service";

      key name;
      leaf name {
        tailf:info "Unique service id";
        tailf:cli-allow-range;
        type string;
      }

      uses ncs:service-data;
      ncs:servicepoint test-servicepoint;

      // may replace this with other ways of refering to the devices.
      leaf-list device {
        type leafref {
          path "/ncs:devices/ncs:device/ncs:name";
        }
      }

      // replace with your own stuff here
      leaf dummy {
        type inet:ipv4-address;
      }
    }
  }
}&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Sep 2019 15:43:07 GMT</pubDate>
    <dc:creator>gmuloche</dc:creator>
    <dc:date>2019-09-03T15:43:07Z</dc:date>
    <item>
      <title>yanger: Correct formatting of swagger format?</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yanger-correct-formatting-of-swagger-format/m-p/3917964#M4235</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to generate a swagger api documentation based on a ncs service with &lt;EM&gt;yanger.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to interpret the swagger output? Is this the correct output?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot find any information about the ncs service inside the swagger output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YANG model:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;module: testservice

  augment /ncs:services:
    +--rw testservice* [infra-type infra-location]
       +---x check-sync
       |  +---w input
       |  |  +---w outformat?                  outformat4
       |  |  +---w (depth)?
       |  |  |  +--:(deep)

[Omitted output]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Command:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;yanger --format=swagger --output=/tmp/testservice.swagger -t expand --swagger-host 127.0.0.1:8080 --swagger-basepath /restconf /var/opt/ncs/packages/testservice/src/yang/testservice.yang&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot.PNG" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/44202i71561D632977B93C/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot.PNG" alt="screenshot.PNG" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Common information:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;$ ncs --version
4.7.2.1
$ yanger --version
yanger 1.0&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 07:24:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/yanger-correct-formatting-of-swagger-format/m-p/3917964#M4235</guid>
      <dc:creator>DTtb</dc:creator>
      <dc:date>2019-09-03T07:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: yanger: Correct formatting of swagger format?</title>
      <link>https://community.cisco.com/t5/nso-developer-hub-discussions/yanger-correct-formatting-of-swagger-format/m-p/3918271#M4237</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you are augmenting the /ncs:services container in your model so you need to get the swagger output of this module to see your service.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is working using a package test:&lt;/P&gt;
&lt;PRE&gt;yanger --swagger-path-filter=/data/tailf-ncs-services:services/test:test --format=swagger -t expand --output=/tmp/testservice.swagger --swagger-host 127.0.0.1:8080  /var/nso-5.2.0.3/src/ncs/yang/tailf-ncs.yang /path/to/file/test.yang&lt;/PRE&gt;
&lt;P&gt;(Note with the current version of yanger - using yanger 1.0 coming with NSO 5.2.0.3 here this works for me because I don't have any "data" in my augmenting module as swagger currently accept only one data module for swagger plugin)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My package yang model looks like:&lt;/P&gt;
&lt;PRE&gt;module test {

  namespace "http://example.com/test";
  prefix test;

  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.";
  }

  augment "/ncs:services" {
    list test {
      description "This is an RFS skeleton service";

      key name;
      leaf name {
        tailf:info "Unique service id";
        tailf:cli-allow-range;
        type string;
      }

      uses ncs:service-data;
      ncs:servicepoint test-servicepoint;

      // may replace this with other ways of refering to the devices.
      leaf-list device {
        type leafref {
          path "/ncs:devices/ncs:device/ncs:name";
        }
      }

      // replace with your own stuff here
      leaf dummy {
        type inet:ipv4-address;
      }
    }
  }
}&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 15:43:07 GMT</pubDate>
      <guid>https://community.cisco.com/t5/nso-developer-hub-discussions/yanger-correct-formatting-of-swagger-format/m-p/3918271#M4237</guid>
      <dc:creator>gmuloche</dc:creator>
      <dc:date>2019-09-03T15:43:07Z</dc:date>
    </item>
  </channel>
</rss>

