[ONOS-6451] Datapath type setting function for supporting OVS DPDK addBridge
Change-Id: Ib6a8fa79dc1221e1387f8888f606306c671c4133
diff --git a/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java b/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java
index 00eb375..b38d1d7 100644
--- a/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java
+++ b/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridge.java
@@ -45,6 +45,7 @@
private final List<ControllerInfo> controllers;
/* Adds more properties */
+ private final Optional<String> datapathType;
/* other optional configs */
private final Map<String, String> otherConfigs;
@@ -55,14 +56,17 @@
* @param name name of the bridge
* @param failMode openflow controller fail mode policy
* @param controllers list of openflow controllers
+ * @param datapathType ovs datapath_type
* @param otherConfigs other configs
*/
private OvsdbBridge(String name, Optional<FailMode> failMode,
List<ControllerInfo> controllers,
+ Optional<String> datapathType,
Map<String, String> otherConfigs) {
this.name = checkNotNull(name);
this.failMode = failMode;
this.controllers = controllers;
+ this.datapathType = datapathType;
this.otherConfigs = otherConfigs;
}
@@ -94,6 +98,15 @@
}
/**
+ * Returns OVSDB datapath Type of the bridge.
+ *
+ * @return datapath type
+ */
+ public Optional<String> datapathType() {
+ return datapathType;
+ }
+
+ /**
* Returns other configurations of the bridge.
*
* @return map of configurations
@@ -134,6 +147,7 @@
.add("bridgeName", name)
.add("failMode", failMode)
.add("controllers", controllers)
+ .add("datapathType", datapathType)
.add("otherConfigs", otherConfigs)
.toString();
}
@@ -164,6 +178,7 @@
private String name;
private Optional<FailMode> failMode = Optional.empty();
private List<ControllerInfo> controllers = Lists.newArrayList();
+ private Optional<String> datapathType = Optional.empty();
private Map<String, String> otherConfigs = Maps.newHashMap();
private Builder() {
@@ -182,7 +197,9 @@
otherConfigs.put(DISABLE_INBAND,
bridgeDesc.disableInBand().get().toString());
}
-
+ if (bridgeDesc.datapathType().isPresent()) {
+ this.datapathType = bridgeDesc.datapathType();
+ }
this.name = bridgeDesc.name();
this.failMode = bridgeDesc.failMode();
this.controllers = Lists.newArrayList(bridgeDesc.controllers());
@@ -194,7 +211,7 @@
* @return ovsdb bridge
*/
public OvsdbBridge build() {
- return new OvsdbBridge(name, failMode, controllers, otherConfigs);
+ return new OvsdbBridge(name, failMode, controllers, datapathType, otherConfigs);
}
/**
@@ -264,6 +281,17 @@
}
/**
+ * Returns OVSDB bridge builder with a given datapath type.
+ *
+ * @param datapathType datapath Type
+ * @return ovsdb bridge builder
+ */
+ public Builder datapathType(String datapathType) {
+ this.datapathType = Optional.ofNullable(datapathType);
+ return this;
+ }
+
+ /**
* Returns OVSDB bridge builder with a given disable in-band config.
*
* @return ovsdb bridge builder
diff --git a/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java b/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java
index f60d48c..cc6e8b5 100644
--- a/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java
+++ b/protocols/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/driver/DefaultOvsdbClient.java
@@ -522,6 +522,11 @@
bridge.setFailMode(Sets.newHashSet(failMode));
}
+ if (ovsdbBridge.datapathType().isPresent()) {
+ String datapathType = ovsdbBridge.datapathType().get();
+ bridge.setDatapathType(datapathType);
+ }
+
String bridgeUuid = getBridgeUuid(ovsdbBridge.name());
if (bridgeUuid == null) {
bridge.setName(ovsdbBridge.name());