Commit d234a754 authored by carignani's avatar carignani
Browse files

yang validations examples

parent d7741584
Loading
Loading
Loading
Loading

test/yang/a.yang

0 → 100644
+40 −0
Original line number Diff line number Diff line
module a {
  namespace "urn:a";
  prefix a;

  /*
   * Typedefs
   *   with indented line
   */

  typedef foo {
    // what?
    type string;
  }

  // bar

  typedef bar {
    /* version
       1
    */
    /* version
         2
    */
    /* version
     3
    */
    /* version
     4 */
    type int32;
  }

  /* single line */

  container x {
    // the container is y
    container y;
    container bar;
  }

}
 No newline at end of file

test/yang/b.yang

0 → 100644
+60 −0
Original line number Diff line number Diff line

module b {
  namespace "urn:a";
  prefix b;

  organization "ETSI";
  contact "my@mail.com";

  description
    "Something";
  revision 2020-01-20 {
    description "ciao";
     reference "EVC Ethernet Services Definitions YANG Modules
                              (MEF XX), TBD";
  }

  /*
   * Typedefs
   *   with indented line
   */

  typedef foo {
    // what?
    type string;
    description "ciao";
  }

  // bar

  typedef bar {

    /* version
       1
    */
    /* version
         2
    */
    /* version
     3
    */
    /* version
     4 */
    type int32;
    description "lol";
  }

  /* single line */

  container x {
    // the container is y
    description "ok";
    container y {
      description "ok";
    }
    container bar {
      description "ok";
    }
  }

}
+5 −0
Original line number Diff line number Diff line
#!/bin/bash

docker run --rm -v $(pwd)/models:/yang hellt/pyang "/bin/sh" -c 'pyang --strict -p . a.yang' ; echo $?
docker run --rm -v $(pwd)/models:/yang hellt/pyang "/bin/sh" -c 'pyang --lint -p . b.yang' ; echo $?