Versions Compared

Key

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

...

This is the kind of object (module) that gets created:

Image RemovedImage Added

Generated Java Object Structures per Yang concept

Object Structure

The SchemaContext object generated by the Yang Parser in java has the following possible structures (java collections)

Gliffy Diagram
macroId8eafa348-6609-4eae-a733-beb5a2766488
nameYang Parser Java Object View
pagePin45
 

SchemaTree are is implemented as a Map <QNameImmutableMap<QName, SchemaTreeEffectiveStatement<? extends LeafStatement>>> 

The Class DataSchemaNode SchemaTree can represent a tree of any Yang Leaf, List or ContainerThe interface LeafStatement provides . All leafs implement the  LeafStatement interface which provides methods for the many Yang Language features including

  • getType()
  • getUnits()
  • getMandatory()
  • getWhenStatement()
  • getMustStatments()

Main data types

The package orgpackage org.opendaylight.yangtools.yang.model.util.type contains classes for all the possible data types including:

...

  • BaseEmptyType
  • BaseIdentityrefType
  • BaseInstanceIdentifierType
  • BaseLeafrefType
  • BaseUnionType

And also 'restricted' versions of the base types such as:

  • RestrictedStringType
  • RestrictedUint64Type


DescriptionYangJava Object ViewNotesXML Validation

JSON
Validation

Datatypes and basic constraints

Basic String

leaf response-code {
  type string;
}

TypeStatement TypeAwareDeclaredStatement.getType()YesYes
Mandatory Basic String

leaf response-code {925px
  type string;
    mandatory "true";
}

Optional<MandatoryStatement> MandatoryStatementAwareDeclaredStatement.getMandatory()

NoNo
Limited String leaf pnf-name {
  type string {
    length "0..256";
}

Optional<LengthConstraint> AbstractLengthRestrictedType.getLengthConstraint()

YesYes
typedef (String) with pattern

typedef dotted-quad {
  type string {
pattern
  '(([0-9] ...';
  }
}

leaf address {
   type dotted-quad;
   mandatory "true";
}

List<PatternConstraint> RestrictedStringType.getPatternConstraints()YesYes
Limited uint64 leaf cid {325px400
  type uint64 {
     range "0..503";
  }
}

Image Modified

Yesorg.opendaylight.yangtools.yang.model.util.type.RestrictedUint64TypeYesYes
boolean with default value

leaf blacklisted {
  type boolean;
  default 1;
}

Image Added

org.opendaylight.yangtools.yang.model.util.type.DerivedBooleanTypeImage RemovedN/AN/A

Unique

Unique list server {
  key "name";
  unique "ip port";
  leaf name {
    type string;
  }
  leaf ip {
    type dotted-quad;
  }
  leaf port {
    type uint32;
  }}

Image Added

org.opendaylight.yangtools.yang.model.api.stmt.UniqueStatementImage RemovedNoNo

Choice

Choicechoice transfer-method {
  leaf transfer-interval {
    type uint64 { range "15..2880"; }
    units minutes; }
  leaf transfer-on-commit {
  type empty;
  }}

Image Added

org.opendaylight.yangtools.yang.model.api.stmt.ChoiceStatementImage RemovedN/AN/A

Must

Must leaf ifType {
type enumeration {
enum ethernet;
enum atm;}}
leaf ifMTU {
type uint32;}
must "ifType != 'ethernet' or "
+ "(ifType = 'ethernet' and ifMTU = 1500)"
{
error-message 466px"An ethernet MTU must be 1500";}

Image Added

org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatementImage RemovedNoNo

When

When
leaf a {
    type boolean;
}
leaf b {
    type string;
    when "../a = 'true'";
}

Image Added

org.opendaylight.yangtools.yang.model.api.stmt.WhenStatementImage RemovedNoNo

Extension

Extension declaration

extension store-state-ext {
argument duration;
description "An extension to enable
state-storage for any attribute.
Use duration to specify how long: nnn h|d|y";

}


N/A
Extension usage leaf attribute-with-temporal-storage {
  type string;
  cm-notify-api:store-state-ext "3 d";
// store state 3 days

}

extension is stored as 'UnknownNode' and refers back to the extension declarationN/A

Augmentation


augment "server" {
  when "port = '8787'";
    leaf enable-debug {
      type boolean;
    }
}


N/A

RPC

rpc
rpc nbrlist-change-notification {
description
"RAN Neighbor List change notification to configure RuntimeDB";
input {
:
}
output {
:
}
}


N/A
rpc input
 input {
leaf fap-service-number-of-entries-changed {
type uint64;
description
"Number of cells for which neighbor list has changed";
}
list fap-service {
key "alias";
leaf alias {
type string {
length "1..64";
}
}
leaf cid {
type string {
length "0..52";
}
}
uses x-0005b9-lte-g;
leaf lte-cell-number-of-entries {
type uint64;
description
"Number of cells in a neighbor list that was changed";
}
list lte-ran-neighbor-list-in-use-lte-cell-changed {
key "plmnid cid";
uses lte-ran-neighbor-list-in-use-lte-cell-g;
description
"Changed/Modified List of cells
in a neighbor list for this fap service";
     }
}
}


N/A
rpc output
output {
uses cm-notification-response;
}


N/A

...