Versions Compared

Key

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

...

YANG utils constructs support/plan

YANG ConstructSupported/Planned version
anyxmlNo plan to supportNot planned
argumentNo plan to supportNot planned
augmentGoldeneye
basePlanned in Hummingbird
belongs-toGoldeneye
bitGoldeneye
caseGoldeneye
choiceGoldeneye
configFalcon
contact

Goldeneye

Enhancement Planned in Hummingbird

containerFalcon
default

Goldeneye

Enhancement Planned in Humminbird

description

Goldeneye

Enhancement Planned in Hummingbird

deviateNo plan to supportNot planned
deviationNo plan to supportNot planned
enumGoldeneye
error-app-tagPlanned in HummingbirdNot planned
error-messagePlanned in HummingbirdNot planned
extensionNo plan to supportNot planned
featurePlanned in Hummingbird
fraction-digitsGoldeneye
groupingGoldeneye
identityPlanned in Hummingbird
if-featurePlanned in Hummingbird
import

Goldeneye

Enhancement in Hummingbird

include

Goldeneye

Enhancement in Hummingbird

inputGoldeneye
keyGoldeneye
leafFalcon
leaf-listFalcon
lengthGoldeneye
listFalcon
mandatoryFalcon
max-elementsFalcon
min-elementsFalcon
moduleFalcon
mustPlanned in Hummingbird
namespaceGoldeneye
notificationGoldeneye
ordered-byPlanned in HummingbirdNot planned
organization

Goldeneye

Enhancement Planned in Hummingbird
outputGoldeneye
pathPlanned in Hummingbird
patternGoldeneye
positionGoldeneye
prefixGoldeneye
presenceGoldeneye
rangeGoldeneye
reference

Goldeneye

Enhancement Planned in Hummingbird
refineNo plan to supportNot planned
require-instanceNo plan to supportNot planned
revision

Goldeneye

Enhancement in Hummingbird

revision-date

Goldeneye

rpcGoldeneye
status

Goldeneye

Enhancement Planned in Hummingbird
submoduleGoldeneye
typeGoldeneye
typedefGoldeneye
uniqueNot Planned in Hummingbird
units

Goldeneye

Enhancement Planned in Hummingbird

usesGoldeneye
valueGoldeneye
whenPlanned in Hummingbird
yang-versionGoldeneye
yin-elementNo plan to supportNot Planned

Built-in YANG data types support/plan

Binary

Goldeneye

Enhancement planned in Hummingbird
Bits

Goldeneye

Enhancement planned in Hummingbird
booleanGoldeneye
decimal64

Goldeneye

Enhancement planned in Hummingbird
emptyGoldeneye
enumerationGoldeneye
identityref Planned in Hummingbird
instance-identifier Planned in Hummingbird
int8Goldeneye
int16Goldeneye
int32Goldeneye
int64Goldeneye
leafref Planned in Hummingbird
stringFalcon
uint8Goldeneye
uint16Goldeneye
uint32Goldeneye
uint64Goldeneye
unionGoldeneye

Generated JAVA

...

Details

Common behavior

Identifier

The identifier name of yang constructs are taken, and are used in java by converting it to lower camel case. Identifier names are allowed to have three special characters such as “-”, ”_”, “.”. Whereas, in java, we cannot use these special characters. Hence, users are provided option to replace these characters by any word in config of pom.xml. If users don't set it, these characters These characters will be removed during conversion. Conversion takes place by following the below rules of lower camel case.

...

  • The package will have “org.onosproject.yang.gen.v1.” by default in it. The namespace will be added to the above and the folder structure will also be formed respectively. This becomes the parent package.

  • When a node occurs in yang, a new package will be generated under the parent package. The new package name is the node name and class for that node will be placed under this newly created package. The conversion from yang namespace to the java package will take place as below.

 Javadocs

Currently Java doc will be generated as per Onos ONOS javadoc guidelines for class, interface, enum etc. i.e “Represents ....”.
Note: Here in wiki for the given examples for each YANG construct we have removed generated javadocs for documentation purpose . Code will contain all the default javadoc which we are providing in golden-eye release. Javadocs support will be enhanced in hummingbird release.

