Re: Assistance required for ONOS YANG Runtime

23 views
Skip to first unread message

Andrea Campanella

unread,
Oct 23, 2019, 4:15:39 AM10/23/19
to Thierno Diallo, Abubakar Muqaddas, ONOS Developers, ONOS Dynamic Configuration Brigade
Hi Thierno, 

I’m not familiar with the ROADM generate code out of the yang models or the process in itself. 
Adding the onos-dev and dynamic config bridge.

Thanks, 
Andrea Campanella

Member of Technical Staff at ONF
Member of ONOS Technical Steering Team
Member of Ambassador Steering Team, ONOS and CORD Community

On 21 Oct 2019, at 13:22, Thierno Diallo <thierno...@bristol.ac.uk> wrote:

Dear Andrea,
 
I am a researcher at the University of Bristol, working on NBI in ONOS where I am trying to integrate my YANG model with Dynamic Configuration Subsystem (YANG runtime).
I posted this issue in the forum but I have not got any response.
 
I tried to run the OpenROADM example to understand how it works in order to run my own YANG runtime application. I activated the OpenROADM application and the OpenROADM model via the Karaf console:
 
app activate  org.onosproject.openroadm
app activate  org.onosproject.models.openroadm
 
I am able to see the activated YANG model through the GUI of ONOS.  I’ve tried to post the following JSON to ONOS:
 
body:
{
                "nodes":[{
                                "clli":"clli",
                                "ids":[{
                                                "node-number":35,
                                                "node-id":"id",
                                                "node-type":1,
                                                "vendor":"Ciena",
                                                "model":"6800",
                                                "domain_subnetwork":"metro",
                                                "ip":"10.10.0.1",
                                                "reklay_rack":"FIC",
                                                "shelf": 5,
                                                "degree-supported":8,
                                                "srg-supported":100
                                }]
                }]}
But I’ve got the following error message:
 
{
    "ietf-restconf:errors": [
        {
            "error": {
                "error-type": "application",
                "error-tag": "operation-failed",
                "error-path": "/onos/restconf/data/org-openroadm-network:network",
                "error-message": "ERROR: JSON cannot be converted to DataNode",
                "error-info": "Invalid YangJavaTypeTranslator{nodeId=org.onosproject.yang.compiler.datamodel.YangNodeIdentifier@7f51e100, dataType=ENUMERATION, dataTypeExtendedInfo=YangSchemaNodeIdentifier{name=node-types_enum, moduleName=org-openroadm-common-types, moduleNamespace=http://org/openroadm/common-types}, resolvableStatus=UNRESOLVED, isTypeForInterFileGroupingResolution=false, isTypeNotResolvedTillRootNode=false} value: 1"
            }
        }
    ]
}
 
Can you kindly tell me if you know what could be the origin of this issue and how to fix it? Or inform someone in the ONOS team who can assist in this issue?
 
Thank you in advance.
 
Best Regards,
Dr Thierno Diallo
Senior Research Associate,
High Performance Networks Group, 
Department of Electrical and Electronic Engineering,
University of Bristol, 
Merchant Venturers Building,
Woodland Road, Bristol, BS8 1UB, UK

Thierno Diallo

unread,
Oct 23, 2019, 6:06:28 AM10/23/19
to Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org, ONOS Dynamic Configuration Brigade

HI Ashish,

Thank you for your response.

I solve the issue by changing the node_type value to rdm.

But an other error about the creation of the root branch in the DCS occured:

{

    "ietf-restconf:errors": [

        {

            "error": {

                "error-type": "application",

                "error-tag": "operation-failed",

                "error-path": "/onos/restconf/data/org-openroadm-network:network",

                "error-message": "ERROR: DynamicConfigService",

                "error-info": "Node or parent does not exist for root|network#http://org/openroadm/network"

            }

        }

    ]

}

 

ONOS tries to add the node on the missing parent in DCS identified by the namespace http://org/openroadm/network.

According to my investigation through the forum, we can’t use RESTCONF to create a parent inside the DCS.

We can also use the  "configsync_netconf"

