Committed by
Gerrit Code Review
Remove reliance on link annotations in optical path provisioner.
Change-Id: Ia45b1ea8bd9e3be88155820d9198cc5f6fa92826
Showing
1 changed file
with
28 additions
and
6 deletions
| ... | @@ -343,6 +343,7 @@ public class OpticalPathProvisioner { | ... | @@ -343,6 +343,7 @@ public class OpticalPathProvisioner { |
| 343 | return getIntents(crossConnectPoints); | 343 | return getIntents(crossConnectPoints); |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | + log.warn("Unable to find multi-layer path."); | ||
| 346 | return Collections.emptyList(); | 347 | return Collections.emptyList(); |
| 347 | } | 348 | } |
| 348 | 349 | ||
| ... | @@ -392,20 +393,41 @@ public class OpticalPathProvisioner { | ... | @@ -392,20 +393,41 @@ public class OpticalPathProvisioner { |
| 392 | } | 393 | } |
| 393 | 394 | ||
| 394 | /** | 395 | /** |
| 395 | - * Verifies if given link is cross-connect between packet and optical layer. | 396 | + * Verifies if given device type is in packet layer, i.e., ROADM, OTN or ROADM_OTN device. |
| 397 | + * | ||
| 398 | + * @param type device type | ||
| 399 | + * @return true if in packet layer, false otherwise | ||
| 400 | + */ | ||
| 401 | + private boolean isPacketLayer(Device.Type type) { | ||
| 402 | + return type == Device.Type.SWITCH || type == Device.Type.ROUTER; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * Verifies if given device type is in packet layer, i.e., switch or router device. | ||
| 407 | + * | ||
| 408 | + * @param type device type | ||
| 409 | + * @return true if in packet layer, false otherwise | ||
| 410 | + */ | ||
| 411 | + private boolean isTransportLayer(Device.Type type) { | ||
| 412 | + return type == Device.Type.ROADM || type == Device.Type.OTN || type == Device.Type.ROADM_OTN; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + /** | ||
| 416 | + * Verifies if given link forms a cross-connection between packet and optical layer. | ||
| 396 | * | 417 | * |
| 397 | * @param link the link | 418 | * @param link the link |
| 398 | - * @return true if the link is a cross-connect link | 419 | + * @return true if the link is a cross-connect link, false otherwise |
| 399 | */ | 420 | */ |
| 400 | - public static boolean isCrossConnectLink(Link link) { | 421 | + private boolean isCrossConnectLink(Link link) { |
| 401 | if (link.type() != Link.Type.OPTICAL) { | 422 | if (link.type() != Link.Type.OPTICAL) { |
| 402 | return false; | 423 | return false; |
| 403 | } | 424 | } |
| 404 | 425 | ||
| 405 | - checkNotNull(link.annotations()); | 426 | + Device.Type src = deviceService.getDevice(link.src().deviceId()).type(); |
| 406 | - checkNotNull(link.annotations().value("optical.type")); | 427 | + Device.Type dst = deviceService.getDevice(link.dst().deviceId()).type(); |
| 407 | 428 | ||
| 408 | - return link.annotations().value("optical.type").equals("cross-connect"); | 429 | + return src != dst && |
| 430 | + ((isPacketLayer(src) && isTransportLayer(dst)) || (isPacketLayer(dst) && isTransportLayer(src))); | ||
| 409 | } | 431 | } |
| 410 | 432 | ||
| 411 | } | 433 | } | ... | ... |
-
Please register or login to post a comment