Rimon Ashkenazy
Committed by Gerrit Code Review

[ONOS-2476]: Circuit intent support for ODU Multiplexing

Change-Id: I37229e7107e38baf8416102598f27004ef319665
......@@ -27,6 +27,8 @@ import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.IntentState;
import org.onosproject.net.intent.LinkCollectionIntent;
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
import org.onosproject.net.intent.OpticalCircuitIntent;
import org.onosproject.net.intent.OpticalConnectivityIntent;
import org.onosproject.net.intent.PathIntent;
import org.onosproject.net.intent.PointToPointIntent;
import org.onosproject.net.intent.SinglePointToMultiPointIntent;
......@@ -114,6 +116,8 @@ public class IntentsListCommand extends AbstractShellCommand {
private IntentSummary summarySinglePointToMultiPoint;
private IntentSummary summaryPath;
private IntentSummary summaryLinkCollection;
private IntentSummary summaryOpticalCircuit;
private IntentSummary summaryOpticalConnectivity;
private IntentSummary summaryUnknownType;
/**
......@@ -130,6 +134,8 @@ public class IntentsListCommand extends AbstractShellCommand {
new IntentSummary("SinglePointToMultiPoint");
summaryPath = new IntentSummary("Path");
summaryLinkCollection = new IntentSummary("LinkCollection");
summaryOpticalCircuit = new IntentSummary("OpticalCircuit");
summaryOpticalConnectivity = new IntentSummary("OpticalConnectivity");
summaryUnknownType = new IntentSummary("UnknownType");
}
......@@ -182,7 +188,14 @@ public class IntentsListCommand extends AbstractShellCommand {
summaryLinkCollection.update(intentState);
continue;
}
if (intent instanceof OpticalCircuitIntent) {
summaryOpticalCircuit.update(intentState);
continue;
}
if (intent instanceof OpticalConnectivityIntent) {
summaryOpticalConnectivity.update(intentState);
continue;
}
summaryUnknownType.update(intentState);
}
}
......@@ -204,6 +217,8 @@ public class IntentsListCommand extends AbstractShellCommand {
summarySinglePointToMultiPoint.json(mapper));
result.set("path", summaryPath.json(mapper));
result.set("linkCollection", summaryLinkCollection.json(mapper));
result.set("opticalCircuit", summaryOpticalCircuit.json(mapper));
result.set("opticalConnectivity", summaryOpticalConnectivity.json(mapper));
result.set("unknownType", summaryUnknownType.json(mapper));
result.set("all", summaryAll.json(mapper));
return result;
......@@ -220,6 +235,8 @@ public class IntentsListCommand extends AbstractShellCommand {
summarySinglePointToMultiPoint.printState();
summaryPath.printState();
summaryLinkCollection.printState();
summaryOpticalCircuit.printState();
summaryOpticalConnectivity.printState();
summaryUnknownType.printState();
summaryAll.printState();
}
......@@ -378,6 +395,12 @@ public class IntentsListCommand extends AbstractShellCommand {
LinkCollectionIntent li = (LinkCollectionIntent) intent;
print(" links=%s", li.links());
print(" egress=%s", li.egressPoints());
} else if (intent instanceof OpticalCircuitIntent) {
OpticalCircuitIntent ci = (OpticalCircuitIntent) intent;
print(" src=%s, dst=%s", ci.getSrc(), ci.getDst());
} else if (intent instanceof OpticalConnectivityIntent) {
OpticalConnectivityIntent ci = (OpticalConnectivityIntent) intent;
print(" src=%s, dst=%s", ci.getSrc(), ci.getDst());
}
List<Intent> installable = service.getInstallableIntents(intent.key());
......
......@@ -45,4 +45,14 @@ public enum OduSignalType {
public long bitRate() {
return this.bitRate;
}
/**
* Returns the number of tributary slots of the OduSignalType.
* Each TributarySlot is 1.25Gbps.
* @return number of tributary slots
*/
public int tributarySlots() {
return (int) (this.bitRate() / OduSignalType.ODU0.bitRate());
}
}
......
......@@ -108,6 +108,11 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
log.debug("Compiling optical connectivity intent between {} and {}", src, dst);
// Release of intent resources here is only a temporary solution for handling the
// case of recompiling due to intent restoration (when intent state is FAILED).
// TODO: try to release intent resources in IntentManager.
resourceService.release(intent.id());
// Reserve OCh ports
Resource srcPortResource = Resources.discrete(src.deviceId(), src.port()).resource();
Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
......