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;
}
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;
}
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;
}
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);
}
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);
}
Aggregations