Refactor: Narrow data provided to method
Change-Id: I7709ae9a2d639170ec8f789ab5ada2b30e1bd12e
Showing
1 changed file
with
9 additions
and
9 deletions
... | @@ -208,7 +208,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -208,7 +208,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
208 | // Create optical connectivity intent if needed - no optical intent or not enough slots available | 208 | // Create optical connectivity intent if needed - no optical intent or not enough slots available |
209 | if (connIntent == null || (multiplexingSupported && slots.isEmpty())) { | 209 | if (connIntent == null || (multiplexingSupported && slots.isEmpty())) { |
210 | // Find OCh ports with available resources | 210 | // Find OCh ports with available resources |
211 | - Pair<OchPort, OchPort> ochPorts = findPorts(intent); | 211 | + Pair<OchPort, OchPort> ochPorts = findPorts(intent.getSrc(), intent.getDst(), intent.getSignalType()); |
212 | 212 | ||
213 | if (ochPorts == null) { | 213 | if (ochPorts == null) { |
214 | // Release port allocations if unsuccessful | 214 | // Release port allocations if unsuccessful |
... | @@ -469,20 +469,20 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -469,20 +469,20 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
469 | return null; | 469 | return null; |
470 | } | 470 | } |
471 | 471 | ||
472 | - private Pair<OchPort, OchPort> findPorts(OpticalCircuitIntent intent) { | 472 | + private Pair<OchPort, OchPort> findPorts(ConnectPoint src, ConnectPoint dst, CltSignalType signalType) { |
473 | Pair<OchPort, OchPort> ochPorts = null; | 473 | Pair<OchPort, OchPort> ochPorts = null; |
474 | // According to the OpticalCircuitIntent's signalType find OCH ports with available TributarySlots resources | 474 | // According to the OpticalCircuitIntent's signalType find OCH ports with available TributarySlots resources |
475 | - switch (intent.getSignalType()) { | 475 | + switch (signalType) { |
476 | case CLT_1GBE: | 476 | case CLT_1GBE: |
477 | case CLT_10GBE: | 477 | case CLT_10GBE: |
478 | // First search for OCH ports with OduSignalType of ODU2. If not found - search for those with ODU4 | 478 | // First search for OCH ports with OduSignalType of ODU2. If not found - search for those with ODU4 |
479 | - ochPorts = findPorts(intent, OduSignalType.ODU2); | 479 | + ochPorts = findPorts(src, dst, OduSignalType.ODU2); |
480 | if (ochPorts == null) { | 480 | if (ochPorts == null) { |
481 | - ochPorts = findPorts(intent, OduSignalType.ODU4); | 481 | + ochPorts = findPorts(src, dst, OduSignalType.ODU4); |
482 | } | 482 | } |
483 | break; | 483 | break; |
484 | case CLT_100GBE: | 484 | case CLT_100GBE: |
485 | - ochPorts = findPorts(intent, OduSignalType.ODU4); | 485 | + ochPorts = findPorts(src, dst, OduSignalType.ODU4); |
486 | break; | 486 | break; |
487 | case CLT_40GBE: | 487 | case CLT_40GBE: |
488 | default: | 488 | default: |
... | @@ -491,13 +491,13 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -491,13 +491,13 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
491 | return ochPorts; | 491 | return ochPorts; |
492 | } | 492 | } |
493 | 493 | ||
494 | - private Pair<OchPort, OchPort> findPorts(OpticalCircuitIntent intent, OduSignalType ochPortSignalType) { | 494 | + private Pair<OchPort, OchPort> findPorts(ConnectPoint src, ConnectPoint dst, OduSignalType ochPortSignalType) { |
495 | - OchPort srcPort = findAvailableOchPort(intent.getSrc(), ochPortSignalType); | 495 | + OchPort srcPort = findAvailableOchPort(src, ochPortSignalType); |
496 | if (srcPort == null) { | 496 | if (srcPort == null) { |
497 | return null; | 497 | return null; |
498 | } | 498 | } |
499 | 499 | ||
500 | - OchPort dstPort = findAvailableOchPort(intent.getDst(), ochPortSignalType); | 500 | + OchPort dstPort = findAvailableOchPort(dst, ochPortSignalType); |
501 | if (dstPort == null) { | 501 | if (dstPort == null) { |
502 | return null; | 502 | return null; |
503 | } | 503 | } | ... | ... |
-
Please register or login to post a comment