Bug 5596 Created lifecycle service
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / connection / ConnectionContextImpl.java
index b37907ae60e124a6a1b01414f97b41736c18d8f0..aebb3fe3d3221034a1291f9f1c7688aedf0d6657 100644 (file)
@@ -17,6 +17,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
@@ -249,6 +250,7 @@ public class ConnectionContextImpl implements ConnectionContext {
         final private KeyedInstanceIdentifier<Node, NodeKey> nodeII;
         final private Short version;
         final private BigInteger datapathId;
+        final private ServiceGroupIdentifier serviceGroupIdentifier;
 
         DeviceInfoImpl(
                 final NodeId nodeId,
@@ -259,6 +261,7 @@ public class ConnectionContextImpl implements ConnectionContext {
             this.nodeII = nodeII;
             this.version = version;
             this.datapathId = datapathId;
+            this.serviceGroupIdentifier = ServiceGroupIdentifier.create(this.nodeId.getValue());
         }
 
         @Override
@@ -281,17 +284,27 @@ public class ConnectionContextImpl implements ConnectionContext {
             return datapathId;
         }
 
+        @Override
+        public ServiceGroupIdentifier getServiceIdentifier() {
+            return this.serviceGroupIdentifier;
+        }
+
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (o == null || getClass() != o.getClass()) return false;
+            if (this == o) {
+                return true;
+            }
+
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
 
             DeviceInfoImpl that = (DeviceInfoImpl) o;
 
-            return  nodeId.equals(that.nodeId) &&
+            return  (nodeId.equals(that.nodeId) &&
                     nodeII.equals(that.nodeII) &&
                     version.equals(that.version) &&
-                    datapathId.equals(that.datapathId);
+                    datapathId.equals(that.datapathId));
 
         }