X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fhandlers%2FSchemaContextHandler.java;fp=restconf%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fhandlers%2FSchemaContextHandler.java;h=c9f849bc4eb007ba2184454cb6c9fbdef21f3e91;hb=266c09557b7cc6d97879e1c7efa7a7e0503c855a;hp=70f1b72618258b2e6c79f3f905ac03fcf6c34ae3;hpb=b652e217b7d49bc8e58072c60aab48b442c58ccb;p=netconf.git diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/handlers/SchemaContextHandler.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/handlers/SchemaContextHandler.java index 70f1b72618..c9f849bc4e 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/handlers/SchemaContextHandler.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/handlers/SchemaContextHandler.java @@ -14,6 +14,7 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException; import org.opendaylight.restconf.Draft18.IetfYangLibrary; +import org.opendaylight.restconf.Draft18.MonitoringModule; import org.opendaylight.restconf.utils.mapping.RestconfMappingNodeUtil; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; @@ -52,9 +53,24 @@ public class SchemaContextHandler implements SchemaContextListenerHandler { this.moduleSetId++; final Module ietfYangLibraryModule = context.findModuleByNamespaceAndRevision(IetfYangLibrary.URI_MODULE, IetfYangLibrary.DATE); - final NormalizedNode>> normNode = + NormalizedNode>> normNode = RestconfMappingNodeUtil.mapModulesByIetfYangLibraryYang(context.getModules(), ietfYangLibraryModule, context, String.valueOf(this.moduleSetId)); + putData(normNode); + + final Module monitoringModule = + this.context.findModuleByNamespaceAndRevision(MonitoringModule.URI_MODULE, MonitoringModule.DATE); + normNode = RestconfMappingNodeUtil.mapCapabilites(monitoringModule); + putData(normNode); + } + + @Override + public SchemaContext get() { + return this.context; + } + + private void putData( + final NormalizedNode>> normNode) { final DOMDataWriteTransaction wTx = this.transactionChainHandler.get().newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.create(NodeIdentifier.create(normNode.getNodeType())), normNode); @@ -64,9 +80,4 @@ public class SchemaContextHandler implements SchemaContextListenerHandler { throw new RestconfDocumentedException("Problem occured while putting data to DS.", e); } } - - @Override - public SchemaContext get() { - return this.context; - } }