[ONOS-5599] Store meter features into MeterStore
Change-Id: I22f7366b87cad6fc706b6ff7b0ccff1a0e85ad6a
diff --git a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowSwitch.java b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowSwitch.java
index 206ffad..2ac0e02 100644
--- a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowSwitch.java
+++ b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowSwitch.java
@@ -18,6 +18,7 @@
import org.onosproject.net.Device;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFMeterFeatures;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
import java.util.List;
@@ -74,6 +75,12 @@
List<OFPortDesc> getPorts();
/**
+ * Fetches the meter features of this switch.
+ * @return unmodifiable meter features
+ */
+ OFMeterFeatures getMeterFeatures();
+
+ /**
* Provides the factory for this OF version.
* @return OF version specific factory.
*/
diff --git a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
index 128863e..eb6571e 100644
--- a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
+++ b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
@@ -30,6 +30,7 @@
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFMeterFeatures;
import org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply;
import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleRequest;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
@@ -472,6 +473,15 @@
}
@Override
+ public OFMeterFeatures getMeterFeatures() {
+ if (this.meterfeatures != null) {
+ return this.meterfeatures.getFeatures();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
public String manufacturerDescription() {
return this.desc.getMfrDesc();
}
diff --git a/protocols/openflow/api/src/test/java/org/onosproject/openflow/controller/OpenFlowSwitchAdapter.java b/protocols/openflow/api/src/test/java/org/onosproject/openflow/controller/OpenFlowSwitchAdapter.java
index 4a511b6..c3b228d 100644
--- a/protocols/openflow/api/src/test/java/org/onosproject/openflow/controller/OpenFlowSwitchAdapter.java
+++ b/protocols/openflow/api/src/test/java/org/onosproject/openflow/controller/OpenFlowSwitchAdapter.java
@@ -18,6 +18,7 @@
import org.onosproject.net.Device;
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFMeterFeatures;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
import java.util.List;
@@ -57,6 +58,11 @@
}
@Override
+ public OFMeterFeatures getMeterFeatures() {
+ return null;
+ }
+
+ @Override
public OFFactory factory() {
return null;
}
diff --git a/protocols/openflow/ctl/src/test/java/org/onosproject/openflow/OpenflowSwitchDriverAdapter.java b/protocols/openflow/ctl/src/test/java/org/onosproject/openflow/OpenflowSwitchDriverAdapter.java
index 11c47e1..74751db 100644
--- a/protocols/openflow/ctl/src/test/java/org/onosproject/openflow/OpenflowSwitchDriverAdapter.java
+++ b/protocols/openflow/ctl/src/test/java/org/onosproject/openflow/OpenflowSwitchDriverAdapter.java
@@ -31,6 +31,7 @@
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFMeterFeatures;
import org.projectfloodlight.openflow.protocol.OFMeterFeaturesStatsReply;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
@@ -241,6 +242,11 @@
}
@Override
+ public OFMeterFeatures getMeterFeatures() {
+ return null;
+ }
+
+ @Override
public OFFactory factory() {
// return what-ever triggers requestPending = true
return OFFactories.getFactory(OFVersion.OF_10);