Fixed some TODOs in netconf. 27/3827/2
authorMaros Marsalek <mmarsale@cisco.com>
Wed, 18 Dec 2013 13:44:56 +0000 (14:44 +0100)
committerMaros Marsalek <mmarsale@cisco.com>
Thu, 19 Dec 2013 09:09:30 +0000 (10:09 +0100)
Remove duplicate code
Remove commented modules in get-config response
Add test for netconf - persister integration
Remove already fixed TODOs

Change-Id: If79fa8652a7018ba2927044d6784d7c9dfafb220
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
23 files changed:
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Config.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditStrategyType.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpc.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/util/Util.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/Util.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/CapabilityProviderImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfMonitoringServiceImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/util/NetconfUtil.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/NetconfDispatcherImplTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java [new file with mode: 0644]
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/HandlingPriority.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java
opendaylight/netconf/netconf-util/src/test/resources/netconfMessages/editConfig_expectedResult.xml

index fc6499e06e803761270e7b42c4135f2c152950e9..ec73cd6068662f825e9d115457174c05ef49726d 100644 (file)
@@ -119,12 +119,11 @@ public class Config {
                 ModuleConfig mapping = moduleConfigs.get(moduleNamespace).get(moduleMappingEntry.getKey());
 
                 if (moduleMappingEntry.getValue().isEmpty()) {
-                    addEmptyModulesCommented(document, modulesElement, moduleNamespace, moduleMappingEntry);
-                } else {
-                    for (ObjectName objectName : moduleMappingEntry.getValue()) {
-                        modulesElement
-                                .appendChild(mapping.toXml(objectName, serviceTracker, document, moduleNamespace));
-                    }
+                    continue;
+                }
+
+                for (ObjectName objectName : moduleMappingEntry.getValue()) {
+                    modulesElement.appendChild(mapping.toXml(objectName, serviceTracker, document, moduleNamespace));
                 }
 
             }
@@ -135,18 +134,6 @@ public class Config {
         return root;
     }
 
-    // TODO remove commented modules from output
-    private void addEmptyModulesCommented(Document document, Element root, String moduleNamespace,
-            Entry<String, Collection<ObjectName>> moduleMappingEntry) {
-        Element emptyModule = document.createElement(XmlNetconfConstants.MODULE_KEY);
-
-        Element typeElement = XmlUtil.createTextElement(document, XmlNetconfConstants.TYPE_KEY,
-                moduleMappingEntry.getKey());
-        emptyModule.appendChild(typeElement);
-
-        root.appendChild(document.createComment(XmlUtil.toString(emptyModule, false)));
-    }
-
     // TODO refactor, replace string representing namespace with namespace class
     // TODO refactor, replace Map->Multimap with e.g. ConfigElementResolved
     // class
