Search in sources :

Example 1 with TapiNepRef

use of org.onosproject.odtn.utils.tapi.TapiNepRef in project onos by opennetworkinglab.

the class DcsBasedTapiConnectionManager method createConnection.

@Override
public TapiConnectionHandler createConnection(TapiNepPair neps) {
    // Calculate route
    TapiConnection connection = connectionController.pathCompute(neps);
    log.debug("Calculated path: {}", connection);
    createConnectionRecursively(connection);
    /*
         * RCAS Create Intent: Assume that if the result of the pathCompute is flat
         * and there are no lower connections, it has to be mapped to an intent
         * It is a connection between line ports (OCh) with an OpticalConnectivity
         * Intent.
         */
    if (connection.getLowerConnections().isEmpty()) {
        TapiNepRef left = neps.left();
        TapiNepRef right = neps.right();
        ConnectPoint leftConnectPoint = left.getConnectPoint();
        ConnectPoint rightConnectPoint = right.getConnectPoint();
        log.debug("Creating Intent from {} to {} {}", leftConnectPoint, rightConnectPoint, connectionHandler.getId());
        notifyTapiConnectivityChange(connectionHandler.getId().toString(), leftConnectPoint, rightConnectPoint, true);
    }
    return connectionHandler;
}
Also used : TapiConnection(org.onosproject.odtn.utils.tapi.TapiConnection) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 2 with TapiNepRef

use of org.onosproject.odtn.utils.tapi.TapiNepRef in project onos by opennetworkinglab.

the class DefaultTapiResolver method getNepRef.

@Override
public TapiNepRef getNepRef(String sipId) throws NoSuchElementException {
    updateCache();
    TapiNepRef ret = null;
    try {
        ret = tapiNepRefList.stream().filter(nep -> nep.getSipId() != null && nep.getSipId().equals(sipId)).findFirst().get();
    } catch (NoSuchElementException e) {
        log.error("Nep not found associated with {}", sipId);
        throw e;
    }
    return ret;
}
Also used : Logger(org.slf4j.Logger) TapiResolver(org.onosproject.odtn.TapiResolver) Deactivate(org.osgi.service.component.annotations.Deactivate) ElementId(org.onosproject.net.ElementId) TapiNodeRef(org.onosproject.odtn.utils.tapi.TapiNodeRef) Collectors(java.util.stream.Collectors) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) ConnectPoint(org.onosproject.net.ConnectPoint) ArrayList(java.util.ArrayList) Component(org.osgi.service.component.annotations.Component) List(java.util.List) Stream(java.util.stream.Stream) Map(java.util.Map) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Activate(org.osgi.service.component.annotations.Activate) NoSuchElementException(java.util.NoSuchElementException) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) NoSuchElementException(java.util.NoSuchElementException)

Example 3 with TapiNepRef

use of org.onosproject.odtn.utils.tapi.TapiNepRef in project onos by opennetworkinglab.

the class DefaultTapiResolver method getNepRef.

@Override
public TapiNepRef getNepRef(ConnectPoint cp) throws NoSuchElementException {
    updateCache();
    TapiNepRef ret = null;
    try {
        ret = tapiNepRefList.stream().filter(nep -> nep.getConnectPoint() != null && nep.getConnectPoint().equals(cp)).findFirst().get();
    } catch (NoSuchElementException e) {
        log.error("Nep not found associated with {}", cp);
        throw e;
    }
    return ret;
}
Also used : Logger(org.slf4j.Logger) TapiResolver(org.onosproject.odtn.TapiResolver) Deactivate(org.osgi.service.component.annotations.Deactivate) ElementId(org.onosproject.net.ElementId) TapiNodeRef(org.onosproject.odtn.utils.tapi.TapiNodeRef) Collectors(java.util.stream.Collectors) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) ConnectPoint(org.onosproject.net.ConnectPoint) ArrayList(java.util.ArrayList) Component(org.osgi.service.component.annotations.Component) List(java.util.List) Stream(java.util.stream.Stream) Map(java.util.Map) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Activate(org.osgi.service.component.annotations.Activate) NoSuchElementException(java.util.NoSuchElementException) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) NoSuchElementException(java.util.NoSuchElementException)

Example 4 with TapiNepRef

use of org.onosproject.odtn.utils.tapi.TapiNepRef 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 5 with TapiNepRef

use of org.onosproject.odtn.utils.tapi.TapiNepRef in project onos by opennetworkinglab.

the class DcsBasedTapiConnectionManager method notifyDeviceConfigChange.

/**
 * Emit NetworkConfig event with parameters for device config,
 * to notify configuration change to device drivers.
 */
private void notifyDeviceConfigChange(boolean enable) {
    if (!this.connection.getCeps().isSameNode()) {
        return;
    }
    TapiNepRef left = this.connection.getCeps().left().getNepRef();
    TapiNepRef right = this.connection.getCeps().right().getNepRef();
    // update with latest data in DCS
    left = resolver.getNepRef(left);
    right = resolver.getNepRef(right);
    AtomicReference<TapiNepRef> line = new AtomicReference<>();
    AtomicReference<TapiNepRef> client = new AtomicReference<>();
    Arrays.asList(left, right).forEach(nep -> {
        if (nep.getPortType() == OdtnDeviceDescriptionDiscovery.OdtnPortType.LINE) {
            line.set(nep);
        }
        if (nep.getPortType() == OdtnDeviceDescriptionDiscovery.OdtnPortType.CLIENT) {
            client.set(nep);
        }
    });
    DeviceConfigEventEmitter eventEmitter = DeviceConfigEventEmitter.create();
    eventEmitter.emit(line.get(), client.get(), enable);
}
Also used : TapiNepRef(org.onosproject.odtn.utils.tapi.TapiNepRef) AtomicReference(java.util.concurrent.atomic.AtomicReference)

Aggregations

TapiNepRef (org.onosproject.odtn.utils.tapi.TapiNepRef)10 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 ConnectPoint (org.onosproject.net.ConnectPoint)4 Logger (org.slf4j.Logger)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 NoSuchElementException (java.util.NoSuchElementException)3 TapiResolver (org.onosproject.odtn.TapiResolver)3 TapiNodeRef (org.onosproject.odtn.utils.tapi.TapiNodeRef)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 Stream (java.util.stream.Stream)2 DefaultServiceDirectory.getService (org.onlab.osgi.DefaultServiceDirectory.getService)2 DynamicConfigService (org.onosproject.config.DynamicConfigService)2 ElementId (org.onosproject.net.ElementId)2 TapiConnection (org.onosproject.odtn.utils.tapi.TapiConnection)2 ModelConverter (org.onosproject.yang.model.ModelConverter)2 Activate (org.osgi.service.component.annotations.Activate)2 Component (org.osgi.service.component.annotations.Component)2 Deactivate (org.osgi.service.component.annotations.Deactivate)2