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=7ee13aeb589c713351f760464f19a4aff48647d3;hb=404d4fc52adf17bad6b53aaeedf59d1db85780bc;hp=b93843d28e65a09aa62c9c5518209a5b0f772712;hpb=a92d9d6a21a0f6ca8d2153795721f500eaf29ee9;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 b93843d28e..7ee13aeb58 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 @@ -18,10 +18,13 @@ import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorS import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag; import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType; 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; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.runtime.ModuleRuntime; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.runtime.Runtime; import org.opendaylight.controller.netconf.confignetconfconnector.operations.AbstractConfigNetconfOperation; +import org.opendaylight.controller.netconf.confignetconfconnector.operations.Datastore; +import org.opendaylight.controller.netconf.confignetconfconnector.operations.getconfig.GetConfig; import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.slf4j.Logger; @@ -37,8 +40,6 @@ import java.util.Set; public class Get extends AbstractConfigNetconfOperation { - public static final String GET = "get"; - private final YangStoreSnapshot yangStoreSnapshot; private static final Logger logger = LoggerFactory.getLogger(Get.class); @@ -99,17 +100,17 @@ public class Get extends AbstractConfigNetconfOperation { } private static void checkXml(XmlElement xml) { - xml.checkName(GET); + 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 " + GET); + throw new UnsupportedOperationException("Unsupported option " + XmlNetconfConstants.FILTER + " for " + XmlNetconfConstants.GET); } @Override protected String getOperationName() { - return GET; + return XmlNetconfConstants.GET; } @Override @@ -129,14 +130,23 @@ public class Get extends AbstractConfigNetconfOperation { throw new NetconfDocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_not_supported, ErrorSeverity.error, errorInfo); } + final Set runtimeBeans = configRegistryClient.lookupRuntimeBeans(); - final Map> moduleMappings = createModuleRuntimes(configRegistryClient, + + //Transaction provider required only for candidate datastore + final Set configBeans = Datastore.getInstanceQueryStrategy(Datastore.running, null) + .queryInstances(configRegistryClient); + + final Map> moduleRuntimes = createModuleRuntimes(configRegistryClient, + yangStoreSnapshot.getModuleMXBeanEntryMap()); + final Map> moduleConfigs = GetConfig.transform(configRegistryClient, yangStoreSnapshot.getModuleMXBeanEntryMap()); - final Runtime runtime = new Runtime(moduleMappings); - final Element element = runtime.toXml(runtimeBeans, document); + final Runtime runtime = new Runtime(moduleRuntimes, moduleConfigs); + + final Element element = runtime.toXml(runtimeBeans, configBeans, document); - logger.info("{} operation successful", GET); + logger.info("{} operation successful", XmlNetconfConstants.GET); return element; }