use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project netvirt by opendaylight.
the class HwvtepTerminationPointListener method handlePortAdded.
private List<ListenableFuture<Void>> handlePortAdded(TerminationPoint portAdded, NodeId psNodeId) {
Node psNode = HwvtepUtils.getHwVtepNode(broker, LogicalDatastoreType.OPERATIONAL, psNodeId);
if (psNode != null) {
String psName = psNode.getAugmentation(PhysicalSwitchAugmentation.class).getHwvtepNodeName().getValue();
L2GatewayDevice l2GwDevice = l2GatewayCache.get(psName);
if (l2GwDevice != null) {
if (isL2GatewayConfigured(l2GwDevice)) {
List<L2gatewayConnection> l2GwConns = L2GatewayConnectionUtils.getAssociatedL2GwConnections(broker, l2GwDevice.getL2GatewayIds());
String newPortId = portAdded.getTpId().getValue();
NodeId hwvtepNodeId = new NodeId(l2GwDevice.getHwvtepNodeId());
List<VlanBindings> vlanBindings = getVlanBindings(l2GwConns, hwvtepNodeId, psName, newPortId);
return Collections.singletonList(elanL2GatewayUtils.updateVlanBindingsInL2GatewayDevice(hwvtepNodeId, psName, newPortId, vlanBindings));
}
} else {
LOG.error("{} details are not present in L2Gateway Cache", psName);
}
} else {
LOG.error("{} entry not in config datastore", psNodeId);
}
return Collections.emptyList();
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project netvirt by opendaylight.
the class L2GatewayConnectionListener method loadL2GwDeviceCache.
private void loadL2GwDeviceCache(List<Node> nodes) {
if (nodes == null) {
LOG.debug("No config topology nodes are present");
return;
}
Map<InstanceIdentifier<Node>, Node> allNodes = nodes.stream().collect(toMap(TO_NODE_PATH, Function.identity()));
LOG.trace("Loading all config nodes");
Set<InstanceIdentifier<Node>> allIids = allNodes.keySet();
Map<String, List<InstanceIdentifier<Node>>> psNodesByDeviceName = allIids.stream().filter(IS_PS_NODE).collect(groupingBy(GET_DEVICE_NAME, toList()));
// Process HA nodes
allNodes.values().stream().filter(IS_HA_PARENT_NODE).forEach(parentNode -> {
allIids.stream().filter(IS_PS_NODE).filter(psIid -> PS_NODE_OF_PARENT_NODE.test(psIid, parentNode)).forEach(psIid -> {
addL2DeviceToCache(psIid, parentNode, allNodes.get(psIid));
});
});
// Process non HA nodes there will be only one ps node iid for each device for non ha nodes
psNodesByDeviceName.values().stream().filter(psIids -> psIids.size() == 1).map(psIids -> psIids.get(0)).forEach(psIid -> {
Node psNode = allNodes.get(psIid);
Node globalNode = allNodes.get(TO_GLOBAL_PATH.apply(psNode));
if (globalNode != null) {
addL2DeviceToCache(psIid, globalNode, psNode);
}
});
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config 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.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config 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;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project netvirt by opendaylight.
the class HwvtepHAUtil method buildManagersForHANode.
/**
* Transform child managers (Source) to HA managers using HA node path.
*
* @param childNode Child Node
* @param haGlobalCfg HA global config node
* @return Transformed managers
*/
public static List<Managers> buildManagersForHANode(Node childNode, Optional<Node> haGlobalCfg) {
Set<NodeId> nodeIds = new HashSet<>();
nodeIds.add(childNode.getNodeId());
List<NodeId> childNodeIds = getChildNodeIdsFromManagerOtherConfig(haGlobalCfg);
nodeIds.addAll(childNodeIds);
ManagersBuilder builder1 = new ManagersBuilder();
builder1.setKey(new ManagersKey(new Uri(MANAGER_KEY)));
List<ManagerOtherConfigs> otherConfigses = new ArrayList<>();
StringBuffer stringBuffer = new StringBuffer();
for (NodeId nodeId : nodeIds) {
stringBuffer.append(nodeId.getValue());
stringBuffer.append(",");
}
String children = stringBuffer.substring(0, stringBuffer.toString().length() - 1);
otherConfigses.add(getOtherConfigBuilder(HA_CHILDREN, children).build());
builder1.setManagerOtherConfigs(otherConfigses);
List<Managers> managers = new ArrayList<>();
managers.add(builder1.build());
return managers;
}
Aggregations