本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation类的典型用法代码示例。如果您正苦于以下问题:Java OvsdbBridgeAugmentation类的具体用法?Java OvsdbBridgeAugmentation怎么用?Java OvsdbBridgeAugmentation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OvsdbBridgeAugmentation类属于org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105包,在下文中一共展示了OvsdbBridgeAugmentation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPortsNode
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Optional<Node> getPortsNode(BigInteger dpnId) {
InstanceIdentifier<BridgeRefEntry> bridgeRefInfoPath = InstanceIdentifier.create(BridgeRefInfo.class)
.child(BridgeRefEntry.class, new BridgeRefEntryKey(dpnId));
// FIXME: Read this through a cache
BridgeRefEntry bridgeRefEntry = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeRefInfoPath);
if (bridgeRefEntry == null) {
LOG.error("no bridge ref entry found for dpnId: " + dpnId);
return Optional.absent();
}
InstanceIdentifier<Node> nodeId = ((InstanceIdentifier<OvsdbBridgeAugmentation>) bridgeRefEntry
.getBridgeReference().getValue()).firstIdentifierOf(Node.class);
// FIXME: Read this through a cache
Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, nodeId);
if (node == null) {
LOG.error("missing node for dpnId: " + dpnId);
return Optional.absent();
}
return Optional.of(node);
}
示例2: 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;
}
示例3: getBridge
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<?> key, Map<InstanceIdentifier<Node>, Node> nodes) {
OvsdbBridgeAugmentation bridge = null;
InstanceIdentifier<Node> nodeIid = key.firstIdentifierOf(Node.class);
if (nodes != null && nodes.get(nodeIid) != null) {
Node node = nodes.get(nodeIid);
bridge = node.getAugmentation(OvsdbBridgeAugmentation.class);
if (bridge == null) {
ReadOnlyTransaction transaction = SouthboundProvider.getDb().newReadOnlyTransaction();
CheckedFuture<Optional<Node>, ReadFailedException> future =
transaction.read(LogicalDatastoreType.OPERATIONAL, nodeIid);
try {
Optional<Node> nodeOptional = future.get();
if (nodeOptional.isPresent()) {
bridge = nodeOptional.get().getAugmentation(OvsdbBridgeAugmentation.class);
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Error reading from datastore",e);
}
transaction.close();
}
}
return bridge;
}
示例4: execute
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private void execute(TransactionBuilder transaction, BridgeOperationalState state,
Set<InstanceIdentifier<ControllerEntry>> removedControllers,
Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation>
modifiedBridges) {
for (InstanceIdentifier<ControllerEntry> controllerIid : removedControllers) {
LOG.debug("Removing Registered...ODL controller : {} ", controllerIid);
InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid =
controllerIid.firstIdentifierOf(OvsdbBridgeAugmentation.class);
OvsdbBridgeAugmentation ovsdbBridge = modifiedBridges.get(bridgeIid);
Optional<ControllerEntry> controllerEntryOptional = state.getControllerEntry(controllerIid);
if (ovsdbBridge != null && controllerEntryOptional.isPresent()) {
ControllerEntry controllerEntry = controllerEntryOptional.get();
Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
bridge.setController(Collections.singleton(new UUID(controllerEntry.getControllerUuid().getValue())));
transaction.add(op.mutate(bridge).addMutation(bridge.getControllerColumn().getSchema(),
Mutator.DELETE, bridge.getControllerColumn().getData()));
}
}
}
示例5: getBridge
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<OvsdbNodeAugmentation> key,
Uri bridgeUri) {
final InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
.child(Node.class, new NodeKey(new NodeId(bridgeUri)))
.augmentation(OvsdbBridgeAugmentation.class);
OvsdbBridgeAugmentation bridge = null;
try (ReadOnlyTransaction transaction = SouthboundProvider.getDb().newReadOnlyTransaction()) {
final Optional<OvsdbBridgeAugmentation> bridgeOptional =
transaction.read(LogicalDatastoreType.OPERATIONAL, bridgeIid).get();
if (bridgeOptional.isPresent()) {
bridge = bridgeOptional.get();
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Error reading from datastore", e);
}
return bridge;
}
示例6: getOperNode
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private OvsdbNodeAugmentation getOperNode(final OvsdbBridgeAugmentation operBridge) {
@SuppressWarnings("unchecked")
InstanceIdentifier<Node> iidNode = (InstanceIdentifier<Node>)operBridge.getManagedBy().getValue();
OvsdbNodeAugmentation operNode = null;
ReadOnlyTransaction transaction = SouthboundProvider.getDb().newReadOnlyTransaction();
CheckedFuture<Optional<Node>, ReadFailedException> future =
transaction.read(LogicalDatastoreType.OPERATIONAL, iidNode);
try {
Optional<Node> nodeOptional = future.get();
if (nodeOptional.isPresent()) {
operNode = nodeOptional.get().getAugmentation(OvsdbNodeAugmentation.class);
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Error reading from datastore", e);
}
return operNode;
}
示例7: getControllerEntry
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
public Optional<ControllerEntry> getControllerEntry(InstanceIdentifier<?> iid) {
if (iid != null) {
Optional<OvsdbBridgeAugmentation> ovsdbBridgeOptional = getOvsdbBridgeAugmentation(iid);
if (ovsdbBridgeOptional.isPresent() && ovsdbBridgeOptional.get().getControllerEntry() != null) {
ControllerEntryKey key = iid.firstKeyOf(ControllerEntry.class);
if (key != null) {
for (ControllerEntry entry: ovsdbBridgeOptional.get().getControllerEntry()) {
if (entry.getKey().equals(key)) {
return Optional.of(entry);
}
}
}
}
}
return Optional.absent();
}
示例8: getProtocolEntry
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
public Optional<ProtocolEntry> getProtocolEntry(InstanceIdentifier<ProtocolEntry> iid) {
if (iid != null) {
Optional<OvsdbBridgeAugmentation> ovsdbBridgeOptional = getOvsdbBridgeAugmentation(iid);
if (ovsdbBridgeOptional.isPresent() && ovsdbBridgeOptional.get().getProtocolEntry() != null) {
ProtocolEntryKey key = iid.firstKeyOf(ProtocolEntry.class);
if (key != null) {
for (ProtocolEntry entry: ovsdbBridgeOptional.get().getProtocolEntry()) {
if (entry.getKey().equals(key)) {
return Optional.of(entry);
}
}
}
}
}
return Optional.absent();
}
示例9: getManagedByIid
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private InstanceIdentifier<?> getManagedByIid(Map<InstanceIdentifier<?>, DataObject> map,
InstanceIdentifier<?> iidToCheck) {
// Get the InstanceIdentifier of the containing node
InstanceIdentifier<Node> nodeEntryIid = iidToCheck.firstIdentifierOf(Node.class);
// Look for the Node in the created/updated data
DataObject dataObject = null;
if (map != null && map.get(nodeEntryIid) != null) {
dataObject = map.get(nodeEntryIid);
}
// If we are contained in a bridge managed by this iid
if (dataObject != null && dataObject instanceof Node) {
Node node = (Node)dataObject;
OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class);
if (bridge != null && bridge.getManagedBy() != null && bridge.getManagedBy().getValue().equals(this.iid)) {
return bridge.getManagedBy().getValue();
}
}
return null;
}
示例10: controllerEntriesToRemove
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private List<InstanceIdentifier<ControllerEntry>> controllerEntriesToRemove(
InstanceIdentifier<Node> bridgeIid, Bridge bridge) {
Preconditions.checkNotNull(bridgeIid);
Preconditions.checkNotNull(bridge);
List<InstanceIdentifier<ControllerEntry>> result =
new ArrayList<>();
Bridge oldBridgeNode = oldBridgeRows.get(bridge.getUuid());
if (oldBridgeNode != null && oldBridgeNode.getControllerColumn() != null) {
for (UUID controllerUuid: oldBridgeNode.getControllerColumn().getData()) {
if (bridge.getControllerColumn() == null
|| !bridge.getControllerColumn().getData().contains(controllerUuid)) {
Controller controller = removedControllerRows.get(controllerUuid);
if (controller != null && controller.getTargetColumn() != null) {
InstanceIdentifier<ControllerEntry> iid = bridgeIid
.augmentation(OvsdbBridgeAugmentation.class)
.child(ControllerEntry.class,
new ControllerEntryKey(new Uri(controller.getTargetColumn().getData())));
result.add(iid);
}
}
}
}
return result;
}
示例11: bridgeOtherConfigsToRemove
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private List<InstanceIdentifier<BridgeOtherConfigs>> bridgeOtherConfigsToRemove(
InstanceIdentifier<Node> bridgeIid, Bridge bridge) {
Preconditions.checkNotNull(bridgeIid);
Preconditions.checkNotNull(bridge);
List<InstanceIdentifier<BridgeOtherConfigs>> result = new ArrayList<>();
Bridge oldBridge = oldBridgeRows.get(bridge.getUuid());
if (oldBridge != null && oldBridge.getOtherConfigColumn() != null) {
for (Entry<String, String> otherConfig:
oldBridge.getOtherConfigColumn().getData().entrySet()) {
if (bridge.getOtherConfigColumn() == null
|| !bridge.getOtherConfigColumn().getData().containsKey(otherConfig.getKey())) {
InstanceIdentifier<BridgeOtherConfigs> iid = bridgeIid
.augmentation(OvsdbBridgeAugmentation.class)
.child(BridgeOtherConfigs.class,
new BridgeOtherConfigsKey(otherConfig.getKey()));
result.add(iid);
}
}
}
return result;
}
示例12: externalIdsToRemove
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private List<InstanceIdentifier<BridgeExternalIds>> externalIdsToRemove(
InstanceIdentifier<Node> bridgeIid, Bridge bridge) {
Preconditions.checkNotNull(bridgeIid);
Preconditions.checkNotNull(bridge);
List<InstanceIdentifier<BridgeExternalIds>> result = new ArrayList<>();
Bridge oldBridge = oldBridgeRows.get(bridge.getUuid());
if (oldBridge != null && oldBridge.getExternalIdsColumn() != null) {
for (Entry<String, String> externalId:
oldBridge.getExternalIdsColumn().getData().entrySet()) {
if (bridge.getExternalIdsColumn() == null
|| !bridge.getExternalIdsColumn().getData().containsKey(externalId.getKey())) {
InstanceIdentifier<BridgeExternalIds> iid = bridgeIid
.augmentation(OvsdbBridgeAugmentation.class)
.child(BridgeExternalIds.class,
new BridgeExternalIdsKey(externalId.getKey()));
result.add(iid);
}
}
}
return result;
}
示例13: buildBridgeNode
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
private Node buildBridgeNode(Bridge bridge) {
NodeBuilder bridgeNodeBuilder = new NodeBuilder();
NodeId bridgeNodeId = getNodeId(bridge);
bridgeNodeBuilder.setNodeId(bridgeNodeId);
OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridge.getName()));
ovsdbBridgeAugmentationBuilder.setBridgeUuid(new Uuid(bridge.getUuid().toString()));
setDataPath(ovsdbBridgeAugmentationBuilder, bridge);
setDataPathType(ovsdbBridgeAugmentationBuilder, bridge);
setProtocol(ovsdbBridgeAugmentationBuilder, bridge);
setExternalIds(ovsdbBridgeAugmentationBuilder, bridge);
setOtherConfig(ovsdbBridgeAugmentationBuilder, bridge);
setFailMode(ovsdbBridgeAugmentationBuilder, bridge);
setOpenFlowNodeRef(ovsdbBridgeAugmentationBuilder, bridge);
setManagedBy(ovsdbBridgeAugmentationBuilder);
setAutoAttach(ovsdbBridgeAugmentationBuilder, bridge);
setStpEnalbe(ovsdbBridgeAugmentationBuilder,bridge);
bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
LOG.debug("Built with the intent to store bridge data {}",
ovsdbBridgeAugmentationBuilder.build());
return bridgeNodeBuilder.build();
}
示例14: updateController
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
/**
* Update the ControllerEntry values after finding the related {@Bridge} list.
*
* <p>
* Controller and Bridge are independent tables in the Open_vSwitch schema
* but the OVSDB yang model includes the Controller fields in the
* Bridge data. In some cases the OVSDB will send Bridge and Controller
* updates together and in other cases independently. This method here
* assumes the latter.
* </p>
*
* @param transaction the {@link ReadWriteTransaction}
* @param newUpdatedControllerRows updated {@link Controller} rows
*/
private void updateController(ReadWriteTransaction transaction,
Map<UUID, Controller> newUpdatedControllerRows) {
Map<InstanceIdentifier<Node>, Node> bridgeNodes = getBridgeNodes(transaction);
for (Map.Entry<InstanceIdentifier<Node>, Node> bridgeNodeEntry : bridgeNodes.entrySet()) {
final List<ControllerEntry> controllerEntries =
SouthboundMapper.createControllerEntries(bridgeNodeEntry.getValue(), newUpdatedControllerRows);
for (ControllerEntry controllerEntry : controllerEntries) {
final InstanceIdentifier<Node> bridgeIid = bridgeNodeEntry.getKey();
InstanceIdentifier<ControllerEntry> iid = bridgeIid
.augmentation(OvsdbBridgeAugmentation.class)
.child(ControllerEntry.class, controllerEntry.getKey());
transaction.merge(LogicalDatastoreType.OPERATIONAL,
iid, controllerEntry);
}
}
}
示例15: getControllerEntryIid
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; //导入依赖的package包/类
/**
* Create the {@link InstanceIdentifier} for the {@link ControllerEntry}.
*
* @param controllerEntry the {@link ControllerEntry}
* @param bridgeName the name of the bridge
* @return the {@link InstanceIdentifier}
*/
private InstanceIdentifier<ControllerEntry> getControllerEntryIid(
ControllerEntry controllerEntry, String bridgeName) {
OvsdbConnectionInstance client = getOvsdbConnectionInstance();
String nodeString = client.getNodeKey().getNodeId().getValue()
+ "/bridge/" + bridgeName;
NodeId nodeId = new NodeId(new Uri(nodeString));
NodeKey nodeKey = new NodeKey(nodeId);
InstanceIdentifier<Node> bridgeIid = InstanceIdentifier.builder(NetworkTopology.class)
.child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
.child(Node.class,nodeKey)
.build();
return bridgeIid
.augmentation(OvsdbBridgeAugmentation.class)
.child(ControllerEntry.class, controllerEntry.getKey());
}