Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. syntax/semantics processing of the request/response being exchanged.
     
  2. business logic to compute the request.

...

  1. Create a folder structure as “src/main/yang” in the test app folder and place your YANG files in it. If incase user want to give desired path for source YANG files and generated java files, the following configuration can be appended to the above pom.xml file.

    Code Block
    <configuration>
        <yangFilesDir>/opt/src/yang/</yangFilesDir>
        <genFilesDir>/opt/src/java/</genFilesDir> 
    </configuration>

     


  2. In YANG, identifier has the support of having “.”, ”-”, “_”. But, in java, we cannot use these characters in class name or attribute name. Hence, by default, these characters will be removed and the successive character will be capitalized for making it camel case. Similarly, in YANG, we can have java keywords and starting with digits, in namespace and identifiers. But, in java, we cannot use it in class name or attribute name or package. Hence, by default, a prefix "yangAutoPrefix" will be added to the identifier name.Here users are given options to change this default behaviour.“.”, ”-”, “_” in identifier name can be replaced by the values given inside the configuration of pom.xml and will be used in java, respectively. Similarly, the prefix value can also be provided in configuration of pom.xml and that will be used as prefix for identifiers.(refer identifier for more details)

    Code Block
    <configuration>
        <replacementForPeriod>dot</replacementForPeriod>
        <replacementForHyphen>hyphen</replacementForHyphen>
        <replacementForUnderscore>underscore</replacementForUnderscore>
        <prefixForIdentifier>prefix</prefixForIdentifier>
    </configuration>
      1. yang-._constuct-generation will be mapped as yangHyphenDotUnderscoreConstuctHyphenGeneration 

      2. const will be mapped as prefixConst 
         

  3.  Default package/folder structure for generated code will be constructed from the namespace of the YANG file and if user wants to generated code with specific folder structure/package he can configure it , using below configurations.

    Code Block
    <configuration>
        <defaultPackage>org.onosproject.sfc</defaultPackage>
    </configuration>

    In above example code will be generated in org.onosproject.sfc package.
     

  4. In case of RPC construct we have given flexibility for controlling the generation of code for input and output sub statements in a special cases where Input or output contains only one leaf/leaf-list/Yang construct. In such case user can configure whether he wants to generate code for input or output. By default code will be generated and in case input or output contains multiple leaf/leaf-list/Yang constructs code will be generated even the configuration is false.

    Code Block
    <configuration>
        <rpcSubStatementCodeGenFlag>true</rpcSubStatementCodeGenFlag>
    </configuration>

...

      • TESTNAME will be mapped to testname

      • TEST-NAME will be mapped to testName

      • TestName will be mapped to testName

      • TEST3NAME will be mapped to test3Name

Note :  When the identifier has to be used as java class name, after the above conversion, the first letter will be capitalized and if consecutive capital letters are present, it will be corrected and assigned as java class name.

...