Versions Compared

Key

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

...

YANG ConstructSupported/Planned version
anyxmlNot planned
argumentNot planned
augmentGoldeneye
baseHummingbird
belongs-toGoldeneye
bitGoldeneye
caseGoldeneye
choiceGoldeneye
configFalcon
contact

Goldeneye

Enhancement in Hummingbird

containerFalcon
default

Goldeneye

Enhancement in Humminbird

description

Goldeneye

Enhancement in Hummingbird

deviateNot planned
deviationNot planned
enumGoldeneye
error-app-tagNot planned
error-messageNot planned
extensionNot planned
featureHummingbird
fraction-digitsGoldeneye
groupingGoldeneye
identityHummingbird
if-featureHummingbird
import

Goldeneye

Enhancement in Hummingbird

include

Goldeneye

Enhancement in Hummingbird

inputGoldeneye
keyGoldeneye
leafFalcon
leaf-listFalcon
lengthGoldeneye
listFalcon
mandatoryFalcon
max-elementsGoldeneye
min-elementsGoldeneye
moduleFalcon
mustHummingbird
namespaceGoldeneye
notificationGoldeneye
ordered-byNot planned
organization

Goldeneye

Enhancement in Hummingbird
outputGoldeneye
pathHummingbird
patternGoldeneye
positionGoldeneye
prefixGoldeneye
presenceGoldeneye
rangeGoldeneye
reference

Goldeneye

Enhancement in Hummingbird
refineNot planned
require-instanceNot planned
revision

Goldeneye

Enhancement in Hummingbird
revision-date

Goldeneye

rpcGoldeneye
status

Goldeneye

Enhancement in Hummingbird
submoduleGoldeneye
typeGoldeneye
typedefGoldeneye
uniqueNot Planned
units

Goldeneye

usesGoldeneye
valueGoldeneye
whenHummingbird
yang-versionGoldeneye
yin-elementNot Planned

Built-in YANG data types support/plan

Binary

Goldeneye

Enhancement in Hummingbird
Bits

Goldeneye

Enhancement in Hummingbird
booleanGoldeneye
decimal64

Goldeneye

Enhancement in Hummingbird
emptyGoldeneye
enumerationGoldeneye
identityrefHummingbird
instance-identifierHummingbird
int8Goldeneye
int16Goldeneye
int32Goldeneye
int64Goldeneye
leafrefHummingbird
stringFalcon
uint8Goldeneye
uint16Goldeneye
uint32Goldeneye
uint64Goldeneye
unionGoldeneye

...

Submodule mapping to java is same as module and files with be generated in module’s namespace.

Example

 

 

Code Block
titleInput YANG files
File : acme-system.yang
module acme-system {
    namespace "http://yang-central.org/ns/example/acme";
    prefix acme;

    include "acme-types";
 
    leaf id {
        type string;
    }
}
File : acme-types.yang
submodule acme-types {
    yang-version 1;
    belongs-to "acme-system" {
        prefix "acme";
    }
    leaf access-timeout {
        type uint32;
    }
    leaf retries {
        type uint8;
    }
}
Code Block
titleGenerated Java files
File : AcmeSystemManager.java
package org.onosproject.yang.gen.v1.http.yang.central.org.ns.example.acme.rev20160526;

import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;

@Component (immediate = true)
@Service
public class AcmeSystemManager implements AcmeSystemService {

    private final Logger log = getLogger(getClass());

    @Activate
    public void activate() {
        //TODO: YANG utils generated code
          log.info("Started");
    }

    @Deactivate
    public void deactivate() {
        //TODO: YANG utils generated code
          log.info("Stopped");
    }

    @Override
    public String getId() {
          //TODO: YANG utils generated code
          return null;
    }

    @Override
    public void setId(String id) {
        //TODO: YANG utils generated code
    }
}

File : AcmeSystemService.java
package org.onosproject.yang.gen.v1.http.yang.central.org.ns.example.acme.rev20160526;

public interface AcmeSystemService {

    String getId();

    void setId(String id);
}

File : AcmeTypesManager.java
package org.onosproject.yang.gen.v1.http.yang.central.org.ns.example.acme.rev20160526;

import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;

@Component (immediate = true)
@Service
public class AcmeTypesManager implements AcmeTypesService {

    private final Logger log = getLogger(getClass());

    @Activate
    public void activate() {
        //TODO: YANG utils generated code
          log.info("Started");
    }

    @Deactivate
    public void deactivate() {
        //TODO: YANG utils generated code
          log.info("Stopped");
    }

    @Override
    public long getAccessTimeout() {
        //TODO: YANG utils generated code
          return 0;
    }

    @Override
    public short getRetries() {
          //TODO: YANG utils generated code
          return 0;
    }

    @Override
    public void setAccessTimeout(long accessTimeout) {
        //TODO: YANG utils generated code
    }

