final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid uuid =
new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.yang.types.rev130715.Uuid(controller.getUuid().toString());
-
- controllerEntries.add(new ControllerEntryBuilder()
+ ControllerEntryBuilder builder = new ControllerEntryBuilder();
+ if (controller.getMaxBackoffColumn() != null && controller.getMaxBackoffColumn().getData() != null) {
+ builder.setMaxBackoff(controller.getMaxBackoffColumn().getData());
+ }
+ if (controller.getInactivityProbeColumn() != null
+ && controller.getInactivityProbeColumn().getData() != null
+ && !controller.getInactivityProbeColumn().getData().isEmpty()) {
+ builder.setInactivityProbe(controller.getInactivityProbeColumn().getData().iterator().next());
+ }
+ controllerEntries.add(builder
.setTarget(new Uri(targetString))
.setIsConnected(controller.getIsConnectedColumn().getData())
.setControllerUuid(uuid).build());
}
}
+ // This is not called from anywhere but test. Do we need this?
public static Map<UUID, Controller> createOvsdbController(OvsdbBridgeAugmentation omn,DatabaseSchema dbSchema) {
List<ControllerEntry> controllerEntries = omn.getControllerEntry();
Map<UUID,Controller> controllerMap = new HashMap<>();
final String targetString = manager.getTargetColumn().getData();
final Map<String, String> statusAttributeMap =
- (manager.getStatusColumn() == null) ? null : manager.getStatusColumn().getData();
- if ((statusAttributeMap != null) && statusAttributeMap.containsKey(N_CONNECTIONS_STR)) {
+ manager.getStatusColumn() == null ? null : manager.getStatusColumn().getData();
+ if (statusAttributeMap != null && statusAttributeMap.containsKey(N_CONNECTIONS_STR)) {
String numberOfConnectionValueStr = statusAttributeMap.get(N_CONNECTIONS_STR);
numberOfConnections = Integer.parseInt(numberOfConnectionValueStr);
} else {
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
private static final String FORMAT_STR = "%s_%s_%d";
private static final Version AUTOATTACH_FROM_VERSION = Version.fromString("7.11.2");
private static final Version IF_INDEX_FROM_VERSION = Version.fromString("7.2.1");
+ private static final Long MAX_BACKOFF = 10000L;
+ private static final Long INACTIVITY_PROBE = 30000L;
private static String addressStr;
private static int portNumber;
private static String connectionType;
synchronized (this) {
long _start = System.currentTimeMillis();
LOG.info("Waiting for {} DataChanged creation on {}", type, iid);
- while (!isCreated(iid) && (System.currentTimeMillis() - _start) < timeout) {
+ while (!isCreated(iid) && System.currentTimeMillis() - _start < timeout) {
wait(RETRY_WAIT);
}
- LOG.info("Woke up, waited {}ms for creation of {}", (System.currentTimeMillis() - _start), iid);
+ LOG.info("Woke up, waited {}ms for creation of {}", System.currentTimeMillis() - _start, iid);
}
}
synchronized (this) {
long _start = System.currentTimeMillis();
LOG.info("Waiting for {} DataChanged deletion on {}", type, iid);
- while (!isRemoved(iid) && (System.currentTimeMillis() - _start) < timeout) {
+ while (!isRemoved(iid) && System.currentTimeMillis() - _start < timeout) {
wait(RETRY_WAIT);
}
- LOG.info("Woke up, waited {}ms for deletion of {}", (System.currentTimeMillis() - _start), iid);
+ LOG.info("Woke up, waited {}ms for deletion of {}", System.currentTimeMillis() - _start, iid);
}
}
synchronized (this) {
long _start = System.currentTimeMillis();
LOG.info("Waiting for {} DataChanged update on {}", type, iid);
- while (!isUpdated(iid) && (System.currentTimeMillis() - _start) < timeout) {
+ while (!isUpdated(iid) && System.currentTimeMillis() - _start < timeout) {
wait(RETRY_WAIT);
}
- LOG.info("Woke up, waited {}ms for update of {}", (System.currentTimeMillis() - _start), iid);
+ LOG.info("Woke up, waited {}ms for update of {}", System.currentTimeMillis() - _start, iid);
}
}
}
+ @Override
@Configuration
public Option[] config() {
Option[] options = super.config();
long _start = System.currentTimeMillis();
LOG.info("Waiting for OPERATIONAL DataChanged creation on {}", iid);
while (!OPERATIONAL_LISTENER.isCreated(
- iid) && (System.currentTimeMillis() - _start) < OVSDB_ROUNDTRIP_TIMEOUT) {
+ iid) && System.currentTimeMillis() - _start < OVSDB_ROUNDTRIP_TIMEOUT) {
OPERATIONAL_LISTENER.wait(OVSDB_UPDATE_TIMEOUT);
}
- LOG.info("Woke up, waited {} for creation of {}", (System.currentTimeMillis() - _start), iid);
+ LOG.info("Woke up, waited {} for creation of {}", System.currentTimeMillis() - _start, iid);
}
}
long _start = System.currentTimeMillis();
LOG.info("Waiting for OPERATIONAL DataChanged deletion on {}", iid);
while (!OPERATIONAL_LISTENER.isRemoved(
- iid) && (System.currentTimeMillis() - _start) < OVSDB_ROUNDTRIP_TIMEOUT) {
+ iid) && System.currentTimeMillis() - _start < OVSDB_ROUNDTRIP_TIMEOUT) {
OPERATIONAL_LISTENER.wait(OVSDB_UPDATE_TIMEOUT);
}
- LOG.info("Woke up, waited {} for deletion of {}", (System.currentTimeMillis() - _start), iid);
+ LOG.info("Woke up, waited {} for deletion of {}", System.currentTimeMillis() - _start, iid);
}
}
long _start = System.currentTimeMillis();
LOG.info("Waiting for OPERATIONAL DataChanged update on {}", iid);
while (!OPERATIONAL_LISTENER.isUpdated(
- iid) && (System.currentTimeMillis() - _start) < OVSDB_ROUNDTRIP_TIMEOUT) {
+ iid) && System.currentTimeMillis() - _start < OVSDB_ROUNDTRIP_TIMEOUT) {
OPERATIONAL_LISTENER.wait(OVSDB_UPDATE_TIMEOUT);
}
- LOG.info("Woke up, waited {} for update of {}", (System.currentTimeMillis() - _start), iid);
+ LOG.info("Woke up, waited {} for update of {}", System.currentTimeMillis() - _start, iid);
}
}
Assert.assertEquals(dpType, bridge.getDatapathType());
// Add port for all dpdk interface types (dpdkvhost not supported in existing dpdk ovs)
- List<String> dpdkTypes = new ArrayList<String>();
+ List<String> dpdkTypes = new ArrayList<>();
dpdkTypes.add("dpdk");
dpdkTypes.add("dpdkr");
dpdkTypes.add("dpdkvhostuser");
if (entry.getTarget() != null) {
Assert.assertEquals(setUri.toString(), entry.getTarget().toString());
}
+ if (entry.getMaxBackoff() != null) {
+ Assert.assertEquals(entry.getMaxBackoff(), MAX_BACKOFF);
+ }
+ if (entry.getInactivityProbe() != null) {
+ Assert.assertEquals(entry.getInactivityProbe(),INACTIVITY_PROBE);
+ }
}
}
}
List<ControllerEntry> controllerEntriesList = new ArrayList<>();
controllerEntriesList.add(new ControllerEntryBuilder()
.setTarget(new Uri(controllerTarget))
+ .setMaxBackoff(MAX_BACKOFF)
+ .setInactivityProbe(INACTIVITY_PROBE)
.build());
return controllerEntriesList;
}
ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
OvsdbNodeAugmentation ovsdbNodeAugmentation;
Uri qosUri = new Uri("QOS-ROW");
- List<String> typeList = new ArrayList<String>();
+ List<String> typeList = new ArrayList<>();
typeList.add(SouthboundConstants.QOS_LINUX_HTB);
typeList.add(SouthboundConstants.QOS_LINUX_HFSC);
private Queues getQueue(Uri queueId, OvsdbNodeAugmentation node) {
for (Queues queue : node.getQueues()) {
- if (queue.getKey().getQueueId().getValue().equals(queueId.getValue()))
+ if (queue.getKey().getQueueId().getValue().equals(queueId.getValue())) {
return queue;
+ }
}
return null;
}
private QosEntries getQos(Uri qosId, OvsdbNodeAugmentation node) {
for (QosEntries qos : node.getQosEntries()) {
- if (qos.getKey().getQosId().equals(qosId))
+ if (qos.getKey().getQosId().equals(qosId)) {
return qos;
+ }
}
return null;
}
@Override
protected void setKey(Builder<InterfaceLldp> builder, String key) {
- ((InterfaceLldpBuilder) builder).setLldpKey((key));
+ ((InterfaceLldpBuilder) builder).setLldpKey(key);
}
@Override
* @return success if the write to md-sal was successful
*/
public boolean setBridgeController(Node ovsdbNode, String bridgeName, List<String> controllers) {
+ return setBridgeController(ovsdbNode, bridgeName, controllers, null, null);
+ }
+ /**
+ * Set the controllers of an existing bridge node
+ * @param ovsdbNode where the bridge is
+ * @param bridgeName Name of the bridge
+ * @param controllers controller strings
+ * @param maxBackoff Max backoff in milliseconds
+ * @param inactivityProbe inactivity probe in milliseconds
+ * @return success if the write to md-sal was successful
+ */
+ public boolean setBridgeController(Node ovsdbNode, String bridgeName, List<String> controllers,
+ Long maxBackoff, Long inactivityProbe) {
LOG.debug("setBridgeController: ovsdbNode: {}, bridgeNode: {}, controller(s): {}",
ovsdbNode, bridgeName, controllers);
List<ControllerEntry> newControllerEntries = new ArrayList<>();
if(existingControllerEntries != null) {
NEW_ENTRY_LOOP:
- for (ControllerEntry newEntry : createControllerEntries(controllers)) {
+ for (ControllerEntry newEntry : createControllerEntries(controllers, maxBackoff, inactivityProbe)) {
for (ControllerEntry existingEntry : existingControllerEntries) {
if (newEntry.getTarget().equals(existingEntry.getTarget())) {
continue NEW_ENTRY_LOOP;
newControllerEntries.add(newEntry);
}
} else {
- newControllerEntries = createControllerEntries(controllers);
+ newControllerEntries = createControllerEntries(controllers,maxBackoff, inactivityProbe);
}
if(newControllerEntries.isEmpty()) {
}
public boolean addBridge(Node ovsdbNode, String bridgeName, List<String> controllersStr,
- final Class<? extends DatapathTypeBase> dpType, String mac) {
+ final Class<? extends DatapathTypeBase> dpType, String mac) {
+ return addBridge(ovsdbNode, bridgeName, controllersStr, dpType, mac, null, null);
+ }
+
+ public boolean addBridge(Node ovsdbNode, String bridgeName, List<String> controllersStr,
+ final Class<? extends DatapathTypeBase> dpType, String mac,
+ Long maxBackoff, Long inactivityProbe) {
boolean result;
LOG.info("addBridge: node: {}, bridgeName: {}, controller(s): {}", ovsdbNode, bridgeName, controllersStr);
NodeId bridgeNodeId = createManagedNodeId(bridgeIid);
bridgeNodeBuilder.setNodeId(bridgeNodeId);
OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
- ovsdbBridgeAugmentationBuilder.setControllerEntry(createControllerEntries(controllersStr));
+ ovsdbBridgeAugmentationBuilder.setControllerEntry(createControllerEntries(
+ controllersStr, maxBackoff, inactivityProbe));
ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName));
ovsdbBridgeAugmentationBuilder.setProtocolEntry(createMdsalProtocols());
ovsdbBridgeAugmentationBuilder.setFailMode( OVSDB_FAIL_MODE_MAP.inverse().get("secure"));
return found;
}
- private List<ControllerEntry> createControllerEntries(List<String> controllersStr) {
+ private List<ControllerEntry> createControllerEntries(List<String> controllersStr,
+ Long maxBackoff, Long inactivityProbe) {
List<ControllerEntry> controllerEntries = new ArrayList<>();
if (controllersStr != null) {
for (String controllerStr : controllersStr) {
ControllerEntryBuilder controllerEntryBuilder = new ControllerEntryBuilder();
controllerEntryBuilder.setTarget(new Uri(controllerStr));
+ if (maxBackoff != null) {
+ controllerEntryBuilder.setMaxBackoff(maxBackoff);
+ }
+ if (inactivityProbe != null) {
+ controllerEntryBuilder.setInactivityProbe(inactivityProbe);
+ }
controllerEntries.add(controllerEntryBuilder.build());
}
}