Since I developed an Northbound Application based on YANG, I would not use the netconf tool  to create a parent path in the DCS. So do you know how to create a parent node in the DCS without using this NETCONF tool "configsync_netconf" ?

BR

Thierno

From: Ashish Mittal <ashish...@altran.com>
Sent: 23 October 2019 10:11
To: Thierno Diallo <thierno...@bristol.ac.uk>
Cc: Abubakar Muqaddas <abubakar...@bristol.ac.uk>; Andrea Campanella <and...@opennetworking.org>; onos...@onosproject.org
Subject: RE: [onos-dev] Re: Assistance required for ONOS YANG Runtime

 

Hi Thierno,

 

We have used DCS in ONOS 1.12.0 and used our Yang model to show it in NBI via RESTConf.

 

We have used example of L3VPN available in ONOS code repo and it had worked.  https://wiki.onosproject.org/display/ONOS/L3VPN

 

I would suggest you also make use of that example.

 

You define your yang model in “models” in parallel to l3vpn and follow steps mentioned on above wiki.

 

 

Regards


Ashish Mittal

 

From: Andrea Campanella <and...@opennetworking.org>
Sent: Wednesday, October 23, 2019 1:46 PM
To: Thierno Diallo <
thierno...@bristol.ac.uk>
Cc: Abubakar Muqaddas <
abubakar...@bristol.ac.uk>; ONOS Developers <onos...@onosproject.org>; ONOS Dynamic Configuration Brigade <brigade-...@onosproject.org>
Subject: [onos-dev] Re: Assistance required for ONOS YANG Runtime

 

** This mail has been sent from an external source **

 

--
You received this message because you are subscribed to the Google Groups "ONOS Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
onos-dev+u...@onosproject.org.
To view this discussion on the web visit
https://groups.google.com/a/onosproject.org/d/msgid/onos-dev/D4DA0B72-1DB8-4E70-9ECF-A95D178E024A%40opennetworking.org.

=====================================================
Please refer to https://northamerica.altran.com/email-disclaimer
for important disclosures regarding this electronic communication.
=====================================================

Ashish Mittal

unread,
Oct 23, 2019, 6:49:48 AM10/23/19
to Thierno Diallo, Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org, ONOS Dynamic Configuration Brigade

Hi Thierno,

 

This can be done from the code when your application starts. The below code snippet shows it being done for l2vpn service model.

 

protected static void createEmptyDcContainer(String containerName, RestconfService restconfService, ResourceId rid,
                                             DynamicConfigService cfgService)

{
   
try {
        URI uri = URI.create(
new StringBuilder(restconfService.getRestconfRootPath()).append(DATA)
                .append(containerName).toString());
        log.debug(
"REST CONF URI : {}", uri);
       
if (!cfgService.nodeExist(rid)) {
            ObjectMapper objectMapper =
new ObjectMapper();
            ObjectNode payload = objectMapper.createObjectNode();
            payload.putPOJO(containerName, objectMapper.createObjectNode());
            log.debug(
"Input Payload: {}", payload);
            uri = URI.create(
new StringBuilder(restconfService.getRestconfRootPath()).append("/data").toString());
            restconfService.runPostOperationOnDataResource(uri, payload);
        }
    }
catch (Exception e) {
       
// When ONOS restart this warning will come as ONOS has already have
        // the empty container in DCS.
       
log.warn("Exception while creating empty container: {}", e);
    }
}

 

protected static ResourceId generateResurceIdForServiceYangs(String nameSpace) {
   
return ResourceId.builder().addBranchPointSchema("/", null).addBranchPointSchema("l2vpn-svc", nameSpace)
            .build();
}

 

And gets invoked as following:

 

createEmptyDcContainer("ietf-l2vpn-svc:l2vpn-svc", restconfService,
        generateResurceIdForServiceYangs(“
urn:ietf:params:xml:ns:yang:ietf-l2vpn-svc“), cfgService);

 

Hope this helps you.

 

Regards


Ashish Mittal

 

