X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnect%2Fnetconf%2FNetconfMapping.xtend;h=76a5506df3f163a2c0ccab2f1515102c6a9b58bb;hb=94d0d20b41d64bb6696c2a573ec367fcfddc44e9;hp=c151e42fbb803e26565e53eb965a6903ebfa98da;hpb=3b0f2c65bfb0f0b07e27529734561a7ae9ee5ad9;p=controller.git diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend index c151e42fbb..76a5506df3 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.connect.netconf import org.opendaylight.controller.netconf.api.NetconfMessage @@ -26,6 +33,8 @@ import com.google.common.base.Preconditions import com.google.common.base.Optional import org.opendaylight.yangtools.yang.model.api.SchemaContext import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils +import org.opendaylight.yangtools.yang.model.api.NotificationDefinition +import java.util.Set class NetconfMapping { @@ -96,7 +105,19 @@ class NetconfMapping { } static def CompositeNode toCompositeNode(NetconfMessage message,Optional ctx) { - return null//message.toRpcResult().result; + //TODO: implement general normalization to normalize incoming Netconf Message + // for Schema Context counterpart + return null + } + + static def CompositeNode toNotificationNode(NetconfMessage message,Optional ctx) { + if (ctx.present) { + val schemaContext = ctx.get + val notifications = schemaContext.notifications + val document = message.document + return XmlDocumentUtils.notificationToDomNodes(document, Optional.>fromNullable(notifications)) + } + return null } static def NetconfMessage toRpcMessage(QName rpc, CompositeNode node,Optional ctx) { @@ -127,11 +148,11 @@ class NetconfMapping { if(isDataRetrievalReply(rpc)) { val xmlData = message.document.dataSubtree - val dataNodes = XmlDocumentUtils.toDomNodes(xmlData,Optional.of(context.get.dataDefinitions)) + val dataNodes = XmlDocumentUtils.toDomNodes(xmlData, Optional.of(context.get.dataDefinitions)) val it = ImmutableCompositeNode.builder() setQName(NETCONF_RPC_REPLY_QNAME) - add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME,dataNodes)); + add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME, dataNodes)); rawRpc = it.toInstance; //sys(xmlData)