+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.opendaylight.transportpce.common.mapping.MappingUtils#getMcCapabilitiesForNode(java.lang.String)
+ */
+ @Override
+ public List<McCapabilities> getMcCapabilitiesForNode(String nodeId) {
+ List<McCapabilities> mcCapabilities = new ArrayList<>();
+ InstanceIdentifier<Nodes> nodePortMappingIID = InstanceIdentifier.builder(Network.class)
+ .child(Nodes.class, new NodesKey(nodeId)).build();
+ try (ReadTransaction readTx = this.dataBroker.newReadOnlyTransaction()) {
+ Optional<Nodes> nodePortMapObject = readTx.read(LogicalDatastoreType.CONFIGURATION, nodePortMappingIID)
+ .get();
+ if (nodePortMapObject.isPresent()) {
+ LOG.info("Found node {}", nodeId);
+ Nodes node = nodePortMapObject.get();
+ mcCapabilities.addAll(node.nonnullMcCapabilities().values());
+ }
+ } catch (ExecutionException e) {
+ LOG.error("Something went wrong while getting node {}", nodeId, e);
+ } catch (InterruptedException e) {
+ LOG.error("Request interrupted for node {} interrupted", nodeId, e);
+ Thread.currentThread().interrupt();
+ }
+ LOG.info("Capabilitities for node {}: {}", nodeId, mcCapabilities);
+ return mcCapabilities;
+ }
+
+ public static Class<? extends SupportedIfCapability> convertSupIfCapa(String ifCapType) {
+ if (!capTypeClassMap.containsKey(ifCapType)) {
+ LOG.error("supported-if-capability {} not supported", ifCapType);
+ return null;
+ }
+ return capTypeClassMap.get(ifCapType);
+ }