From 628f2e9ff7d2a6c361e87ae7c7c3e7503b1d7896 Mon Sep 17 00:00:00 2001 From: Tomas Olvecky Date: Thu, 5 Jun 2014 17:43:20 +0200 Subject: [PATCH] BUG-1105: Implement subtree filtering in netconf Implement subtree filtering according to RFC 6241 section 6. Current implementation first gathers response XML, then applies filtering. Since netconf server is pluggable, modules that might consume significant amount of time to build their response can read the filter and optimize their result. Even if modules do not support filtering, their result is filtered by SubtreeFilter right before sending out the aggregated response. Change-Id: Ica04f8f3adfe06599e54a577fceca0508554d667 Signed-off-by: Tomas Olvecky --- .../operations/get/Get.java | 5 +- .../operations/getconfig/GetConfig.java | 11 +- .../impl/NetconfServerSessionListener.java | 8 +- .../netconf/impl/SubtreeFilter.java | 169 +++++++ .../netconf/impl/SubtreeFilterTest.java | 70 +++ .../resources/getConfig_reply_unfiltered.xml | 439 ++++++++++++++++++ .../src/test/resources/logback-test.xml | 13 + .../test/resources/subtree/0/post-filter.xml | 48 ++ .../test/resources/subtree/0/pre-filter.xml | 40 ++ .../src/test/resources/subtree/0/request.xml | 5 + .../test/resources/subtree/1/post-filter.xml | 5 + .../test/resources/subtree/1/pre-filter.xml | 40 ++ .../src/test/resources/subtree/1/request.xml | 7 + .../test/resources/subtree/2/post-filter.xml | 35 ++ .../test/resources/subtree/2/pre-filter.xml | 48 ++ .../src/test/resources/subtree/2/request.xml | 13 + .../test/resources/subtree/3/post-filter.xml | 26 ++ .../test/resources/subtree/3/pre-filter.xml | 48 ++ .../src/test/resources/subtree/3/request.xml | 25 + .../test/resources/subtree/4/post-filter.xml | 18 + .../test/resources/subtree/4/pre-filter.xml | 48 ++ .../src/test/resources/subtree/4/request.xml | 17 + .../test/resources/subtree/5/post-filter.xml | 14 + .../test/resources/subtree/5/pre-filter.xml | 40 ++ .../src/test/resources/subtree/5/request.xml | 19 + .../test/resources/subtree/6/post-filter.xml | 22 + .../test/resources/subtree/6/pre-filter.xml | 48 ++ .../src/test/resources/subtree/6/request.xml | 32 ++ .../test/resources/subtree/7/post-filter.xml | 13 + .../test/resources/subtree/7/pre-filter.xml | 52 +++ .../src/test/resources/subtree/7/request.xml | 12 + .../test/resources/subtree/8/post-filter.xml | 115 +++++ .../test/resources/subtree/8/pre-filter.xml | 350 ++++++++++++++ .../src/test/resources/subtree/8/request.xml | 12 + .../NetconfMonitoringOperationService.java | 2 +- .../controller/netconf/netty/SSHTest.java | 2 +- .../mapping/AbstractNetconfOperation.java | 8 +- .../netconf/util/xml/XmlElement.java | 11 + .../netconf/util/xml/XmlNetconfConstants.java | 1 + 39 files changed, 1873 insertions(+), 18 deletions(-) create mode 100644 opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/SubtreeFilter.java create mode 100644 opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/SubtreeFilterTest.java create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/getConfig_reply_unfiltered.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/logback-test.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/request.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/post-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/pre-filter.xml create mode 100644 opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/request.xml diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java index 48b4bbc2a8..867ad60362 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java @@ -103,10 +103,7 @@ public class Get extends AbstractConfigNetconfOperation { xml.checkName(XmlNetconfConstants.GET); xml.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0); - // Filter option - unsupported - if (xml.getChildElements(XmlNetconfConstants.FILTER).size() != 0){ - throw new UnsupportedOperationException("Unsupported option " + XmlNetconfConstants.FILTER + " for " + XmlNetconfConstants.GET); - } + // Filter option: ignore for now, TODO only load modules specified by the filter } @Override diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java index 03e0176e32..bc059d345c 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java @@ -9,6 +9,8 @@ package org.opendaylight.controller.netconf.confignetconfconnector.operations.getconfig; import com.google.common.base.Optional; +import java.util.Set; +import javax.management.ObjectName; import org.opendaylight.controller.config.util.ConfigRegistryClient; import org.opendaylight.controller.config.util.ConfigTransactionClient; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; @@ -30,9 +32,6 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; -import javax.management.ObjectName; -import java.util.Set; - public class GetConfig extends AbstractConfigNetconfOperation { public static final String GET_CONFIG = "get-config"; @@ -65,11 +64,7 @@ public class GetConfig extends AbstractConfigNetconfOperation { logger.debug("Setting source datastore to '{}'", sourceParsed); Datastore sourceDatastore = Datastore.valueOf(sourceParsed); - // Filter option - unsupported - if (xml.getChildElements(XmlNetconfConstants.FILTER).size() != 0){ - throw new UnsupportedOperationException("Unsupported option " + XmlNetconfConstants.FILTER + " for " - + GET_CONFIG); - } + // Filter option: ignore for now, TODO only load modules specified by the filter return sourceDatastore; diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java index 75be1f8fe0..54ad18a1de 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java @@ -13,10 +13,10 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouter; import org.opendaylight.controller.netconf.api.NetconfSessionListener; import org.opendaylight.controller.netconf.api.NetconfTerminationReason; import org.opendaylight.controller.netconf.impl.mapping.operations.DefaultCloseSession; +import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouter; import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService; import org.opendaylight.controller.netconf.util.messages.SendErrorExceptionUtil; import org.opendaylight.controller.netconf.util.xml.XmlElement; @@ -98,7 +98,7 @@ public class NetconfServerSessionListener implements NetconfSessionListenerrfc6241 for details. + */ +public class SubtreeFilter { + private static final Logger logger = LoggerFactory.getLogger(SubtreeFilter.class); + + static Document applySubtreeFilter(Document requestDocument, Document rpcReply) throws NetconfDocumentedException { + // FIXME: rpcReply document must be reread otherwise some nodes do not inherit namespaces. (services/service) + try { + rpcReply = XmlUtil.readXmlToDocument(XmlUtil.toString(rpcReply, true)); + } catch (SAXException | IOException e) { + logger.error("Cannot transform document", e); + throw new NetconfDocumentedException("Cannot transform document"); + } + + OperationNameAndNamespace operationNameAndNamespace = new OperationNameAndNamespace(requestDocument); + if (XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0.equals(operationNameAndNamespace.getNamespace()) && + XmlNetconfConstants.GET.equals(operationNameAndNamespace.getOperationName()) || + XmlNetconfConstants.GET_CONFIG.equals(operationNameAndNamespace.getOperationName())) { + // process subtree filtering here, in case registered netconf operations do + // not implement filtering. + Optional maybeFilter = operationNameAndNamespace.getOperationElement().getOnlyChildElementOptionally( + XmlNetconfConstants.FILTER, XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0); + if (maybeFilter.isPresent() && ( + "subtree".equals(maybeFilter.get().getAttribute("type"))|| + "subtree".equals(maybeFilter.get().getAttribute("type", XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0)) + )) { + + + // do + return filtered(maybeFilter.get(), rpcReply); + } + } + return rpcReply; // return identical document + } + + private static Document filtered(XmlElement filter, Document originalReplyDocument) throws NetconfDocumentedException { + Document result = XmlUtil.newDocument(); + // even if filter is empty, copy /rpc/data + Element rpcReply = originalReplyDocument.getDocumentElement(); + Node rpcReplyDst = result.importNode(rpcReply, false); + result.appendChild(rpcReplyDst); + XmlElement dataSrc = XmlElement.fromDomElement(rpcReply).getOnlyChildElement("data", XmlNetconfConstants.RFC4741_TARGET_NAMESPACE); + Element dataDst = (Element) result.importNode(dataSrc.getDomElement(), false); + rpcReplyDst.appendChild(dataDst); + addSubtree(filter, dataSrc, XmlElement.fromDomElement(dataDst)); + + return result; + } + + private static void addSubtree(XmlElement filter, XmlElement src, XmlElement dst) { + for (XmlElement srcChild : src.getChildElements()) { + for (XmlElement filterChild : filter.getChildElements()) { + addSubtree2(filterChild, srcChild, dst); + } + } + } + + private static MatchingResult addSubtree2(XmlElement filter, XmlElement src, XmlElement dstParent) { + Document document = dstParent.getDomElement().getOwnerDocument(); + MatchingResult matches = matches(src, filter); + if (matches != MatchingResult.NO_MATCH && matches != MatchingResult.CONTENT_MISMATCH) { + // copy srcChild to dst + boolean filterHasChildren = filter.getChildElements().isEmpty() == false; + // copy to depth if this is leaf of filter tree + Element copied = (Element) document.importNode(src.getDomElement(), filterHasChildren == false); + boolean shouldAppend = filterHasChildren == false; + if (filterHasChildren) { // this implies TAG_MATCH + // do the same recursively + int numberOfTextMatchingChildren = 0; + for (XmlElement srcChild : src.getChildElements()) { + for (XmlElement filterChild : filter.getChildElements()) { + MatchingResult childMatch = addSubtree2(filterChild, srcChild, XmlElement.fromDomElement(copied)); + if (childMatch == MatchingResult.CONTENT_MISMATCH) { + return MatchingResult.NO_MATCH; + } + if (childMatch == MatchingResult.CONTENT_MATCH) { + numberOfTextMatchingChildren++; + } + shouldAppend |= childMatch != MatchingResult.NO_MATCH; + } + } + // if only text matching child filters are specified.. + if (numberOfTextMatchingChildren == filter.getChildElements().size()) { + // force all children to be added (to depth). This is done by copying parent node to depth. + // implies shouldAppend == true + copied = (Element) document.importNode(src.getDomElement(), true); + } + } + if (shouldAppend) { + dstParent.getDomElement().appendChild(copied); + } + } + return matches; + } + + /** + * Shallow compare src node to filter: tag name and namespace must match. + * If filter node has no children and has text content, it also must match. + */ + private static MatchingResult matches(XmlElement src, XmlElement filter) { + boolean tagMatch = src.getName().equals(filter.getName()) && + src.getNamespaceOptionally().equals(filter.getNamespaceOptionally()); + MatchingResult result = null; + if (tagMatch) { + // match text content + Optional maybeText = filter.getOnlyTextContentOptionally(); + if (maybeText.isPresent()) { + if (maybeText.equals(src.getOnlyTextContentOptionally())) { + result = MatchingResult.CONTENT_MATCH; + } else { + result = MatchingResult.CONTENT_MISMATCH; + } + } + // match attributes, combination of content and tag is not supported + if (result == null) { + for (Attr attr : filter.getAttributes().values()) { + // ignore namespace declarations + if (XmlUtil.XMLNS_URI.equals(attr.getNamespaceURI()) == false ) { + // find attr with matching localName(), namespaceURI(), == value() in src + String found = src.getAttribute(attr.getLocalName(), attr.getNamespaceURI()); + if (attr.getValue().equals(found) && result != MatchingResult.NO_MATCH) { + result = MatchingResult.TAG_MATCH; + } else { + result = MatchingResult.NO_MATCH; + } + } + } + } + if (result == null) { + result = MatchingResult.TAG_MATCH; + } + } + if (result == null) { + result = MatchingResult.NO_MATCH; + } + logger.debug("Matching {} to {} resulted in {}", src, filter, tagMatch); + return result; + } + + enum MatchingResult { + NO_MATCH, TAG_MATCH, CONTENT_MATCH, CONTENT_MISMATCH + } +} diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/SubtreeFilterTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/SubtreeFilterTest.java new file mode 100644 index 0000000000..b11834386e --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/SubtreeFilterTest.java @@ -0,0 +1,70 @@ +/* + * 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.netconf.impl; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import org.custommonkey.xmlunit.Diff; +import org.custommonkey.xmlunit.XMLUnit; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.opendaylight.controller.netconf.util.xml.XmlUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +@RunWith(value = Parameterized.class) +public class SubtreeFilterTest { + private static final Logger logger = LoggerFactory.getLogger(SubtreeFilterTest.class); + + private final int directoryIndex; + + @Parameters + public static Collection data() { + List result = new ArrayList<>(); + for (int i = 0; i <= 8; i++) { + result.add(new Object[]{i}); + } + return result; + } + + public SubtreeFilterTest(int directoryIndex) { + this.directoryIndex = directoryIndex; + } + + @Before + public void setUp(){ + XMLUnit.setIgnoreWhitespace(true); + } + + @Test + public void test() throws Exception { + Document requestDocument = getDocument("request.xml"); + Document preFilterDocument = getDocument("pre-filter.xml"); + Document postFilterDocument = getDocument("post-filter.xml"); + Document actualPostFilterDocument = SubtreeFilter.applySubtreeFilter(requestDocument, preFilterDocument); + logger.info("Actual document: {}", XmlUtil.toString(actualPostFilterDocument)); + Diff diff = XMLUnit.compareXML(postFilterDocument, actualPostFilterDocument); + assertTrue(diff.toString(), diff.similar()); + + } + + public Document getDocument(String fileName) throws SAXException, IOException { + return XmlUtil.readXmlToDocument(getClass().getResourceAsStream("/subtree/" + directoryIndex + "/" + + fileName)); + } +} diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/getConfig_reply_unfiltered.xml b/opendaylight/netconf/netconf-impl/src/test/resources/getConfig_reply_unfiltered.xml new file mode 100644 index 0000000000..3c2765ad1b --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/getConfig_reply_unfiltered.xml @@ -0,0 +1,439 @@ + + + + + + prefix:toaster-provider-impl + + toaster-provider-impl + + + prefix:binding-notification-service + + binding-notification-broker + + + + prefix:binding-rpc-registry + + binding-rpc-broker + + + + prefix:binding-data-broker + + binding-data-broker + + + + + prefix:sal-netconf-connector + + controller-config + 1830 + + 20000 + + 2000 + + 1.5 + admin + + + prefix:dom-broker-osgi-registry + + dom-broker + + + + prefix:netconf-client-dispatcher + + global-netconf-dispatcher + + admin +
127.0.0.1
+ + prefix:threadpool + global-netconf-processing-executor + + false + + + prefix:binding-broker-osgi-registry + + binding-osgi-broker + + 0 + + + prefix:netty-event-executor + global-event-executor + +
+ + + prefix:netconf-client-dispatcher + + global-netconf-dispatcher + + prefix:netty-threadgroup + global-worker-group + + + prefix:netty-timer + global-timer + + + prefix:netty-threadgroup + global-boss-group + + + + prefix:logback + singleton + + ERROR + STDOUT + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n + + + true + logs/audit.log + audit-file + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} %msg %n + + + WARN + org.opendaylight.controller.logging.bridge + + + INFO + audit + audit-file + + + ERROR + ROOT + STDOUT + opendaylight.log + + + INFO + org.opendaylight + + + INFO + org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort + opendaylight.log + + + TRACE + org.opendaylight.controller.netconf + + + WARN + io.netty + + + true + 10MB + logs/opendaylight.log + opendaylight.log + logs/opendaylight.%d.log.zip + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{35} - %msg%n + false + 1 + TimeBasedRollingPolicy + + + + prefix:shutdown + shutdown + + + + + prefix:netty-hashed-wheel-timer + + global-timer + + + + prefix:netty-threadgroup-fixed + + global-boss-group + + + + prefix:netty-threadgroup-fixed + + global-worker-group + + + + prefix:schema-service-singleton + + yang-schema-service + + + prefix:dom-broker-impl + + inmemory-dom-broker + + prefix:dom-async-data-broker + + inmemory-data-broker + + + + + prefix:dom-inmemory-data-broker + + inmemory-data-broker + + prefix:schema-service + yang-schema-service + + + + + prefix:threadpool-flexible + + global-netconf-processing-executor + + prefix:threadfactory + global-netconf-processing-executor-threadfactory + + 1 + + 4 + + 600000 + + + + + prefix:netty-global-event-executor + + singleton + + + + prefix:binding-broker-impl + + binding-broker-impl + + + prefix:binding-notification-service + + binding-notification-broker + + + + prefix:binding-data-broker + + binding-data-broker + + + + + prefix:runtime-generated-mapping + + runtime-mapping-singleton + + + + prefix:binding-notification-broker + + binding-notification-broker + + + + prefix:binding-data-compatible-broker + + inmemory-binding-data-broker + + + prefix:dom-broker-osgi-registry + + dom-broker + + + + prefix:binding-dom-mapping-service + + runtime-mapping-singleton + + + + + prefix:threadfactory-naming + + global-netconf-processing-executor-threadfactory + + remote-connector-processing-executor + + + + + prefix:kitchen-service-impl + + kitchen-service-impl + + + prefix:binding-notification-service + + binding-notification-broker + + + + prefix:binding-rpc-registry + + binding-rpc-broker + + + + + prefix:remote-zeromq-rpc-server + + remoter + 5666 + + + prefix:dom-broker-osgi-registry + + dom-broker + + +
+ + + prefix:schema-service + + yang-schema-service + /modules/module[type='schema-service-singleton'][name='yang-schema-service'] + + + + prefix:dom-broker-osgi-registry + + + dom-broker + /modules/module[type='dom-broker-impl'][name='inmemory-dom-broker'] + + + + prefix:dom-async-data-broker + + + inmemory-data-broker + /modules/module[type='dom-inmemory-data-broker'][name='inmemory-data-broker'] + + + + prefix:threadpool + + global-netconf-processing-executor + /modules/module[type='threadpool-flexible'][name='global-netconf-processing-executor'] + + + + prefix:threadfactory + + global-netconf-processing-executor-threadfactory + + /modules/module[type='threadfactory-naming'][name='global-netconf-processing-executor-threadfactory'] + + + + + + prefix:binding-dom-mapping-service + + + runtime-mapping-singleton + /modules/module[type='runtime-generated-mapping'][name='runtime-mapping-singleton'] + + + + prefix:netty-timer + + global-timer + /modules/module[type='netty-hashed-wheel-timer'][name='global-timer'] + + + + prefix:netty-threadgroup + + global-boss-group + /modules/module[type='netty-threadgroup-fixed'][name='global-boss-group'] + + + global-worker-group + /modules/module[type='netty-threadgroup-fixed'][name='global-worker-group'] + + + + prefix:netty-event-executor + + global-event-executor + /modules/module[type='netty-global-event-executor'][name='singleton'] + + + + prefix:binding-rpc-registry + + + binding-rpc-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + + + + + prefix:binding-notification-service + + + binding-notification-broker + /modules/module[type='binding-notification-broker'][name='binding-notification-broker'] + + + + + prefix:binding-broker-osgi-registry + + + binding-osgi-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + + + + prefix:binding-data-broker + + + binding-data-broker + /modules/module[type='binding-data-compatible-broker'][name='inmemory-binding-data-broker'] + + + + + + prefix:kitchen-service + + + kitchen-service + /modules/module[type='kitchen-service-impl'][name='kitchen-service-impl'] + + + + + prefix:netconf-client-dispatcher + + + global-netconf-dispatcher + /modules/module[type='netconf-client-dispatcher'][name='global-netconf-dispatcher'] + + + +
+
\ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/logback-test.xml b/opendaylight/netconf/netconf-impl/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..74714a0a24 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/logback-test.xml @@ -0,0 +1,13 @@ + + + + + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/post-filter.xml new file mode 100644 index 0000000000..4abe6a3947 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/post-filter.xml @@ -0,0 +1,48 @@ + + + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/pre-filter.xml new file mode 100644 index 0000000000..031409bdcf --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/pre-filter.xml @@ -0,0 +1,40 @@ + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/request.xml new file mode 100644 index 0000000000..8d49a7fcb2 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/0/request.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/post-filter.xml new file mode 100644 index 0000000000..1ad3f205e3 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/post-filter.xml @@ -0,0 +1,5 @@ + + + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/pre-filter.xml new file mode 100644 index 0000000000..8fd61e1b77 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/pre-filter.xml @@ -0,0 +1,40 @@ + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/request.xml new file mode 100644 index 0000000000..2579aa61e6 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/1/request.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/post-filter.xml new file mode 100644 index 0000000000..e974b59ea1 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/post-filter.xml @@ -0,0 +1,35 @@ + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/pre-filter.xml new file mode 100644 index 0000000000..a399e5772f --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/pre-filter.xml @@ -0,0 +1,48 @@ + + + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/request.xml new file mode 100644 index 0000000000..7b549b9c3e --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/2/request.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/post-filter.xml new file mode 100644 index 0000000000..e379d49a66 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/post-filter.xml @@ -0,0 +1,26 @@ + + + + + + + + root + + + fred + + + barney + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/pre-filter.xml new file mode 100644 index 0000000000..42f451bca1 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/pre-filter.xml @@ -0,0 +1,48 @@ + + + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/request.xml new file mode 100644 index 0000000000..771f1364b0 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/3/request.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/post-filter.xml new file mode 100644 index 0000000000..c701ba0a84 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/post-filter.xml @@ -0,0 +1,18 @@ + + + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/pre-filter.xml new file mode 100644 index 0000000000..f2f2cbb9b5 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/pre-filter.xml @@ -0,0 +1,48 @@ + + + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/request.xml new file mode 100644 index 0000000000..04c8149206 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/4/request.xml @@ -0,0 +1,17 @@ + + + + + + + + + + fred + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/post-filter.xml new file mode 100644 index 0000000000..d6ffd008f3 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/post-filter.xml @@ -0,0 +1,14 @@ + + + + + + fred + admin + Fred Flintstone + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/pre-filter.xml new file mode 100644 index 0000000000..7e3f7218e3 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/pre-filter.xml @@ -0,0 +1,40 @@ + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/request.xml new file mode 100644 index 0000000000..35819887d9 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/5/request.xml @@ -0,0 +1,19 @@ + + + + + + + + + + fred + + + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/post-filter.xml new file mode 100644 index 0000000000..05eb019726 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/post-filter.xml @@ -0,0 +1,22 @@ + + + + + + root + + 1 + 1 + + + + fred + + 2 + + + + + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/pre-filter.xml new file mode 100644 index 0000000000..71dd6282e7 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/pre-filter.xml @@ -0,0 +1,48 @@ + + + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/request.xml new file mode 100644 index 0000000000..c4a410dbb5 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/6/request.xml @@ -0,0 +1,32 @@ + + + + + + + + + + root + + + + fred + + + + + + barney + superuser + + + + + + + + + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/post-filter.xml new file mode 100644 index 0000000000..676ba22254 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/post-filter.xml @@ -0,0 +1,13 @@ + + + + + + 45621 + 774344 + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/pre-filter.xml new file mode 100644 index 0000000000..ef88283668 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/pre-filter.xml @@ -0,0 +1,52 @@ + + + + + + root + superuser + Charlie Root + + 1 + 1 + + + + fred + admin + Fred Flintstone + + 2 + 2 + + + + barney + admin + Barney Rubble + + 2 + 3 + + + + + + admin + + + + + + + 45621 + 774344 + + + 1 + 1 + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/request.xml new file mode 100644 index 0000000000..4bbbabaa50 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/7/request.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/post-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/post-filter.xml new file mode 100644 index 0000000000..3498b026e6 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/post-filter.xml @@ -0,0 +1,115 @@ + + + + + prefix:schema-service + + yang-schema-service + /modules/module[type='schema-service-singleton'][name='yang-schema-service'] + + + + prefix:dom-broker-osgi-registry + + dom-broker + /modules/module[type='dom-broker-impl'][name='inmemory-dom-broker'] + + + + prefix:dom-async-data-broker + + inmemory-data-broker + /modules/module[type='dom-inmemory-data-broker'][name='inmemory-data-broker'] + + + + prefix:threadpool + + global-netconf-processing-executor + /modules/module[type='threadpool-flexible'][name='global-netconf-processing-executor'] + + + + prefix:threadfactory + + global-netconf-processing-executor-threadfactory + /modules/module[type='threadfactory-naming'][name='global-netconf-processing-executor-threadfactory'] + + + + prefix:binding-dom-mapping-service + + runtime-mapping-singleton + /modules/module[type='runtime-generated-mapping'][name='runtime-mapping-singleton'] + + + + prefix:netty-timer + + global-timer + /modules/module[type='netty-hashed-wheel-timer'][name='global-timer'] + + + + prefix:netty-threadgroup + + global-boss-group + /modules/module[type='netty-threadgroup-fixed'][name='global-boss-group'] + + + global-worker-group + /modules/module[type='netty-threadgroup-fixed'][name='global-worker-group'] + + + + prefix:netty-event-executor + + global-event-executor + /modules/module[type='netty-global-event-executor'][name='singleton'] + + + + prefix:binding-rpc-registry + + binding-rpc-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + + + + prefix:binding-notification-service + + binding-notification-broker + /modules/module[type='binding-notification-broker'][name='binding-notification-broker'] + + + + prefix:binding-broker-osgi-registry + + binding-osgi-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + + + + prefix:binding-data-broker + + binding-data-broker + /modules/module[type='binding-data-compatible-broker'][name='inmemory-binding-data-broker'] + + + + prefix:kitchen-service + + kitchen-service + /modules/module[type='kitchen-service-impl'][name='kitchen-service-impl'] + + + + prefix:netconf-client-dispatcher + + global-netconf-dispatcher + /modules/module[type='netconf-client-dispatcher'][name='global-netconf-dispatcher'] + + + + + diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/pre-filter.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/pre-filter.xml new file mode 100644 index 0000000000..8a57b4cab0 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/pre-filter.xml @@ -0,0 +1,350 @@ + + + + + prefix:toaster-provider-impl + toaster-provider-impl + + prefix:binding-notification-service + binding-notification-broker + + + prefix:binding-rpc-registry + binding-rpc-broker + + + prefix:binding-data-broker + binding-data-broker + + + + prefix:sal-netconf-connector + controller-config + 1830 + 20000 + 2000 + 1.5 + admin + + prefix:dom-broker-osgi-registry + dom-broker + + + prefix:netconf-client-dispatcher + global-netconf-dispatcher + + admin +
127.0.0.1
+ + prefix:threadpool + global-netconf-processing-executor + + false + + prefix:binding-broker-osgi-registry + binding-osgi-broker + + 0 + + prefix:netty-event-executor + global-event-executor + +
+ + prefix:netconf-client-dispatcher + global-netconf-dispatcher + + prefix:netty-threadgroup + global-worker-group + + + prefix:netty-timer + global-timer + + + prefix:netty-threadgroup + global-boss-group + + + + prefix:logback + singleton + + ERROR + STDOUT + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n + + + true + logs/audit.log + audit-file + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} %msg %n + + + WARN + org.opendaylight.controller.logging.bridge + + + INFO + audit + audit-file + + + ERROR + ROOT + STDOUT + opendaylight.log + + + INFO + org.opendaylight + + + INFO + org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort + opendaylight.log + + + TRACE + org.opendaylight.controller.netconf + + + WARN + io.netty + + + true + 10MB + logs/opendaylight.log + opendaylight.log + logs/opendaylight.%d.log.zip + %date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{35} - %msg%n + false + 1 + TimeBasedRollingPolicy + + + + prefix:shutdown + shutdown + + + + prefix:netty-hashed-wheel-timer + global-timer + + + prefix:netty-threadgroup-fixed + global-boss-group + + + prefix:netty-threadgroup-fixed + global-worker-group + + + prefix:schema-service-singleton + yang-schema-service + + + prefix:dom-broker-impl + inmemory-dom-broker + + prefix:dom-async-data-broker + inmemory-data-broker + + + + prefix:dom-inmemory-data-broker + inmemory-data-broker + + prefix:schema-service + yang-schema-service + + + + prefix:threadpool-flexible + global-netconf-processing-executor + + prefix:threadfactory + global-netconf-processing-executor-threadfactory + + 1 + 4 + 600000 + + + prefix:netty-global-event-executor + singleton + + + prefix:binding-broker-impl + binding-broker-impl + + prefix:binding-notification-service + binding-notification-broker + + + prefix:binding-data-broker + binding-data-broker + + + + prefix:runtime-generated-mapping + runtime-mapping-singleton + + + prefix:binding-notification-broker + binding-notification-broker + + + prefix:binding-data-compatible-broker + inmemory-binding-data-broker + + prefix:dom-broker-osgi-registry + dom-broker + + + prefix:binding-dom-mapping-service + runtime-mapping-singleton + + + + prefix:threadfactory-naming + global-netconf-processing-executor-threadfactory + remote-connector-processing-executor + + + prefix:kitchen-service-impl + kitchen-service-impl + + prefix:binding-notification-service + binding-notification-broker + + + prefix:binding-rpc-registry + binding-rpc-broker + + + + prefix:remote-zeromq-rpc-server + remoter + 5666 + + prefix:dom-broker-osgi-registry + dom-broker + + +
+ + + prefix:schema-service + + yang-schema-service + /modules/module[type='schema-service-singleton'][name='yang-schema-service'] + + + + prefix:dom-broker-osgi-registry + + dom-broker + /modules/module[type='dom-broker-impl'][name='inmemory-dom-broker'] + + + + prefix:dom-async-data-broker + + inmemory-data-broker + /modules/module[type='dom-inmemory-data-broker'][name='inmemory-data-broker'] + + + + prefix:threadpool + + global-netconf-processing-executor + /modules/module[type='threadpool-flexible'][name='global-netconf-processing-executor'] + + + + prefix:threadfactory + + global-netconf-processing-executor-threadfactory + /modules/module[type='threadfactory-naming'][name='global-netconf-processing-executor-threadfactory'] + + + + prefix:binding-dom-mapping-service + + runtime-mapping-singleton + /modules/module[type='runtime-generated-mapping'][name='runtime-mapping-singleton'] + + + + prefix:netty-timer + + global-timer + /modules/module[type='netty-hashed-wheel-timer'][name='global-timer'] + + + + prefix:netty-threadgroup + + global-boss-group + /modules/module[type='netty-threadgroup-fixed'][name='global-boss-group'] + + + global-worker-group + /modules/module[type='netty-threadgroup-fixed'][name='global-worker-group'] + + + + prefix:netty-event-executor + + global-event-executor + /modules/module[type='netty-global-event-executor'][name='singleton'] + + + + prefix:binding-rpc-registry + + binding-rpc-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + + + + prefix:binding-notification-service + + binding-notification-broker + /modules/module[type='binding-notification-broker'][name='binding-notification-broker'] + + + + prefix:binding-broker-osgi-registry + + binding-osgi-broker + /modules/module[type='binding-broker-impl'][name='binding-broker-impl'] + + + + prefix:binding-data-broker + + binding-data-broker + /modules/module[type='binding-data-compatible-broker'][name='inmemory-binding-data-broker'] + + + + prefix:kitchen-service + + kitchen-service + /modules/module[type='kitchen-service-impl'][name='kitchen-service-impl'] + + + + prefix:netconf-client-dispatcher + + global-netconf-dispatcher + /modules/module[type='netconf-client-dispatcher'][name='global-netconf-dispatcher'] + + + +
+
diff --git a/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/request.xml b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/request.xml new file mode 100644 index 0000000000..4d71ba4ac9 --- /dev/null +++ b/opendaylight/netconf/netconf-impl/src/test/resources/subtree/8/request.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java index 731aad6d1a..e9e92d9202 100644 --- a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java +++ b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java @@ -20,7 +20,7 @@ import org.opendaylight.controller.netconf.monitoring.MonitoringConstants; public class NetconfMonitoringOperationService implements NetconfOperationService { - public static final Set CAPABILITIES = Sets.newHashSet(new Capability() { + private static final Set CAPABILITIES = Sets.newHashSet(new Capability() { @Override public String getCapabilityUri() { diff --git a/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java b/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java index 4e32e82e89..2bda51b495 100644 --- a/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java +++ b/opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java @@ -30,7 +30,7 @@ public class SSHTest { AuthProvider authProvider = mock(AuthProvider.class); doReturn(PEMGenerator.generate().toCharArray()).when(authProvider).getPEMAsCharArray(); doReturn(true).when(authProvider).authenticated(anyString(), anyString()); - NetconfSSHServer thread = NetconfSSHServer.start(1831, NetconfConfigUtil.getNetconfLocalAddress(), authProvider, new NioEventLoopGroup()); + NetconfSSHServer thread = NetconfSSHServer.start(10831, NetconfConfigUtil.getNetconfLocalAddress(), authProvider, new NioEventLoopGroup()); Thread.sleep(2000); logger.info("Closing socket"); thread.close(); diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java index 65ca1b7c4b..8837c74ff5 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java @@ -47,12 +47,12 @@ public abstract class AbstractNetconfOperation implements NetconfOperation { public static final class OperationNameAndNamespace { private final String operationName, namespace; + private final XmlElement operationElement; public OperationNameAndNamespace(Document message) throws NetconfDocumentedException { XmlElement requestElement = null; requestElement = getRequestElementWithCheck(message); - - XmlElement operationElement = requestElement.getOnlyChildElement(); + operationElement = requestElement.getOnlyChildElement(); operationName = operationElement.getName(); namespace = operationElement.getNamespace(); } @@ -64,6 +64,10 @@ public abstract class AbstractNetconfOperation implements NetconfOperation { public String getNamespace() { return namespace; } + + public XmlElement getOperationElement() { + return operationElement; + } } protected static XmlElement getRequestElementWithCheck(Document message) throws NetconfDocumentedException { diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java index ac200a0aa6..8780925eb1 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java @@ -338,6 +338,17 @@ public final class XmlElement { ); } + public Optional getOnlyTextContentOptionally() { + // only return text content if this node has exactly one Text child node + if (element.getChildNodes().getLength() == 1) { + Node item = element.getChildNodes().item(0); + if (item instanceof Text) { + return Optional.of(((Text) item).getWholeText()); + } + } + return Optional.absent(); + } + public String getNamespaceAttribute() throws MissingNameSpaceException { String attribute = element.getAttribute(XmlUtil.XMLNS_ATTRIBUTE_KEY); if (attribute == null || attribute.equals("")){ diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java index 708f17cadb..fa72284b98 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java @@ -56,4 +56,5 @@ public final class XmlNetconfConstants { // TODO where to store namespace of config ? public static final String URN_OPENDAYLIGHT_PARAMS_XML_NS_YANG_CONTROLLER_CONFIG = "urn:opendaylight:params:xml:ns:yang:controller:config"; public static final String GET = "get"; + public static final String GET_CONFIG = "get-config"; } -- 2.36.6