From: Thierno Diallo <thierno...@bristol.ac.uk>
Sent: Wednesday, October 23, 2019 3:36 PM
To: Ashish Mittal <ashish...@altran.com>; ONOS Dynamic Configuration Brigade <brigade-...@onosproject.org>
Cc: Abubakar Muqaddas <abubakar...@bristol.ac.uk>; Andrea Campanella <and...@opennetworking.org>; onos...@onosproject.org; ONOS Dynamic Configuration Brigade <brigade-...@onosproject.org>
Subject: RE: [onos-dev] Re: Assistance required for ONOS YANG Runtime

 

** This mail has been sent from an external source **

Thierno Diallo

unread,
Oct 23, 2019, 10:10:46 AM10/23/19
to Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org, ONOS Dynamic Configuration Brigade

HI Ashish,

Thank you for your response. I would like to investigate more the L2VPN service to suit my code against it.

Could you please tell me where I can find the repository of the L2VPN service or which class implements the method describes below.

Thank you for your Help.

Ashish Mittal

unread,
Oct 23, 2019, 10:20:29 AM10/23/19
to Thierno Diallo, Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org
L2VPN is a proprietary app that we have developed taking clues from L3VPN application available in ONOS repository as told earlier.

Regards 

Ashish Mittal 

You received this message because you are subscribed to the Google Groups "Dynamic configuration" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brigade-dyncon...@onosproject.org.
To view this discussion on the web visit https://groups.google.com/a/onosproject.org/d/msgid/brigade-dynconfig/DB7PR06MB586667EFB85E00C524668FEAD56B0%40DB7PR06MB5866.eurprd06.prod.outlook.com.
image001.jpg

Thierno Diallo

unread,
Oct 23, 2019, 10:46:39 AM10/23/19
to Ashish Mittal, Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org

Just to be sure

