Committed by
Gerrit Code Review
[ONOS-2476]: Circuit intent support for ODU Multiplexing
Change-Id: I37229e7107e38baf8416102598f27004ef319665
Showing
4 changed files
with
39 additions
and
1 deletions
| ... | @@ -27,6 +27,8 @@ import org.onosproject.net.intent.IntentService; | ... | @@ -27,6 +27,8 @@ import org.onosproject.net.intent.IntentService; |
| 27 | import org.onosproject.net.intent.IntentState; | 27 | import org.onosproject.net.intent.IntentState; |
| 28 | import org.onosproject.net.intent.LinkCollectionIntent; | 28 | import org.onosproject.net.intent.LinkCollectionIntent; |
| 29 | import org.onosproject.net.intent.MultiPointToSinglePointIntent; | 29 | import org.onosproject.net.intent.MultiPointToSinglePointIntent; |
| 30 | +import org.onosproject.net.intent.OpticalCircuitIntent; | ||
| 31 | +import org.onosproject.net.intent.OpticalConnectivityIntent; | ||
| 30 | import org.onosproject.net.intent.PathIntent; | 32 | import org.onosproject.net.intent.PathIntent; |
| 31 | import org.onosproject.net.intent.PointToPointIntent; | 33 | import org.onosproject.net.intent.PointToPointIntent; |
| 32 | import org.onosproject.net.intent.SinglePointToMultiPointIntent; | 34 | import org.onosproject.net.intent.SinglePointToMultiPointIntent; |
| ... | @@ -114,6 +116,8 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -114,6 +116,8 @@ public class IntentsListCommand extends AbstractShellCommand { |
| 114 | private IntentSummary summarySinglePointToMultiPoint; | 116 | private IntentSummary summarySinglePointToMultiPoint; |
| 115 | private IntentSummary summaryPath; | 117 | private IntentSummary summaryPath; |
| 116 | private IntentSummary summaryLinkCollection; | 118 | private IntentSummary summaryLinkCollection; |
| 119 | + private IntentSummary summaryOpticalCircuit; | ||
| 120 | + private IntentSummary summaryOpticalConnectivity; | ||
| 117 | private IntentSummary summaryUnknownType; | 121 | private IntentSummary summaryUnknownType; |
| 118 | 122 | ||
| 119 | /** | 123 | /** |
| ... | @@ -130,6 +134,8 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -130,6 +134,8 @@ public class IntentsListCommand extends AbstractShellCommand { |
| 130 | new IntentSummary("SinglePointToMultiPoint"); | 134 | new IntentSummary("SinglePointToMultiPoint"); |
| 131 | summaryPath = new IntentSummary("Path"); | 135 | summaryPath = new IntentSummary("Path"); |
| 132 | summaryLinkCollection = new IntentSummary("LinkCollection"); | 136 | summaryLinkCollection = new IntentSummary("LinkCollection"); |
| 137 | + summaryOpticalCircuit = new IntentSummary("OpticalCircuit"); | ||
| 138 | + summaryOpticalConnectivity = new IntentSummary("OpticalConnectivity"); | ||
| 133 | summaryUnknownType = new IntentSummary("UnknownType"); | 139 | summaryUnknownType = new IntentSummary("UnknownType"); |
| 134 | } | 140 | } |
| 135 | 141 | ||
| ... | @@ -182,7 +188,14 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -182,7 +188,14 @@ public class IntentsListCommand extends AbstractShellCommand { |
| 182 | summaryLinkCollection.update(intentState); | 188 | summaryLinkCollection.update(intentState); |
| 183 | continue; | 189 | continue; |
| 184 | } | 190 | } |
| 185 | - | 191 | + if (intent instanceof OpticalCircuitIntent) { |
| 192 | + summaryOpticalCircuit.update(intentState); | ||
| 193 | + continue; | ||
| 194 | + } | ||
| 195 | + if (intent instanceof OpticalConnectivityIntent) { | ||
| 196 | + summaryOpticalConnectivity.update(intentState); | ||
| 197 | + continue; | ||
| 198 | + } | ||
| 186 | summaryUnknownType.update(intentState); | 199 | summaryUnknownType.update(intentState); |
| 187 | } | 200 | } |
| 188 | } | 201 | } |
| ... | @@ -204,6 +217,8 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -204,6 +217,8 @@ public class IntentsListCommand extends AbstractShellCommand { |
| 204 | summarySinglePointToMultiPoint.json(mapper)); | 217 | summarySinglePointToMultiPoint.json(mapper)); |
| 205 | result.set("path", summaryPath.json(mapper)); | 218 | result.set("path", summaryPath.json(mapper)); |
| 206 | result.set("linkCollection", summaryLinkCollection.json(mapper)); | 219 | result.set("linkCollection", summaryLinkCollection.json(mapper)); |
| 220 | + result.set("opticalCircuit", summaryOpticalCircuit.json(mapper)); | ||
| 221 | + result.set("opticalConnectivity", summaryOpticalConnectivity.json(mapper)); | ||
| 207 | result.set("unknownType", summaryUnknownType.json(mapper)); | 222 | result.set("unknownType", summaryUnknownType.json(mapper)); |
| 208 | result.set("all", summaryAll.json(mapper)); | 223 | result.set("all", summaryAll.json(mapper)); |
| 209 | return result; | 224 | return result; |
| ... | @@ -220,6 +235,8 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -220,6 +235,8 @@ public class IntentsListCommand extends AbstractShellCommand { |
| 220 | summarySinglePointToMultiPoint.printState(); | 235 | summarySinglePointToMultiPoint.printState(); |
| 221 | summaryPath.printState(); | 236 | summaryPath.printState(); |
| 222 | summaryLinkCollection.printState(); | 237 | summaryLinkCollection.printState(); |
| 238 | + summaryOpticalCircuit.printState(); | ||
| 239 | + summaryOpticalConnectivity.printState(); | ||
| 223 | summaryUnknownType.printState(); | 240 | summaryUnknownType.printState(); |
| 224 | summaryAll.printState(); | 241 | summaryAll.printState(); |
| 225 | } | 242 | } |
| ... | @@ -378,6 +395,12 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -378,6 +395,12 @@ public class IntentsListCommand extends AbstractShellCommand { |
| 378 | LinkCollectionIntent li = (LinkCollectionIntent) intent; | 395 | LinkCollectionIntent li = (LinkCollectionIntent) intent; |
| 379 | print(" links=%s", li.links()); | 396 | print(" links=%s", li.links()); |
| 380 | print(" egress=%s", li.egressPoints()); | 397 | print(" egress=%s", li.egressPoints()); |
| 398 | + } else if (intent instanceof OpticalCircuitIntent) { | ||
| 399 | + OpticalCircuitIntent ci = (OpticalCircuitIntent) intent; | ||
| 400 | + print(" src=%s, dst=%s", ci.getSrc(), ci.getDst()); | ||
| 401 | + } else if (intent instanceof OpticalConnectivityIntent) { | ||
| 402 | + OpticalConnectivityIntent ci = (OpticalConnectivityIntent) intent; | ||
| 403 | + print(" src=%s, dst=%s", ci.getSrc(), ci.getDst()); | ||
| 381 | } | 404 | } |
| 382 | 405 | ||
| 383 | List<Intent> installable = service.getInstallableIntents(intent.key()); | 406 | List<Intent> installable = service.getInstallableIntents(intent.key()); | ... | ... |
| ... | @@ -45,4 +45,14 @@ public enum OduSignalType { | ... | @@ -45,4 +45,14 @@ public enum OduSignalType { |
| 45 | public long bitRate() { | 45 | public long bitRate() { |
| 46 | return this.bitRate; | 46 | return this.bitRate; |
| 47 | } | 47 | } |
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Returns the number of tributary slots of the OduSignalType. | ||
| 51 | + * Each TributarySlot is 1.25Gbps. | ||
| 52 | + * @return number of tributary slots | ||
| 53 | + */ | ||
| 54 | + public int tributarySlots() { | ||
| 55 | + return (int) (this.bitRate() / OduSignalType.ODU0.bitRate()); | ||
| 56 | + } | ||
| 57 | + | ||
| 48 | } | 58 | } | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -108,6 +108,11 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical | ... | @@ -108,6 +108,11 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical |
| 108 | 108 | ||
| 109 | log.debug("Compiling optical connectivity intent between {} and {}", src, dst); | 109 | log.debug("Compiling optical connectivity intent between {} and {}", src, dst); |
| 110 | 110 | ||
| 111 | + // Release of intent resources here is only a temporary solution for handling the | ||
| 112 | + // case of recompiling due to intent restoration (when intent state is FAILED). | ||
| 113 | + // TODO: try to release intent resources in IntentManager. | ||
| 114 | + resourceService.release(intent.id()); | ||
| 115 | + | ||
| 111 | // Reserve OCh ports | 116 | // Reserve OCh ports |
| 112 | Resource srcPortResource = Resources.discrete(src.deviceId(), src.port()).resource(); | 117 | Resource srcPortResource = Resources.discrete(src.deviceId(), src.port()).resource(); |
| 113 | Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource(); | 118 | Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource(); | ... | ... |
-
Please register or login to post a comment