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;
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;
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) {
Map<String, Map<String, ModuleMXBeanEntry>> mBeanEntries) {
Map<String, Map<String, ModuleRuntime>> retVal = Maps.newHashMap();
- for (String namespace : mBeanEntries.keySet()) {
+ for (Map.Entry<String, Map<String, ModuleMXBeanEntry>> namespaceToModuleEntry : mBeanEntries.entrySet()) {
Map<String, ModuleRuntime> innerMap = Maps.newHashMap();
- Map<String, ModuleMXBeanEntry> entriesFromNamespace = mBeanEntries.get(namespace);
- for (String module : entriesFromNamespace.keySet()) {
+ Map<String, ModuleMXBeanEntry> entriesFromNamespace = namespaceToModuleEntry.getValue();
+ for (Map.Entry<String, ModuleMXBeanEntry> moduleToMXEntry : entriesFromNamespace.entrySet()) {
- ModuleMXBeanEntry mbe = entriesFromNamespace.get(module);
+ ModuleMXBeanEntry mbe = moduleToMXEntry.getValue();
Map<RuntimeBeanEntry, InstanceConfig> cache = Maps.newHashMap();
RuntimeBeanEntry root = null;
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;
}
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
final Element element = runtime.toXml(runtimeBeans, configBeans, document);
- logger.trace("{} operation successful", XmlNetconfConstants.GET);
+ LOG.trace("{} operation successful", XmlNetconfConstants.GET);
return element;
}