@Override public HydrogenMountInstanceAdapter getMountPoint(final InstanceIdentifier<?> path) { final Optional<MountPoint> mount = delegate.getMountPoint(path); if (mount.isPresent()) { return mountAdapters.getUnchecked(mount.get()); } return null; }
@Override public void onSessionInitialized(final ConsumerContext session) { dataBroker = session.getSALService(DataBroker.class); configModuleListener = new BGPConfigModuleMapperProvider(dataBroker, configStateHolders); mountService = session.getSALService(MountPointService.class); mpListenerRegistration = mountService.registerListener(CONTROLLER_CONFIG_IID, this); }
@Override public void onMountPointCreated(final InstanceIdentifier<?> path) { LOG.debug("Created mountpoint {}.", path); if (openConfigListener == null) { openConfigListener = new BGPOpenConfigListener(dataBroker, mountService.getMountPoint(path).get(), configStateHolders); } }
public Optional<DataBroker> getDataBrokerForMountPoint(@Nonnull InstanceIdentifier<?> iidToMountPoint) { Optional<MountPoint> potentialMountPoint = mountService.getMountPoint(iidToMountPoint); if (!potentialMountPoint.isPresent()) { LOG.debug("Mount point does not exist for {}", iidToMountPoint); return Optional.absent(); } return potentialMountPoint.get().getService(DataBroker.class); } }
private DataBroker getNodeMountPoint(InstanceIdentifier<Node> mountPointIid) { Optional<MountPoint> optionalObject = mountService.getMountPoint(mountPointIid); MountPoint mountPoint; if (optionalObject.isPresent()) { mountPoint = optionalObject.get(); if (mountPoint != null) { Optional<DataBroker> optionalDataBroker = mountPoint.getService(DataBroker.class); if (optionalDataBroker.isPresent()) { return optionalDataBroker.get(); } else { LOG.debug("Cannot obtain data broker from mountpoint {}", mountPoint); } } else { LOG.debug("Cannot obtain mountpoint with IID {}", mountPointIid); } } return null; }
private ServiceFunctionDescriptionMonitorReportService getSfDescriptionMonitorService(String nodeName) { InstanceIdentifier<?> nodeIID = NETCONF_TOPO_IID.child(Node.class, new NodeKey(new NodeId(nodeName))); MountPointService mountService = SfcNetconfDataProvider.GetNetconfDataProvider().getMountService(); if (mountService == null) { LOG.error("Mount service is null"); return null; } Optional<MountPoint> mountPoint = mountService.getMountPoint(nodeIID); if (!mountPoint.isPresent()) { LOG.error("Mount point for node {} doesn't exist", nodeName); return null; } final Optional<RpcConsumerRegistry> service = mountPoint.get().getService(RpcConsumerRegistry.class); if (!service.isPresent()) { LOG.error("Failed to get RpcService for node {}", nodeName); return null; } return service.get().getRpcService(ServiceFunctionDescriptionMonitorReportService.class); }
/** * Find a node's NETCONF mount point and then retrieve its DataBroker. * e.g. * http://localhost:8080/restconf/config/network-topology:network-topology/ * topology/topology-netconf/node/{nodeName}/yang-ext:mount/ */ public static Optional<DataBroker> getDataBroker(MountPointService mountService, String nodeName) { NodeId nodeId = new NodeId(nodeName); InstanceIdentifier<Node> nodeInstanceId = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))) .child(Node.class, new NodeKey(nodeId)) .build(); final Optional<MountPoint> nodeOptional = mountService.getMountPoint(nodeInstanceId); if (!nodeOptional.isPresent()) { return Optional.absent(); } MountPoint nodeMountPoint = nodeOptional.get(); return Optional.of(nodeMountPoint.getService(DataBroker.class).get()); }
try { mountPoint = mountService.getMountPoint(mountIds.get(nodeId.getValue())); } catch (ExecutionException e) { throw new IllegalArgumentException(e);
final Optional<MountPoint> xrNodeOptional = mountService.getMountPoint(NETCONF_TOPO_IID .child(Node.class, new NodeKey(new NodeId(input.getNodeName()))));
try { mountPoint = mountService.getMountPoint(mountIds.get(input.getMountName())); } catch (ExecutionException e) { throw new IllegalArgumentException(e);