use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class ElanDpnToTransportZoneListener method add.
@Override
public void add(InstanceIdentifier<DpnInterfaces> key, DpnInterfaces dataObjectModification) {
// Proceed only if "auto-config-transport-zones = TRUE"
if (!useTransportZone) {
return;
}
LOG.debug("Elan dpn {} add detected, updating transport zones", dataObjectModification.getDpId());
Uint64 dpId = dataObjectModification.getDpId();
String elanInstanceName = key.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
if (!ElanUtils.isVxlanNetworkOrVxlanSegment(elanInstanceCache.get(elanInstanceName).orElse(null))) {
return;
}
transportZoneNotificationUtil.updateTransportZone(elanInstanceName, dpId);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class ElanInstanceManager method update.
@Override
public void update(InstanceIdentifier<ElanInstance> identifier, ElanInstance original, ElanInstance update) {
EVENT_LOGGER.debug("ELAN-Instance, UPDATE {}", original.getElanInstanceName());
Uint32 existingElanTag = original.getElanTag();
String elanName = update.getElanInstanceName();
if (existingElanTag == null || !existingElanTag.equals(update.getElanTag())) {
if (update.getElanTag() == null || update.getElanTag().longValue() == 0L) {
// update the elan-Instance with new properties
LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, operTx -> LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> ElanUtils.updateOperationalDataStore(idManager, update, new ArrayList<>(), confTx, operTx)), LOG, "Error updating ELAN tag in ELAN instance for config " + "transaction")), LOG, "Error updating ELAN tag in ELAN instance for operational transaction");
} else {
jobCoordinator.enqueueJob(elanName, () -> elanInterfaceManager.handleunprocessedElanInterfaces(update), ElanConstants.JOB_MAX_RETRIES);
}
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.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);
InstanceIdentifier<Node> parentIid = HwvtepHACache.getInstance().getParent(convertToInstanceIdentifier(childNode.getNodeId().getValue()));
HwvtepHACache.getInstance().getChildrenForHANode(parentIid).stream().forEach(iid -> nodeIds.add(iid.firstKeyOf(Node.class).getNodeId()));
ManagersBuilder builder1 = new ManagersBuilder();
builder1.withKey(new ManagersKey(new Uri(MANAGER_KEY)));
List<ManagerOtherConfigs> otherConfigses = new ArrayList<>();
String children = nodeIds.stream().map(NodeId::getValue).collect(Collectors.joining(","));
otherConfigses.add(getOtherConfigBuilder(HA_CHILDREN, children).build());
builder1.setManagerOtherConfigs(otherConfigses);
List<Managers> managers = new ArrayList<>();
managers.add(builder1.build());
return managers;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.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().augmentation(HwvtepGlobalAugmentation.class);
if (augmentation != null && augmentation.getManagers() != null && augmentation.getManagers().size() > 0) {
Managers managers = new ArrayList<>(augmentation.nonnullManagers().values()).get(0);
if (null == managers.getManagerOtherConfigs()) {
return childNodeIds;
}
for (ManagerOtherConfigs otherConfigs : managers.nonnullManagerOtherConfigs().values()) {
if (HA_CHILDREN.equals(otherConfigs.getOtherConfigKey())) {
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.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.Config in project netvirt by opendaylight.
the class HwvtepHAUtil method deletePSNodesOfNode.
/**
* Delete PS data of HA node of Config Data tree.
*
* @param key Node object
* @param haNode Ha Node from which to be deleted
* @param tx Transaction
*/
public static void deletePSNodesOfNode(InstanceIdentifier<Node> key, Node haNode, TypedReadWriteTransaction<Configuration> tx) throws ExecutionException, InterruptedException {
// read from switches attribute and clean up them
HwvtepGlobalAugmentation globalAugmentation = haNode.augmentation(HwvtepGlobalAugmentation.class);
if (globalAugmentation == null) {
return;
}
HashMap<InstanceIdentifier<Node>, Boolean> deleted = new HashMap<>();
List<Switches> switches = new ArrayList<>(globalAugmentation.nonnullSwitches().values());
if (switches != null) {
for (Switches switche : switches) {
InstanceIdentifier<Node> psId = (InstanceIdentifier<Node>) switche.getSwitchRef().getValue();
deleteNodeIfPresent(tx, psId);
deleted.put(psId, Boolean.TRUE);
}
}
// also read from managed by attribute of switches and cleanup them as a back up if the above cleanup fails
Optional<Topology> topologyOptional = tx.read(key.firstIdentifierOf(Topology.class)).get();
String deletedNodeId = key.firstKeyOf(Node.class).getNodeId().getValue();
if (topologyOptional.isPresent()) {
Topology topology = topologyOptional.get();
if (topology.getNode() != null) {
for (Node psNode : topology.nonnullNode().values()) {
PhysicalSwitchAugmentation ps = psNode.augmentation(PhysicalSwitchAugmentation.class);
if (ps != null) {
InstanceIdentifier<Node> iid = (InstanceIdentifier<Node>) ps.getManagedBy().getValue();
String nodeIdVal = iid.firstKeyOf(Node.class).getNodeId().getValue();
if (deletedNodeId.equals(nodeIdVal)) {
InstanceIdentifier<Node> psNodeId = convertToInstanceIdentifier(psNode.getNodeId().getValue());
if (deleted.containsKey(psNodeId)) {
deleteNodeIfPresent(tx, psNodeId);
}
}
}
}
}
}
}
Aggregations