Merge "Upgrade jackson library to version 2.3.0"
authorMadhu Venugopal <mavenugo@gmail.com>
Sat, 4 Jan 2014 22:11:02 +0000 (22:11 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 4 Jan 2014 22:11:02 +0000 (22:11 +0000)
79 files changed:
.gitreview [new file with mode: 0644]
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/AbstractConfigTest.java
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/MbeParser.java
opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangParserWrapper.java [new file with mode: 0644]
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/switchmanager/CompatibleSwitchManager.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ComponentActivator.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/NodeMapping.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowStatisticsAdapter.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend
opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/FlowCapableInventoryProvider.xtend
opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/meter-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-flow-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/port-types.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/group-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/meter-service.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/port-service.yang
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/flow-statistics.yang
opendaylight/md-sal/model/model-flow-statistics/src/main/yang/port-statistics.yang
opendaylight/md-sal/model/model-topology/src/main/yang/opendaylight-topology-inventory.yang
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/RuntimeCodeGenerator.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRouterCodegenInstance.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RuntimeCodeGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/XtendHelper.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/TransformerGenerator.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/BindingAwareBrokerImpl.xtend
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/TypeSafeDataReader.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsManagerActivator.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsProvider.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java
opendaylight/md-sal/topology-lldp-discovery/pom.xml [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java [new file with mode: 0644]
opendaylight/md-sal/topology-manager/pom.xml
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableNodeMapping.xtend
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.xtend
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.xtend [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java
opendaylight/northbound/bundlescanner/implementation/pom.xml
opendaylight/northbound/commons/pom.xml
opendaylight/northbound/connectionmanager/pom.xml
opendaylight/northbound/containermanager/pom.xml
opendaylight/northbound/controllermanager/pom.xml
opendaylight/northbound/flowprogrammer/pom.xml
opendaylight/northbound/hosttracker/pom.xml
opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml
opendaylight/northbound/networkconfiguration/neutron/pom.xml
opendaylight/northbound/staticrouting/pom.xml
opendaylight/northbound/statistics/pom.xml
opendaylight/northbound/subnets/pom.xml
opendaylight/northbound/switchmanager/pom.xml
opendaylight/northbound/topology/pom.xml
opendaylight/northbound/usermanager/pom.xml
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java
opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SubnetTest.java
opendaylight/topologymanager/implementation/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java

diff --git a/.gitreview b/.gitreview
new file mode 100644 (file)
index 0000000..5c4f71d
--- /dev/null
@@ -0,0 +1,4 @@
+[gerrit]
+host=git.opendaylight.org
+port=29418
+project=controller.git
index 54585898551b0ec935a9ccd8e05590ae5230cf23..8933b1442feaec0988b62f19e297a3d8b4b6c99b 100644 (file)
     <jolokia.bridge.version>0.0.1-SNAPSHOT</jolokia.bridge.version>
     <netty.version>4.0.10.Final</netty.version>
     <commons.io.version>2.4</commons.io.version>
-    <!-- Sonar properties using jacoco to retrieve integration test results -->
-    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
-    <sonar.language>java</sonar.language>
+    <bundlescanner.version>0.4.1-SNAPSHOT</bundlescanner.version>
+    <usermanager.version>0.4.1-SNAPSHOT</usermanager.version>
     <forwardingrulesmanager.version>0.5.0-SNAPSHOT</forwardingrulesmanager.version>
     <statisticsmanager.version>0.5.0-SNAPSHOT</statisticsmanager.version>
     <clustering.services.version>0.5.0-SNAPSHOT</clustering.services.version>
+    <configuration.version>0.4.1-SNAPSHOT</configuration.version>
+    <topologymanager.version>0.4.1-SNAPSHOT</topologymanager.version>
+    <!-- Third party version -->
+    <jersey-servlet.version>1.18-SNAPSHOT</jersey-servlet.version>
+    <corsfilter.version>7.0.43-SNAPSHOT</corsfilter.version>
+    <!-- Northbound API version -->
+    <commons.northbound.version>0.4.1-SNAPSHOT</commons.northbound.version>
+    <!-- Sonar properties using jacoco to retrieve integration test results -->
+    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+    <sonar.language>java</sonar.language>
     <maven.compile.plugin.version>2.5.1</maven.compile.plugin.version>
     <java.version.source>1.7</java.version.source>
     <java.version.target>1.7</java.version.target>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>com.sun.jersey.jersey-servlet</artifactId>
-        <version>1.17</version>
+        <version>${jersey-servlet.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
-        <version>7.0.42</version>
+        <version>${corsfilter.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>switchmanager</artifactId>
-        <version>0.5.1-SNAPSHOT</version>
+        <version>${switchmanager.api.version}</version>
       </dependency>
 
       <!-- equinox http service bridge -->
index fa9e0f169ee212cf2645e00a87e0efee28220427..81b0921660539b822b4c0f3216b704f052500210 100644 (file)
@@ -7,8 +7,13 @@
  */
 package org.opendaylight.controller.config.manager.impl;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import junit.framework.Assert;
 import org.junit.After;
 import org.mockito.Matchers;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.config.api.jmx.CommitStatus;
 import org.opendaylight.controller.config.manager.impl.factoriesresolver.ModuleFactoriesResolver;
 import org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator;
@@ -26,14 +31,20 @@ import javax.management.InstanceAlreadyExistsException;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import java.io.Closeable;
+import java.io.InputStream;
 import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Dictionary;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
 /**
@@ -55,6 +66,10 @@ public abstract class AbstractConfigTest extends
     protected BundleContext mockedContext = mock(BundleContext.class);
     protected ServiceRegistration<?> mockedServiceRegistration;
 
+    protected  Map<Class, BundleContextServiceRegistrationHandler> getBundleContextServiceRegistrationHandlers() {
+        return Maps.newHashMap();
+    }
+
     // this method should be called in @Before
     protected void initConfigTransactionManagerImpl(
             ModuleFactoriesResolver resolver) {
@@ -63,17 +78,14 @@ public abstract class AbstractConfigTest extends
 
         configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(
                 platformMBeanServer);
-        this.mockedServiceRegistration = mock(ServiceRegistration.class);
-        doNothing().when(mockedServiceRegistration).unregister();
-        doReturn(mockedServiceRegistration).when(mockedContext).registerService(
-                Matchers.any(String[].class), any(Closeable.class),
-                any(Dictionary.class));
+        initBundleContext();
 
         internalJmxRegistrator = new InternalJMXRegistrator(platformMBeanServer);
         baseJmxRegistrator = new BaseJMXRegistrator(internalJmxRegistrator);
 
         configRegistry = new ConfigRegistryImpl(resolver,
                 platformMBeanServer, baseJmxRegistrator);
+
         try {
             configRegistryJMXRegistrator.registerToJMX(configRegistry);
         } catch (InstanceAlreadyExistsException e) {
@@ -82,6 +94,35 @@ public abstract class AbstractConfigTest extends
         configRegistryClient = new ConfigRegistryJMXClient(platformMBeanServer);
     }
 
+    private void initBundleContext() {
+        this.mockedServiceRegistration = mock(ServiceRegistration.class);
+        doNothing().when(mockedServiceRegistration).unregister();
+
+        RegisterServiceAnswer answer = new RegisterServiceAnswer();
+
+        doAnswer(answer).when(mockedContext).registerService(Matchers.any(String[].class),
+                any(Closeable.class), Matchers.<Dictionary<String, ?>>any());
+        doAnswer(answer).when(mockedContext).registerService(Matchers.<Class<Closeable>>any(), any(Closeable.class),
+                Matchers.<Dictionary<String, ?>>any());
+    }
+
+
+    public Collection<InputStream> getFilesAsInputStreams(List<String> paths) {
+        final Collection<InputStream> resources = new ArrayList<>();
+        List<String> failedToFind = new ArrayList<>();
+        for (String path : paths) {
+            InputStream resourceAsStream = getClass().getResourceAsStream(path);
+            if (resourceAsStream == null) {
+                failedToFind.add(path);
+            } else {
+                resources.add(resourceAsStream);
+            }
+        }
+        Assert.assertEquals("Some files were not found", Collections.<String>emptyList(), failedToFind);
+
+        return resources;
+    }
+
     @After
     public final void cleanUpConfigTransactionManagerImpl() {
         configRegistryJMXRegistrator.close();
@@ -154,4 +195,35 @@ public abstract class AbstractConfigTest extends
             Class<? extends Module> configBeanClass, String implementationName) {
         return new ClassBasedModuleFactory(implementationName, configBeanClass);
     }
+
+
+    public static interface BundleContextServiceRegistrationHandler {
+
+       void handleServiceRegistration(Object serviceInstance);
+
+    }
+
+    private class RegisterServiceAnswer implements Answer {
+        @Override
+        public Object answer(InvocationOnMock invocation) throws Throwable {
+            Object[] args = invocation.getArguments();
+
+            Preconditions.checkArgument(args.length == 3);
+
+            Preconditions.checkArgument(args[0] instanceof Class);
+            Class<?> serviceType = (Class<?>) args[0];
+            Object serviceInstance = args[1];
+
+            BundleContextServiceRegistrationHandler serviceRegistrationHandler = getBundleContextServiceRegistrationHandlers()
+                    .get(serviceType);
+
+            Preconditions.checkArgument(serviceType.isAssignableFrom(serviceInstance.getClass()));
+
+            if (serviceRegistrationHandler != null) {
+                serviceRegistrationHandler.handleServiceRegistration(serviceType.cast(serviceInstance));
+            }
+
+            return mockedServiceRegistration;
+        }
+    }
 }
index 211da6bfefdc62df10906eff27b30655e90eb790..2be6c81ee75ae0438e4114711f590f4d670d0b9b 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.config.yang.store.impl;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import org.apache.commons.io.IOUtils;
 import org.opendaylight.controller.config.yang.store.api.YangStoreException;
 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
@@ -22,13 +21,10 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -37,26 +33,11 @@ public class MbeParser {
     public YangStoreSnapshotImpl parseYangFiles(
             Collection<? extends InputStream> allInput)
             throws YangStoreException {
-        YangParserImpl parser = new YangParserImpl();
+        YangParserImpl parser = YangParserWrapper.getYangParserInstance();
 
-        List<InputStream> bufferedInputStreams = new ArrayList<>();
-        for (InputStream is : allInput) {
-            String content;
-            try {
-                content = IOUtils.toString(is);
-            } catch (IOException e) {
-                throw new YangStoreException("Can not get yang as String from "
-                        + is, e);
-            }
-            InputStream buf = new ByteArrayInputStream(content.getBytes());
-            bufferedInputStreams.add(buf);
-        }
-
-        Map<InputStream, Module> allYangModules = parser
-                .parseYangModelsFromStreamsMapped(bufferedInputStreams);
+        Map<InputStream, Module> allYangModules = YangParserWrapper.parseYangFiles(parser, allInput);
 
-        SchemaContext resolveSchemaContext = parser.resolveSchemaContext(Sets
-                .newHashSet(allYangModules.values()));
+        SchemaContext resolveSchemaContext = YangParserWrapper.getSchemaContextFromModules(parser, allYangModules);
 
         // JMX generator
 
@@ -115,7 +96,7 @@ public class MbeParser {
 
     public Map<Module, String> parseYangFilesToString(
             Collection<? extends InputStream> allYangs) {
-        YangParserImpl parser = new YangParserImpl();
+        YangParserImpl parser = YangParserWrapper.getYangParserInstance();
 
         Map<InputStream, Module> allYangModules = parser
                 .parseYangModelsFromStreamsMapped(Lists.newArrayList(allYangs));
diff --git a/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangParserWrapper.java b/opendaylight/config/yang-store-impl/src/main/java/org/opendaylight/controller/config/yang/store/impl/YangParserWrapper.java
new file mode 100644 (file)
index 0000000..7c42818
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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.config.yang.store.impl;
+
+import com.google.common.collect.Sets;
+import org.apache.commons.io.IOUtils;
+import org.opendaylight.controller.config.yang.store.api.YangStoreException;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class YangParserWrapper {
+
+    /**
+     * throw IllegalStateException if it is unable to parse yang files
+     */
+    public static SchemaContext parseYangFiles(Collection<? extends InputStream> yangFilesAsInputStreams) {
+        YangParserImpl parser = getYangParserInstance();
+        Map<InputStream, Module> mappedYangModules = null;
+        try {
+            mappedYangModules = parseYangFiles(parser, yangFilesAsInputStreams);
+        } catch (YangStoreException e) {
+            throw new IllegalStateException("Unable to parse yang files", e);
+        }
+        return getSchemaContextFromModules(parser, mappedYangModules);
+    }
+
+    static YangParserImpl getYangParserInstance() {
+        return new YangParserImpl();
+    }
+
+    static SchemaContext getSchemaContextFromModules(YangModelParser parser, Map<InputStream, Module> allYangModules) {
+        return parser.resolveSchemaContext(Sets
+                .newHashSet(allYangModules.values()));
+    }
+
+    static Map<InputStream, Module> parseYangFiles(YangModelParser parser, Collection<? extends InputStream> allInput) throws YangStoreException {
+        List<InputStream> bufferedInputStreams = new ArrayList<>();
+        for (InputStream is : allInput) {
+            String content;
+            try {
+                content = IOUtils.toString(is);
+            } catch (IOException e) {
+                throw new YangStoreException("Can not get yang as String from "
+                        + is, e);
+            }
+            InputStream buf = new ByteArrayInputStream(content.getBytes());
+            bufferedInputStreams.add(buf);
+        }
+
+        return parser
+                .parseYangModelsFromStreamsMapped(bufferedInputStreams);
+    }
+}
index 5ba156ea7cb4690f2147915f1f29163d1b46fec4..718a3ff166e1a7ae72cae6175da0aaef12542e4c 100644 (file)
@@ -277,6 +277,11 @@ public abstract class AbstractScheme {
 
     public Status addNode (Node node, InetAddress controller) {
         if (node == null || controller == null) {
+            if (node == null) {
+                log.warn("addNode: node is null");
+            } else if (controller == null) {
+                log.error("Failed to add node {}. The controller address retrieved from clusterServices is null.", node);
+            }
             return new Status(StatusCode.BADREQUEST);
         }
         if (isLocal(node))  {
index f399e05dc463b875429677d9ca914856e37d67a2..6fca9db636e71479d986710b921912a68b2850a8 100644 (file)
           <artifactId>forwardingrules-manager</artifactId>
           <version>${mdsal.version}</version>
         </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller.md</groupId>
+          <artifactId>topology-lldp-discovery</artifactId>
+          <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.opendaylight.controller.md</groupId>
+          <artifactId>topology-manager</artifactId>
+          <version>${mdsal.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller.model</groupId>
+            <artifactId>model-topology</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+         <groupId>org.opendaylight.yangtools.model</groupId>
+         <artifactId>ietf-topology</artifactId>
+         <version>2013.07.12.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-util</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
         <dependency>
           <groupId>org.opendaylight.controller.md</groupId>
           <artifactId>statistics-manager</artifactId>
index 430b5957efc1e3d4d9f707963871897b68341f54..62e767b8dab1e92194eaf3bb01e275f39054265e 100644 (file)
@@ -225,7 +225,7 @@ class CompatibleSwitchManager extends ConfigurableSwitchManager implements ISwit
         val ret = new HashSet<NodeConnector>();
         for (nc : data.nodeConnector) {
             val flowConn = nc.getAugmentation(FlowCapableNodeConnector);
-            if (flowConn != null && flowConn.state == PortState.Live) {
+            if (flowConn != null && flowConn.state != null && !flowConn.state.linkDown) {
                 ret.add(new NodeConnector(MD_SAL_TYPE, nc.key, node));
             }
         }
index b460edff7438f24e649d2178c55b4cfc89a354a7..95acbcdb1338e10827d76c4d5d19718094db83d0 100644 (file)
@@ -8,7 +8,6 @@ import static org.opendaylight.controller.sal.compatibility.NodeMapping.*
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
 import org.apache.felix.dm.Component
 import java.util.Arrays
-import org.opendaylight.yangtools.yang.binding.NotificationListener
 import java.util.Dictionary
 import java.util.Hashtable
 import org.opendaylight.controller.sal.utils.GlobalConstants
@@ -30,6 +29,9 @@ import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
 import org.opendaylight.controller.sal.discovery.IDiscoveryService
 import org.opendaylight.controller.sal.topology.IPluginOutTopologyService
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
 
 class ComponentActivator extends ComponentActivatorAbstractBase implements BindingAwareConsumer {
 
@@ -44,9 +46,16 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
     @Property
     DataPacketAdapter dataPacket = new DataPacketAdapter;
 
+    @Property
+    org.opendaylight.controller.sal.utils.INodeFactory nodeFactory = new MDSalNodeFactory
+
+    @Property
+    org.opendaylight.controller.sal.utils.INodeConnectorFactory nodeConnectorFactory = new MDSalNodeConnectorFactory
+
+
     override protected init() {
-        Node.NodeIDType.registerIDType(MD_SAL_TYPE, NodeKey);
-        NodeConnector.NodeConnectorIDType.registerIDType(MD_SAL_TYPE, NodeConnectorKey, MD_SAL_TYPE);
+        Node.NodeIDType.registerIDType(MD_SAL_TYPE, String);
+        NodeConnector.NodeConnectorIDType.registerIDType(MD_SAL_TYPE, String, MD_SAL_TYPE);
     }
 
     override start(BundleContext context) {
@@ -71,25 +80,38 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         // Inventory Service
         inventory.dataService = session.getSALService(DataBrokerService);
         inventory.flowStatisticsService = session.getRpcService(OpendaylightFlowStatisticsService);
+        inventory.flowTableStatisticsService = session.getRpcService(OpendaylightFlowTableStatisticsService);
+        inventory.nodeConnectorStatisticsService = session.getRpcService(OpendaylightPortStatisticsService);
         inventory.topologyDiscovery = session.getRpcService(FlowTopologyDiscoveryService);
+               inventory.dataProviderService = session.getSALService(DataProviderService)
 
         subscribe.registerNotificationListener(dataPacket)
 
     }
 
     override protected getGlobalImplementations() {
-        return Arrays.asList(this, flow, inventory, dataPacket)
+        return Arrays.asList(this, flow, inventory, dataPacket, nodeFactory, nodeConnectorFactory)
     }
 
     override protected configureGlobalInstance(Component c, Object imp) {
         configure(imp, c);
     }
 
+    private def dispatch configure(MDSalNodeFactory imp, Component it) {
+        setInterface(org.opendaylight.controller.sal.utils.INodeFactory.name, properties);
+    }
+
+    private def dispatch configure(MDSalNodeConnectorFactory imp, Component it) {
+        setInterface(org.opendaylight.controller.sal.utils.INodeConnectorFactory.name, properties);
+    }
+
     private def dispatch configure(ComponentActivator imp, Component it) {
         add(
             createServiceDependency().setService(BindingAwareBroker) //
             .setCallbacks("setBroker", "setBroker") //
             .setRequired(true))
+
+
     }
 
     private def dispatch configure(DataPacketAdapter imp, Component it) {
@@ -114,7 +136,7 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
         add(
             createServiceDependency() //
             .setService(IPluginOutReadService) //
-            .setCallbacks("setReadPublisher", "setReadPublisher") //
+            .setCallbacks("setReadPublisher", "unsetReadPublisher") //
             .setRequired(false))
         add(
             createServiceDependency() //
@@ -137,6 +159,7 @@ class ComponentActivator extends ComponentActivatorAbstractBase implements Bindi
     private def Dictionary<String, Object> properties() {
         val props = new Hashtable<String, Object>();
         props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString, MD_SAL_TYPE)
+        props.put("protocolName", MD_SAL_TYPE);
         return props;
     }
 }
index ad6009c827a365ff40ebdce31cb1c87e92efb7f8..4e6e49eac70cefd3576754d542e159c649fa457b 100644 (file)
@@ -1,5 +1,9 @@
 package org.opendaylight.controller.sal.compatibility;
 
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
 import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
 import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
 import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
@@ -8,11 +12,6 @@ import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
 
-
-import org.opendaylight.controller.sal.core.NodeConnector;
-
-
-
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchField;
 import org.opendaylight.controller.sal.match.MatchType;
@@ -22,14 +21,11 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
@@ -53,9 +49,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
+
 import com.google.common.net.InetAddresses;
-import static org.opendaylight.controller.sal.compatibility.NodeMapping.*;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.*;
 
 public class FromSalConversionsUtils {
 
@@ -63,19 +58,7 @@ public class FromSalConversionsUtils {
 
     }
 
-    public static GetNodeConnectorStatisticsInput nodeConnectorStatistics(
-            NodeConnector connector) {
-        GetNodeConnectorStatisticsInputBuilder target = new GetNodeConnectorStatisticsInputBuilder();
-
-        NodeRef nodeRef = toNodeRef(connector.getNode());
-        target.setNode(nodeRef);
-
-        NodeConnectorRef nodeConnectorRef = toNodeConnectorRef(connector);
-        target.setNodeConnector(nodeConnectorRef);
-
-        return target.build();
-    }
-
+    @SuppressWarnings("unused")
     private static Address addressFromAction(InetAddress inetAddress) {
         String strInetAddresss = InetAddresses.toAddrString(inetAddress);
         if (inetAddress instanceof Inet4Address) {
@@ -196,7 +179,7 @@ public class FromSalConversionsUtils {
         MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN);
         if (vlan != null && vlan.getValue() != null) {
             VlanIdBuilder vlanIDBuilder = new VlanIdBuilder();
-            vlanIDBuilder.setVlanId(new VlanId((int) (NetUtils
+            vlanIDBuilder.setVlanId(new VlanId((NetUtils
                     .getUnsignedShort((short) vlan.getValue()))));
             vlanMatchBuild.setVlanId(vlanIDBuilder.build());
         }
@@ -270,7 +253,7 @@ public class FromSalConversionsUtils {
 
         InetAddress inetDestAddress = null;
         MatchField netDest = sourceMatch.getField(MatchType.NW_DST);
-        if (netSource != null && netSource.getValue() != null) {
+        if (netDest != null && netDest.getValue() != null) {
             inetDestAddress = (InetAddress) (netDest.getValue());
         }
 
@@ -371,5 +354,76 @@ public class FromSalConversionsUtils {
                 .setIpv6Destination(new Ipv6Prefix(inetDstAddressString));
         return layer6MatchBuild.build();
     }
+    
+    public static boolean flowEquals(Flow statsFlow, Flow storedFlow) {
+        if (statsFlow.getClass() != storedFlow.getClass()) {
+            return false;
+        }
+        if (statsFlow.getBufferId()== null) {
+            if (storedFlow.getBufferId() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getBufferId().equals(storedFlow.getBufferId())) {
+            return false;
+        }
+        if (statsFlow.getContainerName()== null) {
+            if (storedFlow.getContainerName()!= null) {
+                return false;
+            }
+        } else if(!statsFlow.getContainerName().equals(storedFlow.getContainerName())) {
+            return false;
+        }
+        if (statsFlow.getCookie()== null) {
+            if (storedFlow.getCookie()!= null) {
+                return false;
+            }
+        } else if(!statsFlow.getCookie().equals(storedFlow.getCookie())) {
+            return false;
+        }
+        if (statsFlow.getMatch()== null) {
+            if (storedFlow.getMatch() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getMatch().equals(storedFlow.getMatch())) {
+            return false;
+        }
+        if (statsFlow.getCookie()== null) {
+            if (storedFlow.getCookie()!= null) {
+                return false;
+            }
+        } else if(!statsFlow.getCookie().equals(storedFlow.getCookie())) {
+            return false;
+        }
+        if (statsFlow.getHardTimeout() == null) {
+            if (storedFlow.getHardTimeout() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getHardTimeout().equals(storedFlow.getHardTimeout() )) {
+            return false;
+        }
+        if (statsFlow.getIdleTimeout()== null) {
+            if (storedFlow.getIdleTimeout() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getIdleTimeout().equals(storedFlow.getIdleTimeout())) {
+            return false;
+        }
+        if (statsFlow.getPriority() == null) {
+            if (storedFlow.getPriority() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getPriority().equals(storedFlow.getPriority())) {
+            return false;
+        }
+        if (statsFlow.getTableId() == null) {
+            if (storedFlow.getTableId() != null) {
+                return false;
+            }
+        } else if(!statsFlow.getTableId().equals(storedFlow.getTableId())) {
+            return false;
+        }
+        return true;
+    }
+
 
 }
index 8ac6f1b0500d1834fa6883de70a7ae3c6eb601bb..2124185b6c297906d617cbef74d9481e6367ace9 100644 (file)
@@ -9,7 +9,6 @@ import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
 
 import static extension org.opendaylight.controller.sal.common.util.Arguments.*
 import static extension org.opendaylight.controller.sal.compatibility.NodeMapping.*
-import static org.opendaylight.controller.sal.compatibility.MDFlowMapping.*
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
@@ -19,9 +18,7 @@ import org.opendaylight.controller.sal.reader.NodeConnectorStatistics
 import org.opendaylight.controller.sal.reader.FlowOnNode
 import org.opendaylight.controller.sal.reader.NodeDescription
 import org.slf4j.LoggerFactory
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsInputBuilder
 import java.util.ArrayList
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsInputBuilder
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener
 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService
@@ -45,28 +42,88 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal
 import org.opendaylight.controller.sal.topology.TopoEdgeUpdate
 import org.opendaylight.controller.sal.discovery.IDiscoveryService
-
-class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInReadService, IPluginInInventoryService, OpendaylightInventoryListener, FlowTopologyDiscoveryListener {
+import org.opendaylight.controller.sal.reader.IPluginOutReadService
+import java.util.List
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate
+import org.opendaylight.controller.sal.reader.NodeTableStatistics
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatistics
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder
+
+class InventoryAndReadAdapter implements IPluginInTopologyService,
+                                                                                        IPluginInReadService,
+                                                                                        IPluginInInventoryService,
+                                                                                        OpendaylightInventoryListener,
+                                                                                        FlowTopologyDiscoveryListener,
+                                                                                        OpendaylightFlowStatisticsListener,
+                                                                                        OpendaylightFlowTableStatisticsListener,
+                                                                                        OpendaylightPortStatisticsListener {
 
     private static val LOG = LoggerFactory.getLogger(InventoryAndReadAdapter);
 
+       private static val OPENFLOWV10_TABLE_ID = new Integer(0).shortValue;
     @Property
     DataBrokerService dataService;
 
+    @Property
+    DataProviderService dataProviderService;
+
     @Property
     OpendaylightFlowStatisticsService flowStatisticsService;
 
+    @Property
+    OpendaylightPortStatisticsService nodeConnectorStatisticsService;
+    
+    @Property
+    OpendaylightFlowTableStatisticsService flowTableStatisticsService;
+
     @Property
     IPluginOutInventoryService inventoryPublisher;
 
     @Property
     IPluginOutTopologyService topologyPublisher;
-    
-    @Property
-    IDiscoveryService discoveryPublisher;
 
     @Property
     FlowTopologyDiscoveryService topologyDiscovery;
+    
+    @Property
+    List<IPluginOutReadService> statisticsPublisher = new ArrayList<IPluginOutReadService>();
+       
+    def setReadPublisher(IPluginOutReadService listener) {
+       statisticsPublisher.add(listener);
+    }
+    
+    def unsetReadPublisher (IPluginOutReadService listener) {
+       if( listener != null)
+               statisticsPublisher.remove(listener);
+    }
+
+    protected def startChange() {
+        return dataProviderService.beginTransaction;
+    }
 
     override getTransmitRate(NodeConnector connector) {
         val nodeConnector = readFlowCapableNodeConnector(connector.toNodeConnectorRef);
@@ -74,82 +131,206 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
     }
 
     override readAllFlow(Node node, boolean cached) {
-        val input = new GetAllFlowStatisticsInputBuilder;
-        input.setNode(node.toNodeRef);
-        val result = flowStatisticsService.getAllFlowStatistics(input.build)
 
-        val statistics = result.get.result;
         val output = new ArrayList<FlowOnNode>();
-        for (stat : statistics.flowStatistics) {
-            // FIXME: Create FlowOnNode
-        }
+               val tableRef = InstanceIdentifier.builder(Nodes)
+                                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                       .augmentation(FlowCapableNode).child(Table, new TableKey(OPENFLOWV10_TABLE_ID)).toInstance();
+               
+               val it = this.startChange();
+               
+               val table= it.readConfigurationData(tableRef) as Table;
+               
+               if(table != null){
+                       LOG.info("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
+                       
+                       for(flow : table.flow){
+                               
+                               val adsalFlow = ToSalConversionsUtils.toFlow(flow);
+                               val statsFromDataStore = flow.getAugmentation(FlowStatisticsData) as FlowStatisticsData;
+                               
+                               if(statsFromDataStore != null){
+                                       val it = new FlowOnNode(adsalFlow);
+                                       byteCount =  statsFromDataStore.flowStatistics.byteCount.value.longValue;
+                                       packetCount = statsFromDataStore.flowStatistics.packetCount.value.longValue;
+                                       durationSeconds = statsFromDataStore.flowStatistics.duration.second.value.intValue;
+                                       durationNanoseconds = statsFromDataStore.flowStatistics.duration.nanosecond.value.intValue;
+                                       
+                                       output.add(it);
+                               }
+                       }
+               }
+        
+        //TODO (main): Shell we send request to the switch? It will make async request to the switch.
+        // Once plugin receive response, it will let adaptor know through onFlowStatisticsUpdate()
+        // If we assume that md-sal statistics manager will always be running, then its not required
+        // But if not, then sending request will collect the latest data for adaptor atleast.
+        val input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
+        input.setNode(node.toNodeRef);
+        flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build)
+        
         return output;
     }
 
     override readAllNodeConnector(Node node, boolean cached) {
-        val input = new GetAllNodeConnectorStatisticsInputBuilder();
+       
+       val ret = new ArrayList<NodeConnectorStatistics>();
+               val nodeRef = InstanceIdentifier.builder(Nodes)
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                                       .toInstance();
+               
+               val provider = this.startChange();
+               
+               val dsNode= provider.readConfigurationData(nodeRef) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+               
+               if(dsNode != null){
+                       
+                       for (dsNodeConnector : dsNode.nodeConnector){
+                               val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector, dsNodeConnector.key)
+                                                                       .toInstance();
+                               
+                               val nodeConnectorFromDS = provider.readConfigurationData(nodeConnectorRef) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
+                               
+                               if(nodeConnectorFromDS != null){
+                                       val nodeConnectorStatsFromDs = nodeConnectorFromDS.getAugmentation(FlowCapableNodeConnectorStatisticsData) as FlowCapableNodeConnectorStatistics;
+                                       
+                                       ret.add(toNodeConnectorStatistics(nodeConnectorStatsFromDs.flowCapableNodeConnectorStatistics,dsNode.id,dsNodeConnector.id));
+                               }
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetAllNodeConnectorsStatisticsInputBuilder();
         input.setNode(node.toNodeRef);
-        val result = flowStatisticsService.getAllNodeConnectorStatistics(input.build());
-        val statistics = result.get.result.nodeConnectorStatistics;
-        val ret = new ArrayList<NodeConnectorStatistics>();
-        for (stat : statistics) {
-            ret.add(stat.toNodeConnectorStatistics())
-        }
+        nodeConnectorStatisticsService.getAllNodeConnectorsStatistics(input.build());
         return ret;
     }
 
     override readAllNodeTable(Node node, boolean cached) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+       val ret = new ArrayList<NodeTableStatistics>();
+       
+               val dsFlowCapableNode= readFlowCapableNode(node.toNodeRef)
+               
+               if(dsFlowCapableNode != null){
+                       
+                       for (table : dsFlowCapableNode.table){
+                               
+                               val tableStats = table.getAugmentation(FlowTableStatisticsData) as FlowTableStatisticsData;
+                               
+                               if(tableStats != null){
+                                       ret.add(toNodeTableStatistics(tableStats.flowTableStatistics,table.id,node));
+                               }
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetFlowTablesStatisticsInputBuilder();
+        input.setNode(node.toNodeRef);
+        flowTableStatisticsService.getFlowTablesStatistics(input.build);
+        return ret;
     }
 
     override readDescription(Node node, boolean cached) {
-        val capableNode = readFlowCapableNode(node.toNodeRef)
-
-        val it = new NodeDescription()
-        manufacturer = capableNode.manufacturer
-        serialNumber = capableNode.serialNumber
-        software = capableNode.software
-        description = capableNode.description
-
-        return it;
-    }
-
-    override readFlow(Node node, Flow flow, boolean cached) {
-        val input = flowStatisticsInput(node, flow);
-        val output = flowStatisticsService.getFlowStatistics(input);
-
-        try {
-            val statistics = output.get().getResult();
-            if (statistics != null) {
-                val it = new FlowOnNode(flow);
-                byteCount = statistics.byteCount.value.longValue
-                durationNanoseconds = statistics.duration.getNanosecond().getValue().intValue();
-                durationSeconds = statistics.duration.getSecond().getValue().intValue();
-                packetCount = statistics.getPacketCount().getValue().longValue();
-                return it;
-            }
-        } catch (Exception e) {
-            LOG.error("Read flow not processed", e);
-        }
-        return null;
+        return toNodeDescription(node.toNodeRef);
+       }
+
+    override readFlow(Node node, Flow targetFlow, boolean cached) {
+               var FlowOnNode ret= null;
+               
+               val tableRef = InstanceIdentifier.builder(Nodes)
+                                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(node))
+                                                       .augmentation(FlowCapableNode).child(Table, new TableKey(OPENFLOWV10_TABLE_ID)).toInstance();
+               
+               val it = this.startChange();
+               
+               val table= it.readConfigurationData(tableRef) as Table;
+               
+               if(table != null){
+                       LOG.info("Number of flows installed in table 0 of node {} : {}",node,table.flow.size);
+                       
+                       for(mdsalFlow : table.flow){
+                               if(FromSalConversionsUtils.flowEquals(mdsalFlow, MDFlowMapping.toMDSalflow(targetFlow))){
+                                       val statsFromDataStore = mdsalFlow.getAugmentation(FlowStatisticsData) as FlowStatisticsData;
+                                       
+                                       if(statsFromDataStore != null){
+                                               LOG.debug("Found matching flow in the data store flow table ");
+                                               val it = new FlowOnNode(targetFlow);
+                                               byteCount =  statsFromDataStore.flowStatistics.byteCount.value.longValue;
+                                               packetCount = statsFromDataStore.flowStatistics.packetCount.value.longValue;
+                                               durationSeconds = statsFromDataStore.flowStatistics.duration.second.value.intValue;
+                                               durationNanoseconds = statsFromDataStore.flowStatistics.duration.nanosecond.value.intValue;
+                                               
+                                               ret = it;
+                                       }
+                               }                       
+                       }
+               }
+        
+        //TODO: Refer TODO (main)
+        val input = new GetFlowStatisticsFromFlowTableInputBuilder;
+        input.setNode(node.toNodeRef);
+        input.fieldsFrom(MDFlowMapping.toMDSalflow(targetFlow));
+        flowStatisticsService.getFlowStatisticsFromFlowTable(input.build)
+        
+        return ret;
+       
     }
 
     override readNodeConnector(NodeConnector connector, boolean cached) {
+       var NodeConnectorStatistics  nodeConnectorStatistics = null;
+       
+               val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(connector.node))
+                                                                       .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector, InventoryMapping.toNodeConnectorKey(connector))
+                                                                       .toInstance();
+               val provider = this.startChange();
+                               
+               val nodeConnectorFromDS = provider.readConfigurationData(nodeConnectorRef) as org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
+                               
+               if(nodeConnectorFromDS != null){
+                       val nodeConnectorStatsFromDs = nodeConnectorFromDS.getAugmentation(FlowCapableNodeConnectorStatisticsData) as FlowCapableNodeConnectorStatistics;
+                       if(nodeConnectorStatsFromDs != null) {
+                               nodeConnectorStatistics = toNodeConnectorStatistics(nodeConnectorStatsFromDs.flowCapableNodeConnectorStatistics,
+                                                                                                                                               InventoryMapping.toNodeKey(connector.node).id,
+                                                                                                                                               InventoryMapping.toNodeConnectorKey(connector).id);
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetNodeConnectorStatisticsInputBuilder();
+        input.setNode(connector.node.toNodeRef);
+        input.setNodeConnectorId(InventoryMapping.toNodeConnectorKey(connector).id);
+        nodeConnectorStatisticsService.getNodeConnectorStatistics(input.build());
+        return nodeConnectorStatistics;
+    }
 
-        val getNodeConnectorStatisticsInput = FromSalConversionsUtils.nodeConnectorStatistics(connector);
-        val future = flowStatisticsService.getNodeConnectorStatistics(getNodeConnectorStatisticsInput);
-        try {
-            val rpcResult = future.get();
-            val output = rpcResult.getResult();
-
-            if (output != null) {
-                return output.toNodeConnectorStatistics;
-            }
-        } catch (Exception e) {
-            LOG.error("Read node connector not processed", e);
-        }
-
-        return null;
+    override readNodeTable(NodeTable nodeTable, boolean cached) {
+       var NodeTableStatistics nodeStats = null
+       
+       val tableRef = InstanceIdentifier.builder(Nodes)
+                                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, InventoryMapping.toNodeKey(nodeTable.node))
+                                                       .augmentation(FlowCapableNode).child(Table, new TableKey(nodeTable.ID as Short)).toInstance();
+               
+               val it = this.startChange();
+               
+               val table= it.readConfigurationData(tableRef) as Table;
+               
+               if(table != null){
+                       val tableStats = table.getAugmentation(FlowTableStatisticsData) as FlowTableStatisticsData;
+                               
+                       if(tableStats != null){
+                               nodeStats =  toNodeTableStatistics(tableStats.flowTableStatistics,table.id,nodeTable.node);
+                       }
+               }
+
+               //TODO: Refer TODO (main)
+        val input = new GetFlowTablesStatisticsInputBuilder();
+        input.setNode(nodeTable.node.toNodeRef);
+        flowTableStatisticsService.getFlowTablesStatistics(input.build);
+        
+        return nodeStats;
     }
 
     override onNodeConnectorRemoved(NodeConnectorRemoved update) {
@@ -157,17 +338,45 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
     }
 
     override onNodeRemoved(NodeRemoved notification) {
-        // NOOP
+        val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
+
+        inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.REMOVED, properties);
     }
 
     override onNodeConnectorUpdated(NodeConnectorUpdated update) {
-        val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
-        inventoryPublisher.updateNodeConnector(update.nodeConnectorRef.toADNodeConnector, UpdateType.CHANGED, properties);
+        val properties = new java.util.HashSet<org.opendaylight.controller.sal.core.Property>();
+
+
+        val org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> identifier = update.nodeConnectorRef.value as org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>;
+        var updateType = UpdateType.CHANGED;
+        if ( this._dataService.readOperationalData(identifier) == null ){
+            updateType = UpdateType.ADDED;
+        }
+
+        var nodeConnector = update.nodeConnectorRef.toADNodeConnector
+
+
+        properties.add(new org.opendaylight.controller.sal.core.Name(nodeConnector.ID.toString()));
+
+        inventoryPublisher.updateNodeConnector(nodeConnector , updateType , properties);
     }
 
     override onNodeUpdated(NodeUpdated notification) {
         val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
-        inventoryPublisher.updateNode(notification.nodeRef.toADNode, UpdateType.CHANGED, properties);
+        val org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> identifier = notification.nodeRef.value  as org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>;
+
+        var updateType = UpdateType.CHANGED;
+        if ( this._dataService.readOperationalData(identifier) == null ){
+            updateType = UpdateType.ADDED;
+        }
+        inventoryPublisher.updateNode(notification.nodeRef.toADNode, updateType, properties);
+        
+               //Notify the listeners of IPluginOutReadService
+        
+        for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.descriptionStatisticsUpdated(nodeRef.toADNode,toNodeDescription(notification.nodeRef));
+               }
     }
 
     override getNodeProps() {
@@ -182,10 +391,6 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
         return null;
     }
 
-    override readNodeTable(NodeTable table, boolean cached) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-    }
-
     private def FlowCapableNode readFlowCapableNode(NodeRef ref) {
         val dataObject = dataService.readOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
         val node = dataObject.checkInstanceOf(
@@ -200,26 +405,61 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
         return node.getAugmentation(FlowCapableNodeConnector);
     }
 
-    private static def toNodeConnectorStatistics(
-        org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics output) {
-        val it = new NodeConnectorStatistics
-
-        collisionCount = output.getCollisionCount().longValue();
-        receiveCRCErrorCount = output.getReceiveCrcError().longValue();
-        receiveFrameErrorCount = output.getReceiveFrameError().longValue();
-        receiveOverRunErrorCount = output.getReceiveOverRunError().longValue();
+    private def toNodeConnectorStatistics(
+        org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.NodeConnectorStatistics nodeConnectorStatistics, NodeId nodeId, NodeConnectorId nodeConnectorId) {
+               
+                       val it = new NodeConnectorStatistics();
+                       
+                       receivePacketCount = nodeConnectorStatistics.packets.received.longValue;
+                       transmitPacketCount = nodeConnectorStatistics.packets.transmitted.longValue;
+                       
+                       receiveByteCount = nodeConnectorStatistics.bytes.received.longValue;
+                       transmitByteCount = nodeConnectorStatistics.bytes.transmitted.longValue;
+                       
+                       receiveDropCount = nodeConnectorStatistics.receiveDrops.longValue;
+                       transmitDropCount = nodeConnectorStatistics.transmitDrops.longValue;
+                       
+                       receiveErrorCount = nodeConnectorStatistics.receiveErrors.longValue;
+                       transmitErrorCount = nodeConnectorStatistics.transmitErrors.longValue;
+                       
+                       receiveFrameErrorCount = nodeConnectorStatistics.receiveFrameError.longValue;
+                       receiveOverRunErrorCount = nodeConnectorStatistics.receiveOverRunError.longValue;
+                       receiveCRCErrorCount = nodeConnectorStatistics.receiveCrcError.longValue;
+                       collisionCount = nodeConnectorStatistics.collisionCount.longValue;
+                       
+                       val nodeConnectorRef = InstanceIdentifier.builder(Nodes)
+                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(nodeId))
+                                                               .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector,new NodeConnectorKey(nodeConnectorId)).toInstance;
+                       
+                       nodeConnector = NodeMapping.toADNodeConnector(new NodeConnectorRef(nodeConnectorRef));
+                       
+                       return it;
+    }
 
-        receiveDropCount = output.getReceiveDrops().longValue();
-        receiveErrorCount = output.getReceiveErrors().longValue();
-        receivePacketCount = output.getPackets().getReceived().longValue();
-        receiveByteCount = output.getBytes().getReceived().longValue();
+       private def toNodeTableStatistics(
+               org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics tableStats,
+               Short tableId,Node node){
+               var it = new NodeTableStatistics();
+               
+               activeCount = tableStats.activeFlows.value.intValue;
+               lookupCount = tableStats.packetsLookedUp.value.intValue;
+               matchedCount = tableStats.packetsMatched.value.intValue;
+               name = tableId.toString;
+               nodeTable = new NodeTable(NodeMapping.MD_SAL_TYPE,tableId,node);
+               return it;
+       }
+       
+       private def toNodeDescription(NodeRef nodeRef){
+               val capableNode = readFlowCapableNode(nodeRef);
 
-        transmitDropCount = output.getTransmitDrops().longValue();
-        transmitErrorCount = output.getTransmitErrors().longValue();
-        transmitPacketCount = output.getPackets().getTransmitted().longValue();
-        transmitByteCount = output.getBytes().getTransmitted().longValue();
+        val it = new NodeDescription()
+        manufacturer = capableNode.manufacturer
+        serialNumber = capableNode.serialNumber
+        software = capableNode.software
+        description = capableNode.description
+        
         return it;
-    }
+       }
 
     override sollicitRefresh() {
         topologyDiscovery.solicitRefresh
@@ -227,7 +467,6 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
     
     override onLinkDiscovered(LinkDiscovered notification) {
         val update = new TopoEdgeUpdate(notification.toADEdge,Collections.emptySet(),UpdateType.ADDED);
-        discoveryPublisher.notifyEdge(notification.toADEdge,UpdateType.ADDED,Collections.emptySet());
         topologyPublisher.edgeUpdate(Collections.singletonList(update))
     }
     
@@ -248,5 +487,78 @@ class InventoryAndReadAdapter implements IPluginInTopologyService, IPluginInRead
     def Edge toADEdge(Link link) {
         new Edge(link.source.toADNodeConnector,link.destination.toADNodeConnector)
     }
-
+       
+       /*
+        * OpendaylightFlowStatisticsListener interface implementation
+        */
+       override onAggregateFlowStatisticsUpdate(AggregateFlowStatisticsUpdate notification) {
+               throw new UnsupportedOperationException("TODO: auto-generated method stub")
+       }
+       
+       override onFlowsStatisticsUpdate(FlowsStatisticsUpdate notification) {
+               
+               val adsalFlowsStatistics = new ArrayList<FlowOnNode>();
+               
+               for(flowStats : notification.flowAndStatisticsMapList){
+                       if(flowStats.tableId == 0)
+                               adsalFlowsStatistics.add(toFlowOnNode(flowStats));
+               }
+               
+               for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.nodeFlowStatisticsUpdated(nodeRef.toADNode,adsalFlowsStatistics);
+               }
+               
+       }
+       /*
+        * OpendaylightFlowTableStatisticsListener interface implementation
+        */     
+       override onFlowTableStatisticsUpdate(FlowTableStatisticsUpdate notification) {
+               var adsalFlowTableStatistics = new ArrayList<NodeTableStatistics>();
+               
+               for(stats : notification.flowTableAndStatisticsMap){
+                       if (stats.tableId.value == 0){
+                               val it = new NodeTableStatistics();
+                               activeCount = stats.activeFlows.value.intValue;
+                               lookupCount = stats.packetsLookedUp.value.longValue;
+                               matchedCount = stats.packetsMatched.value.longValue;
+                               
+                               adsalFlowTableStatistics.add(it);
+                       }
+               }
+               for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.nodeTableStatisticsUpdated(nodeRef.toADNode,adsalFlowTableStatistics);
+               }
+       }
+       
+       /*
+        * OpendaylightPortStatisticsUpdate interface implementation
+        */
+       override onNodeConnectorStatisticsUpdate(NodeConnectorStatisticsUpdate notification) {
+               
+               val adsalPortStatistics  = new ArrayList<NodeConnectorStatistics>();
+               
+               for(nodeConnectorStatistics : notification.nodeConnectorStatisticsAndPortNumberMap){
+                       adsalPortStatistics.add(toNodeConnectorStatistics(nodeConnectorStatistics,notification.id,nodeConnectorStatistics.nodeConnectorId));
+               }
+               
+               for (statsPublisher : statisticsPublisher){
+                       val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
+                       statsPublisher.nodeConnectorStatisticsUpdated(nodeRef.toADNode,adsalPortStatistics);
+               }
+               
+       }
+       
+       private static def toFlowOnNode (FlowAndStatisticsMapList flowAndStatsMap){
+               
+               val it = new FlowOnNode(ToSalConversionsUtils.toFlow(flowAndStatsMap));
+               
+               byteCount = flowAndStatsMap.byteCount.value.longValue;
+               packetCount = flowAndStatsMap.packetCount.value.longValue;
+               durationSeconds = flowAndStatsMap.duration.second.value.intValue;
+               durationNanoseconds = flowAndStatsMap.duration.nanosecond.value.intValue;
+               
+               return it;
+       }
 }
index 6cf728cde967d2ca1ed250dc93198a061a226795..2f458c41ddfc8dce40325338fe015ba41e8c4118 100644 (file)
@@ -5,7 +5,6 @@ import java.math.BigInteger
 import java.net.Inet4Address
 import java.net.Inet6Address
 import java.util.ArrayList
-import java.util.List
 import org.opendaylight.controller.sal.action.Controller
 import org.opendaylight.controller.sal.action.Drop
 import org.opendaylight.controller.sal.action.Flood
@@ -40,7 +39,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddF
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInputBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder
@@ -67,7 +65,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder
@@ -106,6 +103,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder
 
 public class MDFlowMapping {
 
@@ -142,13 +141,6 @@ public class MDFlowMapping {
         return it.build;
     }
 
-    public static def flowStatisticsInput(Node sourceNode, Flow sourceFlow) {
-        val source = flowAdded(sourceFlow);
-        val it = new GetFlowStatisticsInputBuilder(source as org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow);
-        node = sourceNode.toNodeRef();
-        return it.build();
-    }
-
     public static def removeFlowInput(Node sourceNode, Flow sourceFlow) {
         val source = flowAdded(sourceFlow);
         val it = new RemoveFlowInputBuilder(source as org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow);
@@ -355,7 +347,7 @@ public class MDFlowMapping {
     }
 
     public static def Uri toUri(NodeConnector connector) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        return new NodeConnectorId(connector.ID as String);
     }
 
     public static def MacAddress toMacAddress(byte[] bytes) {
@@ -367,4 +359,25 @@ public class MDFlowMapping {
         }
         return new MacAddress(sb.toString());
     }
+       
+       public static def toMDSalflow(Flow sourceFlow) {
+        if (sourceFlow == null)
+            throw new IllegalArgumentException();
+        val it = new FlowBuilder();
+
+        hardTimeout = sourceFlow.hardTimeout as int
+        idleTimeout = sourceFlow.idleTimeout as int
+        cookie = BigInteger.valueOf(sourceFlow.id)
+        priority = sourceFlow.priority as int
+
+        val sourceActions = sourceFlow.actions;
+        val targetActions = new ArrayList<Action>();
+        for (sourceAction : sourceActions) {
+            targetActions.add(sourceAction.toAction());
+        }
+        instructions = targetActions.toApplyInstruction();
+        match = sourceFlow.match.toMatch();
+        return it.build();
+       }
+       
 }
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeConnectorFactory.java
new file mode 100644 (file)
index 0000000..5b4b16a
--- /dev/null
@@ -0,0 +1,23 @@
+package org.opendaylight.controller.sal.compatibility;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MDSalNodeConnectorFactory implements INodeConnectorFactory{
+    private Logger logger = LoggerFactory.getLogger(MDSalNodeConnectorFactory.class);
+
+    @Override
+    public NodeConnector fromStringNoNode(String type, String id, Node node) {
+        try {
+            return new NodeConnector(type, id, node);
+        } catch (ConstructionException e) {
+            logger.error("Could not construct NodeConnector", e);
+        }
+        return null;
+
+    }
+}
diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDSalNodeFactory.java
new file mode 100644 (file)
index 0000000..e36ebd7
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.sal.compatibility;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.INodeFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MDSalNodeFactory implements INodeFactory{
+    private Logger logger = LoggerFactory.getLogger(MDSalNodeFactory.class);
+
+    @Override
+    public Node fromString(String type, String id) {
+
+        try {
+            return new Node(type, id);
+        } catch (ConstructionException e) {
+            logger.error("Could not construct Node", e);
+        }
+        return null;
+    }
+}
index 4c9a9e6658145c481c153e9747434ef65b395443..6bfee578abc0ce56d78ce7aaa432bd4cee7aecd6 100644 (file)
@@ -10,17 +10,19 @@ import static extension org.opendaylight.controller.sal.common.util.Arguments.*;
 
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
 import org.opendaylight.controller.sal.core.ConstructionException
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
+
 
 public class NodeMapping {
 
     public static val MD_SAL_TYPE = "MD_SAL";
     private static val NODE_CLASS = org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-    private static val NODECONNECTOR_CLASS = org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.
-        NodeConnector;
+    private static val NODECONNECTOR_CLASS = org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 
     private new() {
         throw new UnsupportedOperationException("Utility class. Instantiation is not allowed.");
@@ -33,7 +35,7 @@ public class NodeMapping {
         val arg = node.getPath().get(1);
         val item = arg.checkInstanceOf(IdentifiableItem);
         val nodeKey = item.getKey().checkInstanceOf(NodeKey);
-        return new Node(MD_SAL_TYPE, nodeKey);
+        return new Node(MD_SAL_TYPE, nodeKey.getId().getValue().toString());
     }
 
     public static def toADNodeConnector(NodeConnectorRef source) throws ConstructionException {
@@ -44,20 +46,22 @@ public class NodeMapping {
         val arg = path.getPath().get(2);
         val item = arg.checkInstanceOf(IdentifiableItem);
         val connectorKey = item.getKey().checkInstanceOf(NodeConnectorKey);
-        return new NodeConnector(MD_SAL_TYPE, connectorKey, node);
+        return new NodeConnector(MD_SAL_TYPE, connectorKey.getId().getValue().toString(), node);
     }
-
+    
     public static def toNodeRef(Node node) {
         checkArgument(MD_SAL_TYPE.equals(node.getType()));
-        val nodeKey = node.ID.checkInstanceOf(NodeKey);
+        var nodeId = node.ID.checkInstanceOf(String)
+        val nodeKey = new NodeKey(new NodeId(nodeId));
         val nodePath = InstanceIdentifier.builder().node(Nodes).child(NODE_CLASS, nodeKey).toInstance();
         return new NodeRef(nodePath);
     }
-
+    
     public static def toNodeConnectorRef(NodeConnector nodeConnector) {
         val node = nodeConnector.node.toNodeRef();
         val nodePath = node.getValue() as InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node>
-        val connectorKey = nodeConnector.ID.checkInstanceOf(NodeConnectorKey);
+        var nodeConnectorId = nodeConnector.ID.checkInstanceOf(String)
+        val connectorKey = new NodeConnectorKey(new NodeConnectorId(nodeConnectorId));
         val path = InstanceIdentifier.builder(nodePath).child(NODECONNECTOR_CLASS, connectorKey).toInstance();
         return new NodeConnectorRef(path);
     }
@@ -65,5 +69,5 @@ public class NodeMapping {
     public static def toADNode(NodeRef node) throws ConstructionException {
         return toADNode(node.getValue());
     }
-
+    
 }
index a8349be1b410f2abcd3714de6ba141e8257c02d0..37bb2778584dc6deb08add85d63eee4ca9489acd 100644 (file)
@@ -1,6 +1,25 @@
 package org.opendaylight.controller.sal.compatibility;
 
-import com.google.common.net.InetAddresses;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
+import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
+import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
+import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
+import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
+import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN;
+import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN_PR;
+import static org.opendaylight.controller.sal.match.MatchType.NW_DST;
+import static org.opendaylight.controller.sal.match.MatchType.NW_PROTO;
+import static org.opendaylight.controller.sal.match.MatchType.NW_SRC;
+import static org.opendaylight.controller.sal.match.MatchType.NW_TOS;
+import static org.opendaylight.controller.sal.match.MatchType.TP_DST;
+import static org.opendaylight.controller.sal.match.MatchType.TP_SRC;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import org.opendaylight.controller.sal.action.Controller;
 import org.opendaylight.controller.sal.action.Drop;
@@ -33,7 +52,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.ActionList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
@@ -88,26 +106,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId;
 
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.TCP;
-import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.UDP;
-import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
-import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
-import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
-import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN;
-import static org.opendaylight.controller.sal.match.MatchType.DL_VLAN_PR;
-import static org.opendaylight.controller.sal.match.MatchType.NW_DST;
-import static org.opendaylight.controller.sal.match.MatchType.NW_PROTO;
-import static org.opendaylight.controller.sal.match.MatchType.NW_SRC;
-import static org.opendaylight.controller.sal.match.MatchType.NW_TOS;
-import static org.opendaylight.controller.sal.match.MatchType.TP_DST;
-import static org.opendaylight.controller.sal.match.MatchType.TP_SRC;
+import com.google.common.net.InetAddresses;
 
 public class ToSalConversionsUtils {
 
@@ -484,11 +483,11 @@ public class ToSalConversionsUtils {
     private static void fillFromArp(Match target, ArpMatch source) {
         Ipv4Prefix sourceAddress = source.getArpSourceTransportAddress();
         if (sourceAddress != null) {
-            target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null);
+            target.setField(NW_SRC, inetAddressFrom(sourceAddress), null);
         }
         Ipv4Prefix destAddress = source.getArpTargetTransportAddress();
         if (destAddress != null) {
-            target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null);
+            target.setField(NW_DST, inetAddressFrom(destAddress), null);
         }
         ArpSourceHardwareAddress sourceHwAddress = source.getArpSourceHardwareAddress();
         if (sourceHwAddress != null) {
@@ -506,22 +505,22 @@ public class ToSalConversionsUtils {
     private static void fillFromIpv6(Match target, Ipv6Match source) {
         Ipv6Prefix sourceAddress = source.getIpv6Source();
         if (sourceAddress != null) {
-            target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null);
+            target.setField(NW_SRC, inetAddressFrom(sourceAddress), null);
         }
         Ipv6Prefix destAddress = source.getIpv6Destination();
         if (destAddress != null) {
-            target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null);
+            target.setField(NW_DST, inetAddressFrom(destAddress), null);
         }
     }
 
     private static void fillFromIpv4(Match target, Ipv4Match source) {
         Ipv4Prefix sourceAddress = source.getIpv4Source();
         if (sourceAddress != null) {
-            target.setField(NW_SRC, (InetAddress) inetAddressFrom(sourceAddress), null);
+            target.setField(NW_SRC, inetAddressFrom(sourceAddress), null);
         }
         Ipv4Prefix destAddress = source.getIpv4Destination();
         if (destAddress != null) {
-            target.setField(NW_DST, (InetAddress) inetAddressFrom(destAddress), null);
+            target.setField(NW_DST, inetAddressFrom(destAddress), null);
         }
     }
 
index 09585d6273a0c2cecd32e90d4f442313bf685946..149544b6c4e76509af96635ccc7fd21423dc9935 100644 (file)
@@ -8,6 +8,8 @@ import java.util.concurrent.Future;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.common.util.Futures;
 import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.compatibility.FromSalConversionsUtils;
+import org.opendaylight.controller.sal.compatibility.InventoryMapping;
 import org.opendaylight.controller.sal.compatibility.NodeMapping;
 import org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils;
 import org.opendaylight.controller.sal.core.ConstructionException;
@@ -19,87 +21,78 @@ import org.opendaylight.controller.sal.reader.IReadServiceListener;
 import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
 import org.opendaylight.controller.sal.reader.NodeDescription;
 import org.opendaylight.controller.sal.reader.NodeTableStatistics;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter32;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter64;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllNodeConnectorStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowTableStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.NodeConnectorStatisticsUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.flow.statistics.output.FlowStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.flow.statistics.output.FlowStatisticsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatisticsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.statistics.Duration;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.statistics.DurationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Bytes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.Packets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService, IReadServiceListener {
+public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService, IReadServiceListener{
 
     private static final Logger LOG = LoggerFactory.getLogger(FlowStatisticsAdapter.class);
     private IReadService readDelegate;
     private NotificationProviderService notifier;
 
     @Override
-    public Future<RpcResult<GetAllFlowStatisticsOutput>> getAllFlowStatistics(GetAllFlowStatisticsInput input) {
-        GetAllFlowStatisticsOutput rpcResultType = null;
-        boolean rpcResultBool = false;
-
-        try {
-            Node adNode = NodeMapping.toADNode(input.getNode());
-            List<FlowOnNode> flowsOnNode = readDelegate.readAllFlows(adNode);
-            List<FlowStatistics> flowsStatistics = toOdFlowsStatistics(flowsOnNode);
-            GetAllFlowStatisticsOutputBuilder builder = new GetAllFlowStatisticsOutputBuilder();
-            rpcResultType = builder.setFlowStatistics(flowsStatistics).build();
-            rpcResultBool = true;
-        } catch (ConstructionException e) {
-            LOG.error(e.getMessage());
-        }
+    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
+            GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
+        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and 
+        // generating aggregate flow statistics out of those individual flow stats.
+        return null;
+    }
 
-        return Futures.immediateFuture(Rpcs.getRpcResult(rpcResultBool, rpcResultType, null));
+    @Override
+    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
+            GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+        //TODO: No supported API exist in AD-SAL, it can either be implemented by fetching all the stats of the flows and 
+        // generating aggregate flow statistics out of those individual flow stats.
+        return null;
     }
 
     @Override
-    public Future<RpcResult<GetAllNodeConnectorStatisticsOutput>> getAllNodeConnectorStatistics(
-            GetAllNodeConnectorStatisticsInput input) {
-        GetAllNodeConnectorStatisticsOutput rpcResultType = null;
+    public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
+            GetAllFlowStatisticsFromFlowTableInput input) {
+        GetAllFlowStatisticsFromFlowTableOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
         try {
             Node adNode = NodeMapping.toADNode(input.getNode());
-            List<NodeConnectorStatistics> nodesConnectorStatistics = readDelegate.readNodeConnectors(adNode);
-            List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics> odNodesConnectorStatistics;
-            odNodesConnectorStatistics = toOdNodesConnectorStatistics(nodesConnectorStatistics);
-            GetAllNodeConnectorStatisticsOutputBuilder builder = new GetAllNodeConnectorStatisticsOutputBuilder();
-            rpcResultType = builder.setNodeConnectorStatistics(odNodesConnectorStatistics).build();
+            List<FlowOnNode> flowsOnNode = readDelegate.readAllFlows(adNode);
+            List<FlowAndStatisticsMapList> flowsStatistics = toOdFlowsStatistics(flowsOnNode);
+            GetAllFlowStatisticsFromFlowTableOutputBuilder builder = new GetAllFlowStatisticsFromFlowTableOutputBuilder();
+            builder.setTransactionId(new TransactionId(new BigInteger("0")));
+            rpcResultType = builder.setFlowAndStatisticsMapList(flowsStatistics).build();
+            
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -108,17 +101,24 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         return Futures.immediateFuture(Rpcs.getRpcResult(rpcResultBool, rpcResultType, null));
     }
 
+    /**
+     * Essentially this API will return the same result as getAllFlowStatisticsFromFlowTable
+     */
     @Override
-    public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
-        GetFlowStatisticsOutput rpcResultType = null;
+    public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
+            GetAllFlowsStatisticsFromAllFlowTablesInput input) {
+        
+        GetAllFlowsStatisticsFromAllFlowTablesOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
         try {
-            Node node = NodeMapping.toADNode(input.getNode());
-            Flow flow = ToSalConversionsUtils.toFlow(input);
-            FlowOnNode readFlow = readDelegate.readFlow(node, flow);
-            FlowStatistics flowOnNodeToFlowStatistics = toOdFlowStatistics(readFlow);
-            rpcResultType = new GetFlowStatisticsOutputBuilder(flowOnNodeToFlowStatistics).build();
+            Node adNode = NodeMapping.toADNode(input.getNode());
+            List<FlowOnNode> flowsOnNode = readDelegate.readAllFlows(adNode);
+            List<FlowAndStatisticsMapList> flowsStatistics = toOdFlowsStatistics(flowsOnNode);
+            GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder builder = new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
+            builder.setTransactionId(new TransactionId(new BigInteger("0")));
+            rpcResultType = builder.setFlowAndStatisticsMapList(flowsStatistics).build();
+            
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -128,38 +128,18 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     }
 
     @Override
-    public Future<RpcResult<GetFlowTableStatisticsOutput>> getFlowTableStatistics(GetFlowTableStatisticsInput input) {
-        GetFlowTableStatisticsOutput rpcResultType = null;
+    public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
+            GetFlowStatisticsFromFlowTableInput input) {
+        GetFlowStatisticsFromFlowTableOutput rpcResultType = null;
         boolean rpcResultBool = false;
 
         try {
             Node node = NodeMapping.toADNode(input.getNode());
-            List<NodeTableStatistics> nodesTable = readDelegate.readNodeTable(node);
-            NodeTableStatistics nodeTable = null;
-            if (!nodesTable.isEmpty()) {
-                nodeTable = nodesTable.get(0);
-                rpcResultType = toOdTableStatistics(nodeTable);
-                rpcResultBool = true;
-            }
-        } catch (ConstructionException e) {
-            LOG.error(e.getMessage());
-        }
-
-        return Futures.immediateFuture(Rpcs.getRpcResult(rpcResultBool, rpcResultType, null));
-    }
-
-    @Override
-    public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
-            GetNodeConnectorStatisticsInput input) {
-        GetNodeConnectorStatisticsOutput rpcResultType = null;
-        boolean rpcResultBool = false;
-
-        NodeConnectorRef nodeConnector = input.getNodeConnector();
-        try {
-            NodeConnectorStatistics nodeConnectorStats = readDelegate.readNodeConnector(NodeMapping
-                    .toADNodeConnector(nodeConnector));
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics odNodeConnectorStatistics = toOdNodeConnectorStatistics(nodeConnectorStats);
-            rpcResultType = new GetNodeConnectorStatisticsOutputBuilder(odNodeConnectorStatistics).build();
+            Flow flow = ToSalConversionsUtils.toFlow(input);
+            FlowOnNode readFlow = readDelegate.readFlow(node, flow);
+            List<FlowAndStatisticsMapList> flowOnNodeToFlowStatistics = new ArrayList<FlowAndStatisticsMapList>();
+            flowOnNodeToFlowStatistics.add(toOdFlowStatistics(readFlow));
+            rpcResultType = new GetFlowStatisticsFromFlowTableOutputBuilder().setFlowAndStatisticsMapList(flowOnNodeToFlowStatistics).build();
             rpcResultBool = true;
         } catch (ConstructionException e) {
             LOG.error(e.getMessage());
@@ -169,59 +149,74 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
     }
 
     @Override
-    public void descriptionStatisticsUpdated(Node node, NodeDescription nodeDescription) {
-
-        // TODO which *StatisticsUpdated interface should be used?
-
+    public void nodeFlowStatisticsUpdated(Node node, List<FlowOnNode> flowStatsList) {
+        List<FlowAndStatisticsMapList> flowStatistics = toOdFlowsStatistics(flowStatsList);
+        FlowsStatisticsUpdateBuilder flowsStatisticsUpdateBuilder = new FlowsStatisticsUpdateBuilder();
+        flowsStatisticsUpdateBuilder.setFlowAndStatisticsMapList(flowStatistics);
+        flowsStatisticsUpdateBuilder.setMoreReplies(false);
+        flowsStatisticsUpdateBuilder.setTransactionId(null);
+        flowsStatisticsUpdateBuilder.setId(InventoryMapping.toNodeKey(node).getId());
+        notifier.publish(flowsStatisticsUpdateBuilder.build());
     }
 
     @Override
     public void nodeConnectorStatisticsUpdated(Node node, List<NodeConnectorStatistics> ncStatsList) {
-        for (NodeConnectorStatistics ndConStats : ncStatsList) {
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics odNodeConnectorStatistics;
-            odNodeConnectorStatistics = toOdNodeConnectorStatistics(ndConStats);
-            NodeConnectorStatisticsUpdatedBuilder statisticsBuilder = new NodeConnectorStatisticsUpdatedBuilder(
-                    odNodeConnectorStatistics);
-            notifier.publish(statisticsBuilder.build());
-        }
-    }
-
-    @Override
-    public void nodeFlowStatisticsUpdated(Node node, List<FlowOnNode> flowStatsList) {
-        for (FlowOnNode flowOnNode : flowStatsList) {
-            FlowStatistics flowStatistics = toOdFlowStatistics(flowOnNode);
-            FlowStatisticsUpdatedBuilder statisticsBuilder = new FlowStatisticsUpdatedBuilder(flowStatistics);
-            notifier.publish(statisticsBuilder.build());
-        }
+        NodeConnectorStatisticsUpdateBuilder nodeConnectorStatisticsUpdateBuilder = new NodeConnectorStatisticsUpdateBuilder();
+        List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatistics = toOdNodeConnectorStatistics(ncStatsList);
+        
+        nodeConnectorStatisticsUpdateBuilder.setNodeConnectorStatisticsAndPortNumberMap(nodeConnectorStatistics);
+        nodeConnectorStatisticsUpdateBuilder.setMoreReplies(false);
+        nodeConnectorStatisticsUpdateBuilder.setTransactionId(null);
+        nodeConnectorStatisticsUpdateBuilder.setId(InventoryMapping.toNodeKey(node).getId());
+        notifier.publish(nodeConnectorStatisticsUpdateBuilder.build());
     }
 
     @Override
     public void nodeTableStatisticsUpdated(Node node, List<NodeTableStatistics> tableStatsList) {
-        // TODO : Not implemented by AD-SAL.
+        
+        FlowTableStatisticsUpdateBuilder flowTableStatisticsUpdateBuilder = new FlowTableStatisticsUpdateBuilder();  
+        
+        List<FlowTableAndStatisticsMap>  flowTableStatistics = toOdFlowTableStatistics(tableStatsList);
+        flowTableStatisticsUpdateBuilder.setFlowTableAndStatisticsMap(flowTableStatistics);
+        flowTableStatisticsUpdateBuilder.setMoreReplies(false);
+        flowTableStatisticsUpdateBuilder.setTransactionId(null);
+        flowTableStatisticsUpdateBuilder.setId(InventoryMapping.toNodeKey(node).getId());
+        notifier.publish(flowTableStatisticsUpdateBuilder.build());
+}
+
+        @Override
+    public void descriptionStatisticsUpdated(Node node, NodeDescription nodeDescription) {
+            // TODO which *StatisticsUpdated interface should be used?
+        
     }
 
-    private List<FlowStatistics> toOdFlowsStatistics(List<FlowOnNode> flowsOnNode) {
-        List<FlowStatistics> flowsStatistics = new ArrayList<>();
+    private List<FlowAndStatisticsMapList> toOdFlowsStatistics(List<FlowOnNode> flowsOnNode) {
+        List<FlowAndStatisticsMapList> flowsStatistics = new ArrayList<>();
         for (FlowOnNode flowOnNode : flowsOnNode) {
             flowsStatistics.add(toOdFlowStatistics(flowOnNode));
         }
         return flowsStatistics;
     }
 
-    private FlowStatistics toOdFlowStatistics(FlowOnNode flowOnNode) {
-        FlowStatisticsBuilder builder = new FlowStatisticsBuilder();
+    private FlowAndStatisticsMapList toOdFlowStatistics(FlowOnNode flowOnNode) {
+        FlowAndStatisticsMapListBuilder builder = new FlowAndStatisticsMapListBuilder();
 
         builder.setByteCount(toCounter64(flowOnNode.getByteCount()));
         builder.setPacketCount(toCounter64(flowOnNode.getPacketCount()));
         builder.setDuration(extractDuration(flowOnNode));
-
+        builder.setMatch(FromSalConversionsUtils.toMatch(flowOnNode.getFlow().getMatch()));
+        builder.setPriority((int)flowOnNode.getFlow().getPriority());
+        builder.setHardTimeout((int)flowOnNode.getFlow().getHardTimeout());
+        builder.setIdleTimeout((int)flowOnNode.getFlow().getIdleTimeout());
+        //TODO: actions to instruction conversion
+        builder.setInstructions(null);
         return builder.build();
     }
 
-    private Duration extractDuration(FlowOnNode flowOnNode) {
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.Duration extractDuration(FlowOnNode flowOnNode) {
         DurationBuilder builder = new DurationBuilder();
-        builder.setNanosecond(toCounter64(flowOnNode.getDurationNanoseconds()));
-        builder.setSecond(toCounter64(flowOnNode.getDurationSeconds()));
+        builder.setNanosecond(new Counter32((long)flowOnNode.getDurationNanoseconds()));
+        builder.setSecond(new Counter32((long)flowOnNode.getDurationSeconds()));
         return builder.build();
     }
 
@@ -231,38 +226,43 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         return new Counter64(byteCountBigInt);
     }
 
-    private Counter64 toCounter64(int num) {
-        String byteCountStr = String.valueOf(num);
-        BigInteger byteCountBigInt = new BigInteger(byteCountStr);
-        return new Counter64(byteCountBigInt);
-    }
-
-    private List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics> toOdNodesConnectorStatistics(
-            List<NodeConnectorStatistics> nodesConnectorStatistics) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics> odNodesConnectorStatistics = new ArrayList<>();
-        for (NodeConnectorStatistics nodeConnectorStatistics : nodesConnectorStatistics) {
-            odNodesConnectorStatistics.add(toOdNodeConnectorStatistics(nodeConnectorStatistics));
+    private List<FlowTableAndStatisticsMap> toOdFlowTableStatistics(List<NodeTableStatistics> tableStatsList) {
+        
+        List<FlowTableAndStatisticsMap> flowTableStatsMap = new ArrayList<FlowTableAndStatisticsMap>();
+        for (NodeTableStatistics nodeTableStatistics : tableStatsList) {
+            FlowTableAndStatisticsMapBuilder flowTableAndStatisticsMapBuilder = new FlowTableAndStatisticsMapBuilder();
+            flowTableAndStatisticsMapBuilder.setActiveFlows(new Counter32((long) nodeTableStatistics.getActiveCount()));
+            flowTableAndStatisticsMapBuilder.setPacketsLookedUp(toCounter64(nodeTableStatistics.getLookupCount()));
+            flowTableAndStatisticsMapBuilder.setPacketsMatched(toCounter64(nodeTableStatistics.getMatchedCount()));
+            flowTableAndStatisticsMapBuilder.setActiveFlows(new Counter32((long) nodeTableStatistics.getActiveCount()));
+            flowTableAndStatisticsMapBuilder.setTableId(new TableId((short)nodeTableStatistics.getNodeTable().getID()));
+            flowTableStatsMap.add(flowTableAndStatisticsMapBuilder.build());
         }
-        return odNodesConnectorStatistics;
+        
+        return flowTableStatsMap;
     }
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.all.node.connector.statistics.output.NodeConnectorStatistics toOdNodeConnectorStatistics(
-            NodeConnectorStatistics ndConStats) {
-        NodeConnectorStatisticsBuilder builder = new NodeConnectorStatisticsBuilder();
-
-        builder.setBytes(extractBytes(ndConStats));
-        builder.setCollisionCount(toBI(ndConStats.getCollisionCount()));
-        builder.setDuration(null);
-        builder.setPackets(extractPackets(ndConStats));
-        builder.setReceiveCrcError(toBI(ndConStats.getReceiveCRCErrorCount()));
-        builder.setReceiveDrops(toBI(ndConStats.getReceiveDropCount()));
-        builder.setReceiveErrors(toBI(ndConStats.getReceiveErrorCount()));
-        builder.setReceiveFrameError(toBI(ndConStats.getReceiveFrameErrorCount()));
-        builder.setReceiveOverRunError(toBI(ndConStats.getReceiveOverRunErrorCount()));
-        builder.setTransmitDrops(toBI(ndConStats.getTransmitDropCount()));
-        builder.setTransmitErrors(toBI(ndConStats.getTransmitErrorCount()));
-
-        return builder.build();
+    private List<NodeConnectorStatisticsAndPortNumberMap> toOdNodeConnectorStatistics(
+            List<NodeConnectorStatistics> ncStatsList) {
+        List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsList = new ArrayList<NodeConnectorStatisticsAndPortNumberMap>();
+        for(NodeConnectorStatistics ofNodeConnectorStatistics : ncStatsList){
+            NodeConnectorStatisticsAndPortNumberMapBuilder nodeConnectorStatisticsAndPortNumberMapBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
+            
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setBytes(extractBytes(ofNodeConnectorStatistics));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setCollisionCount(toBI(ofNodeConnectorStatistics.getCollisionCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setDuration(null);
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setPackets(extractPackets(ofNodeConnectorStatistics));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveCrcError(toBI(ofNodeConnectorStatistics.getReceiveCRCErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveDrops(toBI(ofNodeConnectorStatistics.getReceiveDropCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveErrors(toBI(ofNodeConnectorStatistics.getReceiveErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveFrameError(toBI(ofNodeConnectorStatistics.getReceiveFrameErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setReceiveOverRunError(toBI(ofNodeConnectorStatistics.getReceiveOverRunErrorCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setTransmitDrops(toBI(ofNodeConnectorStatistics.getTransmitDropCount()));
+            nodeConnectorStatisticsAndPortNumberMapBuilder.setTransmitErrors(toBI(ofNodeConnectorStatistics.getTransmitErrorCount()));
+            nodeConnectorStatisticsList.add(nodeConnectorStatisticsAndPortNumberMapBuilder.build());
+        }
+        
+        return nodeConnectorStatisticsList;
     }
 
     private BigInteger toBI(long num) {
@@ -292,49 +292,4 @@ public class FlowStatisticsAdapter implements OpendaylightFlowStatisticsService,
         return builder.build();
     }
 
-    private GetFlowTableStatisticsOutput toOdTableStatistics(NodeTableStatistics nodeTable) {
-        GetFlowTableStatisticsOutputBuilder builder = new GetFlowTableStatisticsOutputBuilder();
-
-        builder.setActive(toCounter64(nodeTable.getActiveCount()));
-        builder.setLookup(toCounter64(nodeTable.getLookupCount()));
-        builder.setMatched(toCounter64(nodeTable.getMatchedCount()));
-
-        return builder.build();
-    }
-
-    @Override
-    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
-            GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
-            GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
-            GetAllFlowStatisticsFromFlowTableInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
-            GetAllFlowsStatisticsFromAllFlowTablesInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
-            GetFlowStatisticsFromFlowTableInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
 }
index 5203d3c1a8165932e78fbe4fbe0f739b45926f0d..6fcadea8bf378af897d36bd916c72997eca6c08c 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yangtools.yang.binding.DataObject
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef
 
 class FlowTransaction extends AbstractTransaction {
     
@@ -32,6 +33,7 @@ class FlowTransaction extends AbstractTransaction {
             val tableInstanceId = instanceId.firstIdentifierOf(Table);
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new RemoveFlowInputBuilder(flow);
+            builder.setFlowRef(new FlowRef(instanceId));
             builder.setNode(new NodeRef(nodeInstanceId));
             builder.setFlowTable(new FlowTableRef(tableInstanceId));
             _salFlowService.removeFlow(builder.build());            
@@ -45,6 +47,7 @@ class FlowTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new UpdateFlowInputBuilder();
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowRef(new FlowRef(instanceId));
             val ufb = new UpdatedFlowBuilder(updatedFlow);
             builder.setUpdatedFlow((ufb.build()));
             val ofb = new OriginalFlowBuilder(originalFlow);
@@ -61,6 +64,7 @@ class FlowTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new AddFlowInputBuilder(flow);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowRef(new FlowRef(instanceId));
             builder.setFlowTable(new FlowTableRef(tableInstanceId));
             _salFlowService.addFlow(builder.build());            
         }
index 54382ea0560b561018005f9f86542c91dbd153be..d68ffa09fa571beb2d679ebe9250eeae841199ed 100644 (file)
@@ -2,26 +2,18 @@ package org.opendaylight.controller.frm.group
 
 import org.opendaylight.controller.frm.AbstractTransaction
 import org.opendaylight.controller.md.sal.common.api.data.DataModification
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
 import org.opendaylight.yangtools.yang.binding.DataObject
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder
 
 class GroupTransaction extends AbstractTransaction {
     
@@ -39,6 +31,7 @@ class GroupTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new RemoveGroupInputBuilder(group);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setGroupRef(new GroupRef(instanceId));
             _groupService.removeGroup(builder.build());            
         }
     }
@@ -50,6 +43,7 @@ class GroupTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new UpdateGroupInputBuilder();
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setGroupRef(new GroupRef(instanceId));
             val ufb = new UpdatedGroupBuilder(updatedGroup);
             builder.setUpdatedGroup((ufb.build()));
             val ofb = new OriginalGroupBuilder(originalGroup);
@@ -65,6 +59,7 @@ class GroupTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new AddGroupInputBuilder(group);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setGroupRef(new GroupRef(instanceId));
             _groupService.addGroup(builder.build());            
         }
     }
index 3ed1f4073565ec64cac14d265a8c9a307181fa47..d64f2518a8287d761aadac55b87a95d4c7704d8b 100644 (file)
@@ -13,6 +13,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.met
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter
 import org.opendaylight.yangtools.yang.binding.DataObject
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef
 
 class MeterTransaction extends AbstractTransaction {
     
@@ -30,6 +31,7 @@ class MeterTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new RemoveMeterInputBuilder(meter);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setMeterRef(new MeterRef(instanceId));
             _salMeterService.removeMeter(builder.build());            
         }
     }
@@ -41,6 +43,7 @@ class MeterTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new UpdateMeterInputBuilder();
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setMeterRef(new MeterRef(instanceId));
             val ufb = new UpdatedMeterBuilder(updatedMeter);
             builder.setUpdatedMeter((ufb.build()));
             val ofb = new OriginalMeterBuilder(originalMeter);
@@ -56,6 +59,7 @@ class MeterTransaction extends AbstractTransaction {
             val nodeInstanceId = instanceId.firstIdentifierOf(Node);
             val builder = new AddMeterInputBuilder(meter);
             builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setMeterRef(new MeterRef(instanceId));
             _salMeterService.addMeter(builder.build());            
         }
     }
index 2b023a72e1c0442cb8f932c0d1472381cb3740ea..1a66b3ba16316b4c5a1c92485e909cf061c3d398 100644 (file)
@@ -76,7 +76,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
 
         // Check path
         val it = manager.startChange()
-        removeRuntimeData(ref.value as InstanceIdentifier<? extends DataObject>);
+        removeOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
         commit()
     }
 
@@ -93,7 +93,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
             data.addAugmentation(FlowCapableNodeConnector, augment)
         }
 
-        putRuntimeData(ref.value as InstanceIdentifier<NodeConnector>, data.build());
+        putOperationalData(ref.value as InstanceIdentifier<NodeConnector>, data.build());
         commit()
     }
 
@@ -101,7 +101,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
         val ref = node.nodeRef;
         val it = manager.startChange()
 
-        removeRuntimeData(ref.value as InstanceIdentifier<? extends DataObject>);
+        removeOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
         commit()
     }
 
@@ -117,7 +117,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
             data.addAugmentation(FlowCapableNode, augment)
         }
 
-        putRuntimeData(ref.value as InstanceIdentifier<Node>, data.build())
+        putOperationalData(ref.value as InstanceIdentifier<Node>, data.build())
         commit()
     }
 }
index 8c874e2fe80a60f345f67fe091cde4a883fcc631..4442fbb3358001297434fee652faad30bb5712c4 100644 (file)
@@ -84,6 +84,10 @@ module opendaylight-group-types {
        description "Check chaining for loops and delete";
     }
     
+    typedef group-ref {
+        type instance-identifier;
+    }
+    
     grouping group {
         
         leaf group-type {
@@ -102,10 +106,6 @@ module opendaylight-group-types {
             type string; 
         }
         
-        leaf install {
-            type boolean; 
-        } 
-        
         leaf barrier {
             type boolean; 
         }       
index b380af22129c44f068bb02d50aa57283e8bfbac0..d84b2f08511f466848886cb75aa4f418341d5563 100644 (file)
@@ -112,6 +112,10 @@ module opendaylight-meter-types {
         }
     }
     
+    typedef meter-ref {
+        type instance-identifier;
+    }
+    
     grouping meter {
         
         leaf flags {
@@ -120,11 +124,12 @@ module opendaylight-meter-types {
         
         leaf meter-id {
             type meter-id;
-        }
+        }       
         
-        leaf install {
+        leaf barrier {
             type boolean; 
         }
+        
         leaf meter-name {
             type string;
         }
index 2bcd40522330901eaaf08824d68680cfdb48d381..a0beb2a84c936f51b83c20bd469b235563857949 100644 (file)
@@ -12,6 +12,10 @@ module opendaylight-flow-types {
         description "Initial revision of flow service";
     }
     
+    typedef flow-ref {
+        type instance-identifier;
+    }
+    
     typedef output-port-values {
         type enumeration {
             enum MAX {
index bc05894da82637cfae12f61257fc79bdd2609500..2554fffadb7a047d0e8bb525688a20ba1423ba13 100644 (file)
@@ -27,11 +27,15 @@ module opendaylight-port-types {
         }
     }
     
-    typedef port-state {
-        type enumeration {
-            enum link-down;
-            enum blocked;
-            enum live;
+    grouping port-state {
+        leaf link-down {
+            type boolean;
+        }
+        leaf blocked {
+            type boolean;
+        }   
+        leaf live {
+            type boolean;
         }
     }
     
@@ -103,9 +107,9 @@ module opendaylight-port-types {
             description "Human readable name of the port";                    
         }
         
-        leaf state {
-            type port-state;
-            description "Bit map of OFPPS-* flags";            
+        container state {
+            uses port-state;
+            description "Description of state of port";            
         }
         
         leaf current-feature {
index 07678f57e1b429d8655fa3665d26eaa9c83f74d8..d6a31c30deeae87f619e157c39901ee3456f9e1a 100644 (file)
@@ -51,6 +51,9 @@ module sal-flow {
 
     rpc add-flow {
         input {
+            leaf flow-ref {
+                type types:flow-ref;
+            }
             uses node-flow;
             uses tr:transaction-aware;
         }
@@ -61,6 +64,9 @@ module sal-flow {
 
     rpc remove-flow {
         input {
+            leaf flow-ref {
+                type types:flow-ref;
+            }
             uses node-flow;
             uses tr:transaction-aware;
         }
@@ -71,6 +77,9 @@ module sal-flow {
 
     rpc update-flow {
         input {
+            leaf flow-ref {
+                type types:flow-ref;
+            }
             uses flow-update;
             uses tr:transaction-aware;
         }
@@ -80,15 +89,28 @@ module sal-flow {
     }
 
     notification flow-added {
+        leaf flow-ref {
+            type types:flow-ref;
+        }
         uses node-flow;
+        uses tr:transaction-aware;
     }
 
     notification flow-updated {
+        leaf flow-ref {
+            type types:flow-ref;
+        }
         uses node-flow;
+        uses tr:transaction-aware;
+        
     }
 
     notification flow-removed {
+        leaf flow-ref {
+            type types:flow-ref;
+        }
         uses node-flow;
+        uses tr:transaction-aware;
     }
     
     notification switch-flow-removed {
index 9106bca8a4826619f09062a3c3322b16e3551621..6cc1537ebc11c5d8f05a5921badbe79c300c8a12 100644 (file)
@@ -31,6 +31,9 @@ module sal-group {
 
     rpc add-group {
         input {
+            leaf group-ref {
+                type group-type:group-ref;
+            }
             uses node-group;
             uses tr:transaction-aware;
         }
@@ -41,6 +44,9 @@ module sal-group {
 
     rpc remove-group {
         input {
+            leaf group-ref {
+                type group-type:group-ref;
+            }
             uses node-group;
             uses tr:transaction-aware;
         }
@@ -51,6 +57,9 @@ module sal-group {
 
     rpc update-group {
         input {
+            leaf group-ref {
+                type group-type:group-ref;
+            }
             uses group-update;
             uses tr:transaction-aware;
         }
@@ -60,14 +69,26 @@ module sal-group {
     } 
 
     notification group-added {
+        leaf group-ref {
+            type group-type:group-ref;
+        }
         uses node-group;
+        uses tr:transaction-aware;
     }
 
     notification group-updated {
+        leaf group-ref {
+            type group-type:group-ref;
+        }
         uses node-group;
+        uses tr:transaction-aware;
     }
 
     notification group-removed {
+        leaf group-ref {
+            type group-type:group-ref;
+        }
         uses node-group;
+        uses tr:transaction-aware;
     }    
 }
\ No newline at end of file
index c187181e5e89099cc4720031cd3fa888629d69a2..6205fed529d85a849ea77bdf5c6ff87b0b5c1331 100644 (file)
@@ -31,6 +31,9 @@ module sal-meter {
 
     rpc add-meter {
         input {
+            leaf meter-ref {
+                type meter-type:meter-ref;
+            }
             uses node-meter;
             uses tr:transaction-aware;            
         }
@@ -41,6 +44,10 @@ module sal-meter {
 
     rpc remove-meter {
         input {
+            leaf meter-ref {
+                type meter-type:meter-ref;
+            }
+            
             uses node-meter;
             uses tr:transaction-aware;            
         }
@@ -51,6 +58,10 @@ module sal-meter {
 
     rpc update-meter {
         input {
+            leaf meter-ref {
+                type meter-type:meter-ref;
+            }
+            
             uses meter-update;
             uses tr:transaction-aware;            
         }
@@ -60,14 +71,26 @@ module sal-meter {
     }
         
     notification meter-added {
+        leaf meter-ref {
+            type meter-type:meter-ref;
+        }
         uses node-meter;
+        uses tr:transaction-aware;
     }
 
     notification meter-updated {
+        leaf meter-ref {
+            type meter-type:meter-ref;
+        }
         uses node-meter;
+        uses tr:transaction-aware;
     }
 
     notification meter-removed {
+        leaf meter-ref {
+            type meter-type:meter-ref;
+        }
         uses node-meter;
+        uses tr:transaction-aware;
     }
 }
\ No newline at end of file
index d49675ad39366bb3e8c9b3a5a191f2a677683ce7..6795e6fd67a8090e525546deb18658f6dc5930d3 100644 (file)
@@ -43,9 +43,14 @@ module sal-port {
         output {
             uses port-type:flow-capable-port;
         }
-    }  
+    }
+    
+    notification port-updated {
+        uses port-update;
+        uses tr:transaction-aware;
+    }
     
     notification port-removed {
-        uses node-port;
+        uses node-port;       
     }
 }
\ No newline at end of file
index 3bd37bcf3387ae4500f45d372f6a6454c949526f..7bbcca3a1258a36997449ccfc17c3858bb0d362f 100644 (file)
@@ -115,7 +115,7 @@ module opendaylight-flow-statistics {
         }
        }    
        
-    // RPC calls to fetch flow statistics
+    // RPC calls to fetch aggregate flow statistics
     rpc get-aggregate-flow-statistics-from-flow-table-for-all-flows {
        description "Fetch aggregate statistics for all the flows present in the specific flow table of the switch"; 
         input {
@@ -150,76 +150,4 @@ module opendaylight-flow-statistics {
                uses stat-types:aggregate-flow-statistics;
                uses tr:transaction-aware;
     }
-       
-       //Keeping flow statistics RPC call for backward compatibility for sal-compatibility layer --START
-       rpc get-flow-statistics {
-        input {
-            uses inv:node-context-ref;
-            uses flow-types:flow;
-        }
-        output {
-            uses flow-types:flow-statistics;
-        }
-    }
-
-    rpc get-all-flow-statistics {
-        input {
-            uses inv:node-context-ref;
-        }
-        output {
-            list flow-statistics {
-                uses flow-types:flow-statistics;
-            }
-        }
-    }
-
-    notification flow-statistics-updated {
-        uses flow-types:flow-statistics;
-    }
-       
-       //Keeping flow statistics RPC call for backward compatibility for sal-compatibility layer --END
-       
-       //RPC call to fetch node connector statistics
-    rpc get-node-connector-statistics {
-        input {
-            uses inv:node-context-ref;
-            leaf node-connector {
-                type inv:node-connector-ref;
-            }
-        }
-        output {
-            uses stat-types:node-connector-statistics;
-        }
-    }
-
-    rpc get-all-node-connector-statistics {
-        input {
-            uses inv:node-context-ref;
-        }
-        output {
-            list node-connector-statistics {
-                uses stat-types:node-connector-statistics;
-            }
-        }
-    }
-
-    rpc get-flow-table-statistics {
-        input {
-            uses inv:node-context-ref;
-        }
-        output {
-            uses flow-types:flow-table-statistics;
-        }
-    }
-
-    notification flow-table-statistics-updated {
-        leaf flow-table {
-            type flow:flow-table-ref;
-        }
-        uses flow-types:flow-table-statistics;
-    }
-
-    notification node-connector-statistics-updated {
-        uses stat-types:node-connector-statistics;
-    }
 }
index 0cb6a60cfe0e5dd23d918be3879859c848ab55dc..787a4e6aa0ef2fe3b26931877aa56a608450eda8 100644 (file)
@@ -30,19 +30,19 @@ module opendaylight-port-statistics {
        }    
        
     // RPC calls
-    rpc get-all-ports-statistics {
-       description "Get statistics for all the ports from the node";
+    rpc get-all-node-connectors-statistics {
+       description "Get statistics for all node connectors from the node";
         input {
             uses inv:node-context-ref;
         }
         output {
-            uses stat-types:node-connector-statistics;
+                       uses node-connector-statistics-and-port-number-map;
             uses tr:transaction-aware;
         }
     }
     
-    rpc get-port-statistics {
-       description "Get statistics for given port from the node";
+    rpc get-node-connector-statistics {
+       description "Get statistics for given node connector from the node";
        input {
                uses inv:node-context-ref;
                leaf node-connector-id {
@@ -55,9 +55,9 @@ module opendaylight-port-statistics {
        }
     }
     
-    //Notification for port statistics update
+    //Notification for node connector statistics update
        grouping node-connector-statistics-and-port-number-map {
-               description "List of flow and statistics map";
+               description "List of map - node connectors and their statistics";
                list node-connector-statistics-and-port-number-map {
                        key "node-connector-id";
                        leaf node-connector-id {
@@ -67,7 +67,7 @@ module opendaylight-port-statistics {
                }
        }
 
-       notification port-statistics-update {
+       notification node-connector-statistics-update {
         leaf moreReplies {
             type boolean;
         }
index 33c03ba059722a1a2162c7f3b3559a24c6267b49..ceeef45f238046881e1cace964cb814cf7ddede7 100644 (file)
@@ -21,12 +21,14 @@ module opendaylight-topology-inventory {
 
     augment "/topo:network-topology/topo:topology/topo:node" {
         ext:augment-identifier "inventory-node";
-        uses inv:node-context-ref;
+        leaf inventory-node-ref {
+            type inv:node-ref;
+        }
     }
 
     augment "/topo:network-topology/topo:topology/topo:node/topo:termination-point" {
         ext:augment-identifier "inventory-node-connector";
-        leaf node-connector {
+        leaf inventory-node-connector-ref {
             ext:context-reference "inv:node-connector-context";
             type inv:node-connector-ref;
         }
index 0d6523bc0bbb38dd059e9c978be147cab7a4b7e8..efc84237b5ba202b0806bfa2e34db3a94e0d7a20 100644 (file)
@@ -50,7 +50,9 @@
 
         <module>inventory-manager</module>
         <module>statistics-manager</module>
+        <module>topology-manager</module>
         <module>forwardingrules-manager</module>
+        <module>topology-lldp-discovery</module>
 
         <!-- Compability Packages -->
         <module>compatibility</module>
index 48c33ad0fc704e162c8dcae4f56be23ffb87ee1d..c46b0dd6b4c529d00e0fae55f862f6a0229e701b 100644 (file)
@@ -36,7 +36,7 @@ public final class BindingBrokerImplModule extends org.opendaylight.controller.c
 \r
     @Override\r
     public java.lang.AutoCloseable createInstance() {\r
-        BindingAwareBrokerImpl broker = new BindingAwareBrokerImpl(getBundleContext());\r
+        BindingAwareBrokerImpl broker = new BindingAwareBrokerImpl(getIdentifier().getInstanceName(),getBundleContext());\r
         broker.setDataBroker(getDataBrokerDependency());\r
         broker.setNotifyBroker(getNotificationServiceDependency());\r
         broker.start();\r
index 6672d953a2c29243d525de87f07c4c014c6bdf97..7789a06fe8c734f61215805d3e5b18bd558c4916 100644 (file)
@@ -86,7 +86,7 @@ public interface RuntimeCodeGenerator {
      * @return Instance of RpcService of provided serviceType which implements
      *         also {@link RpcRouter}<T> and {@link DelegateProxy}
      */
-    <T extends RpcService> RpcRouter<T> getRouterFor(Class<T> serviceType) throws IllegalArgumentException;
+    <T extends RpcService> RpcRouter<T> getRouterFor(Class<T> serviceType,String name) throws IllegalArgumentException;
 
     NotificationInvokerFactory getInvokerFactory();
 }
index 780d0bd4c7095a771955a3df80c01ef19827fb1f..8b2db8b13cd09b175fc1269ebec693717b70aab5 100644 (file)
@@ -45,16 +45,23 @@ public class RpcRouterCodegenInstance<T extends RpcService> implements //
 
     private final Map<Class<? extends BaseIdentity>, RpcRoutingTableImpl<? extends BaseIdentity, T>> routingTables;
 
-    public RpcRouterCodegenInstance(Class<T> type, T routerImpl, Set<Class<? extends BaseIdentity>> contexts,
+    private final String name;
+
+    @SuppressWarnings("unchecked")
+    public RpcRouterCodegenInstance(String name,Class<T> type, T routerImpl, Set<Class<? extends BaseIdentity>> contexts,
             Set<Class<? extends DataContainer>> inputs) {
+        this.name = name;
         this.listeners = ListenerRegistry.create();
         this.serviceType = type;
         this.invocationProxy = routerImpl;
         this.contexts = ImmutableSet.copyOf(contexts);
         Map<Class<? extends BaseIdentity>, RpcRoutingTableImpl<? extends BaseIdentity, T>> mutableRoutingTables = new HashMap<>();
         for (Class<? extends BaseIdentity> ctx : contexts) {
-            RpcRoutingTableImpl<? extends BaseIdentity, T> table = new RpcRoutingTableImpl<>(ctx);
+            RpcRoutingTableImpl<? extends BaseIdentity, T> table = new RpcRoutingTableImpl<>(name,ctx,type);
+            
+            @SuppressWarnings("rawtypes")
             Map invokerView = table.getRoutes();
+            
             setRoutingTable((RpcService) invocationProxy, ctx, invokerView);
             mutableRoutingTables.put(ctx, table);
             table.registerRouteChangeListener(this);
index f9592351f6ea04b706abdd1df83ddc27d44ef410..808358fb3503c1ea38bca66951137c1353c7b64d 100644 (file)
@@ -15,8 +15,11 @@ import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublishe
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Mutable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class RpcRoutingTableImpl<C extends BaseIdentity, S extends RpcService> //
 implements //
@@ -24,16 +27,22 @@ implements //
         RpcRoutingTable<C, S>, //
         RouteChangePublisher<Class<? extends BaseIdentity>, InstanceIdentifier<?>> {
 
-    private final Class<C> identifier;
+    private static final Logger LOGGER = LoggerFactory.getLogger(RpcRoutingTableImpl.class);
+    private final String routerName;
+    private final Class<S> serviceType;
+
+    private final Class<C> contextType;
     private final ConcurrentMap<InstanceIdentifier<?>, S> routes;
     private final Map<InstanceIdentifier<?>, S> unmodifiableRoutes;
 
     private RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>> listener;
     private S defaultRoute;
-
-    public RpcRoutingTableImpl(Class<C> identifier) {
+    
+    public RpcRoutingTableImpl(String routerName,Class<C> contextType, Class<S> serviceType) {
         super();
-        this.identifier = identifier;
+        this.routerName = routerName;
+        this.serviceType = serviceType;
+        this.contextType = contextType;
         this.routes = new ConcurrentHashMap<>();
         this.unmodifiableRoutes = Collections.unmodifiableMap(routes);
     }
@@ -56,17 +65,19 @@ implements //
         
     @Override
     public Class<C> getIdentifier() {
-        return identifier;
+        return contextType;
     }
 
     @Override
     @SuppressWarnings("unchecked")
     public void updateRoute(InstanceIdentifier<?> path, S service) {
         S previous = this.routes.put(path, service);
+        
+        LOGGER.debug("Route {} updated to {} in routing table {}",path,service,this);
         @SuppressWarnings("rawtypes")
         RouteChangeListener listenerCapture = listener;
         if (previous == null && listenerCapture != null) {
-            listenerCapture.onRouteChange(RoutingUtils.announcementChange(identifier, path));
+            listenerCapture.onRouteChange(RoutingUtils.announcementChange(contextType, path));
         }
     }
 
@@ -75,10 +86,11 @@ implements //
     @SuppressWarnings("unchecked")
     public void removeRoute(InstanceIdentifier<?> path) {
         S previous = this.routes.remove(path);
+        LOGGER.debug("Route {} to {} removed in routing table {}",path,previous,this);
         @SuppressWarnings("rawtypes")
         RouteChangeListener listenerCapture = listener;
         if (previous != null && listenerCapture != null) {
-            listenerCapture.onRouteChange(RoutingUtils.removalChange(identifier, path));
+            listenerCapture.onRouteChange(RoutingUtils.removalChange(contextType, path));
         }
     }
     
@@ -86,7 +98,8 @@ implements //
         @SuppressWarnings("rawtypes")
         RouteChangeListener listenerCapture = listener;
         if (routes.remove(path, service) && listenerCapture != null) {
-            listenerCapture.onRouteChange(RoutingUtils.removalChange(identifier, path));
+            LOGGER.debug("Route {} to {} removed in routing table {}",path,service,this);
+            listenerCapture.onRouteChange(RoutingUtils.removalChange(contextType, path));
         }
     }
 
@@ -107,6 +120,16 @@ implements //
     protected void removeAllReferences(S service) {
         
     }
+    
+    
+
+    @Override
+    public String toString() {
+        return "RpcRoutingTableImpl [router=" + routerName + ", service=" + serviceType.getSimpleName() + ", context="
+                + contextType.getSimpleName() + "]";
+    }
+
+
 
     private class SingletonListenerRegistration<L extends RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>>> extends
             AbstractObjectRegistration<L>
index 8b4155285746b2fa4b0245aeeba220da3efd245c..d9e0983cfa516f07e0285dab813b5b0c1b3aec17 100644 (file)
@@ -91,7 +91,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co
         return instance;
     }
 
-    override <T extends RpcService> getRouterFor(Class<T> iface) {
+    override <T extends RpcService> getRouterFor(Class<T> iface,String routerInstanceName) {
         val metadata = withClassLoader(iface.classLoader) [|
             val supertype = iface.asCtClass
             return supertype.rpcMetadata;
@@ -148,7 +148,7 @@ class RuntimeCodeGenerator implements org.opendaylight.controller.sal.binding.co
             return targetCls.toClass(iface.classLoader,iface.protectionDomain).newInstance as T
             
         ];
-        return new RpcRouterCodegenInstance(iface, instance, metadata.contexts,metadata.supportedInputs);
+        return new RpcRouterCodegenInstance(routerInstanceName,iface, instance, metadata.contexts,metadata.supportedInputs);
     }
 
     private def RpcServiceMetadata getRpcMetadata(CtClass iface) {
index 588bc789cf3ab6f305f68a3cce8d66d4b7c678fc..ca1b6344e6cd2fd178cf598b91cbced94397205e 100644 (file)
@@ -9,11 +9,6 @@ import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
 
 public class XtendHelper {
 
-    public static <C extends BaseIdentity> RpcRoutingTableImpl createRoutingTable(
-            Class<C> cls) {
-        return new RpcRoutingTableImpl<>(cls);
-    }
-
     @SuppressWarnings({"rawtypes","unchecked"})
     public static Iterable<TypeDefinition> getTypes(UnionTypeDefinition definition) {
         return (Iterable<TypeDefinition>) (List) definition.getTypes();
index e5bd3e7b9a737ac66f6f0457a4c6e258533b4ed2..5bc2d70c6a97a6cfba93ff15ee065ecbae352ae8 100644 (file)
@@ -145,9 +145,13 @@ class TransformerGenerator {
             if (typeSpecBuilder == null) {
                 typeSpecBuilder = pathToType.get(node.path);
             }
+            var schemaNode = typeToSchemaNode.get(ref);
+            if(schemaNode === null) {
+                schemaNode = node;
+            }
             checkState(typeSpecBuilder !== null, "Could not find TypeDefinition for %s, $s", inputType.name, node);
             val typeSpec = typeSpecBuilder.toInstance();
-            val newret = generateTransformerFor(inputType, typeSpec, node);
+            val newret = generateTransformerFor(inputType, typeSpec, schemaNode);
             listener.onClassProcessed(inputType);
             return newret as Class<? extends BindingCodec<Map<QName,Object>, Object>>;
         ]
@@ -524,7 +528,7 @@ class TransformerGenerator {
                             return null;
                             }
                             java.util.Map _compositeNode = (java.util.Map) $2;
-                            ////System.out.println(_localQName + " " + _compositeNode);
+                            System.out.println(_localQName + " " + _compositeNode);
                             Â«type.builderName» _builder = new Â«type.builderName»();
                             boolean _is_empty = true;
                             Â«FOR child : node.childNodes»
@@ -672,6 +676,7 @@ class TransformerGenerator {
                 return null;
             }
             java.util.Map _compositeNode = (java.util.Map) $2;
+            System.out.println(_localQName + " " + _compositeNode);
             Â«type.builderName» _builder = new Â«type.builderName»();
             Â«deserializeKey(type, node)»
             Â«deserializeDataNodeContainerBody(type, node)»
@@ -687,6 +692,7 @@ class TransformerGenerator {
                 return null;
             }
             java.util.Map _compositeNode = (java.util.Map) $2;
+            System.out.println(_localQName + " " + _compositeNode);
             Â«type.builderName» _builder = new Â«type.builderName»();
             Â«deserializeDataNodeContainerBody(type, node)»
             Â«deserializeAugmentations»
@@ -702,7 +708,7 @@ class TransformerGenerator {
                 return null;
             }
             java.util.Map _compositeNode = (java.util.Map) $2;
-            ////System.out.println(_localQName + " " + _compositeNode);
+            System.out.println(_localQName + " " + _compositeNode);
             Â«type.builderName» _builder = new Â«type.builderName»();
             Â«deserializeDataNodeContainerBody(type, node)»
             Â«deserializeAugmentations»
index 8d3545fbbb169f7faafd40330660dc5b109342ef..b4bf3f5a83cbcaff144af392ee2f1141235aa753 100644 (file)
@@ -9,47 +9,16 @@ package org.opendaylight.controller.sal.binding.impl
 
 import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider
-import org.opendaylight.yangtools.yang.binding.RpcService
-import javassist.ClassPool
 import org.osgi.framework.BundleContext
-import java.util.Map
-import javassist.LoaderClassPath
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker
-import java.util.Hashtable
-import static extension org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*
-
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.osgi.framework.ServiceRegistration
-import static org.opendaylight.controller.sal.binding.impl.osgi.Constants.*
-import static extension org.opendaylight.controller.sal.binding.impl.osgi.PropertiesUtils.*
-import org.opendaylight.controller.sal.binding.api.NotificationService
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
-
-import org.slf4j.LoggerFactory
-import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
-import org.opendaylight.controller.sal.binding.spi.RpcRouter
-import java.util.concurrent.ConcurrentHashMap
-import static com.google.common.base.Preconditions.*
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration
-import org.opendaylight.yangtools.yang.binding.BaseIdentity
-import com.google.common.collect.Multimap
-import com.google.common.collect.HashMultimap
-import static org.opendaylight.controller.sal.binding.impl.util.ClassLoaderUtils.*
-import java.util.concurrent.Executors
-import java.util.Collections
 import org.opendaylight.yangtools.yang.binding.DataObject
-import java.util.concurrent.locks.ReentrantLock
-import java.util.concurrent.Callable
-import java.util.WeakHashMap
-import javax.annotation.concurrent.GuardedBy
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry
-import org.opendaylight.yangtools.concepts.ListenerRegistration
-import org.opendaylight.yangtools.concepts.util.ListenerRegistry
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener
+import org.opendaylight.controller.sal.binding.spi.RpcContextIdentifier
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.slf4j.LoggerFactory
 
 class BindingAwareBrokerImpl extends RpcProviderRegistryImpl implements BindingAwareBroker, AutoCloseable {
     private static val log = LoggerFactory.getLogger(BindingAwareBrokerImpl)
@@ -65,7 +34,8 @@ class BindingAwareBrokerImpl extends RpcProviderRegistryImpl implements BindingA
     @Property
     var BundleContext brokerBundleContext
 
-    public new(BundleContext bundleContext) {
+    public new(String name,BundleContext bundleContext) {
+        super(name);
         _brokerBundleContext = bundleContext;
     }
 
@@ -95,9 +65,12 @@ class BindingAwareBrokerImpl extends RpcProviderRegistryImpl implements BindingA
     private def createContext(BindingAwareProvider provider, BundleContext providerCtx) {
         new OsgiProviderContext(providerCtx, this)
     }
+
+    override <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> registerRouteChangeListener(L listener) {
+        super.<L>registerRouteChangeListener(listener)
+    }
     
     override close() throws Exception {
         
     }
-
 }
\ No newline at end of file
index bc862886d7abc548efc680d8f029c89a6d98f8d6..6a17007d22779c81dd9a55d592fc80da73323f6f 100644 (file)
@@ -27,6 +27,8 @@ import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static com.google.common.base.Preconditions.*;
 
@@ -41,6 +43,19 @@ public class RpcProviderRegistryImpl implements //
     private final ListenerRegistry<RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> routeChangeListeners = ListenerRegistry
             .create();
 
+    private final static Logger LOG = LoggerFactory.getLogger(RpcProviderRegistryImpl.class);
+    
+    private final String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public RpcProviderRegistryImpl(String name) {
+        super();
+        this.name = name;
+    }
+
     @Override
     public final <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type,
             T implementation) throws IllegalStateException {
@@ -50,6 +65,7 @@ public class RpcProviderRegistryImpl implements //
     @Override
     public final <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
             throws IllegalStateException {
+        @SuppressWarnings("unchecked")
         RpcRouter<T> potentialRouter = (RpcRouter<T>) rpcRouters.get(type);
         if (potentialRouter != null) {
             checkState(potentialRouter.getDefaultService() == null,
@@ -59,20 +75,35 @@ public class RpcProviderRegistryImpl implements //
         T publicProxy = getRpcService(type);
         RpcService currentDelegate = RuntimeCodeHelper.getDelegate(publicProxy);
         checkState(currentDelegate == null, "Rpc service is already registered");
+        LOG.debug("Registering {} as global implementation of {} in {}",implementation,type.getSimpleName(),this);
         RuntimeCodeHelper.setDelegate(publicProxy, implementation);
         return new RpcProxyRegistration<T>(type, implementation, this);
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public final <T extends RpcService> T getRpcService(Class<T> type) {
 
-        RpcService potentialProxy = publicProxies.get(type);
+        @SuppressWarnings("unchecked")
+        T potentialProxy = (T) publicProxies.get(type);
         if (potentialProxy != null) {
-            return (T) potentialProxy;
+            return potentialProxy;
+        }
+        synchronized(this) {
+            /**
+             * Potential proxy could be instantiated by other thread while we were
+             * waiting for the lock.
+             */
+            
+            potentialProxy = (T) publicProxies.get(type);
+            if (potentialProxy != null) {
+                return (T) potentialProxy;
+            }
+            T proxy = rpcFactory.getDirectProxyFor(type);
+            LOG.debug("Created {} as public proxy for {} in {}",proxy,type.getSimpleName(),this);
+            publicProxies.put(type, proxy);
+            return proxy;
         }
-        T proxy = rpcFactory.getDirectProxyFor(type);
-        publicProxies.put(type, proxy);
-        return proxy;
     }
 
     private <T extends RpcService> RpcRouter<T> getRpcRouter(Class<T> type) {
@@ -80,13 +111,25 @@ public class RpcProviderRegistryImpl implements //
         if (potentialRouter != null) {
             return (RpcRouter<T>) potentialRouter;
         }
-        RpcRouter<T> router = rpcFactory.getRouterFor(type);
-        router.registerRouteChangeListener(new RouteChangeForwarder(type));
-        RuntimeCodeHelper.setDelegate(getRpcService(type), router.getInvocationProxy());
-        rpcRouters.put(type, router);
-        return router;
+        synchronized(this) {
+            /**
+             * Potential Router could be instantiated by other thread while we were
+             * waiting for the lock.
+             */
+            potentialRouter = rpcRouters.get(type); 
+            if (potentialRouter != null) {
+                return (RpcRouter<T>) potentialRouter;
+            }
+            RpcRouter<T> router = rpcFactory.getRouterFor(type,name);
+            router.registerRouteChangeListener(new RouteChangeForwarder(type));
+            LOG.debug("Registering router {} as global implementation of {} in {}",router,type.getSimpleName(),this);
+            RuntimeCodeHelper.setDelegate(getRpcService(type), router.getInvocationProxy());
+            rpcRouters.put(type, router);
+            return router;
+        }
     }
 
+    @Override
     public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
             L listener) {
         return (ListenerRegistration<L>) routeChangeListeners.register(listener);
index 9c9841a4a5dc8deed41f717f7ce50d208f1c6b9f..6f0db4cd8d3635d0cd43bea0e943dd7d5555fdd2 100644 (file)
@@ -61,7 +61,7 @@ public class RuntimeCodeGeneratorTest {
 
     @Test
     public void testGenerateRouter() throws Exception {
-        RpcRouter<FooService> product = codeGenerator.getRouterFor(FooService.class);
+        RpcRouter<FooService> product = codeGenerator.getRouterFor(FooService.class,"test");
         assertNotNull(product);
         assertNotNull(product.getInvocationProxy());
 
index 3217a31329939e5b8d27c67f3114bbb82b9f498a..d4d27a14eceb68c3df38c8b826ae23845fb76e69 100644 (file)
@@ -110,7 +110,7 @@ public class BindingTestContext implements AutoCloseable {
         checkState(executor != null,"Executor needs to be set");
         checkState(baDataImpl != null,"Binding Data Broker must be started");
         checkState(baNotifyImpl != null, "Notification Service must be started");
-        baBrokerImpl = new BindingAwareBrokerImpl(null);
+        baBrokerImpl = new BindingAwareBrokerImpl("test",null);
         
         baBrokerImpl.setDataBroker(baDataImpl);
         baBrokerImpl.setNotifyBroker(baNotifyImpl);
index 738a14a9bd408ddeed36aa161824ceb2f39e91e4..fd81af353ceb0d137bf9fbd527a349b6430fd20c 100644 (file)
@@ -7,7 +7,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 public final class TypeSafeDataReader {
 
     
-    private final DataReader<InstanceIdentifier<?>,DataObject> delegate;
+    private final DataReader<InstanceIdentifier<? extends DataObject>,DataObject> delegate;
     
     
     
@@ -16,7 +16,7 @@ public final class TypeSafeDataReader {
     }
 
 
-    public TypeSafeDataReader(DataReader<InstanceIdentifier<?>, DataObject> delegate) {
+    public TypeSafeDataReader(DataReader<InstanceIdentifier<? extends DataObject>, DataObject> delegate) {
         this.delegate = delegate;
     }
 
@@ -32,7 +32,7 @@ public final class TypeSafeDataReader {
         return (D) delegate.readOperationalData(path);
     }
     
-    public static TypeSafeDataReader forReader(DataReader<InstanceIdentifier<?>, DataObject> delegate) {
+    public static TypeSafeDataReader forReader(DataReader<InstanceIdentifier<? extends DataObject>, DataObject> delegate) {
         return new TypeSafeDataReader(delegate);
     }
 }
index 521de7e394ee69fd3d5dfdda4bf8f546a1b513c0..738c2cb9a8f6375d8681a5e824b0d2f953d1a211 100644 (file)
@@ -5,12 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-/*
- * TODO: Handle multipart messages with following flag true 
- * OFPMPF_REPLY_MORE = 1 << 0
- * Better accumulate all the messages and update local cache 
- * and configurational data store
- */
+
 package org.opendaylight.controller.md.statistics.manager;
 
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
index 95ba01cd54bb333a6fbd6076f70f9d6581ec9530..19cf0ed386bda52aed1ab8b572dd1c5cea821d53 100644 (file)
@@ -44,8 +44,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllPortsStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
@@ -180,17 +180,13 @@ public class StatisticsProvider implements AutoCloseable {
             InstanceIdentifier<Node> targetInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class,targetNode.getKey()).toInstance();
             NodeRef targetNodeRef = new NodeRef(targetInstanceId);
             
-            System.out.println("ANIL: Target Node object ::"+targetNode.toString());
-            
-            System.out.println("ANIL: FlowCapableNode augmentations ::"+targetNode.getAugmentation(FlowCapableNode.class));
-            
             try {
                 
                 sendAggregateFlowsStatsFromAllTablesRequest(targetNode.getKey());
 
                 sendAllFlowsStatsFromAllTablesRequest(targetNodeRef);
 
-                sendAllPortStatisticsRequest(targetNodeRef);
+                sendAllNodeConnectorsStatisticsRequest(targetNodeRef);
                 
                 sendAllFlowTablesStatisticsRequest(targetNodeRef);
                 
@@ -206,13 +202,9 @@ public class StatisticsProvider implements AutoCloseable {
 
                 try{
                   sendAllGroupStatisticsRequest(targetNodeRef);
-                  Thread.sleep(1000);
                   sendAllMeterStatisticsRequest(targetNodeRef);
-                  Thread.sleep(1000);
                   sendGroupDescriptionRequest(targetNodeRef);
-                  Thread.sleep(1000);
                   sendMeterConfigStatisticsRequest(targetNodeRef);
-                  Thread.sleep(1000);
                 }catch(Exception e){
                     spLogger.error("Exception occured while sending statistics requests : {}", e);
                 }
@@ -286,14 +278,14 @@ public class StatisticsProvider implements AutoCloseable {
         
     }
 
-    private void sendAllPortStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
+    private void sendAllNodeConnectorsStatisticsRequest(NodeRef targetNode) throws InterruptedException, ExecutionException{
         
-        final GetAllPortsStatisticsInputBuilder input = new GetAllPortsStatisticsInputBuilder();
+        final GetAllNodeConnectorsStatisticsInputBuilder input = new GetAllNodeConnectorsStatisticsInputBuilder();
         
         input.setNode(targetNode);
 
-        Future<RpcResult<GetAllPortsStatisticsOutput>> response = 
-                portStatsService.getAllPortsStatistics(input.build());
+        Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> response = 
+                portStatsService.getAllNodeConnectorsStatistics(input.build());
         this.multipartMessageManager.addTxIdToRequestTypeEntry(response.get().getResult().getTransactionId()
                 , StatsRequestType.ALL_PORT);
 
index edffb976c6f87148badc8aa3c48b7db3595e67a1..30f98cedd330ee1fac7933824e3fb8da46e57de8 100644 (file)
@@ -29,10 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.A
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsDataBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowStatisticsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowTableStatisticsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.NodeConnectorStatisticsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.aggregate.flow.statistics.AggregateFlowStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
@@ -48,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.q
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
@@ -90,12 +88,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericQueueStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.GenericStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.PortStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
@@ -485,7 +487,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
                                 .child(Flow.class,existingFlow.getKey()).toInstance();
                         flowBuilder.setKey(existingFlow.getKey());
                         flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build());
-                        sucLogger.debug("Found matching flow in the datastore, augmenting statistics");
+                        sucLogger.info("Found matching flow in the datastore, augmenting statistics");
                         foundOriginalFlow = true;
                         it.putOperationalData(flowRef, flowBuilder.build());
                         it.commit();
@@ -495,9 +497,9 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             }
             
             if(!foundOriginalFlow){
-                sucLogger.info("Associated original flow is not found in data store. Augmenting flow in operational data st");
-                //TODO: Temporary fix: format [ 0+tableid+0+unaccounted flow counter]
-                long flowKey = Long.getLong(new String("0"+Short.toString(tableId)+"0"+Integer.toString(this.unaccountedFlowsCounter)));
+                sucLogger.debug("Associated original flow is not found in data store. Augmenting flow in operational data store");
+                //TODO: Temporary fix: format [ 1+tableid+1+unaccounted flow counter]
+                long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"1"+Integer.toString(this.unaccountedFlowsCounter)));
                 FlowKey newFlowKey = new FlowKey(new FlowId(flowKey));
                 InstanceIdentifier<Flow> flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
                         .augmentation(FlowCapableNode.class)
@@ -554,7 +556,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
     }
 
     @Override
-    public void onPortStatisticsUpdate(PortStatisticsUpdate notification) {
+    public void onNodeConnectorStatisticsUpdate(NodeConnectorStatisticsUpdate notification) {
         //Check if response is for the request statistics-manager sent.
         if(this.statisticsManager.getMultipartMessageManager().removeTxId(notification.getTransactionId()) == null)
             return;
@@ -714,28 +716,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         
     }
 
-    @Override
-    public void onFlowStatisticsUpdated(FlowStatisticsUpdated notification) {
-        // TODO Auto-generated method stub
-        //TODO: Depricated, will clean it up once sal-compatibility is fixed.
-        //Sal-Compatibility code usage this notification event.
-        
-    }
-
-    @Override
-    public void onFlowTableStatisticsUpdated(FlowTableStatisticsUpdated notification) {
-        // TODO Auto-generated method stub
-        //TODO: Need to implement it yet
-        
-    }
-
-    @Override
-    public void onNodeConnectorStatisticsUpdated(NodeConnectorStatisticsUpdated notification) {
-        // TODO Auto-generated method stub
-        //TODO: Need to implement it yet
-        
-    }
-
     private NodeRef getNodeRef(NodeKey nodeKey){
         InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
         return new NodeRef(builder.toInstance());
@@ -770,14 +750,8 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             if (storedFlow.getMatch() != null) {
                 return false;
             }
-        } else if(!statsFlow.getMatch().equals(storedFlow.getMatch())) {
-            return false;
-        }
-        if (statsFlow.getCookie()== null) {
-            if (storedFlow.getCookie()!= null) {
-                return false;
-            }
-        } else if(!statsFlow.getCookie().equals(storedFlow.getCookie())) {
+        } //else if(!statsFlow.getMatch().equals(storedFlow.getMatch())) {
+        else if(!matchEquals(statsFlow.getMatch(), storedFlow.getMatch())) {
             return false;
         }
         if (statsFlow.getHardTimeout() == null) {
@@ -810,5 +784,171 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         }
         return true;
     }
+    
+    /**
+     * Explicit equals method to compare the 'match' for flows stored in the data-stores and flow fetched from the switch.
+     * Usecase: e.g If user don't set any ethernet source and destination address for match,data store will store null for 
+     * these address.
+     * e.g [_ethernetMatch=EthernetMatch [_ethernetDestination=null, _ethernetSource=null, _ethernetType=
+     * EthernetType [_type=EtherType [_value=2048], _mask=null, augmentation=[]]
+     * 
+     * But when you fetch the flows from switch, openflow driver library converts all zero bytes of mac address in the 
+     * message stream to 00:00:00:00:00:00. Following string shows how library interpret the zero mac address bytes and 
+     * eventually when translator convert it to MD-SAL match, this is how it looks 
+     * [_ethernetDestination=EthernetDestination [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]], 
+     * _ethernetSource=EthernetSource [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]], 
+     * _ethernetType=EthernetType [_type=EtherType [_value=2048], _mask=null, augmentation=[]]
+     * 
+     * So this custom equals method add additional check, in case any match element is null in data-store-flow, but not
+     * in the flow fetched from switch.
+     * 
+     * @param statsFlow
+     * @param storedFlow
+     * @return
+     */
+    public boolean matchEquals(Match statsFlow, Match storedFlow) {
+        if (statsFlow == storedFlow) {
+            return true;
+        }
+        if (storedFlow.getClass() != statsFlow.getClass()) {
+            return false;
+        }
+        if (storedFlow.getEthernetMatch() == null) {
+            if (statsFlow.getEthernetMatch() != null) {
+                if(!statsFlow.getEthernetMatch().getEthernetDestination().getAddress().getValue().equals("00:00:00:00:00:00") ||
+                        !statsFlow.getEthernetMatch().getEthernetSource().getAddress().getValue().equals("00:00:00:00:00:00")){
+                    return false;
+                }
+            }
+        } //else if(!storedFlow.getEthernetMatch().equals(statsFlow.getEthernetMatch())) {
+        else if(!EthernetMatchEquals(statsFlow.getEthernetMatch(),storedFlow.getEthernetMatch())) {
+            return false;
+        }
+        if (storedFlow.getIcmpv4Match()== null) {
+            if (statsFlow.getIcmpv4Match() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getIcmpv4Match().equals(statsFlow.getIcmpv4Match())) {
+            return false;
+        }
+        if (storedFlow.getIcmpv6Match() == null) {
+            if (statsFlow.getIcmpv6Match() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getIcmpv6Match().equals(statsFlow.getIcmpv6Match())) {
+            return false;
+        }
+        if (storedFlow.getInPhyPort() == null) {
+            if (statsFlow.getInPhyPort() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getInPhyPort().equals(statsFlow.getInPhyPort())) {
+            return false;
+        }
+        if (storedFlow.getInPort()== null) {
+            if (statsFlow.getInPort() != null) {
+                if(statsFlow.getInPort()!= 0){
+                    return false;
+                }
+            }
+        } else if(!storedFlow.getInPort().equals(statsFlow.getInPort())) {
+            return false;
+        }
+        if (storedFlow.getIpMatch()== null) {
+            if (statsFlow.getIpMatch() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getIpMatch().equals(statsFlow.getIpMatch())) {
+            return false;
+        }
+        if (storedFlow.getLayer3Match()== null) {
+            if (statsFlow.getLayer3Match() != null) {
+                Ipv4Match ipv4Match = (Ipv4Match)statsFlow.getLayer3Match();
+                if(!ipv4Match.getIpv4Source().getValue().equals("0.0.0.0/0") ||
+                        !ipv4Match.getIpv4Destination().getValue().equals("0.0.0.0/0")){
+                    return false;
+                }
+            }
+        } else if(!storedFlow.getLayer3Match().equals(statsFlow.getLayer3Match())) {
+            return false;
+        }
+        if (storedFlow.getLayer4Match()== null) {
+            if (statsFlow.getLayer4Match() != null) {
+                TcpMatch tcpMatch = (TcpMatch)statsFlow.getLayer4Match();
+                if(!tcpMatch.getTcpDestinationPort().getValue().equals(0) ||
+                    !tcpMatch.getTcpSourcePort().getValue().equals(0)){
+                        return false;
+                }
+            }
+        } else if(!storedFlow.getLayer4Match().equals(statsFlow.getLayer4Match())) {
+            return false;
+        }
+        if (storedFlow.getMetadata() == null) {
+            if (statsFlow.getMetadata() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getMetadata().equals(statsFlow.getMetadata())) {
+            return false;
+        }
+        if (storedFlow.getProtocolMatchFields() == null) {
+            if (statsFlow.getProtocolMatchFields() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getProtocolMatchFields().equals(statsFlow.getProtocolMatchFields())) {
+            return false;
+        }
+        if (storedFlow.getTunnel()== null) {
+            if (statsFlow.getTunnel() != null) {
+                return false;
+            }
+        } else if(!storedFlow.getTunnel().equals(statsFlow.getTunnel())) {
+            return false;
+        }
+        if (storedFlow.getVlanMatch()== null) {
+            if (statsFlow.getVlanMatch() != null) {
+                VlanMatch vlanMatch = statsFlow.getVlanMatch();
+                if(!vlanMatch.getVlanId().getVlanId().getValue().equals(0) ||
+                        !vlanMatch.getVlanPcp().getValue().equals((short)0)){
+                    return false;
+                }
+            }
+        } else if(!storedFlow.getVlanMatch().equals(statsFlow.getVlanMatch())) {
+            return false;
+        }
+        return true;
+    }
 
+    public boolean EthernetMatchEquals(EthernetMatch statsEtherMatch, EthernetMatch storedEtherMatch) {
+        if (statsEtherMatch == storedEtherMatch) {
+            return true;
+        }
+        if (storedEtherMatch.getEthernetDestination()== null) {
+            if (statsEtherMatch.getEthernetDestination() != null) {
+                if(!statsEtherMatch.getEthernetDestination().getAddress().getValue().equals("00:00:00:00:00:00")){
+                    return false;
+                }
+            }
+        } else if(!storedEtherMatch.getEthernetDestination().equals(statsEtherMatch.getEthernetDestination())) {
+            return false;
+        }
+        if (storedEtherMatch.getEthernetSource() == null) {
+            if (statsEtherMatch.getEthernetSource() != null) {
+                if(!statsEtherMatch.getEthernetSource().getAddress().getValue().equals("00:00:00:00:00:00")){
+                    return false;
+                }
+            }
+        } else if(!storedEtherMatch.getEthernetSource().equals(statsEtherMatch.getEthernetSource())) {
+            return false;
+        }
+        if (storedEtherMatch.getEthernetType() == null) {
+            if (statsEtherMatch.getEthernetType() != null) {
+                if(!statsEtherMatch.getEthernetType().getType().getValue().equals(0)){
+                    return false;
+                }
+            }
+        } else if(!storedEtherMatch.getEthernetType().equals(statsEtherMatch.getEthernetType())) {
+            return false;
+        }
+        return true;
+    }
 }
diff --git a/opendaylight/md-sal/topology-lldp-discovery/pom.xml b/opendaylight/md-sal/topology-lldp-discovery/pom.xml
new file mode 100644 (file)
index 0000000..ed94c8d
--- /dev/null
@@ -0,0 +1,129 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>sal-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../</relativePath>
+    </parent>
+    <groupId>org.opendaylight.controller.md</groupId>
+    <artifactId>topology-lldp-discovery</artifactId>
+    <packaging>bundle</packaging>
+    <scm>
+        <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+    </scm>
+    <properties>
+        <guava.version>14.0.1</guava.version>
+        <xtend.version>2.4.3</xtend.version>
+        <bundle.plugin.version>2.4.0</bundle.plugin.version>
+        <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal-binding-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.controller.model</groupId>
+            <artifactId>model-flow-service</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>    
+           <dependency>
+             <groupId>org.opendaylight.controller.model</groupId>
+             <artifactId>model-flow-base</artifactId>
+             <version>1.0-SNAPSHOT</version>
+           </dependency>
+          <dependency>
+             <groupId>org.opendaylight.controller.model</groupId>
+             <artifactId>model-flow-management</artifactId>
+             <version>1.0-SNAPSHOT</version>
+           </dependency>    
+        <dependency>
+            <groupId>org.opendaylight.controller.model</groupId>
+            <artifactId>model-inventory</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.xtend</groupId>
+            <artifactId>org.eclipse.xtend.lib</artifactId>
+        </dependency>
+         <dependency>
+               <groupId>equinoxSDK381</groupId>
+               <artifactId>org.eclipse.osgi</artifactId>
+               <version>3.8.1.v20120830-144521</version>
+             </dependency>
+             <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.6</version>
+          </dependency>
+          <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+          </dependency>
+          <dependency>
+                   <groupId>commons-codec</groupId>
+                   <artifactId>commons-codec</artifactId>
+                   <version>1.8</version>
+                 </dependency>
+    <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>sal</artifactId>
+            <version>0.7.0-SNAPSHOT</version>
+        </dependency>
+             
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Activator>org.opendaylight.md.controller.topology.lldp.LLDPActivator</Bundle-Activator>
+                        <Export-Package>org.opendaylight.md.controller.topology.lldp.utils</Export-Package>
+                        <Embed-Dependency>commons-lang</Embed-Dependency>>
+                        <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+                    </instructions>
+                    <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.eclipse.xtend</groupId>
+                <artifactId>xtend-maven-plugin</artifactId>
+                <executions>
+                  <execution>
+                      <goals>
+                          <goal>compile</goal>
+                      </goals>
+                      <configuration>
+                          <outputDirectory>${basedir}/src/main/xtend-gen</outputDirectory>
+                      </configuration>
+                  </execution>
+              </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-clean-plugin</artifactId>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <directory>${basedir}/src/main/xtend-gen</directory>
+                            <includes>
+                                <include>**</include>
+                            </includes>
+                        </fileset>
+                    </filesets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend
new file mode 100644 (file)
index 0000000..674e919
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * 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.md.controller.topology.lldp
+
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.osgi.framework.BundleContext
+
+class LLDPActivator extends AbstractBindingAwareProvider {
+
+    static var LLDPDiscoveryProvider provider = new LLDPDiscoveryProvider();
+
+    override onSessionInitiated(ProviderContext session) {
+        provider.dataService = session.getSALService(DataProviderService)
+        provider.notificationService = session.getSALService(NotificationProviderService)
+        provider.start();
+    }
+
+    override protected stopImpl(BundleContext context) {
+        provider.close();
+    }
+
+}
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryListener.java
new file mode 100644 (file)
index 0000000..095d12e
--- /dev/null
@@ -0,0 +1,34 @@
+package org.opendaylight.md.controller.topology.lldp;
+
+import org.opendaylight.md.controller.topology.lldp.utils.LLDPDiscoveryUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscoveredBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class LLDPDiscoveryListener implements PacketProcessingListener {
+    static Logger LOG = LoggerFactory.getLogger(LLDPDiscoveryListener.class);
+
+    private LLDPDiscoveryProvider manager;
+
+    LLDPDiscoveryListener(LLDPDiscoveryProvider manager) {
+        this.manager = manager;
+    }
+    
+    public void onPacketReceived(PacketReceived lldp) {
+        NodeConnectorRef src = LLDPDiscoveryUtils.lldpToNodeConnectorRef(lldp.getPayload());
+        if(src != null) {
+            LinkDiscoveredBuilder ldb = new LinkDiscoveredBuilder();
+            ldb.setDestination(lldp.getIngress());
+            ldb.setSource(new NodeConnectorRef(src));
+            LinkDiscovered ld = ldb.build();
+            
+            manager.getNotificationService().publish(ld);
+            LLDPLinkAger.getInstance().put(ld);
+        }
+    }
+    
+}
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend
new file mode 100644 (file)
index 0000000..fc724ac
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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.md.controller.topology.lldp
+
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.NotificationListener
+import org.slf4j.LoggerFactory
+
+class LLDPDiscoveryProvider implements AutoCloseable {
+
+
+    static val LOG = LoggerFactory.getLogger(LLDPDiscoveryProvider);
+
+    @Property
+    DataProviderService dataService;        
+
+    @Property
+    NotificationProviderService notificationService;
+
+    val LLDPDiscoveryListener commiter = new LLDPDiscoveryListener(this);
+
+    Registration<NotificationListener> listenerRegistration
+
+    def void start() {
+        listenerRegistration = notificationService.registerNotificationListener(commiter);
+        LLDPLinkAger.instance.manager = this;
+        LOG.info("LLDPDiscoveryListener Started.");
+        
+    }   
+    
+    override close() {
+       LOG.info("LLDPDiscoveryListener stopped.");
+        listenerRegistration?.close();
+        LLDPLinkAger.instance.close();
+    }
+    
+}
+
+
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPLinkAger.java
new file mode 100644 (file)
index 0000000..171783b
--- /dev/null
@@ -0,0 +1,65 @@
+package org.opendaylight.md.controller.topology.lldp;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.Timer;
+import java.util.Map.Entry;
+import java.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.opendaylight.md.controller.topology.lldp.utils.LLDPDiscoveryUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemovedBuilder;
+
+
+public class LLDPLinkAger {
+    private static final LLDPLinkAger instance = new LLDPLinkAger();
+    private Map<LinkDiscovered,Date> linkToDate = new ConcurrentHashMap<LinkDiscovered,Date>();
+    private LLDPDiscoveryProvider manager;
+    private Timer timer = new Timer();
+
+    public LLDPDiscoveryProvider getManager() {
+        return manager;
+    }
+    public void setManager(LLDPDiscoveryProvider manager) {
+        this.manager = manager;
+    }
+    private LLDPLinkAger() {
+        timer.schedule(new LLDPAgingTask(), 0,LLDPDiscoveryUtils.LLDP_INTERVAL);
+    }
+    public static LLDPLinkAger getInstance() {
+        return instance;
+    }
+    
+    public void put(LinkDiscovered link) {
+        Date expires = new Date();
+        expires.setTime(expires.getTime() + LLDPDiscoveryUtils.LLDP_EXPIRATION_TIME);
+        linkToDate.put(link, expires);
+    }
+    
+    public void close() {
+        timer.cancel();
+    }
+    
+    private class LLDPAgingTask extends TimerTask {
+
+        @Override
+        public void run() {
+            for (Entry<LinkDiscovered,Date> entry : linkToDate.entrySet()) {
+                LinkDiscovered link = entry.getKey();
+                Date expires = entry.getValue();
+                Date now = new Date();
+                if(now.after(expires)) {
+                    if(getInstance().getManager() != null) {
+                        LinkRemovedBuilder lrb = new LinkRemovedBuilder(link);
+                        getInstance().getManager().getNotificationService().publish(lrb.build());
+                        linkToDate.remove(link);
+                    }
+                }
+            }
+            
+        }
+        
+    }
+}
+
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/utils/LLDPDiscoveryUtils.java
new file mode 100644 (file)
index 0000000..d5dee32
--- /dev/null
@@ -0,0 +1,76 @@
+package org.opendaylight.md.controller.topology.lldp.utils;
+
+import java.nio.charset.Charset;
+import java.util.List;
+
+import org.opendaylight.controller.sal.packet.Ethernet;
+import org.opendaylight.controller.sal.packet.LLDP;
+import org.opendaylight.controller.sal.packet.LLDPTLV;
+import org.opendaylight.controller.sal.utils.NetUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LLDPDiscoveryUtils {
+    static Logger LOG = LoggerFactory.getLogger(LLDPDiscoveryUtils.class);
+    
+    public static final Long LLDP_INTERVAL = (long) (1000*5); // Send LLDP every five seconds
+    public static final Long LLDP_EXPIRATION_TIME = LLDP_INTERVAL*3; // Let up to three intervals pass before we decide we are expired.
+    
+    public static String macToString(byte[] mac) {
+        StringBuilder b = new StringBuilder();
+        for (int i = 0; i < mac.length; i++) {
+            b.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? ":" : ""));
+        }
+
+        return b.toString();
+    }
+    
+    public static NodeConnectorRef lldpToNodeConnectorRef(byte[] payload)  {
+        Ethernet ethPkt = new Ethernet();
+        try {
+            ethPkt.deserialize(payload, 0,payload.length * NetUtils.NumBitsInAByte);
+        } catch (Exception e) {
+            LOG.warn("Failed to decode LLDP packet {}", e);
+        }
+
+        if (ethPkt.getPayload() instanceof LLDP) {
+            LLDP lldp = (LLDP) ethPkt.getPayload();
+    
+            try {
+                List<LLDPTLV> optionalTLVList = lldp.getOptionalTLVList();
+                if (optionalTLVList == null) {
+                    return null;
+                }
+                NodeId srcNodeId = null;
+                NodeConnectorId srcNodeConnectorId = null;
+                for (LLDPTLV lldptlv : lldp.getOptionalTLVList()) {
+                    if (lldptlv.getType() == LLDPTLV.TLVType.Custom.getValue()) {
+                        srcNodeConnectorId = new NodeConnectorId(LLDPTLV.getCustomString(lldptlv.getValue(), lldptlv.getLength()));
+                    }
+                    if (lldptlv.getType() == LLDPTLV.TLVType.SystemName.getValue()) {
+                        String srcNodeIdString = new String(lldptlv.getValue(),Charset.defaultCharset());
+                        srcNodeId = new NodeId(srcNodeIdString);
+                    }
+                }
+                
+                InstanceIdentifier<NodeConnector> srcInstanceId = InstanceIdentifier.builder(Nodes.class)
+                        .child(Node.class,new NodeKey(srcNodeId))
+                        .child(NodeConnector.class, new NodeConnectorKey(srcNodeConnectorId))
+                        .toInstance();
+                return new NodeConnectorRef(srcInstanceId);
+            } catch (Exception e) {
+                LOG.warn("Caught exception ", e);
+            }
+        }
+        return null;
+    }
+}
index 6e50f9ce73aab798124ea7c9624cda5f881104d5..76300864fd3367092babd58b6d0d97595851e640 100644 (file)
@@ -42,7 +42,7 @@
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller.model</groupId>
-            <artifactId>model-topology-view</artifactId>
+            <artifactId>model-topology</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
         <dependency>
@@ -58,8 +58,8 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Bundle-Activator>org.opendaylight.controller.md.inventory.manager.InventoryActivator</Bundle-Activator>
-                        <Private-Package>org.opendaylight.controller.md.inventory.manager</Private-Package>
+                        <Bundle-Activator>org.opendaylight.md.controller.topology.manager.FlowCapableTopologyProvider</Bundle-Activator>
+                        <Private-Package>org.opendaylight.md.controller.topology.manager</Private-Package>
                     </instructions>
                 </configuration>
             </plugin>
index 46f5d2b406916d5f46bc9e7ab5527278a8090914..05f7fe12729384590459ed9a41bb271ca2ffa157 100644 (file)
@@ -5,7 +5,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeCon
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnector
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.node.TerminationPoint
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated
@@ -14,6 +14,17 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TpId
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NodeId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.NodeBuilder
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.link.attributes.SourceBuilder
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.link.attributes.DestinationBuilder
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.LinkBuilder
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.LinkKey
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.LinkId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnector
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.topology.inventory.rev131030.InventoryNodeConnectorBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
 
 class FlowCapableNodeMapping {
 
@@ -29,12 +40,6 @@ class FlowCapableNodeMapping {
         (ref?.value?.path?.get(2) as IdentifiableItem<NodeConnector,NodeConnectorKey>).key
     }
 
-    static def TerminationPoint toTerminationPoint(NodeConnectorUpdated updated) {
-        val it = new TerminationPointBuilder
-        key = new TerminationPointKey(new TpId(updated.id));
-        return it.build()
-    }
-
     static def NodeId toToplogyNodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId nodeId) {
         return new NodeId(nodeId);
     }
@@ -42,4 +47,36 @@ class FlowCapableNodeMapping {
     static def toTerminationPointId(NodeConnectorId id) {
         return new TpId(id);
     }
+    
+    static def toTopologyNode(NodeId nodeId,NodeRef invNodeRef) {
+        val nb = new NodeBuilder();
+        nb.setNodeId(nodeId)
+        val inb = new InventoryNodeBuilder
+        inb.setInventoryNodeRef(invNodeRef)
+        nb.addAugmentation(InventoryNode,inb.build)
+        return nb.build();
+    }
+    
+    static def toTerminationPoint(TpId id, NodeConnectorRef invNodeConnectorRef) {
+        val tpb = new TerminationPointBuilder
+        tpb.setTpId(id);
+        val incb = new InventoryNodeConnectorBuilder
+        incb.setInventoryNodeConnectorRef(invNodeConnectorRef)
+        tpb.addAugmentation(InventoryNodeConnector,incb.build())
+        return tpb.build();
+    }
+    
+    static def toTopologyLink(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.Link link) {
+        val sb = new SourceBuilder();
+        sb.setSourceNode(link.source.nodeKey.id.toToplogyNodeId)
+        sb.setSourceTp(link.source.nodeConnectorKey.id.toTerminationPointId)
+        val db = new DestinationBuilder();
+        db.setDestNode(link.destination.nodeKey.id.toToplogyNodeId)
+        db.setDestTp(link.destination.nodeConnectorKey.id.toTerminationPointId)
+        val lb = new LinkBuilder();
+        lb.setSource(sb.build())
+        lb.setDestination(db.build());
+        lb.setLinkId(new LinkId(lb.source.sourceTp.value))
+        return lb.build();
+    } 
 }
index fb129e47106a363d99f6729a3fd53490448b488c..92a2277b4c613abdf858ca28a3dbebb4c3a429f9 100644 (file)
 package org.opendaylight.md.controller.topology.manager
 
+import com.google.common.collect.FluentIterable
+import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorUpdated
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryListener
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkDiscovered
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkOverutilized
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkRemoved
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.LinkUtilizationNormal
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.OpendaylightInventoryListener
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NetworkTopology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NodeId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TopologyId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TpId
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.Topology
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.node.TerminationPoint
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.TopologyBuilder
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.TopologyKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NetworkTopology
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Link
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Node
-
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.NodeKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.NodeId
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.node.TerminationPoint
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.node.TerminationPointKey
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.TpId
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
 import static extension org.opendaylight.md.controller.topology.manager.FlowCapableNodeMapping.*
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction
-import org.opendaylight.controller.md.sal.binding.util.TypeSafeDataReader
-import com.google.common.collect.FluentIterable
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712.network.topology.topology.Link
 
 class FlowCapableTopologyExporter implements //
 FlowTopologyDiscoveryListener, //
 OpendaylightInventoryListener //
 {
 
-    var TopologyKey topology;
+    var TopologyKey topology = new TopologyKey(new TopologyId("flow:1"));
 
     @Property
     var DataProviderService dataService;
+    
+    def start() {
+        val tb = new TopologyBuilder();
+        tb.setKey(topology);
+        val path = InstanceIdentifier.builder(NetworkTopology).child(Topology,topology).toInstance;
+        val top = tb.build();
+        val it = dataService.beginTransaction
+        putOperationalData(path,top);
+        commit()       
+    }
 
     override onNodeRemoved(NodeRemoved notification) {
-        val invNodeKey = notification.nodeRef.nodeKey
-        val tpNodeId = invNodeKey.id.toToplogyNodeId()
-        val tpNodeInstance = notification.nodeRef.toNodeIdentifier()
+        val nodeId = notification.nodeRef.nodeKey.id.toToplogyNodeId()
+        val nodeInstance = notification.nodeRef.toNodeIdentifier()
 
         val it = dataService.beginTransaction
-        removeRuntimeData(tpNodeInstance);
-        removeAffectedLinks(tpNodeId)
+        removeOperationalData(nodeInstance);
+        removeAffectedLinks(it,nodeId)
         commit()
 
     }
 
     override onNodeUpdated(NodeUpdated notification) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        val fcnu = notification.getAugmentation(FlowCapableNodeUpdated)
+        if(fcnu != null) {
+            val node = notification.id.toToplogyNodeId.toTopologyNode(notification.nodeRef)
+            val path = notification.id.toToplogyNodeId.nodePath;
+            val it = dataService.beginTransaction
+            putOperationalData(path, node);
+            commit()
+        }
     }
 
     override onNodeConnectorRemoved(NodeConnectorRemoved notification) {
-        val tpRef = notification.nodeConnectorRef.toTerminationPointIdentifier();
+        val tpInstance = notification.nodeConnectorRef.toTerminationPointIdentifier;
+        val tpId = notification.nodeConnectorRef.nodeConnectorKey.id.toTerminationPointId;
         val it = dataService.beginTransaction
-        removeRuntimeData(tpRef);
+        removeOperationalData(tpInstance);
+        removeAffectedLinks(it,tpId)
         commit()
 
     }
 
     override onNodeConnectorUpdated(NodeConnectorUpdated notification) {
-        val nodeId = notification.nodeConnectorRef.nodeKey.id.toToplogyNodeId();
-        val TerminationPoint point = notification.toTerminationPoint();
-        val path = tpPath(nodeId, point.key.tpId);
-
-        val it = dataService.beginTransaction
-        putRuntimeData(path, point);
-        commit()
+        val fcncu = notification.getAugmentation(FlowCapableNodeConnectorUpdated)
+        if(fcncu != null) {
+            val nodeId = notification.nodeConnectorRef.nodeKey.id.toToplogyNodeId;
+            val TerminationPoint point = notification.id.toTerminationPointId.toTerminationPoint(notification.nodeConnectorRef);
+            val path = tpPath(nodeId, point.key.tpId);
+    
+            val it = dataService.beginTransaction
+            putOperationalData(path, point);
+            if((fcncu.state != null && fcncu.state.linkDown) || (fcncu.configuration != null && fcncu.configuration.PORTDOWN)) {
+                removeAffectedLinks(it,point.tpId)
+            }
+            commit()     
+       }
     }
 
     override onLinkDiscovered(LinkDiscovered notification) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        val link = notification.toTopologyLink;
+        val path = link.linkPath;
+        val it = dataService.beginTransaction
+        putOperationalData(path, link);
+        commit()
     }
 
     override onLinkOverutilized(LinkOverutilized notification) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        // NOOP
     }
 
     override onLinkRemoved(LinkRemoved notification) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
-
+        val path = notification.toTopologyLink.linkPath
+        val it = dataService.beginTransaction
+        removeOperationalData(path);
+        commit()
     }
 
     override onLinkUtilizationNormal(LinkUtilizationNormal notification) {
-        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+        // NOOP
     }
 
     def InstanceIdentifier<Node> toNodeIdentifier(NodeRef ref) {
         val invNodeKey = ref.nodeKey
 
         val nodeKey = new NodeKey(invNodeKey.id.toToplogyNodeId);
-        return InstanceIdentifier.builder.node(NetworkTopology).child(Topology, topology).child(Node, nodeKey).
+        return InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).child(Node, nodeKey).
             toInstance;
     }
 
@@ -107,7 +141,7 @@ OpendaylightInventoryListener //
 
     private def void removeAffectedLinks(DataModificationTransaction transaction, NodeId id) {
         val reader = TypeSafeDataReader.forReader(transaction)
-        val topologyPath = InstanceIdentifier.builder().node(NetworkTopology).child(Topology, topology).toInstance;
+        val topologyPath = InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).toInstance;
         val topologyData = reader.readOperationalData(topologyPath);
         if (topologyData === null) {
             return;
@@ -115,18 +149,52 @@ OpendaylightInventoryListener //
         val affectedLinkInstances = FluentIterable.from(topologyData.link).filter[
             source.sourceNode == id || destination.destNode == id].transform [
             //
-            InstanceIdentifier.builder().node(NetworkTopology).child(Topology, topology).child(Link, key).toInstance
+            InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).child(Link, key).toInstance
         //
         ]
         for(affectedLink : affectedLinkInstances) {
-            transaction.removeRuntimeData(affectedLink);
+            transaction.removeOperationalData(affectedLink);
         }
     }
     
+    private def void removeAffectedLinks(DataModificationTransaction transaction, TpId id) {
+        val reader = TypeSafeDataReader.forReader(transaction)
+        val topologyPath = InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).toInstance;
+        val topologyData = reader.readOperationalData(topologyPath);
+        if (topologyData === null) {
+            return;
+        }
+        val affectedLinkInstances = FluentIterable.from(topologyData.link).filter[
+            source.sourceTp == id || destination.destTp == id].transform [
+            //
+            InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).child(Link, key).toInstance
+        //
+        ]
+        for(affectedLink : affectedLinkInstances) {
+            transaction.removeOperationalData(affectedLink);
+        }
+    }
+    
+    private def InstanceIdentifier<Node> nodePath(NodeId nodeId) {
+        val nodeKey = new NodeKey(nodeId);
+        return InstanceIdentifier.builder(NetworkTopology)
+            .child(Topology, topology)
+            .child(Node, nodeKey)
+            .toInstance;
+    }
+    
     private def InstanceIdentifier<TerminationPoint> tpPath(NodeId nodeId, TpId tpId) {
         val nodeKey = new NodeKey(nodeId);
         val tpKey = new TerminationPointKey(tpId)
-        return InstanceIdentifier.builder.node(NetworkTopology).child(Topology, topology).child(Node, nodeKey).
+        return InstanceIdentifier.builder(NetworkTopology).child(Topology, topology).child(Node, nodeKey).
             child(TerminationPoint, tpKey).toInstance;
     }
+    
+    private def InstanceIdentifier<Link> linkPath(Link link) {
+        val linkInstanceId = InstanceIdentifier.builder(NetworkTopology)
+            .child(Topology, topology)
+            .child(Link, link.key)
+            .toInstance;
+        return linkInstanceId;
+    }    
 }
diff --git a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.xtend b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.xtend
new file mode 100644 (file)
index 0000000..036fe73
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.md.controller.topology.manager
+
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.NotificationListener
+import org.slf4j.LoggerFactory
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
+
+class FlowCapableTopologyProvider extends AbstractBindingAwareProvider implements AutoCloseable {
+
+
+
+    static val LOG = LoggerFactory.getLogger(FlowCapableTopologyProvider);
+
+    @Property
+    DataProviderService dataService;        
+
+    @Property
+    NotificationProviderService notificationService;
+
+    val FlowCapableTopologyExporter exporter = new FlowCapableTopologyExporter();
+
+    Registration<NotificationListener> listenerRegistration
+    
+    override close() {
+       LOG.info("FlowCapableTopologyProvider stopped.");
+        listenerRegistration?.close();
+    }
+    
+    override onSessionInitiated(ProviderContext session) {
+        dataService = session.getSALService(DataProviderService)
+        notificationService = session.getSALService(NotificationProviderService)
+        exporter.setDataService(dataService);
+        exporter.start();
+        listenerRegistration = notificationService.registerNotificationListener(exporter);
+    }
+    
+}
+
+
index e30ce5b47e961f87adccebcce363f2092da9c165..4fee930eff7db3c3ecfe5beb0bd113c9acfd5366 100644 (file)
@@ -124,8 +124,9 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
                                 "Session was not established after " + timeout);
                         negotiationFailed(cause);
                         changeState(State.FAILED);
-                    } else
+                    } else if(channel.isOpen()) {
                         channel.pipeline().remove(NAME_OF_EXCEPTION_HANDLER);
+                    }
                 }
             }
         }, INITIAL_HOLDTIMER, TimeUnit.MINUTES);
index baa0755dc9314f2ead370bad01acc804dc1d7a44..03cb9c20de7f4d504b5dacc60197281d0a482bf0 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>bundlescanner</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${bundlescanner.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
   </dependencies>
 </project>
index 0a05571a82b4e97631e5cd703bb055bd3c7e663c..2169f3f3e7c679670f24c94516217fe9bbceaf9b 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>usermanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${usermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>bundlescanner</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${bundlescanner.version}</version>
     </dependency>
 
     <dependency>
index fbfba08444eca63d179981dddfe1b294ae228c40..8ade6134e6b3a715d223288d9e0719098aa5b4df 100644 (file)
@@ -27,7 +27,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal.connection</artifactId>
-      <version>0.1.1-SNAPSHOT</version>
+      <version>${sal.connection.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>connectionmanager</artifactId>
-      <version>0.1.1-SNAPSHOT</version>
+      <version>${connectionmanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
   </dependencies>
 </project>
index ff64d1872467296c4e727a5558de41edb6dc1fa1..a8b8f2a5d0e4ae44cc6ca3183dadadbd1586edf3 100644 (file)
@@ -67,7 +67,7 @@
   <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -82,7 +82,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
@@ -92,7 +92,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
   </dependencies>
 </project>
index fe3c2b9a5bf97933b42788fb1a4bfa2048d5b694..8c3279e6c7b6857630bb5e7855b93cfd1064f906 100644 (file)
@@ -27,7 +27,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller.thirdparty</groupId>
       <artifactId>com.sun.jersey.jersey-servlet</artifactId>
-      <version>1.18-SNAPSHOT</version>
+      <version>${jersey-servlet.version}</version>
     </dependency>
 
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.6.1-SNAPSHOT</version>
+      <version>${switchmanager.api.version}</version>
     </dependency>
 
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
 
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
 
     <dependency>
     <dependency>
       <groupId>org.opendaylight.controller.thirdparty</groupId>
       <artifactId>org.apache.catalina.filters.CorsFilter</artifactId>
-      <version>7.0.43-SNAPSHOT</version>
+      <version>${corsfilter.version}</version>
     </dependency>
   </dependencies>
 </project>
index 61791692bfb3b9cd767ececc3b27e87c8a41fa31..565bd5f6aa1961452041069baa57f5fd5b997615 100644 (file)
@@ -28,7 +28,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -75,7 +75,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>forwardingrulesmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${forwardingrulesmanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.7.0-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
@@ -99,7 +99,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index b9b5fb7514adeeb905804b404656053212f1759a..aab519e5f682746f9478a311bdf4966fe29243ab 100644 (file)
@@ -27,7 +27,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -75,7 +75,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
index 2576441061e5e53847a53d199502cfbac6197db6..483d993d04a0e872034fae5f1a926846d4639b9b 100644 (file)
@@ -27,7 +27,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal.connection</artifactId>
-      <version>0.1.1-SNAPSHOT</version>
+      <version>${sal.connection.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal.networkconfiguration</artifactId>
-      <version>0.0.2-SNAPSHOT</version>
+      <version>${sal.networkconfiguration.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>connectionmanager</artifactId>
-      <version>0.1.1-SNAPSHOT</version>
+      <version>${connectionmanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
   </dependencies>
 </project>
index f8342f935c9124568e652356028093cad7b12036..d54f2c5b2860ca6f2514ea1ca4420b2280132c84 100644 (file)
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>containermanager</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${containermanager.version}</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>commons.northbound</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>${commons.northbound.version}</version>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
index 01f3ff76c862a75766264217a180bf2c79ebcf79..c020e6b2a24e32226c96b4892a5530a2257feb2e 100644 (file)
@@ -27,7 +27,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
@@ -95,7 +95,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index b7891a4b86fe6aeacffe949f834e11cc8fe63494..95410b0d3a34a4a879e0fde3f3ed00561c495992 100644 (file)
@@ -27,7 +27,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>statisticsmanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${statisticsmanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
index 225d097ecc00c94eff54a58704193715cfc4886a..c7108b2efaa9ec375d9597afa8ccceb62835fa92 100644 (file)
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>clustering.services</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>${clustering.services.version}</version>
           </dependency>
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>configuration</artifactId>
-            <version>0.4.1-SNAPSHOT</version>
+            <version>${configuration.version}</version>
           </dependency>
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>switchmanager</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${switchmanager.api.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
index 29c9dd810df667860a1be34650eb2312ac8d5cf8..a1932f521bcec302e30e4b77fb5d2cdfaa5afb8d 100644 (file)
@@ -28,7 +28,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -75,7 +75,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
 
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
 
     <dependency>
index 45fe9e6d8b6cdf5f83323009e361e65240d5a61a..4cdfb02d58ee81d77fb29e938fb6f64a95c1951a 100644 (file)
@@ -29,7 +29,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>sal</artifactId>
-            <version>0.5.1-SNAPSHOT</version>
+            <version>${sal.version}</version>
           </dependency>
         </dependencies>
       </plugin>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${containermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>topologymanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${topologymanager.version}</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index d2614f03ed999849f13cf38be4f01234b75941d9..b48d67252e1bac2165f8d7a8bdec5c25b952ea91 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
-      <version>0.5.1-SNAPSHOT</version>
+      <version>${sal.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>usermanager</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${usermanager.version}</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>commons.northbound</artifactId>
-      <version>0.4.1-SNAPSHOT</version>
+      <version>${commons.northbound.version}</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.enunciate</groupId>
index bb5681b2dff0dbc988407885fa6b65599617617a..4e4e867fec637a30c3a0a26eedb128becbda84c7 100644 (file)
@@ -298,18 +298,18 @@ public class TopologyServiceShim implements IDiscoveryListener,
             // Compare bandwidth usage
             Long switchId = (Long) connector.getNode().getID();
             Short port = (Short) connector.getID();
-            float rate = statsMgr.getTransmitRate(switchId, port);
-            if (rate > bwThresholdFactor * bw) {
-                if (!connectorsOverUtilized.contains(connector)) {
-                    connectorsOverUtilized.add(connector);
-                    this.bwUtilNotifyQ.add(new UtilizationUpdate(connector,
-                            UpdateType.ADDED));
-                }
-            } else {
-                if (connectorsOverUtilized.contains(connector)) {
-                    connectorsOverUtilized.remove(connector);
-                    this.bwUtilNotifyQ.add(new UtilizationUpdate(connector,
-                            UpdateType.REMOVED));
+            if (statsMgr != null) {
+                float rate = statsMgr.getTransmitRate(switchId, port);
+                if (rate > bwThresholdFactor * bw) {
+                    if (!connectorsOverUtilized.contains(connector)) {
+                        connectorsOverUtilized.add(connector);
+                        this.bwUtilNotifyQ.add(new UtilizationUpdate(connector, UpdateType.ADDED));
+                    }
+                } else {
+                    if (connectorsOverUtilized.contains(connector)) {
+                        connectorsOverUtilized.remove(connector);
+                        this.bwUtilNotifyQ.add(new UtilizationUpdate(connector, UpdateType.REMOVED));
+                    }
                 }
             }
         }
index 16c09fe3f6a4ddfe62623293b055b53eabde15c0..56df8e26bd094b82bdd8d6ddb89cec4ab249e7a9 100644 (file)
@@ -161,15 +161,11 @@ public class Subnet implements Cloneable, Serializable {
         }
         InetAddress thisPrefix = getPrefixForAddress(this.networkAddress);
         InetAddress otherPrefix = getPrefixForAddress(ip);
-        if ((thisPrefix == null) || (otherPrefix == null)) {
-            return false;
-        }
-        if (thisPrefix.equals(otherPrefix)) {
-            return true;
-        }
-        else {
-            return false;
+        boolean isSubnetOf = true;
+        if (((thisPrefix == null) || (otherPrefix == null)) || (!thisPrefix.equals(otherPrefix)) ) {
+            isSubnetOf = false;
         }
+        return isSubnetOf;
     }
 
     public short getVlan() {
@@ -248,17 +244,7 @@ public class Subnet implements Cloneable, Serializable {
     }
 
     public boolean isMutualExclusive(Subnet otherSubnet) {
-        if (this.networkAddress.getClass() != otherSubnet.networkAddress
-                .getClass()) {
-            return true;
-        }
-        if (this.isSubnetOf(otherSubnet.getNetworkAddress())) {
-            return false;
-        }
-        if (otherSubnet.isSubnetOf(this.getNetworkAddress())) {
-            return false;
-        }
-        return true;
+        return !(isSubnetOf(otherSubnet.getNetworkAddress()) || otherSubnet.isSubnetOf(getNetworkAddress()));
     }
 
     /**
index 189476a5d1bb1c1420c683bf4ea6a6c2a07b3d7b..4f06b79f490c55ddd530924cab3f75705255c8bc 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
@@ -35,8 +34,8 @@ import org.opendaylight.controller.sal.utils.StatusCode;
 @XmlAccessorType(XmlAccessType.NONE)
 public class SubnetConfig implements Cloneable, Serializable {
     private static final long serialVersionUID = 1L;
-    private static final String prettyFields[] = { GUIField.NAME.toString(),
-            GUIField.GATEWAYIP.toString(), GUIField.NODEPORTS.toString() };
+    private static final String prettyFields[] = { GUIField.NAME.toString(), GUIField.GATEWAYIP.toString(),
+            GUIField.NODEPORTS.toString() };
 
     /**
      * Name of the subnet
@@ -44,14 +43,13 @@ public class SubnetConfig implements Cloneable, Serializable {
     @XmlElement
     private String name;
     /**
-     * A.B.C.D/MM  Where A.B.C.D is the Default
-     * Gateway IP (L3) or ARP Querier IP (L2)
+     * A.B.C.D/MM Where A.B.C.D is the Default Gateway IP (L3) or ARP Querier IP
+     * (L2)
      */
     @XmlElement
     private String subnet;
     /**
-     * Set of node connectors in the format:
-     * Port Type|Port Id@Node Type|Node Id
+     * Set of node connectors in the format: Port Type|Port Id@Node Type|Node Id
      */
     @XmlElement
     private List<String> nodeConnectors;
@@ -68,7 +66,8 @@ public class SubnetConfig implements Cloneable, Serializable {
     public SubnetConfig(SubnetConfig subnetConfig) {
         name = subnetConfig.name;
         subnet = subnetConfig.subnet;
-        nodeConnectors = (subnetConfig.nodeConnectors == null) ? null : new ArrayList<String>(subnetConfig.nodeConnectors);
+        nodeConnectors = (subnetConfig.nodeConnectors == null) ? null : new ArrayList<String>(
+                subnetConfig.nodeConnectors);
     }
 
     public String getName() {
@@ -96,22 +95,43 @@ public class SubnetConfig implements Cloneable, Serializable {
     public Short getIPMaskLen() {
         Short maskLen = 0;
         String[] s = subnet.split("/");
-        maskLen = (s.length == 2) ? Short.valueOf(s[1]) : 32;
+
+        try {
+            maskLen = (s.length == 2) ? Short.valueOf(s[1]) : 32;
+        } catch (NumberFormatException e) {
+            maskLen = 32;
+        }
         return maskLen;
     }
 
     private Status validateSubnetAddress() {
         if (!NetUtils.isIPAddressValid(subnet)) {
-            return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid address: %s", subnet));
+            return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid address: %s",
+                    subnet));
+        }
+        if ((this.getIPMaskLen() == 0) || (this.getIPMaskLen() == 32)) {
+            return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid mask: /%s",
+                    this.getIPMaskLen()));
         }
-        if((this.getIPMaskLen() == 0) || (this.getIPMaskLen() == 32)) {
-            return new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid mask: /%s", this.getIPMaskLen()));
+
+        //checks that address doesn't start with 0 or 255
+        String address = subnet.split("/")[0];
+        if (address.startsWith("0.") || address.startsWith("255.")) {
+            return  new Status(StatusCode.BADREQUEST, String.format("Invalid Subnet configuration: Invalid address: %s", address));
         }
+
         byte[] bytePrefix = NetUtils.getSubnetPrefix(this.getIPAddress(), this.getIPMaskLen()).getAddress();
         long prefix = BitBufferHelper.getLong(bytePrefix);
         if (prefix == 0) {
             return new Status(StatusCode.BADREQUEST, "Invalid network source address: subnet zero");
         }
+
+        //check that host is not set to all 0's or 1's
+        long hostAddress = BitBufferHelper.getLong(this.getIPAddress().getAddress()) - prefix;
+        if (hostAddress == 0 || hostAddress == Math.pow(2, 32-this.getIPMaskLen()) - 1) {
+            return new Status(StatusCode.BADREQUEST, String.format("Invalid subnet gateway address: /%s", subnet));
+        }
+
         return new Status(StatusCode.SUCCESS);
     }
 
@@ -158,7 +178,8 @@ public class SubnetConfig implements Cloneable, Serializable {
     }
 
     public boolean isGlobal() {
-        // If no ports are specified to be part of the domain, then it's a global domain IP
+        // If no ports are specified to be part of the domain, then it's a
+        // global domain IP
         return (nodeConnectors == null || nodeConnectors.isEmpty());
     }
 
@@ -180,8 +201,7 @@ public class SubnetConfig implements Cloneable, Serializable {
 
     @Override
     public String toString() {
-        return ("SubnetConfig [Name=" + name + ", Subnet=" + subnet
-                + ", NodeConnectors=" + nodeConnectors + "]");
+        return ("SubnetConfig [Name=" + name + ", Subnet=" + subnet + ", NodeConnectors=" + nodeConnectors + "]");
     }
 
     /**
index 41a1f1ab06d978a350002d7e52c5d0e5c755bbfd..8b6a149917602992c8f4360cceed2cc1c70cb54a 100644 (file)
@@ -8,8 +8,13 @@
 
 package org.opendaylight.controller.switchmanager;
 
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.net.Inet6Address;
 import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -26,19 +31,19 @@ public class SubnetTest {
     public void testSubnet() throws Exception {
         InetAddress ipaddr = InetAddress.getByName("100.0.0.1");
         Subnet subnet = new Subnet(ipaddr, (short) 24, (short) 5);
-        Assert.assertTrue(subnet.equals(subnet));
-        Assert.assertFalse(subnet.equals(null));
-        Assert.assertFalse(subnet.equals(ipaddr));
+        assertTrue(subnet.equals(subnet));
+        assertFalse(subnet.equals(null));
+        assertFalse(subnet.equals(ipaddr));
         Subnet subnet2 = new Subnet(ipaddr, (short) 24, (short) 5);
         Inet6Address ipv6 = (Inet6Address) Inet6Address
                 .getByName("1111::2222:3333:4444:5555:6666");
         Subnet subnet3 = new Subnet(ipv6, (short) 24, (short) 5);
-        Assert.assertTrue(subnet.equals(subnet2));
-        Assert.assertFalse(subnet.isMutualExclusive(subnet2));
-        Assert.assertTrue(subnet.isMutualExclusive(subnet3));
+        assertTrue(subnet.equals(subnet2));
+        assertFalse(subnet.isMutualExclusive(subnet2));
+        assertTrue(subnet.isMutualExclusive(subnet3));
         InetAddress subnetAddr = InetAddress.getByName("200.0.0.100");
 
-        Assert.assertTrue(subnet.isFlatLayer2() == true);
+        assertTrue(subnet.isFlatLayer2() == true);
 
         Set<NodeConnector> ncSet = new HashSet<NodeConnector>();
         Node node = NodeCreator.createOFNode(((long) 10));
@@ -53,10 +58,10 @@ public class SubnetTest {
         ncSet.add(nc1);
         ncSet.add(nc2);
 
-        Assert.assertTrue(subnet.hasNodeConnector(nc0));
-        Assert.assertFalse(subnet.hasNodeConnector(null));
+        assertTrue(subnet.hasNodeConnector(nc0));
+        assertFalse(subnet.hasNodeConnector(null));
         subnet.addNodeConnectors(ncSet);
-        Assert.assertTrue(subnet.hasNodeConnector(nc0));
+        assertTrue(subnet.hasNodeConnector(nc0));
 
         Set<NodeConnector> resultncSet = subnet.getNodeConnectors();
         Assert.assertEquals(resultncSet, ncSet);
@@ -69,24 +74,61 @@ public class SubnetTest {
         Set<NodeConnector> ncSet2 = new HashSet<NodeConnector>();
         ncSet2.add(nc0);
         subnet.deleteNodeConnectors(ncSet2);
-        Assert.assertFalse(subnet.getNodeConnectors().contains(nc0));
-        Assert.assertFalse(subnet.hasNodeConnector(nc0));
-        Assert.assertTrue(subnet.getNodeConnectors().contains(nc1));
-        Assert.assertTrue(subnet.getNodeConnectors().contains(nc2));
+        assertFalse(subnet.getNodeConnectors().contains(nc0));
+        assertFalse(subnet.hasNodeConnector(nc0));
+        assertTrue(subnet.getNodeConnectors().contains(nc1));
+        assertTrue(subnet.getNodeConnectors().contains(nc2));
 
         subnet.deleteNodeConnectors(ncSet2);
 
         subnet.setNetworkAddress(subnetAddr);
-        Assert.assertTrue(subnet.isMutualExclusive(subnet2));
-        Assert.assertTrue(subnet.getNetworkAddress().equals(subnetAddr));
+        assertTrue(subnet.isMutualExclusive(subnet2));
+        assertTrue(subnet.getNetworkAddress().equals(subnetAddr));
 
         subnet.setSubnetMaskLength((short) 16);
-        Assert.assertTrue(subnet.getSubnetMaskLength() == 16);
+        assertTrue(subnet.getSubnetMaskLength() == 16);
 
         subnet.setVlan((short) 100);
-        Assert.assertTrue(subnet.getVlan() == 100);
+        assertTrue(subnet.getVlan() == 100);
+
+        assertTrue(subnet.isFlatLayer2() == false);
+    }
+
+    @Test
+    public void checkIsSubnetOfComparisonMatch() {
+        String host = "10.0.0.1";
+        InetAddress ipAddrForSubnetComparison = null;
+        try {
+            ipAddrForSubnetComparison = InetAddress.getByName(host);
+        } catch (UnknownHostException e) {
+            fail("Failed to create InetAddress object for" + host);
+        }
+        SubnetConfig subnetConf = new SubnetConfig("subnet", "10.0.0.254/24",null);
+        Subnet subnet = new Subnet(subnetConf);
+        assertTrue(subnet.isSubnetOf(ipAddrForSubnetComparison));
+    }
 
-        Assert.assertTrue(subnet.isFlatLayer2() == false);
+    @Test
+    public void checkIsSubnetOfComparisonNoMatch() {
+        String host = "100.0.0.1";
+        InetAddress ipAddrForSubnetComparison = null;
+        try {
+            ipAddrForSubnetComparison = InetAddress.getByName(host);
+        } catch (UnknownHostException e) {
+            fail("Failed to create InetAddress object for" + host);
+        }
+        SubnetConfig subnetConf = new SubnetConfig("subnet", "10.0.0.254/24",null);
+        Subnet subnet = new Subnet(subnetConf);
+        assertFalse(subnet.isSubnetOf(ipAddrForSubnetComparison));
+    }
+
+    @Test
+    public void checkIsSubnetOfComparisonIpEmpty() {
+        SubnetConfig subnetConf = new SubnetConfig("subnet", "10.0.0.254/24",null);
+        Subnet subnet = new Subnet(subnetConf);
+        assertFalse(subnet.isSubnetOf(null));
     }
 
+
+
 }
index 97966255a03db0b91b60a899764cd1de3b8e432b..fa01fa6a6025f1dc4da35e0bda80b43f77a0388a 100644 (file)
@@ -35,10 +35,10 @@ import org.opendaylight.controller.sal.core.State;
 import org.opendaylight.controller.sal.core.UpdateType;
 import org.opendaylight.controller.sal.packet.address.EthernetAddress;
 import org.opendaylight.controller.sal.topology.TopoEdgeUpdate;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.controller.switchmanager.ISwitchManager;
 import org.opendaylight.controller.switchmanager.SpanConfig;
 import org.opendaylight.controller.switchmanager.Subnet;
@@ -55,7 +55,7 @@ public class TopologyManagerImplTest {
     private final class TestSwitchManager implements ISwitchManager {
         private final Set<Node>  nodeSet = new HashSet<Node>();
         private final Set<NodeConnector> nodeConnectorSet =
-            new HashSet<NodeConnector>();
+                new HashSet<NodeConnector>();
 
         private void addNodeConnectors(NodeConnector ... connectors) {
             for (NodeConnector nc: connectors) {
@@ -69,9 +69,9 @@ public class TopologyManagerImplTest {
         private void addNodeConnectors(TopologyUserLinkConfig ... links) {
             for (TopologyUserLinkConfig link: links) {
                 NodeConnector src =
-                    NodeConnector.fromString(link.getSrcNodeConnector());
+                        NodeConnector.fromString(link.getSrcNodeConnector());
                 NodeConnector dst =
-                    NodeConnector.fromString(link.getDstNodeConnector());
+                        NodeConnector.fromString(link.getDstNodeConnector());
                 addNodeConnectors(src, dst);
             }
         }
@@ -292,6 +292,35 @@ public class TopologyManagerImplTest {
         public String getNodeDescription(Node node) {
             return null;
         }
+
+        @Override
+        public Status removeControllerProperty(String propertyName){
+            return null;
+        }
+
+        @Override
+        public Set<Switch> getConfiguredNotConnectedSwitches() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public Map<String, Property> getControllerProperties() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public Property getControllerProperty(String propertyName) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        @Override
+        public Status setControllerProperty(Property property) {
+            // TODO Auto-generated method stub
+            return null;
+        }
     }
 
     /*
@@ -485,13 +514,13 @@ public class TopologyManagerImplTest {
         Assert.assertTrue(topoManagerImpl.getUserLinks().isEmpty());
 
         TopologyUserLinkConfig badlink1 =
-            new TopologyUserLinkConfig("bad1", "OF|1@OF|4", "OF|1@OF|5");
+                new TopologyUserLinkConfig("bad1", "OF|1@OF|4", "OF|1@OF|5");
         TopologyUserLinkConfig badlink2 =
-            new TopologyUserLinkConfig("bad2", "OF|10@OF|7", "OF|7@OF|13");
+                new TopologyUserLinkConfig("bad2", "OF|10@OF|7", "OF|7@OF|13");
         Assert.assertEquals(StatusCode.NOTFOUND,
-                            topoManagerImpl.addUserLink(badlink1).getCode());
+                topoManagerImpl.addUserLink(badlink1).getCode());
         Assert.assertEquals(StatusCode.NOTFOUND,
-                            topoManagerImpl.addUserLink(badlink2).getCode());
+                topoManagerImpl.addUserLink(badlink2).getCode());
     }
 
     @Test
@@ -559,7 +588,7 @@ public class TopologyManagerImplTest {
             reverseLink[i] = new TopologyUserLinkConfig(name, dstNodeConnector, srcNodeConnector);
 
             Assert.assertEquals(StatusCode.NOTFOUND,
-                                topoManagerImpl.addUserLink(link[i]).getCode());
+                    topoManagerImpl.addUserLink(link[i]).getCode());
             swMgr.addNodeConnectors(link[i]);
             Assert.assertTrue(topoManagerImpl.addUserLink(link[i]).isSuccess());
         }