use of org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.Uuid 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.tapicommon.rev20181210.tapicommon.Uuid in project onos by opennetworkinglab.
the class DcsBasedTapiConnectivityRpc method createConnectivityService.
/**
* Service interface of createConnectivityService.
*
* @param inputVar input of service interface createConnectivityService
* @return output of service interface createConnectivityService
*/
@Override
public RpcOutput createConnectivityService(RpcInput inputVar) {
try {
TapiCreateConnectivityInputHandler input = new TapiCreateConnectivityInputHandler();
input.setRpcInput(inputVar);
log.info("input SIPs: {}", input.getSips());
// check SIP validation
if (!disjoint(getUsedSips(), input.getSips())) {
log.error("SIPS {} are already used, please use a different pair", input.getSips());
return new RpcOutput(RpcOutput.Status.RPC_FAILURE, null);
}
log.debug("check SIP validation : OK");
List<TapiNepRef> nepRefs = input.getSips().stream().map(sipId -> resolver.getNepRef(sipId)).collect(Collectors.toList());
// setup connections
TapiNepPair neps = TapiNepPair.create(nepRefs.get(0), nepRefs.get(1));
// Allocate a connectivity Service
TapiConnectivityServiceHandler connectivityServiceHandler = TapiConnectivityServiceHandler.create();
// This connectivity service will be supported over a single end-to-end connection
// Allocate a manager for that connection
DcsBasedTapiConnectionManager connectionManager = DcsBasedTapiConnectionManager.create();
TapiConnectionHandler connectionHandler = connectionManager.createConnection(neps);
// Add the supporting connection uuid to the service
connectivityServiceHandler.addConnection(connectionHandler.getModelObject().uuid());
neps.stream().map(nepRef -> TapiSepHandler.create().setSip(nepRef.getSipId())).forEach(sepBuilder -> {
connectivityServiceHandler.addSep(sepBuilder.getModelObject());
});
// build
connectionManager.apply();
connectivityServiceHandler.add();
// output
TapiCreateConnectivityOutputHandler output = TapiCreateConnectivityOutputHandler.create().addService(connectivityServiceHandler.getModelObject());
return new RpcOutput(RpcOutput.Status.RPC_SUCCESS, output.getDataNode());
} catch (Throwable e) {
log.error("Error:", e);
return new RpcOutput(RpcOutput.Status.RPC_FAILURE, null);
}
}
use of org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.Uuid in project onos by opennetworkinglab.
the class TapiGetSipListOutputHandler method addSip.
public TapiGetSipListOutputHandler addSip(Uuid sipId) {
Sip sip = new DefaultSip();
sip.uuid(sipId);
obj.addToSip(sip);
return this;
}
use of org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.Uuid in project onos by opennetworkinglab.
the class TapiConnectivityServiceHandler method addConnection.
public TapiConnectivityServiceHandler addConnection(Uuid connectionUuid) {
DefaultConnection connection = new DefaultConnection();
connection.connectionUuid(connectionUuid.toString());
obj.addToConnection(connection);
return this;
}
Aggregations