...

  1. Service interface 
    It includes:
    a) java methods corresponding to the YANG RPC (Refer RPC section for more details)
    b) If module contains notification, generated service interface will extend listener service (refer notification for more details)
  2. Manager class
    It includes:
    a ) Activate/Deactivate methods
    b) If module contains child data nodes, empty getters and setters for those nodes will be generated for app designer developers to implement.
    c)If module contains notification, generated manager class will extend ListenerRegistry(refer notification for more details) .
     
    The manager class implements the service interface. The name of service interface and manager class is <module_name>Service.java and <module_name>Manager.java.

...

Code Block
File : ospf.yang
module ospf {
    namespace "http://example.com/ospf";
    prefix "ospf";

    notification test {
           leaf event-class {
              type string;
           }
           leaf severity {
              type string;
           }
    }
}

File : OspfManager.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519;

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.onosproject.event.ListenerRegistry;
import org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf.OspfEvent;
import org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf.OspfListener;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;

@Component (immediate = true)
@Service
public class OspfManager
        extends ListenerRegistry<OspfEvent, OspfListener>
        implements OspfService {

    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");
    }
}

File : OspfService.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519;

import org.onosproject.event.ListenerService;
import org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf.OspfEvent;
import org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf.OspfListener;

public interface OspfService
        extends ListenerService<OspfEvent, OspfListener> {
}

File : OspfEvent.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160527.ospf;

import org.onosproject.event.AbstractEvent;

public class OspfEvent extends AbstractEvent<OspfEvent.Type, OspfEventSubject> {

    public enum Type {

    TEST
    }

    public OspfEvent(Type type, OspfEventSubject subject) {
        super(type, subject);
    }

    public OspfEvent(Type type, OspfEventSubject subject, long time) {
        super(type, subject, time);
    }

}

File : OspfEventSubject.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf;

public class OspfEventSubject {

    private Test test;

    public Test test() {
            return test;
    }

    public void test(Test test) {
            this.test = test;
    }
}

File : OspfListener.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf;

import org.onosproject.event.EventListener;

public interface OspfListener extends EventListener<OspfEvent> {
}

File : Test.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf;

import org.onosproject.yangutils.translator.tojava.AugmentationHolder;

public interface Test extends AugmentationHolder  {


    String eventClass();

    String severity();

    interface TestBuilder {

            String eventClass();

            String severity();

            TestBuilder eventClass(String eventClass);

       TestBuilder severity(String severity);

        Test build();
    }
}

File : TestBuilder.java
package org.onosproject.yang.gen.v1.http.example.com.ospf.rev20160519.ospf;

import com.google.common.base.MoreObjects;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.onosproject.yangutils.translator.tojava.AugmentedInfo;

public class TestBuilder implements Test.TestBuilder {

    private String eventClass;
    private String severity;

    @Override
    public String eventClass() {
            return eventClass;
    }

    @Override
    public String severity() {
            return severity;
    }

    @Override
    public TestBuilder eventClass(String eventClass) {
            this.eventClass = eventClass;
            return this;
    }

    @Override
    public TestBuilder severity(String severity) {
            this.severity = severity;
            return this;
    }

    @Override
    public Test build() {
            return new TestImpl(this);
    }

    public TestBuilder() {
    }


    public final class TestImpl implements Test {

            private List<AugmentedInfo> augmentedInfoList = new ArrayList<>();
            private String eventClass;
            private String severity;

            @Override
            public String eventClass() {
                return eventClass;
            }

            @Override
            public String severity() {
                return severity;
            }

            @Override
            public int hashCode() {
                return Objects.hash(eventClass, severity);
            }

            @Override
            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (obj instanceof TestImpl) {
                    TestImpl other = (TestImpl) obj;
                    return
                             Objects.equals(eventClass, other.eventClass) &&
                         Objects.equals(severity, other.severity);
                }
                return false;
            }

            @Override
            public String toString() {
                return MoreObjects.toStringHelper(getClass())
                    .add("eventClass", eventClass)
                    .add("severity", severity)
                    .toString();
            }

            public TestImpl(TestBuilder builderObject) {
                this.eventClass = builderObject.eventClass();
                this.severity = builderObject.severity();
            }

            @Override
            public void addAugmentation(AugmentedInfo value) {
                getAugmentedInfoList().add(value);
            }

            @Override
            public List<AugmentedInfo> getAugmentedInfoList() {
                return augmentedInfoList;
            }

            @Override
            public void removeAugmentation() {
                getAugmentedInfoList().clear();
            }
    }
}

 

 

 


Goldeneye

Enhancement in Hummingbird