X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Foperations%2Fget%2FGet.java;h=b504cbf6fd290fba58d362279aa1d935a7b95f3a;hb=b8996e71640a91241dfac8a3f16c917d7046a834;hp=5e44427da3ce4ba006a1c6085466bbb05d28f22b;hpb=f2b0b8646e5e8060dbb1a8278ddaf0f4b2a422c0;p=controller.git 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 5e44427da3..b504cbf6fd 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 @@ -17,6 +17,7 @@ import org.opendaylight.controller.config.util.ConfigRegistryClient; import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry; import org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; +import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.InstanceConfig; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ModuleConfig; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.runtime.InstanceRuntime; @@ -30,7 +31,6 @@ import org.opendaylight.controller.netconf.util.exception.MissingNameSpaceExcept import org.opendaylight.controller.netconf.util.exception.UnexpectedElementException; import org.opendaylight.controller.netconf.util.exception.UnexpectedNamespaceException; import org.opendaylight.controller.netconf.util.xml.XmlElement; -import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -39,7 +39,7 @@ import org.w3c.dom.Element; public class Get extends AbstractConfigNetconfOperation { private final YangStoreSnapshot yangStoreSnapshot; - private static final Logger logger = LoggerFactory.getLogger(Get.class); + private static final Logger LOG = LoggerFactory.getLogger(Get.class); public Get(YangStoreSnapshot yangStoreSnapshot, ConfigRegistryClient configRegistryClient, String netconfSessionIdForReporting) { @@ -51,18 +51,18 @@ public class Get extends AbstractConfigNetconfOperation { Map> mBeanEntries) { Map> retVal = Maps.newHashMap(); - for (String namespace : mBeanEntries.keySet()) { + for (Map.Entry> namespaceToModuleEntry : mBeanEntries.entrySet()) { Map innerMap = Maps.newHashMap(); - Map entriesFromNamespace = mBeanEntries.get(namespace); - for (String module : entriesFromNamespace.keySet()) { + Map entriesFromNamespace = namespaceToModuleEntry.getValue(); + for (Map.Entry moduleToMXEntry : entriesFromNamespace.entrySet()) { - ModuleMXBeanEntry mbe = entriesFromNamespace.get(module); + ModuleMXBeanEntry mbe = moduleToMXEntry.getValue(); Map cache = Maps.newHashMap(); RuntimeBeanEntry root = null; for (RuntimeBeanEntry rbe : mbe.getRuntimeBeans()) { - cache.put(rbe, new InstanceConfig(configRegistryClient, rbe.getYangPropertiesToTypesMap())); + cache.put(rbe, new InstanceConfig(configRegistryClient, rbe.getYangPropertiesToTypesMap(), mbe.getNullableDummyContainerName())); if (rbe.isRoot()){ root = rbe; } @@ -74,10 +74,10 @@ public class Get extends AbstractConfigNetconfOperation { InstanceRuntime rootInstanceRuntime = createInstanceRuntime(root, cache); ModuleRuntime moduleRuntime = new ModuleRuntime(rootInstanceRuntime); - innerMap.put(module, moduleRuntime); + innerMap.put(moduleToMXEntry.getKey(), moduleRuntime); } - retVal.put(namespace, innerMap); + retVal.put(namespaceToModuleEntry.getKey(), innerMap); } return retVal; } @@ -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 @@ -133,7 +130,7 @@ public class Get extends AbstractConfigNetconfOperation { final Element element = runtime.toXml(runtimeBeans, configBeans, document); - logger.trace("{} operation successful", XmlNetconfConstants.GET); + LOG.trace("{} operation successful", XmlNetconfConstants.GET); return element; }