use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class DpnTepStateCache method removeTepFromDpnTepInterfaceConfigDS.
public void removeTepFromDpnTepInterfaceConfigDS(BigInteger srcDpnId) throws TransactionCommitFailedException {
Collection<DpnsTeps> dpnsTeps = this.getAllPresent();
for (DpnsTeps dpnTep : dpnsTeps) {
if (!dpnTep.getSourceDpnId().equals(srcDpnId)) {
List<RemoteDpns> remoteDpns = dpnTep.getRemoteDpns();
for (RemoteDpns remoteDpn : remoteDpns) {
if (remoteDpn.getDestinationDpnId().equals(srcDpnId)) {
// Remote the SrcDpnId from the remote List. Remove it from COnfig DS. 4
// This will be reflected in cache by the ClusteredDTCN. Not removing it here !
// Caution :- Batching Delete !!
InstanceIdentifier<RemoteDpns> remoteDpnII = buildRemoteDpnsInstanceIdentifier(dpnTep.getSourceDpnId(), remoteDpn.getDestinationDpnId());
SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, remoteDpnII);
break;
}
}
} else {
// The source DPn id is the one to be removed
InstanceIdentifier<DpnsTeps> dpnsTepsII = buildDpnsTepsInstanceIdentifier(dpnTep.getSourceDpnId());
SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, dpnsTepsII);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class TepCommandHelper method validateForDuplicates.
/**
* Validate for duplicates.
*
* @param inputVtep
* the input vtep
* @param transportZone
* the transport zone
*/
public void validateForDuplicates(Vteps inputVtep, String transportZone) {
Map<String, TransportZone> allTransportZonesAsMap = getAllTransportZonesAsMap();
boolean isConfiguredTepGreType = isGreTunnelType(transportZone, allTransportZonesAsMap);
// Checking for duplicates in local cache
for (Entry<String, Map<SubnetObject, List<Vteps>>> entry : transportZonesHashMap.entrySet()) {
String tz = entry.getKey();
boolean isGreType = isGreTunnelType(tz, allTransportZonesAsMap);
Map<SubnetObject, List<Vteps>> subVtepMapTemp = entry.getValue();
for (List<Vteps> vtepList : subVtepMapTemp.values()) {
validateForDuplicateAndSingleGreTep(inputVtep, isConfiguredTepGreType, isGreType, vtepList);
}
}
// Checking for duplicates in config DS
for (TransportZone tz : allTransportZonesAsMap.values()) {
boolean isGreType = false;
if (tz.getTunnelType().equals(TunnelTypeGre.class)) {
isGreType = true;
}
for (Subnets sub : ItmUtils.emptyIfNull(tz.getSubnets())) {
List<Vteps> vtepList = sub.getVteps();
validateForDuplicateAndSingleGreTep(inputVtep, isConfiguredTepGreType, isGreType, vtepList);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project genius by opendaylight.
the class InterfaceMetaUtils method getBridgeEntryFromConfigDS.
public BridgeEntry getBridgeEntryFromConfigDS(BigInteger dpnId) {
BridgeEntry bridgeEntry = getBridgeEntryFromCache(dpnId);
if (bridgeEntry != null) {
return bridgeEntry;
}
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(dpnId);
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
LOG.debug("Trying to retrieve bridge entry from config for Id: {}", bridgeEntryInstanceIdentifier);
bridgeEntry = readBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
if (bridgeEntry != null) {
addBridgeEntryToCache(dpnId, bridgeEntry);
}
return bridgeEntry;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project bgpcep by opendaylight.
the class OpenconfigRoutingPolicyLoader method loadConfiguration.
@Override
public void loadConfiguration(final NormalizedNode<?, ?> dto) {
final RoutingPolicy routingPolicy = (RoutingPolicy) this.bindingSerializer.fromNormalizedNode(this.routingPolicyYiid, dto).getValue();
final WriteTransaction wtx = this.dataBroker.newWriteOnlyTransaction();
wtx.merge(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID, routingPolicy, WriteTransaction.CREATE_MISSING_PARENTS);
try {
wtx.submit().get();
} catch (final ExecutionException | InterruptedException e) {
LOG.warn("Failed to create Routing Policy config", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsaltrace.rev160908.Config in project bgpcep by opendaylight.
the class BmpMonitorConfigFileProcessor method loadConfiguration.
@Override
public synchronized void loadConfiguration(final NormalizedNode<?, ?> dto) {
final ContainerNode bmpMonitorsConfigsContainer = (ContainerNode) dto;
final MapNode monitorsList = (MapNode) bmpMonitorsConfigsContainer.getChild(this.bmpMonitorsYii.getLastPathArgument()).orElse(null);
if (monitorsList == null) {
return;
}
final Collection<MapEntryNode> bmpMonitorConfig = monitorsList.getValue();
final WriteTransaction wtx = this.dataBroker.newWriteOnlyTransaction();
bmpMonitorConfig.stream().map(topology -> this.bindingSerializer.fromNormalizedNode(this.bmpMonitorsYii, topology)).filter(Objects::nonNull).forEach(bi -> processBmpMonitorConfig((BmpMonitorConfig) bi.getValue(), wtx));
try {
wtx.submit().get();
} catch (final ExecutionException | InterruptedException e) {
LOG.warn("Failed to create Bmp config", e);
}
}
Aggregations