- private String getSupportedStream(String nodeId) {
- InstanceIdentifier<Streams> streamsIID = InstanceIdentifier.create(Netconf.class).child(Streams.class);
- Optional<Streams> ordmInfoObject =
- deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, streamsIID,
- Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (ordmInfoObject == null || ordmInfoObject.isEmpty() || ordmInfoObject.get().getStream().isEmpty()) {
- LOG.error("List of streams supports by device is not present");
- return "NETCONF";
- }
- for (Stream strm : ordmInfoObject.get().getStream().values()) {
- LOG.debug("Streams are {}", strm);
- if ("OPENROADM".equalsIgnoreCase(strm.getName().getValue())) {
- return strm.getName().getValue();
- }
+ private boolean checkSupportedStream(
+ String streamName,
+ ListenableFuture<RpcResult<CreateSubscriptionOutput>> subscription) {
+ boolean subscriptionSuccessful = false;
+ try {
+ // Using if condition does not work, since we need to handle exceptions
+ subscriptionSuccessful = subscription.get().isSuccessful();
+ LOG.info("{} subscription is {}", streamName, subscriptionSuccessful);
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Error during subscription to stream {}", streamName, e);