Jump to: navigation, search

OpenDaylight Controller:MD-SAL:Explained:Modeling Concepts

  • Data Tree - All state-related data are modeled and represented as data tree, with possibility to address any element / subtree
  • Operational Data Tree - Reported state of the system, published by the providers using MD-SAL. Represents a feedback loop for applications to observe state of the network / system.
  • Configuration Data Tree - Intended state of the system or network, populated by consumers, which expreses their intention.
  • Instance Identifier - Unique identifier of node / subtree in data tree, which provides unambiguous information, how to retrieve node / subtree from conceptual data trees.
  • Notification - Asynchronous transient event (from perspective of provider) which may be consumed by consumers and they may act upon it
  • RPC - asynchronous request-reply message pair, when request is triggered by consumer, send to the provider, which in future replies with reply message.

Data Tree

Data tree represents structured tree-like hierarchy of data structures. Structure of data tree is described by YANG models using basic building blocks such as list, leaf or container.

Access and modifications of data tree is available via use of Data Transactions

Location of node in data tree is represented by Instance Identifier.

Types of Data Trees

  • Configuration Data Tree - Configuration data tree represents intended state of system and usually is populated by consumers (users) of system or components (providers) in system
  • Operational Data Tree - Operational data tree represents export of state as is perceived by components in the system, and may be consumed by other consumers / providers as source of information for their actions.

Instance Identifier

The Instance Identifier is a unique identifier of an element (location) in the yang data tree; basically it is the path to the node that uniquely identifies all the node's parent nodes. For unique identification of list elements it is required to specify key values as well.

MD-SAL currently provides three different representations of Instance Identifier:

Example

Example

Consider the following simple YANG model for examples list:

module examples {
    namespace "urn:example:examples";
    prefix inv;
    revision "2013-06-07";
    container examples {
        list example {
            key "id";
            leaf "id" {
                type "string";
            }
        }
    }
}

And having one instance of node with name foo;

Lets asume we want to create instance identifier for node foo, in following bindings/ formats:

  • YANG / XML / XPath version

    /inv:nodes/inv:node[id="foo"]
  • Binding Independent version (yang-data-api)

    import org.opendaylight.yang.common.QName;
    import org.opendaylight.yang.data.api.InstanceIdentifier;
    
    QName nodes = QName.create("urn:example:examples","2013-06-07","examples");
    QName node = QName.create("urn:example:examples","2013-06-07","example");
    QName idName = QName.create("urn:example:examples","2013-06-07","id");
    InstanceIdentifier = InstanceIdentifier.builder()
        .node(nodes)
        .nodeWithKey(node,idName,"foo")
        .toInstance();

    Note: Last call toInstance() does not return an instance of node, but Java version of Instance identifier which uniquely identifies node "foo";

  • Binding-Aware version (generated APIs)

    import org.opendaylight.yang.gen.urn.example.examples.rev130607.Examples;
    import org.opendaylight.yang.gen.urn.example.examples.rev130607.examples.Example;
    import org.opendaylight.yang.gen.urn.example.examples.rev130607.examples.ExampleKey;
    
    import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
    
    InstanceIdentifier<Node> identifier = InstanceIdentifier.builder(Examples.class).child(Example.class,new ExampleKey("foo")).toInstance();
    

    Note: Last call toInstance() does not return an instance of node, but Java version of Instance identifier of Instance identifier which uniquely identifies node "foo";

  • HTTP Restconf APIs

  • http://localhost:8080/restconf/config/examples:examples/example/foo
    

    Note: We assume that HTTP APIs are exposed on localhost, port 8080


Notification

Notification represents event (and data associated with this event) which is explicitly modeled in YANG, and could be published / received by users of MD-SAL.

Data structure of Notification is defined by YANG Schema.

RPC

RPC Input

RPC Output