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.openroadmapp activate org.onosproject.models.openroadmI 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 DialloSenior Research Associate,
High Performance Networks Group,
Department of Electrical and Electronic Engineering,University of Bristol,Merchant Venturers Building,
Woodland Road, Bristol, BS8 1UB, UKTel: +44 117 331 5157
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.
=====================================================
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 **
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.
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.
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
Yes, you are correct.
DATA means “/data”
Regards
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
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);
}
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}]}
To unsubscribe from this group and stop receiving emails from it, send an email to onos-dev+unsubscribe@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.
=====================================================
=====================================================
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.
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.