use of org.onosproject.odtn.utils.tapi.TapiObjectHandler.DEVICE_ID in project onos by opennetworkinglab.
the class DcsBasedTapiDataProducer method getNodes.
/**
* Extract Tapi Nodes from context modelObject and convert them to NodeRefs.
*
* @param context
* @return List of NodeRef
*/
private List<TapiNodeRef> getNodes(DefaultContext context) {
DefaultAugmentedTapiCommonContext topologyContext = context.augmentation(DefaultAugmentedTapiCommonContext.class);
Topology topology = topologyContext.topologyContext().topology().get(0);
if (topology.node() == null) {
return Collections.emptyList();
}
return topology.node().stream().map(node -> {
TapiNodeRef nodeRef = DcsBasedTapiObjectRefFactory.create(topology, node);
if (node.name() != null) {
String deviceId = node.name().stream().filter(kv -> kv.valueName().equals(DEVICE_ID)).findFirst().map(Name::value).get();
nodeRef.setDeviceId(DeviceId.deviceId(deviceId));
}
return nodeRef;
}).collect(Collectors.toList());
}
Aggregations