DeviceState changes
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / device / DeviceStateImpl.java
index 0a69374b5807040517c59797f2c05281baf65b0c..5372cc0db9bd28583c2a7b85b3355400d2455b88 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 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;
 
 /**
@@ -29,16 +28,9 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
  * 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
  */
 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;
@@ -46,30 +38,12 @@ class DeviceStateImpl implements DeviceState {
     private boolean flowStatisticsAvailable;
     private boolean tableStatisticsAvailable;
     private boolean portStatisticsAvailable;
+    private boolean statPollEnabled;
     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;
+    DeviceStateImpl() {
+        statPollEnabled = false;
+        deviceSynchronized = false;
     }
 
     @Override
@@ -82,11 +56,6 @@ class DeviceStateImpl implements DeviceState {
         this.valid = valid;
     }
 
-    @Override
-    public short getVersion() {
-        return version;
-    }
-
     @Override
     public boolean isMetersAvailable() {
         return meterIsAvailable;
@@ -159,12 +128,12 @@ class DeviceStateImpl implements DeviceState {
     }
 
     @Override
-    public OfpRole getRole() {
-        return role;
+    public boolean isStatisticsPollingEnabled() {
+        return statPollEnabled;
     }
 
     @Override
-    public void setRole(OfpRole role) {
-        this.role = role;
+    public void setStatisticsPollingEnabledProp(final boolean statPollEnabled) {
+        this.statPollEnabled = statPollEnabled;
     }
 }