index 70b10d00191cd04c01e83dee8be44fd0c4db0f9d..6a0d7508c849ee12c16e0d742fd7dfcadae5fe65 100644 (file)
@@ -88,7 +88,6 @@ public class InstanceRuntime {
 
     public Element toXml(ObjectName rootOn, Set<ObjectName> childRbeOns, Document document, String instanceIndex,
                          Element parentElement, String namespace) {
-        // TODO namespace
         Element xml = instanceMapping.toXml(rootOn, null, namespace, document, parentElement);
 
         if (instanceIndex != null) {
index ca9fb604238dcbc0a58f9359a96c22a8adece2ad..709573c2414c3249917aae4e03851e0f9ada4da8 100644 (file)
@@ -210,32 +210,38 @@ public class EditConfig extends AbstractConfigNetconfOperation {
     public static Config getConfigMapping(ConfigRegistryClient configRegistryClient,
             Map<String/* Namespace from yang file */,
                     Map<String /* Name of module entry from yang file */, ModuleMXBeanEntry>> mBeanEntries) {
-        Map<String, Map<String, ModuleConfig>> factories = transform(configRegistryClient, mBeanEntries);
+        Map<String, Map<String, ModuleConfig>> factories = transformMbeToModuleConfigs(configRegistryClient, mBeanEntries);
 
         return new Config(factories);
     }
 
-    // TODO refactor
-    private static Map<String/* Namespace from yang file */,
-            Map<String /* Name of module entry from yang file */, ModuleConfig>> transform
-    (final ConfigRegistryClient configRegistryClient, Map<String/* Namespace from yang file */,
+    public static Map<String/* Namespace from yang file */,
+            Map<String /* Name of module entry from yang file */, ModuleConfig>> transformMbeToModuleConfigs
+            (final ConfigRegistryClient configRegistryClient, Map<String/* Namespace from yang file */,
                     Map<String /* Name of module entry from yang file */, ModuleMXBeanEntry>> mBeanEntries) {
-        return Maps.transformEntries(mBeanEntries,
-                new Maps.EntryTransformer<String, Map<String, ModuleMXBeanEntry>, Map<String, ModuleConfig>>() {
-
-                    @Override
-                    public Map<String, ModuleConfig> transformEntry(String arg0, Map<String, ModuleMXBeanEntry> arg1) {
-                        return Maps.transformEntries(arg1,
-                                new Maps.EntryTransformer<String, ModuleMXBeanEntry, ModuleConfig>() {
-
-                                    @Override
-                                    public ModuleConfig transformEntry(String key, ModuleMXBeanEntry moduleMXBeanEntry) {
-                                        return new ModuleConfig(key, new InstanceConfig(configRegistryClient, moduleMXBeanEntry
-                                                .getAttributes()), moduleMXBeanEntry.getProvidedServices().values());
-                                    }
-                                });
-                    }
-                });
+
+        Map<String, Map<String, ModuleConfig>> namespaceToModuleNameToModuleConfig = Maps.newHashMap();
+
+        for (String namespace : mBeanEntries.keySet()) {
+            for (Entry<String, ModuleMXBeanEntry> moduleNameToMbe : mBeanEntries.get(namespace).entrySet()) {
+                String moduleName = moduleNameToMbe.getKey();
+                ModuleMXBeanEntry moduleMXBeanEntry = moduleNameToMbe.getValue();
+
+                ModuleConfig moduleConfig = new ModuleConfig(moduleName, new InstanceConfig(configRegistryClient,
+                        moduleMXBeanEntry.getAttributes()), moduleMXBeanEntry
+                        .getProvidedServices().values());
+
+                Map<String, ModuleConfig> moduleNameToModuleConfig = namespaceToModuleNameToModuleConfig.get(namespace);
+                if(moduleNameToModuleConfig == null) {
+                    moduleNameToModuleConfig = Maps.newHashMap();
+                    namespaceToModuleNameToModuleConfig.put(namespace, moduleNameToModuleConfig);
+                }
+
+                moduleNameToModuleConfig.put(moduleName, moduleConfig);
+            }
+        }
+
+        return namespaceToModuleNameToModuleConfig;
     }
 
     @Override
index 21771b64c78bd6412c51032f207d2d2c90b32ae3..ea602091a0423ec0957a5c0974f163b89f0fd72a 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.controller.netconf.confignetconfconnector.mapping.runtim
 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.confignetconfconnector.operations.editconfig.EditConfig;
 import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
@@ -144,8 +144,8 @@ public class Get extends AbstractConfigNetconfOperation {
 
         final Map<String, Map<String, ModuleRuntime>> moduleRuntimes = createModuleRuntimes(configRegistryClient,
                 yangStoreSnapshot.getModuleMXBeanEntryMap());
-        final Map<String, Map<String, ModuleConfig>> moduleConfigs = GetConfig.transform(configRegistryClient,
-                yangStoreSnapshot.getModuleMXBeanEntryMap());
+        final Map<String, Map<String, ModuleConfig>> moduleConfigs = EditConfig.transformMbeToModuleConfigs(
+                configRegistryClient, yangStoreSnapshot.getModuleMXBeanEntryMap());
 
         final Runtime runtime = new Runtime(moduleRuntimes, moduleConfigs);
 
index 42f8c2dd8bede11c30fc183ebcdfd84b603c3a79..16dd5ad80a695aa791ec5b8e86ebacec9dac50ab 100644 (file)
@@ -9,21 +9,18 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.operations.getconfig;
 
 import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
 import org.opendaylight.controller.config.util.ConfigRegistryClient;
 import org.opendaylight.controller.config.util.ConfigTransactionClient;
 import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot;
-import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;
 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.Config;
-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.config.ServiceRegistryWrapper;
 import org.opendaylight.controller.netconf.confignetconfconnector.operations.AbstractConfigNetconfOperation;
 import org.opendaylight.controller.netconf.confignetconfconnector.operations.Datastore;
+import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig;
 import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
@@ -83,7 +80,7 @@ public class GetConfig extends AbstractConfigNetconfOperation {
         final Set<ObjectName> instances = Datastore.getInstanceQueryStrategy(source, this.transactionProvider)
                 .queryInstances(configRegistryClient);
 
-        final Config configMapping = new Config(transform(configRegistryClient,
+        final Config configMapping = new Config(EditConfig.transformMbeToModuleConfigs(configRegistryClient,
                 yangStoreSnapshot.getModuleMXBeanEntryMap()));
 
 
@@ -98,27 +95,6 @@ public class GetConfig extends AbstractConfigNetconfOperation {
         return dataElement;
     }
 
-    // TODO refactor ... duplicate code
-    public static Map<String, Map<String, ModuleConfig>> transform(final ConfigRegistryClient configRegistryClient,
-            Map<String, Map<String, ModuleMXBeanEntry>> mBeanEntries) {
-        return Maps.transformEntries(mBeanEntries,
-                new Maps.EntryTransformer<String, Map<String, ModuleMXBeanEntry>, Map<String, ModuleConfig>>() {
-
-                    @Override
-                    public Map<String, ModuleConfig> transformEntry(String arg0, Map<String, ModuleMXBeanEntry> arg1) {
-                        return Maps.transformEntries(arg1,
-                                new Maps.EntryTransformer<String, ModuleMXBeanEntry, ModuleConfig>() {
-
-                                    @Override
-                                    public ModuleConfig transformEntry(String key, ModuleMXBeanEntry value) {
-                                        return new ModuleConfig(key, new InstanceConfig(configRegistryClient, value
-                                                .getAttributes()), value.getProvidedServices().values());
-                                    }
-                                });
-                    }
-                });
-    }
-
     @Override
     protected String getOperationName() {
         return GET_CONFIG;
index 7463bdd429e4dc9552dfc390d59bcaba32fe5e5b..f838c6f9f5e69160b4c889d799f7e42ed2c7338c 100644 (file)
@@ -127,7 +127,6 @@ public class RuntimeRpc extends AbstractConfigNetconfOperation {
         if (contextInstanceElement.isPresent() == false)
             return HandlingPriority.CANNOT_HANDLE;
 
-        // FIXME update xpath to instance to conform to config-api yang
         final RuntimeRpcElementResolved id = RuntimeRpcElementResolved.fromXpath(contextInstanceElement.get()
                 .getTextContent(), netconfOperationName, netconfOperationNamespace);
 
index 1c806742e9b141c7f836d9565a9f449255406b69..fc8ddc01bdfb2da52ef0aa6cd0bd28f519878377 100644 (file)
@@ -9,13 +9,6 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.util;
 
 import com.google.common.base.Preconditions;
-import org.opendaylight.controller.config.yang.store.api.YangStoreException;
-import org.opendaylight.controller.config.yang.store.api.YangStoreService;
-import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -41,15 +34,4 @@ public final class Util {
                 + " should be " + clazz + " of " + value);
     }
 
-    // TODO: add message and proper error types
-    public static YangStoreSnapshot getYangStore(final YangStoreService yangStoreService)
-            throws NetconfDocumentedException {
-        try {
-            return yangStoreService.getYangStoreSnapshot();
-        } catch (final YangStoreException e) {
-            throw new NetconfDocumentedException("TODO", e, ErrorType.application, ErrorTag.bad_attribute,
-                    ErrorSeverity.error);
-        }
-    }
-
 }
index 1c3ac7a455c4f80eb8a1607f1e942bb2c91f3977..b66a1a57c20c9288b60e79cdb54daa1cf53bbec3 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.netconf.persist.impl;
 
+import org.opendaylight.controller.config.persist.api.Persister;
 import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
 import org.opendaylight.controller.netconf.api.jmx.DefaultCommitOperationMXBean;
 import org.opendaylight.controller.netconf.api.jmx.NetconfJMXNotification;
@@ -36,11 +37,11 @@ public class ConfigPersisterNotificationHandler implements NotificationListener,
     private static final Logger logger = LoggerFactory.getLogger(ConfigPersisterNotificationHandler.class);
     private final MBeanServerConnection mBeanServerConnection;
     private final NetconfClient netconfClient;
-    private final PersisterAggregator persisterAggregator;
+    private final Persister persisterAggregator;
     private final Pattern ignoredMissingCapabilityRegex;
 
     public ConfigPersisterNotificationHandler(MBeanServerConnection mBeanServerConnection, NetconfClient netconfClient,
-                                              PersisterAggregator persisterAggregator, Pattern ignoredMissingCapabilityRegex) {
+                                              Persister persisterAggregator, Pattern ignoredMissingCapabilityRegex) {
         this.mBeanServerConnection = mBeanServerConnection;
         this.netconfClient = netconfClient;
         this.persisterAggregator = persisterAggregator;
@@ -72,8 +73,9 @@ public class ConfigPersisterNotificationHandler implements NotificationListener,
         if (notification instanceof CommitJMXNotification) {
             try {
                 handleAfterCommitNotification((CommitJMXNotification) notification);
-            } catch (Exception e) {
-                // TODO: notificationBroadcast support logs only DEBUG
+            } catch (Throwable e) {
+                // log exceptions from notification Handler here since
+                // notificationBroadcastSupport logs only DEBUG level
                 logger.warn("Exception occured during notification handling: ", e);
                 throw e;
             }
index 811ba38c10068d470492a93073a656f6b0c42f79..86a024a240db6b97ba45cb493dba36b8fe1d1d62 100644 (file)
@@ -40,8 +40,6 @@ public final class Util {
         return true;
     }
 
-
-    // TODO: check if closing in correct order
     public static void closeClientAndDispatcher(NetconfClient client) {
         NetconfClientDispatcher dispatcher = client.getNetconfClientDispatcher();
         Exception fromClient = null;
index 1d2e039b290d9eef4c77e90fa99ef36257c29c5c..8dbdb26bff1934d1f2071be7114363985a16d5f7 100644 (file)
@@ -15,6 +15,8 @@ import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider;
 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceSnapshot;
 import org.opendaylight.controller.netconf.mapping.api.Capability;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Collections;
 import java.util.Map;
@@ -24,6 +26,8 @@ public class CapabilityProviderImpl implements CapabilityProvider {
     private final NetconfOperationServiceSnapshot netconfOperationServiceSnapshot;
     private final Set<String> capabilityURIs;
 
+    private static final Logger logger = LoggerFactory.getLogger(DefaultCommitNotificationProducer.class);
+
     public CapabilityProviderImpl(NetconfOperationServiceSnapshot netconfOperationServiceSnapshot) {
         this.netconfOperationServiceSnapshot = netconfOperationServiceSnapshot;
         Map<String, Capability> urisToCapabilitiesInternalMap = getCapabilitiesInternal(netconfOperationServiceSnapshot);
@@ -38,7 +42,11 @@ public class CapabilityProviderImpl implements CapabilityProvider {
             final Set<Capability> caps = netconfOperationService.getCapabilities();
 
             for (Capability cap : caps) {
-                // TODO check for duplicates ?
+
+                if(capabilityMap.containsKey(cap.getCapabilityUri())) {
+                    logger.debug("Duplicate capability {} from service {}", cap.getCapabilityUri(), netconfOperationService);
+                }
+
                 capabilityMap.put(cap.getCapabilityUri(), cap);
             }
         }
index 4f60788975fb910f5ae29a4fbac35b8f28d4fe08..7c5bd0cb21dcc25988c3e66c17f7821b3a780d11 100644 (file)
@@ -12,12 +12,13 @@ import io.netty.channel.ChannelFuture;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.Promise;
-import java.net.InetSocketAddress;
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.impl.util.DeserializerExceptionHandler;
 import org.opendaylight.controller.netconf.util.AbstractChannelInitializer;
 import org.opendaylight.protocol.framework.AbstractDispatcher;
 
+import java.net.InetSocketAddress;
+
 public class NetconfServerDispatcher extends AbstractDispatcher<NetconfSession, NetconfServerSessionListener> {
 
     private final ServerChannelInitializer initializer;
@@ -28,7 +29,6 @@ public class NetconfServerDispatcher extends AbstractDispatcher<NetconfSession,
         this.initializer = serverChannelInitializer;
     }
 
-    // TODO test create server with same address twice
     public ChannelFuture createServer(InetSocketAddress address) {
 
         return super.createServer(address, new PipelineInitializer<NetconfSession>() {
index e74723032d247888c65b22c1eed7d9b62a543d71..91734beacbf57f3e164411b6832dcfda1ac93a02 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.netconf.impl;
 
+import com.google.common.base.Preconditions;
 import io.netty.channel.Channel;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Promise;
@@ -28,9 +29,12 @@ import org.w3c.dom.Node;
 
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpression;
+import java.io.InputStream;
 
 public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorFactory {
 
+    public static final String SERVER_HELLO_XML_LOCATION = "/server_hello.xml";
+
     private final Timer timer;
 
     private static final Document helloMessageTemplate = loadHelloMessageTemplate();
@@ -45,8 +49,11 @@ public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorF
     }
 
     private static Document loadHelloMessageTemplate() {
-        return NetconfUtil.createMessage(
-                NetconfServerSessionNegotiatorFactory.class.getResourceAsStream("/server_hello.xml")).getDocument();
+        InputStream resourceAsStream = NetconfServerSessionNegotiatorFactory.class
+                .getResourceAsStream(SERVER_HELLO_XML_LOCATION);
+        Preconditions.checkNotNull(resourceAsStream, "Unable to load server hello message blueprint from %s",
+                SERVER_HELLO_XML_LOCATION);
+        return NetconfUtil.createMessage(resourceAsStream).getDocument();
     }
 
     @Override
index 1b3542595f319132820d6b762d305cff740d7a75..505c74714a71c269ad9721497cdbffaedd4fb706 100644 (file)
@@ -68,6 +68,7 @@ public class NetconfMonitoringServiceImpl implements NetconfMonitoringService, S
     @Override
     public Schemas getSchemas() {
         // FIXME, session ID
+        // capabilities should be split from operations (it will allow to move getSchema operation to monitoring module)
         return transformSchemas(factoriesListener.getSnapshot(0));
     }
 
@@ -78,6 +79,7 @@ public class NetconfMonitoringServiceImpl implements NetconfMonitoringService, S
 
         for (NetconfOperationService netconfOperationService : snapshot.getServices()) {
             // TODO check for duplicates ? move capability merging to snapshot
+            // Split capabilities from operations first and delete this duplicate code
             caps.addAll(netconfOperationService.getCapabilities());
         }
 
@@ -115,8 +117,7 @@ public class NetconfMonitoringServiceImpl implements NetconfMonitoringService, S
         monitoringLocations.add(new Schema.Location(Schema.Location.Enumeration.NETCONF));
 
         for (String location : locations) {
-            // TODO how to create enumerration from string location ?
-            // monitoringLocations.add(new Schema.Location(Schema.Location.Enumeration.valueOf(location)));
+            monitoringLocations.add(new Schema.Location(new Uri(location)));
         }
 
         return monitoringLocations;
index ee474dbba01f4068de6190662c50d25f8339749d..d70a15c18bdf933d56df70d7f7e9be07df6653da 100644 (file)
@@ -185,7 +185,6 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter {
     private NetconfOperationExecution getNetconfOperationWithHighestPriority(
             Document message, NetconfSession session) {
 
-        // TODO test
         TreeMap<HandlingPriority, Set<NetconfOperation>> sortedPriority = getSortedNetconfOperationsWithCanHandle(
                 message, session);
 
index f2c70d61011294d72ba798078bbc3dfc5254ceb2..b70a31a84b0e009052559e7564013f3ae2266de2 100644 (file)
@@ -1,11 +1,6 @@
 package org.opendaylight.controller.netconf.impl.util;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.slf4j.Logger;
@@ -13,12 +8,18 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-// TODO purge nulls
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
 public class NetconfUtil {
 
     private static final Logger logger = LoggerFactory.getLogger(NetconfUtil.class);
 
     public static NetconfMessage createMessage(final File f) {
+        Preconditions.checkNotNull(f, "File parameter was null");
         try {
             return createMessage(new FileInputStream(f));
         } catch (final FileNotFoundException e) {
@@ -28,6 +29,7 @@ public class NetconfUtil {
     }
 
     public static NetconfMessage createMessage(final InputStream is) {
+        Preconditions.checkNotNull(is, "InputStream parameter was null");
         Document doc = null;
         try {
             doc = XmlUtil.readXmlToDocument(is);
index 0140b65c146e4389ecc92e117d23685740ad3f4c..0ecc1cb38324ede5b3443706a071a68a3d21a9dc 100644 (file)
@@ -24,21 +24,14 @@ import java.net.InetSocketAddress;
 public class NetconfDispatcherImplTest {
 
     private EventLoopGroup nettyGroup;
+    private NetconfServerDispatcher dispatch;
+    private DefaultCommitNotificationProducer commitNot;
 
     @Before
     public void setUp() throws Exception {
         nettyGroup = new NioEventLoopGroup();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        nettyGroup.shutdownGracefully();
-    }
 
-    @Test
-    public void test() throws Exception {
-
-        DefaultCommitNotificationProducer commitNot = new DefaultCommitNotificationProducer(
+        commitNot = new DefaultCommitNotificationProducer(
                 ManagementFactory.getPlatformMBeanServer());
         NetconfOperationServiceFactoryListener factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
 
@@ -50,13 +43,20 @@ public class NetconfDispatcherImplTest {
                 factoriesListener, commitNot, idProvider, null);
         NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(serverNegotiatorFactory, listenerFactory);
 
-
-        NetconfServerDispatcher dispatch = new NetconfServerDispatcher(
+        dispatch = new NetconfServerDispatcher(
                 serverChannelInitializer, nettyGroup, nettyGroup);
+    }
 
+    @After
+    public void tearDown() throws Exception {
+        commitNot.close();
+        nettyGroup.shutdownGracefully();
+    }
+
+    @Test
+    public void test() throws Exception {
         InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 8333);
         ChannelFuture s = dispatch.createServer(addr);
-
-        commitNot.close();
+        s.get();
     }
 }
diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfConfigPersisterITTest.java
new file mode 100644 (file)
index 0000000..14f70d3
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2013 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.it;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.util.HashedWheelTimer;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.matchers.JUnitMatchers;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
+import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
+import org.opendaylight.controller.config.persist.api.ConfigSnapshotHolder;
+import org.opendaylight.controller.config.persist.api.Persister;
+import org.opendaylight.controller.config.spi.ModuleFactory;
+import org.opendaylight.controller.config.yang.store.api.YangStoreException;
+import org.opendaylight.controller.config.yang.store.impl.HardcodedYangStoreService;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.api.jmx.CommitJMXNotification;
+import org.opendaylight.controller.netconf.api.monitoring.NetconfManagementSession;
+import org.opendaylight.controller.netconf.client.NetconfClient;
+import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
+import org.opendaylight.controller.netconf.confignetconfconnector.osgi.NetconfOperationServiceFactoryImpl;
+import org.opendaylight.controller.netconf.impl.DefaultCommitNotificationProducer;
+import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher;
+import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory;
+import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory;
+import org.opendaylight.controller.netconf.impl.SessionIdProvider;
+import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl;
+import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
+import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl;
+import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceSnapshot;
+import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService;
+import org.opendaylight.controller.netconf.mapping.api.Capability;
+import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
+import org.opendaylight.controller.netconf.monitoring.osgi.NetconfMonitoringActivator;
+import org.opendaylight.controller.netconf.monitoring.osgi.NetconfMonitoringOperationService;
+import org.opendaylight.controller.netconf.persist.impl.ConfigPersisterNotificationHandler;
+import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
+
+import static junit.framework.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+
+public class NetconfConfigPersisterITTest extends AbstractConfigTest {
+
+    private static final Logger logger =  LoggerFactory.getLogger(NetconfConfigPersisterITTest.class);
+
+    private static final InetSocketAddress tcpAddress = new InetSocketAddress("127.0.0.1", 12023);
+
+    private EventLoopGroup nettyThreadgroup;
+
+    private NetconfClientDispatcher clientDispatcher;
+
+    @Before
+    public void setUp() throws Exception {
+        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(NetconfITTest.getModuleFactoriesS().toArray(
+                new ModuleFactory[0])));
+
+        NetconfMonitoringServiceImpl monitoringService = new NetconfMonitoringServiceImpl(getFactoriesListener());
+
+        NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
+        factoriesListener.onAddNetconfOperationServiceFactory(new NetconfOperationServiceFactoryImpl(getYangStore()));
+        factoriesListener
+                .onAddNetconfOperationServiceFactory(new NetconfMonitoringActivator.NetconfMonitoringOperationServiceFactory(
+                        new NetconfMonitoringOperationService(monitoringService)));
+
+        nettyThreadgroup = new NioEventLoopGroup();
+
+        NetconfServerDispatcher dispatch = createDispatcher(factoriesListener);
+        ChannelFuture s = dispatch.createServer(tcpAddress);
+        s.await();
+
+        clientDispatcher = new NetconfClientDispatcher(nettyThreadgroup, nettyThreadgroup);
+    }
+
+    private HardcodedYangStoreService getYangStore() throws YangStoreException, IOException {
+        final Collection<InputStream> yangDependencies = NetconfITTest.getBasicYangs();
+        return new HardcodedYangStoreService(yangDependencies);
+    }
+
+    private NetconfServerDispatcher createDispatcher(
+                                                     NetconfOperationServiceFactoryListenerImpl factoriesListener) {
+        SessionIdProvider idProvider = new SessionIdProvider();
+        NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
+                new HashedWheelTimer(5000, TimeUnit.MILLISECONDS), factoriesListener, idProvider);
+
+        NetconfServerSessionListenerFactory listenerFactory = new NetconfServerSessionListenerFactory(
+                factoriesListener, new DefaultCommitNotificationProducer(platformMBeanServer), idProvider, mockSessionMonitoringService());
+
+        NetconfServerDispatcher.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcher.ServerChannelInitializer(
+                serverNegotiatorFactory, listenerFactory);
+        return new NetconfServerDispatcher(serverChannelInitializer, nettyThreadgroup, nettyThreadgroup);
+    }
+
+    private SessionMonitoringService mockSessionMonitoringService() {
+        SessionMonitoringService mockedSessionMonitor = mock(SessionMonitoringService.class);
+        doNothing().when(mockedSessionMonitor).onSessionUp(any(NetconfManagementSession.class));
+        doNothing().when(mockedSessionMonitor).onSessionDown(any(NetconfManagementSession.class));
+        return mockedSessionMonitor;
+    }
+
+    @Test
+    public void testNetconfCommitNotifications() throws Exception {
+
+        VerifyingNotificationListener notificationVerifier = createCommitNotificationListener();
+        VerifyingPersister mockedAggregator = mockAggregator();
+
+        try (NetconfClient persisterClient = new NetconfClient("persister", tcpAddress, 4000, clientDispatcher)) {
+            ConfigPersisterNotificationHandler configPersisterNotificationHandler = new ConfigPersisterNotificationHandler(
+                    platformMBeanServer, persisterClient, mockedAggregator,
+                    Pattern.compile(""));
+            configPersisterNotificationHandler.init();
+
+            try (NetconfClient netconfClient = new NetconfClient("client", tcpAddress, 4000, clientDispatcher)) {
+                NetconfMessage response = netconfClient.sendMessage(loadGetConfigMessage());
+                assertResponse(response, "<modules");
+                assertResponse(response, "<services");
+                response = netconfClient.sendMessage(loadCommitMessage());
+                assertResponse(response, "ok");
+
+                response = netconfClient.sendMessage(loadEditConfigMessage());
+                assertResponse(response, "ok");
+                response = netconfClient.sendMessage(loadCommitMessage());
+                assertResponse(response, "ok");
+            }
+        }
+
+        notificationVerifier.assertNotificationCount(2);
+        notificationVerifier.assertNotificationContent(0, 0, 0, 9);
+        notificationVerifier.assertNotificationContent(1, 4, 4, 9);
+
+        mockedAggregator.assertSnapshotCount(2);
+        // Capabilities are stripped for persister
+        mockedAggregator.assertSnapshotContent(0, 0, 0, 1);
+        mockedAggregator.assertSnapshotContent(1, 4, 4, 3);
+    }
+
+    private VerifyingPersister mockAggregator() throws IOException {
+        return new VerifyingPersister();
+    }
+
+    private VerifyingNotificationListener createCommitNotificationListener() throws InstanceNotFoundException {
+        VerifyingNotificationListener listener = new VerifyingNotificationListener();
+        platformMBeanServer.addNotificationListener(DefaultCommitNotificationProducer.objectName, listener, null, null);
+        return listener;
+    }
+
+    private void assertResponse(NetconfMessage response, String content) {
+        Assert.assertThat(XmlUtil.toString(response.getDocument()), JUnitMatchers.containsString(content));
+    }
+
+    private NetconfMessage loadGetConfigMessage() throws Exception {
+        return XmlFileLoader.xmlFileToNetconfMessage("netconfMessages/getConfig.xml");
+    }
+
+    private NetconfMessage loadEditConfigMessage() throws Exception {
+        return XmlFileLoader.xmlFileToNetconfMessage("netconfMessages/editConfig.xml");
+    }
+
+    private NetconfMessage loadCommitMessage() throws Exception {
+        return XmlFileLoader.xmlFileToNetconfMessage("netconfMessages/commit.xml");
+    }
+
+
+    public NetconfOperationServiceFactoryListener getFactoriesListener() {
+        NetconfOperationServiceFactoryListener factoriesListener = mock(NetconfOperationServiceFactoryListener.class);
+        NetconfOperationServiceSnapshot snap = mock(NetconfOperationServiceSnapshot.class);
+        NetconfOperationService service = mock(NetconfOperationService.class);
+        Set<Capability> caps = Sets.newHashSet();
+        doReturn(caps).when(service).getCapabilities();
+        Set<NetconfOperationService> services = Sets.newHashSet(service);
+        doReturn(services).when(snap).getServices();
+        doReturn(snap).when(factoriesListener).getSnapshot(anyLong());
+
+        return factoriesListener;
+    }
+
+    private static class VerifyingNotificationListener implements NotificationListener {
+        public List<Notification> notifications = Lists.newArrayList();
+
+        @Override
+        public void handleNotification(Notification notification, Object handback) {
+            this.notifications.add(notification);
+        }
+
+        void assertNotificationCount(Object size) {
+            assertEquals(size, notifications.size());
+        }
+
+        void assertNotificationContent(int notificationIndex, int expectedModulesSize, int expectedServicesSize, int expectedCapsSize) {
+            Notification notification = notifications.get(notificationIndex);
+            assertEquals(CommitJMXNotification.class, notification.getClass());
+            int capsSize = ((CommitJMXNotification) notification).getCapabilities().size();
+            assertEquals("Expected capabilities count", expectedCapsSize, capsSize);
+            Element configSnapshot = ((CommitJMXNotification) notification).getConfigSnapshot();
+            int modulesSize = configSnapshot.getElementsByTagName("module").getLength();
+            assertEquals("Expected modules count", expectedModulesSize, modulesSize);
+            int servicesSize = configSnapshot.getElementsByTagName("instance").getLength();
+            assertEquals("Expected services count", expectedServicesSize, servicesSize);
+        }
+    }
+
+    private static class VerifyingPersister implements Persister {
+
+        public List<ConfigSnapshotHolder> snapshots = Lists.newArrayList();
+        private Persister mockedPersister;
+
+        public VerifyingPersister() throws IOException {
+            Persister mockedAggregator = mock(Persister.class);
+
+            doAnswer(new Answer() {
+                @Override
+                public Object answer(InvocationOnMock invocation) throws Throwable {
+                    ConfigSnapshotHolder configSnapshot = (ConfigSnapshotHolder) invocation.getArguments()[0];
+                    snapshots.add(configSnapshot);
+                    return null;
+                }
+            }).when(mockedAggregator).persistConfig(any(ConfigSnapshotHolder.class));
+
+            this.mockedPersister = mockedAggregator;
+        }
+
+        void assertSnapshotCount(Object size) {
+            assertEquals(size, snapshots.size());
+        }
+
+        void assertSnapshotContent(int notificationIndex, int expectedModulesSize, int expectedServicesSize, int expectedCapsSize) {
+            ConfigSnapshotHolder snapshot = snapshots.get(notificationIndex);
+            int capsSize = snapshot.getCapabilities().size();
+            assertEquals("Expected capabilities count", expectedCapsSize, capsSize);
+            String configSnapshot = snapshot.getConfigSnapshot();
+            int modulesSize = StringUtils.countMatches(configSnapshot, "<module>");
+            assertEquals("Expected modules count", expectedModulesSize, modulesSize);
+            int servicesSize = StringUtils.countMatches(configSnapshot, "<instance>");
+            assertEquals("Expected services count", expectedServicesSize, servicesSize);
+        }
+
+        @Override
+        public void persistConfig(ConfigSnapshotHolder configSnapshotHolder) throws IOException {
+            mockedPersister.persistConfig(configSnapshotHolder);
+        }
+
+        @Override
+        public List<ConfigSnapshotHolder> loadLastConfigs() throws IOException {
+            return mockedPersister.loadLastConfigs();
+        }
+
+        @Override
+        public void close() {
+            mockedPersister.close();
+        }
+    }
+}
index 4818b5f0a3c7868be0a02dafd19e8c1657e0d777..64c410219f208afcf9533a0b684391b22c115f02 100644 (file)
@@ -16,19 +16,6 @@ import io.netty.channel.ChannelFuture;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.management.ManagementFactory;
-import java.net.InetSocketAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import javax.management.ObjectName;
-import javax.xml.parsers.ParserConfigurationException;
 import junit.framework.Assert;
 import org.junit.After;
 import org.junit.Before;
@@ -74,6 +61,21 @@ import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
+
+import javax.management.ObjectName;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.management.ManagementFactory;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
 import static java.util.Collections.emptyList;
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
@@ -215,20 +217,6 @@ public class NetconfITTest extends AbstractConfigTest {
         }
     }
 
-
-    //TODO: test persister actually
-    @Ignore
-    @Test(timeout = 10000)
-    public void testPersister() throws Exception {
-//        Persister persister = mock(Persister.class);
-//        doReturn("mockPersister").when(persister).toString();
-//        doReturn(Collections.emptyList()).when(persister).loadLastConfigs();
-//        ConfigPersisterNotificationHandler h =
-//                new ConfigPersisterNotificationHandler(persister, tcpAddress, ManagementFactory.getPlatformMBeanServer(),
-//                        Pattern.compile(ConfigPersisterActivator.DEFAULT_IGNORED_REGEX));
-//        h.init();
-    }
-
     @Ignore
     @Test
     public void waitingTest() throws Exception {
index 3a7b7de7a0b2a589b410ddd76996556412e64434..fdea831b47e0dd05d73e1ed70dd1bf4be2b90c84 100644 (file)
@@ -7,27 +7,14 @@
  */
 package org.opendaylight.controller.netconf.it;
 
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
+import com.google.common.base.Charsets;
+import com.google.common.base.Optional;
+import com.google.common.collect.Sets;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 import junit.framework.Assert;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.matchers.JUnitMatchers;
@@ -61,9 +48,20 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
-import com.google.common.base.Charsets;
-import com.google.common.base.Optional;
-import com.google.common.collect.Sets;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 
 public class NetconfMonitoringITTest extends AbstractConfigTest {
 
@@ -197,7 +195,7 @@ public class NetconfMonitoringITTest extends AbstractConfigTest {
         return XmlFileLoader.xmlFileToNetconfMessage("netconfMessages/get.xml");
     }
 
-    public NetconfOperationServiceFactoryListener getFactoriesListener() {
+    public static NetconfOperationServiceFactoryListener getFactoriesListener() {
         NetconfOperationServiceFactoryListener factoriesListener = mock(NetconfOperationServiceFactoryListener.class);
         NetconfOperationServiceSnapshot snap = mock(NetconfOperationServiceSnapshot.class);
         NetconfOperationService service = mock(NetconfOperationService.class);
index 5a0688c8d14dd4fd4d2d3de0be37b7ca40c5a802..176cf2d28c02d54dbaeedc39abe23357e27d8324 100644 (file)
@@ -36,8 +36,6 @@ public class HandlingPriority implements Comparable<HandlingPriority> {
         return Optional.of(priority).or(Optional.<Integer> absent());
     }
 
-    // TODO test
-
     @Override
     public int compareTo(HandlingPriority o) {
         if (this == o)
index e30ce5b47e961f87adccebcce363f2092da9c165..b4018a716f8eb005f37d899756de278c6a206019 100644 (file)
@@ -42,7 +42,7 @@ import java.util.concurrent.TimeUnit;
 public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionPreferences, S extends NetconfSession>
         extends AbstractSessionNegotiator<NetconfMessage, S> {
 
-    // TODO what time ?
+    // TODO Adjust wait time for negotiation, now is 1 minute ?
     private static final long INITIAL_HOLDTIMER = 1;
 
     private static final Logger logger = LoggerFactory.getLogger(AbstractNetconfSessionNegotiator.class);
index 7f884dc43c605af7537a95ed7d0bce71e93d577a..36f79a50bcceaaed5649492b69dff79ff08ee157 100644 (file)
@@ -1,19 +1,6 @@
 <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" a="64" id="a" message-id="101" xmlnx="a:b:c:d">
     <data>
-        <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-            <!--<module>
-            <type>impl</type>
-            </module>
-            -->
-            <!--<module>
-            <type>impl-dep</type>
-            </module>
-            -->
-            <!--<module>
-            <type>impl-netconf</type>
-            </module>
-            -->
-        </modules>
+        <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"/>
         <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"/>
     </data>
 </rpc-reply>