    @Override
    public void setRetries(short retries) {
          //TODO: YANG utils generated code
    }
}

File : AcmeTypesService.java
package org.onosproject.yang.gen.v1.http.yang.central.org.ns.example.acme.rev20160526;

public interface AcmeTypesService {
    long getAccessTimeout();

    short getRetries();

    void setAccessTimeout(long accessTimeout);

    void setRetries(short retries);
}

...

Prefix 

Overview

Prefix is used to define prefix associated with module. It is used as a hint to other module developers when they import our module.

...

A module can import definitions from other module or submodule by using import statement. It takes an argument, the name of the module or submodule followed by sub statements prefix and revision statement. Multiple import statements may be specified to import from different modules. Prefix statement inside import is mandatory and its scope is within the imported module or sub-module.

JAVA mapping
Example

Include

 Overview

A module uses a include statement to include sub-module that belongs to module. The argument is the name of sub-module. Modules are only allowed to include sub-module that belongs to module, as defined by belongs-to statement. When a module includes a submodule, it incorporates the contents of the submodule into the node hierarchy of the module.

JAVA mapping

 

Example

 

 

Organization

When imported YANG file is used in any of the nodes in current YANG file, then Java code will genereted for imported YANG file. If it is imported YANG file is not used in any of the node in current YANG file then Java code for imported file will not be genereted.

Example

 

 

 

Code Block
titleInput YANG files
File : flow-classifier.yang
module flow-classifier {
    yang-version 1;
    namespace "sfc.flowclassifier";
    prefix "flow-classifier";
    import "ietf-yang-types" {
        prefix "yang";
    } 
    
    organization "ON-LAB";
    description "This submodule defines for flow classifier.";
    revision "2016-05-24" {
        description "Initial revision.";
    }
   
    leaf id {
        type yang:uuid;
    }
}

File : ietf-yang-types.yang
module ietf-yang-types {

     namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
     prefix "yang";

     organization
      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

     contact
      "WG Web:   <http://tools.ietf.org/wg/netmod/>
       WG List:  <mailto:netmod@ietf.org>

       WG Chair: David Kessens
                 <mailto:david.kessens@nsn.com>

       WG Chair: Juergen Schoenwaelder
                 <mailto:j.schoenwaelder@jacobs-university.de>

       Editor:   Juergen Schoenwaelder
                 <mailto:j.schoenwaelder@jacobs-university.de>";

     description
      "This module contains a collection of generally useful derived
       YANG data types.

       Copyright (c) 2013 IETF Trust and the persons identified as
       authors of the code.  All rights reserved.

       Redistribution and use in source and binary forms, with or
       without modification, is permitted pursuant to, and subject
       to the license terms contained in, the Simplified BSD License
       set forth in Section 4.c of the IETF Trust's Legal Provisions
       Relating to IETF Documents
       (http://trustee.ietf.org/license-info).

       This version of this YANG module is part of RFC 6991; see
       the RFC itself for full legal notices.";

     revision 2013-07-15 {
       description
        "This revision adds the following new data types:
         - yang-identifier
         - hex-string
         - uuid
         - dotted-quad";
       reference
        "RFC 6991: Common YANG Data Types";
     }

     revision 2010-09-24 {
       description
        "Initial revision.";
       reference
        "RFC 6021: Common YANG Data Types";
     }

     typedef uuid {
       type string {
         pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
               + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
       }
       description
        "A Universally Unique IDentifier in the string representation
         defined in RFC 4122.  The canonical representation uses
         lowercase characters.

         The following is an example of a UUID in string representation:
         f81d4fae-7dec-11d0-a765-00a0c91e6bf6
         ";
       reference
        "RFC 4122: A Universally Unique IDentifier (UUID) URN
                   Namespace";
     }
}

 

 

 

package org.onosproject.yang.gen.v1.sfc.flowclassifier.rev20160524;import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev20100924.ietfyangtypes.Uuid;/** * Abstraction of an entity which represents the functionality of flowClassifierService. */public interface FlowClassifierService { /** * Returns the attribute id. * * @return value of id */ Uuid getId(); /** * Sets the value to attribute id. * * @param id value of id */ void setId(Uuid id);}

Code Block
titleGenerated Java files
 

 

 

 

Include

 Overview

A module uses a include statement to include sub-module that belongs to module. The argument is the name of sub-module. Modules are only allowed to include sub-module that belongs to module, as defined by belongs-to statement. When a module includes a submodule, it incorporates the contents of the submodule into the node hierarchy of the module.

JAVA mapping

There is no java mapping for include statement.

Example

Please refer submodule example

Organization

 Overview

   The "organization" statement defines the party responsible for this module.  The argument is a string that is used to specify a textual description of the organization(s) under whose auspices this module was developed.

...