Introduce driver property to suppress meter feature
Piggybacked in this commit:
- Fix CLI output of driver properties
- Fix mfr matching pattern in onos-drivers.xml
- Add driver support for Accton OFDPA 3
Change-Id: Ia350bd52f4e88e53565ff491d68bce5e4894bbb9
diff --git a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java
index 2062951..2774194 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/DefaultDriverTest.java
@@ -17,15 +17,25 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.onosproject.net.driver.DefaultDriverDataTest.DEVICE_ID;
public class DefaultDriverTest {
+ private static final String MFR = "mfr";
+ private static final String HW = "hw";
+ private static final String SW = "sw";
+ private static final String KEY = "key";
+ private static final String VALUE = "value";
+ private static final String ROOT = "rootDriver";
+ private static final String CHILD = "childDriver";
+ private static final String GRAND_CHILD = "grandChilDriver";
@Test
public void basics() {
@@ -90,4 +100,20 @@
assertTrue("incorrect toString", ddc.toString().contains("Circus"));
}
+
+ @Test
+ public void testGetProperty() throws Exception {
+ DefaultDriver root = new DefaultDriver(ROOT, Lists.newArrayList(), MFR, HW, SW,
+ ImmutableMap.of(), ImmutableMap.of());
+
+ DefaultDriver child = new DefaultDriver(CHILD, Lists.newArrayList(root), MFR, HW, SW,
+ ImmutableMap.of(), ImmutableMap.of(KEY, VALUE));
+
+ DefaultDriver grandChild = new DefaultDriver(GRAND_CHILD, Lists.newArrayList(child),
+ MFR, HW, SW, ImmutableMap.of(), ImmutableMap.of());
+
+ assertNull(root.getProperty(KEY));
+ assertEquals(VALUE, child.getProperty(KEY));
+ assertEquals(VALUE, grandChild.getProperty(KEY));
+ }
}
diff --git a/core/api/src/test/java/org/onosproject/net/driver/DriverAdapter.java b/core/api/src/test/java/org/onosproject/net/driver/DriverAdapter.java
index a989e758..25b3aca 100644
--- a/core/api/src/test/java/org/onosproject/net/driver/DriverAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/driver/DriverAdapter.java
@@ -84,6 +84,11 @@
}
@Override
+ public String getProperty(String name) {
+ return null;
+ }
+
+ @Override
public Driver merge(Driver other) {
return null;
}