URI uri = URI.create(new StringBuilder(restconfService.getRestconfRootPath()).append(DATA)

the DATA variable in the code above has as value equals to the “/data”?

BR

Thierno

Ashish Mittal

unread,
Oct 25, 2019, 1:51:32 AM10/25/19
to Thierno Diallo, Ashish Mittal, Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org

Yes, you are correct.

DATA means “/data”

Regards

Thierno Diallo

unread,
Oct 25, 2019, 6:23:25 AM10/25/19
to Ashish Mittal, Ashish Mittal, ONOS Dynamic Configuration Brigade, Abubakar Muqaddas, Andrea Campanella, onos...@onosproject.org

Hi Ashish,

Thank you for your help,

You code is  very helpful and helps me to understand better how the YANGRUNTIME works in ONOS.

I am still getting an error on the conversion from JSON to DATANode :

 

2019-10-24T21:10:45,690 | ERROR | features-3-thread-1 | RestconfUtils                    | 225 - org.onosproject.onos-apps-restconf-utils - 2.1.0.SNAPSHOT | convertJsonToDataNode failure: Requested topologies is not child in topologies

java.lang.IllegalArgumentException: Requested topologies is not child in topologies

 

I’ve generated some logs for you about the value of my different instances:

 

2019-10-24T20:45:53,294 | INFO  | features-3-thread-1 | CopServiceLoader                 | 227 - org.onosproject.onos-apps-cop-app1 - 2.1.0.SNAPSHOT | STARTED point

2019-10-24T20:45:53,294 | INFO  | features-3-thread-1 | CopServiceLoader                 | 227 - org.onosproject.onos-apps-cop-app1 - 2.1.0.SNAPSHOT | RESTCONF INSTANCE coploader: /onos/restconf

2019-10-24T20:45:53,294 | INFO  | features-3-thread-1 | CopServiceLoader                 | 227 - org.onosproject.onos-apps-cop-app1 - 2.1.0.SNAPSHOT | DYNAMIC CONFIG SYSTEM in coploader: org.onosproject.config.impl.DynamicConfigManager@6f5c53d5

2019-10-24T20:46:24,181 | INFO  | features-3-thread-1 | GetServiceDevicetoCopDevice      | 227 - org.onosproject.onos-apps-cop-app1 - 2.1.0.SNAPSHOT | URI- VALUE: /onos/restconf/data/service-topology:topologies

2019-10-24T20:46:26,460 | INFO  | features-3-thread-1 | GetServiceDevicetoCopDevice      | 227 - org.onosproject.onos-apps-cop-app1 - 2.1.0.SNAPSHOT | REST CONF URI : /onos/restconf/data/service-topology:topologies

2019-10-24T20:46:32,011 | INFO  | features-3-thread-1 | GetServiceDevicetoCopDevice      | 227 - org.onosproject.onos-apps-cop-app1 - 2.1.0.SNAPSHOT | Input Payload : {"service-topology:topologies":{}}

 

I highlighted the value of the input payload in red. Topologies represent the container to reach within the service-topology module. Do you think is the correct format?

 

Also in you code, you use the  restconfService.runPostOperationOnDataResource. This method is also used when we post a request by an external REST client e.g. Postman. I have not seen any method running in this function to create a new point in the DCS.

The ResourceId corresponding to my yang model is created but is not installed under the root in the DCS.

 

So can you kindly address your comment to my analysis provided above?

Please can you tell me you how to create the end point in the DCS ?

Thank you in advance

thierno diallo

unread,
Oct 29, 2019, 8:54:52 AM10/29/19
to ONOS Developers, thierno...@bristol.ac.uk, ashish....@gmail.com, ashish...@altran.com, brigade-...@onosproject.org, abubakar...@bristol.ac.uk, and...@opennetworking.org

Dear Ashish,

Dear all;

As you know I am trying to create my own node under the root in the DCS when I’ve received a Restconf request in order to run  YANGRUNTIME app.

As I've understood so far, the Restconf manager cannot create a parent  DataNode endpoint in the DCS but can add a child node under an exciting parent. So my main concern is to create a parent node in the DCS based on my restconf request:

I add this snippet of code (Bold text) in the DistributedDynamicConfigStore.java  just for testing:

I added these code lines under addNode function

@Override
   
public CompletableFuture<Boolean>
    addNode
(ResourceId parent, DataNode node) {
       
String spath = ResourceIdParser.parseResId(parent);
        log
.trace(" addNode({}, {})", parent, node);
        log
.trace(" spath={}", spath);
       
if (spath == null) {
           
throw new FailedException("Invalid ResourceId, cannot create Node");
       
}
       
if (spath.equals(ResourceIdParser.ROOT)) {
           
//If not present, adding static ROOT node after immutable documentTree root.
           
if (complete(keystore.get(DocumentPath.from(spath))) == null) {
                addLeaf
(spath, LeafNode.builder(DeviceResourceIds.ROOT_NAME, DCS_NAMESPACE)
                       
.type(DataNode.Type.SINGLE_INSTANCE_NODE).build());
           
}
           
ResourceId abs = ResourceIds.resourceId(parent, node);
            parseNode
(ResourceIdParser.parseResId(abs), node);
           
return CompletableFuture.completedFuture(true);
       
}
       
// ************************************add***************************************************************
       
else if (spath.equals("root|topologies#http://cop.eu/service-topology")){
           
if (complete(keystore.get(DocumentPath.from(spath))) == null){
                addLeaf
(spath, LeafNode.builder("topologies", "http://cop.eu/service-topology")
                       
.type(DataNode.Type.SINGLE_INSTANCE_NODE).build());
           
}
           
ResourceId abs = ResourceIds.resourceId(parent, node);
            parseNode
(ResourceIdParser.parseResId(abs),node);
           
return CompletableFuture.completedFuture(true);
       
}

       
//*******************Added***************************** TD
       
else if (complete(keystore.get(DocumentPath.from(spath))) == null) {
           
throw new FailedException("Node or parent does not exist for " + spath);
       
}
       
ResourceId abs = ResourceIds.resourceId(parent, node);
       
//spath = ResourceIdParser.appendNodeKey(spath, node.key());
        parseNode
(ResourceIdParser.parseResId(abs), node);
       
return CompletableFuture.completedFuture(true);
   
}

I added the code to create a leaf under the root when the path corresponds to the namespace of my yang model :"http://cop.eu/service-topology" and the name corresponds on the container described in the module of my yang model: "topologies".
i got the following error
2019-10-29T11:51:36,399 | ERROR | qtp1272676067-102 | RestconfManager                  | 224 - org.onosproject.onos-apps-restconf-restconfmgr - 2.1.0.SNAPSHOT | ERROR: DynamicConfigService: creating /http://cop.eu/service-topology:topologies with {key=ListKey{identifier=SchemaId{name=topology, nameSpace=http://cop.eu/service-topology}, value=[KeyLeaf{schemaId=SchemaId{name=topology_id, nameSpace=http://cop.eu/service-topology}, leafValue=TSON}]}, childNodes=[{key=NodeKey{schemaId=SchemaId{name=topology_id, nameSpace=http://cop.eu/service-topology}}, value=TSONvalueNamespace=nullleafType=STRING}]}
org.onosproject.config.FailedException: Datastore operation failed
at org.onosproject.config.impl.DistributedDynamicConfigStore.complete(DistributedDynamicConfigStore.java:562) ~[?:?]
at org.onosproject.config.impl.DistributedDynamicConfigStore.addKey(DistributedDynamicConfigStore.java:259) ~[?:?]
at org.onosproject.config.impl.DistributedDynamicConfigStore.addLeaf(DistributedDynamicConfigStore.java:245) ~[?:?]
at org.onosproject.config.impl.DistributedDynamicConfigStore.addNode(DistributedDynamicConfigStore.java:162) ~[?:?]
at org.onosproject.config.impl.DynamicConfigManager.createNode(DynamicConfigManager.java:111) ~[?:?]
at org.onosproject.restconf.restconfmanager.RestconfManager.runPostOperationOnDataResource(RestconfManager.java:156) ~[?:?]
at org.onosproject.protocol.restconf.server.rpp.RestconfWebResource.handlePostRequest(RestconfWebResource.java:205) ~[226:org.onosproject.onos-protocols-restconf-server-rpp:2.1.0.SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
Caused by: org.onosproject.store.service.StorageException: An application error occurred
at org.onosproject.store.atomix.primitives.impl.AtomixFutures.lambda$adaptTreeFuture$2(AtomixFutures.java:123) ~[?:?]
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760) ~[?:?]
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736) ~[?:?]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) ~[?:?]
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) ~[?:?]
at io.atomix.utils.concurrent.AtomixFuture.lambda$wrap$0(AtomixFuture.java:48) ~[?:?]
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760) ~[?:?]
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736) ~[?:?]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) ~[?:?]
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) ~[?:?]
at io.atomix.utils.concurrent.AtomixFuture.lambda$wrap$0(AtomixFuture.java:48) ~[?:?]
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760) ~[?:?]
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736) ~[?:?]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) ~[?:?]
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) ~[?:?]
at io.atomix.utils.concurrent.AtomixFuture.lambda$wrap$0(AtomixFuture.java:48) ~[?:?]
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760) ~[?:?]
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736) ~[?:?]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) ~[?:?]
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) ~[?:?]
at io.atomix.utils.concurrent.Futures.lambda$null$3(Futures.java:159) ~[?:?]
at io.atomix.utils.concurrent.ThreadPoolContext.lambda$new$0(ThreadPoolContext.java:81) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:?]


I get this error because the CompletableFuture obtained in the keystore.create(dpath, type) in the addkey method is null.

Do you know the correct process to create and operate the data in the DCS (DataStructure  AtomixTree) in ONOS ?
Do you know how to operate in the ONOS Store (using APIs or not)?

BR
Thierno

To unsubscribe from this group and stop receiving emails from it, send an email to onos-dev+unsubscribe@onosproject.org.

=====================================================
Please refer to https://northamerica.altran.com/email-disclaimer
for important disclosures regarding this electronic communication.
=====================================================

=====================================================
Please refer to https://northamerica.altran.com/email-disclaimer
for important disclosures regarding this electronic communication.
=====================================================

--
You received this message because you are subscribed to the Google Groups "Dynamic configuration" group.

To unsubscribe from this group and stop receiving emails from it, send an email to brigade-...@onosproject.org.

Reply all
Reply to author
Forward
0 new messages