Bug 6554 Fix rejecting connections
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / device / DeviceStateImpl.java
index 0a69374b5807040517c59797f2c05281baf65b0c..d7ec195a11c68df293419b480fe899bb0083441e 100644 (file)
@@ -8,83 +8,23 @@
 
 package org.opendaylight.openflowplugin.impl.device;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
-import org.opendaylight.openflowplugin.impl.util.DeviceStateUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-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.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
 /**
- * openflowplugin-impl
- * org.opendaylight.openflowplugin.impl.device
- * <p/>
- * DeviceState is builded from {@link FeaturesReply} and {@link NodeId}. Both values are inside
- * {@link org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext}
- *
- * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
- *         <p/>
- *         Created: Mar 29, 2015
+ * Holder for device features
  */
 class DeviceStateImpl implements DeviceState {
 
-    private final GetFeaturesOutput featuresOutput;
-    private final NodeId nodeId;
-    private final KeyedInstanceIdentifier<Node, NodeKey> nodeII;
-    private final short version;
-    private boolean valid;
     private boolean meterIsAvailable;
     private boolean groupIsAvailable;
-    private boolean deviceSynchronized;
     private boolean flowStatisticsAvailable;
     private boolean tableStatisticsAvailable;
     private boolean portStatisticsAvailable;
     private boolean queueStatisticsAvailable;
-    private volatile OfpRole role;
-
-    public DeviceStateImpl(@CheckForNull final FeaturesReply featuresReply, @Nonnull final NodeId nodeId) {
-        Preconditions.checkArgument(featuresReply != null);
-        featuresOutput = new GetFeaturesOutputBuilder(featuresReply).build();
-        this.nodeId = Preconditions.checkNotNull(nodeId);
-        nodeII = DeviceStateUtil.createNodeInstanceIdentifier(nodeId);
-        version = featuresReply.getVersion();
-    }
-
-    @Override
-    public NodeId getNodeId() {
-        return nodeId;
-    }
-
-    @Override
-    public KeyedInstanceIdentifier<Node, NodeKey> getNodeInstanceIdentifier() {
-        return nodeII;
-    }
-
-    @Override
-    public GetFeaturesOutput getFeatures() {
-        return featuresOutput;
-    }
-
-    @Override
-    public boolean isValid() {
-        return valid;
-    }
-
-    @Override
-    public void setValid(final boolean valid) {
-        this.valid = valid;
-    }
 
-    @Override
-    public short getVersion() {
-        return version;
+    DeviceStateImpl() {
     }
 
     @Override
@@ -107,11 +47,6 @@ class DeviceStateImpl implements DeviceState {
         groupIsAvailable = available;
     }
 
-    @Override
-    public boolean deviceSynchronized() {
-        return deviceSynchronized;
-    }
-
     @Override
     public boolean isFlowStatisticsAvailable() {
         return flowStatisticsAvailable;
@@ -150,21 +85,6 @@ class DeviceStateImpl implements DeviceState {
     @Override
     public void setQueueStatisticsAvailable(final boolean available) {
         queueStatisticsAvailable = available;
-
     }
 
-    @Override
-    public void setDeviceSynchronized(final boolean _deviceSynchronized) {
-        deviceSynchronized = _deviceSynchronized;
-    }
-
-    @Override
-    public OfpRole getRole() {
-        return role;
-    }
-
-    @Override
-    public void setRole(OfpRole role) {
-        this.role = role;
-    }
 }