use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node in project netvirt by opendaylight.
the class ElanBridgeManager method getDpIdFromManagerNodeId.
@Override
public Optional<BigInteger> getDpIdFromManagerNodeId(String managerNodeId) {
InstanceIdentifier<Node> identifier = getIntegrationBridgeIdentifier(managerNodeId);
OvsdbBridgeAugmentation integrationBridgeAugmentation = interfaceManager.getOvsdbBridgeForNodeIid(identifier);
if (integrationBridgeAugmentation == null) {
LOG.debug("Failed to get OvsdbBridgeAugmentation for node {}", managerNodeId);
return Optional.empty();
}
return Optional.ofNullable(integrationBridgeAugmentation.getDatapathId()).map(datapathId -> MDSALUtil.getDpnId(datapathId.getValue()));
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node in project netvirt by opendaylight.
the class ElanBridgeManager method prepareIntegrationBridge.
private void prepareIntegrationBridge(Node ovsdbNode, Node brIntNode) {
if (southboundUtils.getBridgeFromConfig(ovsdbNode, INTEGRATION_BRIDGE) == null) {
LOG.debug("br-int in operational but not config, copying into config");
copyBridgeToConfig(brIntNode);
}
Map<String, String> providerMappings = getOpenvswitchOtherConfigMap(ovsdbNode, PROVIDER_MAPPINGS_KEY);
for (String value : providerMappings.values()) {
if (southboundUtils.extractTerminationPointAugmentation(brIntNode, value) != null) {
LOG.debug("prepareIntegrationBridge: port {} already exists on {}", value, INTEGRATION_BRIDGE);
continue;
}
Node exBridgeNode = southboundUtils.readBridgeNode(ovsdbNode, value);
if (exBridgeNode != null) {
LOG.debug("prepareIntegrationBridge: bridge {} found. Patching to {}", value, INTEGRATION_BRIDGE);
patchBridgeToBrInt(brIntNode, exBridgeNode, value);
} else {
LOG.debug("prepareIntegrationBridge: adding interface {} to {}", value, INTEGRATION_BRIDGE);
if (!addPortToBridge(brIntNode, INTEGRATION_BRIDGE, value)) {
LOG.error("Failed to add {} port to {}", value, brIntNode);
}
}
}
if (!addControllerToBridge(ovsdbNode, INTEGRATION_BRIDGE)) {
LOG.error("Failed to set controller to existing integration bridge {}", brIntNode);
}
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node in project netvirt by opendaylight.
the class ElanBridgeManager method handleNewProviderNetBridges.
public void handleNewProviderNetBridges(Node originalNode, Node updatedNode) {
if (!isOvsdbNode(updatedNode)) {
return;
}
List<ManagedNodeEntry> originalManagedNodes = getManagedNodeEntries(originalNode);
if (originalManagedNodes == null) {
return;
}
List<ManagedNodeEntry> updatedManagedNodes = getManagedNodeEntries(updatedNode);
if (updatedManagedNodes == null) {
return;
}
updatedManagedNodes.removeAll(originalManagedNodes);
if (updatedManagedNodes.isEmpty()) {
return;
}
LOG.debug("handleNewProviderNetBridges checking if any of these are provider nets {}", updatedManagedNodes);
Node brInt = southboundUtils.readBridgeNode(updatedNode, INTEGRATION_BRIDGE);
if (brInt == null) {
LOG.info("handleNewProviderNetBridges, br-int not found");
return;
}
Collection<String> providerVals = getOpenvswitchOtherConfigMap(updatedNode, PROVIDER_MAPPINGS_KEY).values();
for (ManagedNodeEntry nodeEntry : updatedManagedNodes) {
String bridgeName = nodeEntry.getBridgeRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
bridgeName = bridgeName.substring(bridgeName.lastIndexOf('/') + 1);
if (bridgeName.equals(INTEGRATION_BRIDGE)) {
continue;
}
if (providerVals.contains(bridgeName)) {
patchBridgeToBrInt(brInt, southboundUtils.readBridgeNode(updatedNode, bridgeName), bridgeName);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node in project netvirt by opendaylight.
the class HwvtepHAUtil method convertLogicalSwitchRef.
/**
* Trnaform logical switch to nodepath passed .
*
* @param src {@link HwvtepLogicalSwitchRef} Logical Switch Ref which needs to be transformed
* @param nodePath {@link InstanceIdentifier} src needs to be transformed to this path
* @return ref {@link HwvtepLogicalSwitchRef} the transforrmed result
*/
public static HwvtepLogicalSwitchRef convertLogicalSwitchRef(HwvtepLogicalSwitchRef src, InstanceIdentifier<Node> nodePath) {
InstanceIdentifier<LogicalSwitches> srcId = (InstanceIdentifier<LogicalSwitches>) src.getValue();
HwvtepNodeName switchName = srcId.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
InstanceIdentifier<LogicalSwitches> iid = nodePath.augmentation(HwvtepGlobalAugmentation.class).child(LogicalSwitches.class, new LogicalSwitchesKey(switchName));
HwvtepLogicalSwitchRef ref = new HwvtepLogicalSwitchRef(iid);
return ref;
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node in project netvirt by opendaylight.
the class HwvtepHAUtil method getChildNodeIdsFromManagerOtherConfig.
/**
* Returns ha child node path from ha node of config data tree.
*
* @param haGlobalConfigNodeOptional HA global node
* @return ha Child ids
*/
public static List<NodeId> getChildNodeIdsFromManagerOtherConfig(Optional<Node> haGlobalConfigNodeOptional) {
List<NodeId> childNodeIds = new ArrayList<>();
if (!haGlobalConfigNodeOptional.isPresent()) {
return childNodeIds;
}
HwvtepGlobalAugmentation augmentation = haGlobalConfigNodeOptional.get().getAugmentation(HwvtepGlobalAugmentation.class);
if (augmentation != null && augmentation.getManagers() != null && augmentation.getManagers().size() > 0) {
Managers managers = augmentation.getManagers().get(0);
if (null == managers.getManagerOtherConfigs()) {
return childNodeIds;
}
for (ManagerOtherConfigs otherConfigs : managers.getManagerOtherConfigs()) {
if (otherConfigs.getOtherConfigKey().equals(HA_CHILDREN)) {
String nodeIdsVal = otherConfigs.getOtherConfigValue();
if (nodeIdsVal != null) {
String[] parts = nodeIdsVal.split(",");
for (String part : parts) {
childNodeIds.add(new NodeId(part));
}
}
}
}
}
return childNodeIds;
}
Aggregations