use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class TepCommandHelper method getAllTransportZonesAsMap.
/**
* Gets all transport zones as map.
*
* @return all transport zones as map
*/
private Map<String, TransportZone> getAllTransportZonesAsMap() {
TransportZones allTransportZones = getAllTransportZones();
Map<String, TransportZone> transportZoneMap = new HashMap<>();
if (null != allTransportZones) {
for (TransportZone tzone : ItmUtils.emptyIfNull(allTransportZones.getTransportZone())) {
transportZoneMap.put(tzone.getZoneName(), tzone);
}
}
return transportZoneMap;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class ItmInternalTunnelAddWorker method wireUpWithinTransportZone.
private void wireUpWithinTransportZone(DPNTEPsInfo srcDpn, DPNTEPsInfo dstDpn, IMdsalApiManager mdsalManager, WriteTransaction transaction) {
LOG.trace("Wiring up within Transport Zone for Dpns {}, {} ", srcDpn, dstDpn);
List<TunnelEndPoints> srcEndPts = srcDpn.getTunnelEndPoints();
List<TunnelEndPoints> dstEndPts = dstDpn.getTunnelEndPoints();
for (TunnelEndPoints srcte : srcEndPts) {
for (TunnelEndPoints dstte : dstEndPts) {
// Compare the Transport zones
if (!srcDpn.getDPNID().equals(dstDpn.getDPNID())) {
if (!ItmUtils.getIntersection(srcte.getTzMembership(), dstte.getTzMembership()).isEmpty()) {
// wire them up
wireUpBidirectionalTunnel(srcte, dstte, srcDpn.getDPNID(), dstDpn.getDPNID(), mdsalManager, transaction);
if (!ItmTunnelAggregationHelper.isTunnelAggregationEnabled()) {
// CHECK THIS -- Assumption -- One end point per Dpn per transport zone
break;
}
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project controller by opendaylight.
the class MdsalLowLevelTestProvider method unsubscribeDtcl.
@Override
public Future<RpcResult<UnsubscribeDtclOutput>> unsubscribeDtcl() {
LOG.debug("Received unsubscribe-dtcl");
if (idIntsListener == null || dtclReg == null) {
final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Dtcl missing.", "No DataTreeChangeListener registered.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDtclOutput>failed().withRpcError(error).build());
}
try {
idIntsListener.tryFinishProcessing().get(120, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "resource-denied-transport", "Unable to finish notification processing in 120 seconds.", "clustering-it", "clustering-it", e);
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDtclOutput>failed().withRpcError(error).build());
}
dtclReg.close();
dtclReg = null;
if (!idIntsListener.hasTriggered()) {
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "No notification received.", "id-ints listener has not received" + "any notifications.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDtclOutput>failed().withRpcError(error).build());
}
final DOMDataReadOnlyTransaction rTx = domDataBroker.newReadOnlyTransaction();
try {
final Optional<NormalizedNode<?, ?>> readResult = rTx.read(CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID).checkedGet();
if (!readResult.isPresent()) {
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "Final read empty.", "No data read from id-ints list.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDtclOutput>failed().withRpcError(error).build());
}
return Futures.immediateFuture(RpcResultBuilder.success(new UnsubscribeDtclOutputBuilder().setCopyMatches(idIntsListener.checkEqual(readResult.get()))).build());
} catch (final ReadFailedException e) {
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDtclOutput>failed().withRpcError(error).build());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project controller by opendaylight.
the class MdsalLowLevelTestProvider method unsubscribeDdtl.
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public Future<RpcResult<UnsubscribeDdtlOutput>> unsubscribeDdtl() {
LOG.debug("Received unsubscribe-ddtl.");
if (idIntsDdtl == null || ddtlReg == null) {
final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "Ddtl missing.", "No DOMDataTreeListener registered.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDdtlOutput>failed().withRpcError(error).build());
}
try {
idIntsDdtl.tryFinishProcessing().get(120, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
final RpcError error = RpcResultBuilder.newError(ErrorType.RPC, "resource-denied-transport", "Unable to finish notification processing in 120 seconds.", "clustering-it", "clustering-it", e);
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDdtlOutput>failed().withRpcError(error).build());
}
ddtlReg.close();
ddtlReg = null;
if (!idIntsDdtl.hasTriggered()) {
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "No notification received.", "id-ints listener has not received" + "any notifications.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDdtlOutput>failed().withRpcError(error).build());
}
final String shardName = ClusterUtils.getCleanShardName(ProduceTransactionsHandler.ID_INTS_YID);
LOG.debug("Creating distributed datastore client for shard {}", shardName);
final ActorContext actorContext = configDataStore.getActorContext();
final Props distributedDataStoreClientProps = SimpleDataStoreClientActor.props(actorContext.getCurrentMemberName(), "Shard-" + shardName, actorContext, shardName);
final ActorRef clientActor = actorSystem.actorOf(distributedDataStoreClientProps);
final DataStoreClient distributedDataStoreClient;
try {
distributedDataStoreClient = SimpleDataStoreClientActor.getDistributedDataStoreClient(clientActor, 30, TimeUnit.SECONDS);
} catch (RuntimeException e) {
LOG.error("Failed to get actor for {}", distributedDataStoreClientProps, e);
clientActor.tell(PoisonPill.getInstance(), noSender());
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "Unable to create ds client for read.", "Unable to create ds client for read.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDdtlOutput>failed().withRpcError(error).build());
}
final ClientLocalHistory localHistory = distributedDataStoreClient.createLocalHistory();
final ClientTransaction tx = localHistory.createTransaction();
final CheckedFuture<Optional<NormalizedNode<?, ?>>, org.opendaylight.mdsal.common.api.ReadFailedException> read = tx.read(YangInstanceIdentifier.of(ProduceTransactionsHandler.ID_INT));
tx.abort();
localHistory.close();
try {
final Optional<NormalizedNode<?, ?>> optional = read.checkedGet();
if (!optional.isPresent()) {
LOG.warn("Final read from client is empty.");
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "Read failed.", "Final read from id-ints is empty.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDdtlOutput>failed().withRpcError(error).build());
}
return Futures.immediateFuture(RpcResultBuilder.success(new UnsubscribeDdtlOutputBuilder().setCopyMatches(idIntsDdtl.checkEqual(optional.get()))).build());
} catch (org.opendaylight.mdsal.common.api.ReadFailedException e) {
LOG.error("Unable to read data to verify ddtl data.", e);
final RpcError error = RpcResultBuilder.newError(ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed.");
return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeDdtlOutput>failed().withRpcError(error).build());
} finally {
distributedDataStoreClient.close();
clientActor.tell(PoisonPill.getInstance(), noSender());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project bgpcep by opendaylight.
the class OpenConfigMappingUtil method getPort.
@Nullable
private static PortNumber getPort(@Nullable final Transport transport) {
if (transport != null) {
final Config config = transport.getConfig();
if (config != null) {
final NeighborTransportConfig peerTc = config.getAugmentation(NeighborTransportConfig.class);
if (peerTc != null) {
return peerTc.getRemotePort();
}
final PeerGroupTransportConfig peerGroupTc = config.getAugmentation(PeerGroupTransportConfig.class);
if (peerGroupTc != null) {
return peerGroupTc.getRemotePort();
}
}
}
return null;
}
Aggregations