use of org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery.CONNECTION_ID in project onos by opennetworkinglab.
the class DcsBasedTapiDataProducer method getNeps.
/**
* Extract Tapi Neps from context modelObject and convert them to NepRefs.
*
* @param context
* @return List of TapiNepRef
*/
private List<TapiNepRef> getNeps(DefaultContext context) {
DefaultAugmentedTapiCommonContext topologyContext = context.augmentation(DefaultAugmentedTapiCommonContext.class);
Topology topology = topologyContext.topologyContext().topology().get(0);
if (topology.node() == null) {
return Collections.emptyList();
}
List<TapiNepRef> ret = topology.node().stream().flatMap(node -> {
if (node.ownedNodeEdgePoint() == null) {
return null;
}
return node.ownedNodeEdgePoint().stream().map(nep -> {
TapiNepRef nepRef = DcsBasedTapiObjectRefFactory.create(topology, node, nep);
if (nep.name() != null) {
Map<String, String> kvs = new HashMap<>();
nep.name().forEach(kv -> kvs.put(kv.valueName(), kv.value()));
String onosConnectPoint = kvs.getOrDefault(ONOS_CP, null);
String portType = kvs.getOrDefault(ODTN_PORT_TYPE, null);
String connectionId = kvs.getOrDefault(CONNECTION_ID, null);
nepRef.setConnectPoint(ConnectPoint.fromString(onosConnectPoint)).setPortType(portType).setConnectionId(connectionId);
}
if (nep.mappedServiceInterfacePoint() != null) {
nep.mappedServiceInterfacePoint().stream().forEach(sip -> {
nepRef.setSipId(sip.serviceInterfacePointUuid().toString());
});
}
DefaultAugmentedTapiTopologyOwnedNodeEdgePoint augmentNep = nep.augmentation(DefaultAugmentedTapiTopologyOwnedNodeEdgePoint.class);
try {
if (augmentNep.cepList().connectionEndPoint() != null) {
List<String> cepIds = augmentNep.cepList().connectionEndPoint().stream().map(cep -> cep.uuid().toString()).collect(Collectors.toList());
nepRef.setCepIds(cepIds);
}
} catch (NullPointerException e) {
log.warn("Augmented ownedNodeEdgePoint is not found.");
}
return nepRef;
});
}).collect(Collectors.toList());
return ret;
}
Aggregations