Search in sources :

Example 6 with Uuid

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);
}
Also used : ConnectionEndPoint(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connection.ConnectionEndPoint) DefaultConnection(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectivitycontext.DefaultConnection) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef)

Example 7 with Uuid

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);
    }
}
Also used : TapiConnectivityService(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.TapiConnectivityService) TapiConnectivityServiceHandler(org.onosproject.odtn.utils.tapi.TapiConnectivityServiceHandler) LoggerFactory(org.slf4j.LoggerFactory) Collections.disjoint(java.util.Collections.disjoint) TapiCreateConnectivityInputHandler(org.onosproject.odtn.utils.tapi.TapiCreateConnectivityInputHandler) ArrayList(java.util.ArrayList) TapiDeleteConnectivityInputHandler(org.onosproject.odtn.utils.tapi.TapiDeleteConnectivityInputHandler) TapiSepHandler(org.onosproject.odtn.utils.tapi.TapiSepHandler) TapiConnectionHandler(org.onosproject.odtn.utils.tapi.TapiConnectionHandler) DynamicConfigService(org.onosproject.config.DynamicConfigService) TapiNepPair(org.onosproject.odtn.utils.tapi.TapiNepPair) DefaultServiceDirectory.getService(org.onlab.osgi.DefaultServiceDirectory.getService) RpcInput(org.onosproject.yang.model.RpcInput) Logger(org.slf4j.Logger) TapiCreateConnectivityOutputHandler(org.onosproject.odtn.utils.tapi.TapiCreateConnectivityOutputHandler) TapiResolver(org.onosproject.odtn.TapiResolver) ModelConverter(org.onosproject.yang.model.ModelConverter) TapiObjectHandler(org.onosproject.odtn.utils.tapi.TapiObjectHandler) DefaultConnectivityService(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectivitycontext.DefaultConnectivityService) Collectors(java.util.stream.Collectors) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) RpcOutput(org.onosproject.yang.model.RpcOutput) TapiGetConnectivityListOutputHandler(org.onosproject.odtn.utils.tapi.TapiGetConnectivityListOutputHandler) Uuid(org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.Uuid) TapiGetConnectivityDetailsOutputHandler(org.onosproject.odtn.utils.tapi.TapiGetConnectivityDetailsOutputHandler) TapiGetConnectivityDetailsInputHandler(org.onosproject.odtn.utils.tapi.TapiGetConnectivityDetailsInputHandler) List(java.util.List) TapiContextHandler(org.onosproject.odtn.utils.tapi.TapiContextHandler) TapiConnectionHandler(org.onosproject.odtn.utils.tapi.TapiConnectionHandler) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) TapiNepPair(org.onosproject.odtn.utils.tapi.TapiNepPair) RpcOutput(org.onosproject.yang.model.RpcOutput) TapiCreateConnectivityInputHandler(org.onosproject.odtn.utils.tapi.TapiCreateConnectivityInputHandler) TapiConnectivityServiceHandler(org.onosproject.odtn.utils.tapi.TapiConnectivityServiceHandler) TapiCreateConnectivityOutputHandler(org.onosproject.odtn.utils.tapi.TapiCreateConnectivityOutputHandler)

Example 8 with Uuid

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;
}
Also used : DefaultSip(org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.getserviceinterfacepointlist.getserviceinterfacepointlistoutput.DefaultSip) Sip(org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.getserviceinterfacepointlist.getserviceinterfacepointlistoutput.Sip) DefaultSip(org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.getserviceinterfacepointlist.getserviceinterfacepointlistoutput.DefaultSip)

Example 9 with Uuid

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;
}
Also used : DefaultConnection(org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectivityservice.DefaultConnection)

Aggregations

Uuid (org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.Uuid)3 ConnectPoint (org.onosproject.net.ConnectPoint)2 TapiConnectionHandler (org.onosproject.odtn.utils.tapi.TapiConnectionHandler)2 TapiConnectivityServiceHandler (org.onosproject.odtn.utils.tapi.TapiConnectivityServiceHandler)2 TapiNepRef (org.onosproject.odtn.utils.tapi.TapiNepRef)2 TapiSepHandler (org.onosproject.odtn.utils.tapi.TapiSepHandler)2 DefaultContext (org.onosproject.yang.gen.v1.tapicommon.rev20181210.tapicommon.DefaultContext)2 DefaultConnection (org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectivitycontext.DefaultConnection)2 DefaultConnectivityService (org.onosproject.yang.gen.v1.tapiconnectivity.rev20181210.tapiconnectivity.connectivitycontext.DefaultConnectivityService)2 DefaultTopologyContext (org.onosproject.yang.gen.v1.tapitopology.rev20181210.tapitopology.context.augmentedtapicommoncontext.DefaultTopologyContext)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 Collections.disjoint (java.util.Collections.disjoint)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 DefaultServiceDirectory.getService (org.onlab.osgi.DefaultServiceDirectory.getService)1 DynamicConfigService (org.onosproject.config.DynamicConfigService)1 DeviceId (org.onosproject.net.DeviceId)1 TapiResolver (org.onosproject.odtn.TapiResolver)1