use of org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint in project onos by opennetworkinglab.
the class TapiCepRefHandler method setCep.
public TapiCepRefHandler setCep(ConnectionEndPoint cep) {
obj.connectionEndPointUuid(cep.uuid());
ParentNodeEdgePoint parentNep = cep.parentNodeEdgePoint();
obj.topologyUuid(parentNep.topologyUuid());
obj.nodeUuid(parentNep.nodeUuid());
obj.nodeEdgePointUuid(parentNep.nodeEdgePointUuid());
return this;
}
use of org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint in project onos by opennetworkinglab.
the class DcsBasedTapiConnectionManager method deleteConnection.
@Override
public void deleteConnection(TapiConnectionHandler connectionHandler) {
// Retrieve the target to be deleted (right now we have the uuid)
connectionHandler.read();
// Remove Intent if exists
if (connectionHandler.getLowerConnections().isEmpty()) {
// Connection object
DefaultConnection connection = connectionHandler.getModelObject();
// These are two connection.ConnectionEndpoint (Actually Refs, mainly UUID)
ConnectionEndPoint cepLeft = connection.connectionEndPoint().get(0);
ConnectionEndPoint cepRight = connection.connectionEndPoint().get(1);
TapiNepRef left = TapiNepRef.create(cepLeft.topologyUuid().toString(), cepLeft.nodeUuid().toString(), cepLeft.nodeEdgePointUuid().toString());
TapiNepRef right = TapiNepRef.create(cepRight.topologyUuid().toString(), cepRight.nodeUuid().toString(), cepRight.nodeEdgePointUuid().toString());
// update with latest data in DCS
left = resolver.getNepRef(left);
right = resolver.getNepRef(right);
log.debug("Removing intent connection: {}", connection);
notifyTapiConnectivityChange(connectionHandler.getId().toString(), left.getConnectPoint(), right.getConnectPoint(), false);
}
deleteConnectionRecursively(connectionHandler);
}
use of org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint 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