add bridge configuration at Arista Switch driver
For Arista switch, the following code is required
because the port to be used as OpenFlow bridge should be added.
Change-Id: Id73560b9c9592838ba91329ef652742fb1beb65b
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java b/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java
index e9ee007..d155a14 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/BridgeConfig.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.behaviour;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -59,6 +60,19 @@
void addPort(BridgeName bridgeName, String portName);
/**
+ * Adds ports to a given bridge.
+ *
+ * @param bridgeName bridge name
+ * @param portNames list port name
+ */
+ default void addPorts(BridgeName bridgeName, List<String> portNames) {
+ List<String> portsList = new ArrayList<>();
+ for (String portName : portNames) {
+ portsList.add(portName);
+ }
+ }
+
+ /**
* Removes a port from a given bridge.
*
* @param bridgeName bridge name
diff --git a/drivers/arista/src/main/java/org/onosproject/drivers/arista/BridgeConfigAristaImpl.java b/drivers/arista/src/main/java/org/onosproject/drivers/arista/BridgeConfigAristaImpl.java
index ce64459..42f08f7 100644
--- a/drivers/arista/src/main/java/org/onosproject/drivers/arista/BridgeConfigAristaImpl.java
+++ b/drivers/arista/src/main/java/org/onosproject/drivers/arista/BridgeConfigAristaImpl.java
@@ -72,6 +72,18 @@
}
@Override
+ public void addPorts(BridgeName bridgeName, List<String> portNames) {
+ List<String> cmds = new ArrayList<>();
+ cmds.add(CONFIGURE_TERMINAL);
+ cmds.add(OPENFLOW_CMD);
+ for (String portName : portNames) {
+ cmds.add(String.format(BIND_CMD, portName));
+ }
+
+ AristaUtils.getWithChecking(handler(), cmds);
+ }
+
+ @Override
public void deletePort(BridgeName bridgeName, String portName) {
List<String> cmds = new ArrayList<>();
cmds.add(CONFIGURE_TERMINAL);