bug fixes about OpticalPathProvisioner:
- Made optical domain path computation to take care of capacity of optical channel. - Removed hard coded signal types. - Rebased to new optical device/port implementation. Change-Id: I8e030fee83c5a05a51bef470363e247ac8943ab7
Showing
1 changed file
with
33 additions
and
14 deletions
... | @@ -40,12 +40,10 @@ import org.onosproject.newoptical.api.OpticalPathListener; | ... | @@ -40,12 +40,10 @@ import org.onosproject.newoptical.api.OpticalPathListener; |
40 | import org.onosproject.newoptical.api.OpticalPathService; | 40 | import org.onosproject.newoptical.api.OpticalPathService; |
41 | import org.onosproject.event.AbstractListenerManager; | 41 | import org.onosproject.event.AbstractListenerManager; |
42 | import org.onosproject.mastership.MastershipService; | 42 | import org.onosproject.mastership.MastershipService; |
43 | -import org.onosproject.net.CltSignalType; | ||
44 | import org.onosproject.net.ConnectPoint; | 43 | import org.onosproject.net.ConnectPoint; |
45 | import org.onosproject.net.Device; | 44 | import org.onosproject.net.Device; |
46 | import org.onosproject.net.DeviceId; | 45 | import org.onosproject.net.DeviceId; |
47 | import org.onosproject.net.Link; | 46 | import org.onosproject.net.Link; |
48 | -import org.onosproject.net.OduSignalType; | ||
49 | import org.onosproject.net.Path; | 47 | import org.onosproject.net.Path; |
50 | import org.onosproject.net.Port; | 48 | import org.onosproject.net.Port; |
51 | import org.onosproject.net.config.NetworkConfigService; | 49 | import org.onosproject.net.config.NetworkConfigService; |
... | @@ -87,6 +85,7 @@ import java.util.stream.Stream; | ... | @@ -87,6 +85,7 @@ import java.util.stream.Stream; |
87 | 85 | ||
88 | import static com.google.common.base.Preconditions.checkArgument; | 86 | import static com.google.common.base.Preconditions.checkArgument; |
89 | import static com.google.common.base.Preconditions.checkNotNull; | 87 | import static com.google.common.base.Preconditions.checkNotNull; |
88 | +import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView; | ||
90 | 89 | ||
91 | /** | 90 | /** |
92 | * Main component to configure optical connectivity. | 91 | * Main component to configure optical connectivity. |
... | @@ -149,6 +148,7 @@ public class OpticalPathProvisioner | ... | @@ -149,6 +148,7 @@ public class OpticalPathProvisioner |
149 | 148 | ||
150 | @Activate | 149 | @Activate |
151 | protected void activate() { | 150 | protected void activate() { |
151 | + deviceService = opticalView(deviceService); | ||
152 | appId = coreService.registerApplication("org.onosproject.newoptical"); | 152 | appId = coreService.registerApplication("org.onosproject.newoptical"); |
153 | 153 | ||
154 | idCounter = storageService.atomicCounterBuilder() | 154 | idCounter = storageService.atomicCounterBuilder() |
... | @@ -360,12 +360,18 @@ public class OpticalPathProvisioner | ... | @@ -360,12 +360,18 @@ public class OpticalPathProvisioner |
360 | Port dstPort = deviceService.getPort(dst.getKey().deviceId(), dst.getKey().port()); | 360 | Port dstPort = deviceService.getPort(dst.getKey().deviceId(), dst.getKey().port()); |
361 | 361 | ||
362 | if (srcPort instanceof OduCltPort && dstPort instanceof OduCltPort) { | 362 | if (srcPort instanceof OduCltPort && dstPort instanceof OduCltPort) { |
363 | + OduCltPort srcOCPort = (OduCltPort) srcPort; | ||
364 | + OduCltPort dstOCPort = (OduCltPort) dstPort; | ||
365 | + if (!srcOCPort.signalType().equals(dstOCPort.signalType())) { | ||
366 | + continue; | ||
367 | + } | ||
368 | + | ||
363 | // Create OTN circuit | 369 | // Create OTN circuit |
364 | OpticalCircuitIntent circuitIntent = OpticalCircuitIntent.builder() | 370 | OpticalCircuitIntent circuitIntent = OpticalCircuitIntent.builder() |
365 | .appId(appId) | 371 | .appId(appId) |
366 | .src(src.getKey()) | 372 | .src(src.getKey()) |
367 | .dst(dst.getKey()) | 373 | .dst(dst.getKey()) |
368 | - .signalType(CltSignalType.CLT_10GBE) | 374 | + .signalType(srcOCPort.signalType()) |
369 | .bidirectional(true) | 375 | .bidirectional(true) |
370 | .build(); | 376 | .build(); |
371 | intents.add(circuitIntent); | 377 | intents.add(circuitIntent); |
... | @@ -374,13 +380,18 @@ public class OpticalPathProvisioner | ... | @@ -374,13 +380,18 @@ public class OpticalPathProvisioner |
374 | connectivity.addRealizingLink(pLink); | 380 | connectivity.addRealizingLink(pLink); |
375 | linkPathMap.put(pLink, connectivity); | 381 | linkPathMap.put(pLink, connectivity); |
376 | } else if (srcPort instanceof OchPort && dstPort instanceof OchPort) { | 382 | } else if (srcPort instanceof OchPort && dstPort instanceof OchPort) { |
383 | + OchPort srcOchPort = (OchPort) srcPort; | ||
384 | + OchPort dstOchPort = (OchPort) dstPort; | ||
385 | + if (!srcOchPort.signalType().equals(dstOchPort.signalType())) { | ||
386 | + continue; | ||
387 | + } | ||
388 | + | ||
377 | // Create lightpath | 389 | // Create lightpath |
378 | - // FIXME: hardcoded ODU signal type | ||
379 | OpticalConnectivityIntent opticalIntent = OpticalConnectivityIntent.builder() | 390 | OpticalConnectivityIntent opticalIntent = OpticalConnectivityIntent.builder() |
380 | .appId(appId) | 391 | .appId(appId) |
381 | .src(src.getKey()) | 392 | .src(src.getKey()) |
382 | .dst(dst.getKey()) | 393 | .dst(dst.getKey()) |
383 | - .signalType(OduSignalType.ODU4) | 394 | + .signalType(srcOchPort.signalType()) |
384 | .bidirectional(true) | 395 | .bidirectional(true) |
385 | .build(); | 396 | .build(); |
386 | intents.add(opticalIntent); | 397 | intents.add(opticalIntent); |
... | @@ -533,17 +544,25 @@ public class OpticalPathProvisioner | ... | @@ -533,17 +544,25 @@ public class OpticalPathProvisioner |
533 | 544 | ||
534 | private boolean hasEnoughBandwidth(ConnectPoint cp) { | 545 | private boolean hasEnoughBandwidth(ConnectPoint cp) { |
535 | if (cp.elementId() instanceof DeviceId) { | 546 | if (cp.elementId() instanceof DeviceId) { |
536 | - Device.Type type = deviceService.getDevice(cp.deviceId()).type(); | 547 | + Device device = deviceService.getDevice(cp.deviceId()); |
548 | + Device.Type type = device.type(); | ||
549 | + | ||
537 | if (isTransportLayer(type)) { | 550 | if (isTransportLayer(type)) { |
538 | - // Optical ports are assumed to have enough bandwidth | 551 | + // Check if the port has enough capacity |
539 | - // TODO should look up physical limit? | 552 | + Port port = deviceService.getPort(cp.deviceId(), cp.port()); |
540 | - return true; | 553 | + if (port instanceof OduCltPort || port instanceof OchPort) { |
554 | + // Port with capacity | ||
555 | + return bandwidth.bps() < port.portSpeed() * 1000000.0; | ||
556 | + } else { | ||
557 | + // Port without valid capacity (OMS port, etc.) | ||
558 | + return true; | ||
559 | + } | ||
560 | + } else { | ||
561 | + // Check if enough amount of bandwidth resource remains | ||
562 | + ContinuousResource resource = Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class) | ||
563 | + .resource(bandwidth.bps()); | ||
564 | + return resourceService.isAvailable(resource); | ||
541 | } | 565 | } |
542 | - | ||
543 | - ContinuousResource resource = Resources.continuous(cp.deviceId(), cp.port(), Bandwidth.class) | ||
544 | - .resource(bandwidth.bps()); | ||
545 | - | ||
546 | - return resourceService.isAvailable(resource); | ||
547 | } | 566 | } |
548 | return false; | 567 | return false; |
549 | } | 568 | } | ... | ... |
-
Please register or login to post a comment