本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation.getControllerEntry方法的典型用法代码示例。如果您正苦于以下问题:Java OvsdbBridgeAugmentation.getControllerEntry方法的具体用法?Java OvsdbBridgeAugmentation.getControllerEntry怎么用?Java OvsdbBridgeAugmentation.getControllerEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation
的用法示例。
在下文中一共展示了OvsdbBridgeAugmentation.getControllerEntry方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControllerEntries
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
/**
* Create the {@link ControllerEntry} list given an MDSAL {@link Node} bridge
* and {@link Controller} rows.
*
* @param bridgeNode the {@link Node} to update
* @param updatedControllerRows the list of {@link Controller} controllers with updates
* @return list of {@link ControllerEntry} entries
*/
public static List<ControllerEntry> createControllerEntries(Node bridgeNode,
Map<UUID, Controller> updatedControllerRows) {
LOG.debug("createControllerEntries Bridge 2: {}\n, updatedControllerRows: {}",
bridgeNode, updatedControllerRows);
final List<ControllerEntry> controllerEntriesCreated = new ArrayList<>();
final OvsdbBridgeAugmentation ovsdbBridgeAugmentation =
bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
if (ovsdbBridgeAugmentation == null) {
return controllerEntriesCreated;
}
final List<ControllerEntry> controllerEntries = ovsdbBridgeAugmentation.getControllerEntry();
if (controllerEntries != null) {
for (ControllerEntry controllerEntry : controllerEntries) {
final Controller controller = updatedControllerRows.get(
new UUID(controllerEntry.getControllerUuid().getValue()));
addControllerEntries(controllerEntriesCreated, controller);
}
}
LOG.debug("controllerEntries: {}", controllerEntriesCreated);
return controllerEntriesCreated;
}
示例2: createExpectedConfigurationChanges
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
private Map<InstanceIdentifier<?>, DataObject> createExpectedConfigurationChanges(final Node bridgeNode) {
OvsdbBridgeAugmentation ovsdbBridge = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>();
final InstanceIdentifier<Node> bridgeNodeIid =
SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId());
final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid =
bridgeNodeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build();
changes.put(bridgeNodeIid, bridgeNode);
changes.put(ovsdbBridgeIid, ovsdbBridge);
for (ProtocolEntry protocolEntry : ovsdbBridge.getProtocolEntry()) {
KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid =
ovsdbBridgeIid.child(ProtocolEntry.class, protocolEntry.getKey());
changes.put(protocolIid, protocolEntry);
}
for (ControllerEntry controller : ovsdbBridge.getControllerEntry()) {
KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid =
ovsdbBridgeIid.child(ControllerEntry.class, controller.getKey());
changes.put(controllerIid, controller);
}
return changes;
}
示例3: isControllerConnected
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
/**
* Checks whether the OVSDB controller is connected. This method will retry 10 times and will through an
* AssertionError for any number of unexpected states.
* @param connectionInfo where to connect to
* @return true if connected
* @throws InterruptedException if interrupted while waiting for connection to appear
*/
public boolean isControllerConnected(ConnectionInfo connectionInfo) throws InterruptedException {
LOG.info("isControllerConnected enter");
ControllerEntry controllerEntry;
Node ovsdbNode = southboundUtils.getOvsdbNode(connectionInfo);
assertNotNull("ovsdb node not found", ovsdbNode);
String controllerTarget = southboundUtils.getControllersFromOvsdbNode(ovsdbNode).get(0);
assertNotNull("Failed to get controller target", controllerTarget);
for (int i = 0; i < 10; i++) {
LOG.info("isControllerConnected try {}: looking for controller: {}", i, controllerTarget);
OvsdbBridgeAugmentation bridge =
southboundUtils.getBridge(connectionInfo, "br-int");
if (bridge != null && bridge.getControllerEntry() != null) {
controllerEntry = bridge.getControllerEntry().iterator().next();
assertEquals(controllerTarget, controllerEntry.getTarget().getValue());
if (controllerEntry.isIsConnected()) {
LOG.info("isControllerConnected exit: true {}", controllerTarget);
return true;
}
}
Thread.sleep(1000);
}
LOG.info("isControllerConnected exit: false {}", controllerTarget);
return false;
}
示例4: createOvsdbController
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
public static Map<UUID, Controller> createOvsdbController(OvsdbBridgeAugmentation omn,DatabaseSchema dbSchema) {
List<ControllerEntry> controllerEntries = omn.getControllerEntry();
Map<UUID,Controller> controllerMap = new HashMap<>();
if (controllerEntries != null && !controllerEntries.isEmpty()) {
for (ControllerEntry controllerEntry : controllerEntries) {
String controllerNamedUuid = "Controller_" + getRandomUuid();
Controller controller = TyperUtils.getTypedRowWrapper(dbSchema, Controller.class);
controller.setTarget(controllerEntry.getTarget().getValue());
controllerMap.put(new UUID(controllerNamedUuid), controller);
}
}
return controllerMap;
}
示例5: extractBridgeConfigurationChanges
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
private Map<InstanceIdentifier<?>, DataObject> extractBridgeConfigurationChanges(
final Node bridgeNode, final OvsdbBridgeAugmentation ovsdbBridge) {
Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>();
final InstanceIdentifier<Node> bridgeNodeIid =
SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId());
final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid =
bridgeNodeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build();
changes.put(bridgeNodeIid, bridgeNode);
changes.put(ovsdbBridgeIid, ovsdbBridge);
if (ovsdbBridge.getProtocolEntry() != null) {
for (ProtocolEntry protocol : ovsdbBridge.getProtocolEntry()) {
if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {
KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid =
ovsdbBridgeIid.child(ProtocolEntry.class, protocol.getKey());
changes.put(protocolIid, protocol);
} else {
throw new IllegalArgumentException("Unknown protocol " + protocol.getProtocol());
}
}
}
if (ovsdbBridge.getControllerEntry() != null) {
for (ControllerEntry controller : ovsdbBridge.getControllerEntry()) {
KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid =
ovsdbBridgeIid.child(ControllerEntry.class, controller.getKey());
changes.put(controllerIid, controller);
}
}
return changes;
}
示例6: testOvsdbBridgeControllerInfo
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
@Test
public void testOvsdbBridgeControllerInfo() throws InterruptedException {
ConnectionInfo connectionInfo = getConnectionInfo(addressStr,portNumber);
String controllerTarget = SouthboundUtil.getControllerTarget(ovsdbNode);
assertNotNull("Failed to get controller target", controllerTarget);
List<ControllerEntry> setControllerEntry = createControllerEntry(controllerTarget);
Uri setUri = new Uri(controllerTarget);
try (TestBridge testBridge = new TestBridge(connectionInfo, null, SouthboundITConstants.BRIDGE_NAME,null, true,
SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null,
setControllerEntry, null)) {
OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
Assert.assertNotNull("bridge was not found: " + SouthboundITConstants.BRIDGE_NAME, bridge);
Assert.assertNotNull("ControllerEntry was not found: " + setControllerEntry.iterator().next(),
bridge.getControllerEntry());
List<ControllerEntry> getControllerEntries = bridge.getControllerEntry();
for (ControllerEntry entry : getControllerEntries) {
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);
}
}
}
}
示例7: setBridgeController
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入方法依赖的package包/类
/**
* 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);
InstanceIdentifier<Node> bridgeNodeIid = createInstanceIdentifier(ovsdbNode.getKey(), bridgeName);
Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeNodeIid);
if (bridgeNode == null) {
LOG.info("setBridgeController could not find bridge in configuration {}", bridgeNodeIid);
return false;
}
OvsdbBridgeAugmentation bridgeAug = extractBridgeAugmentation(bridgeNode);
//Only add controller entries that do not already exist on this bridge
List<ControllerEntry> existingControllerEntries = bridgeAug.getControllerEntry();
List<ControllerEntry> newControllerEntries = new ArrayList<>();
if(existingControllerEntries != null) {
NEW_ENTRY_LOOP:
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,maxBackoff, inactivityProbe);
}
if(newControllerEntries.isEmpty()) {
return true;
}
NodeBuilder nodeBuilder = new NodeBuilder(bridgeNode);
OvsdbBridgeAugmentationBuilder augBuilder = new OvsdbBridgeAugmentationBuilder(bridgeAug);
augBuilder.setControllerEntry(newControllerEntries);
nodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, augBuilder.build());
InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier(ovsdbNode.getKey(), bridgeName);
return mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION, bridgeIid, nodeBuilder.build());
}