Committed by
Gerrit Code Review
Refactor: Narrow data provided to method
Change-Id: Ib871410d36214457eb1291f308332f35e4e807c5
Showing
1 changed file
with
11 additions
and
9 deletions
... | @@ -199,7 +199,8 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -199,7 +199,8 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
199 | // slots are used only for devices supporting multiplexing | 199 | // slots are used only for devices supporting multiplexing |
200 | Set<TributarySlot> slots = Collections.emptySet(); | 200 | Set<TributarySlot> slots = Collections.emptySet(); |
201 | 201 | ||
202 | - OpticalConnectivityIntent connIntent = findOpticalConnectivityIntent(intent, multiplexingSupported); | 202 | + OpticalConnectivityIntent connIntent = findOpticalConnectivityIntent(intent.getSrc(), intent.getDst(), |
203 | + intent.getSignalType(), multiplexingSupported); | ||
203 | if ((connIntent != null) && multiplexingSupported) { | 204 | if ((connIntent != null) && multiplexingSupported) { |
204 | // Allocate TributarySlots on existing OCH ports | 205 | // Allocate TributarySlots on existing OCH ports |
205 | slots = assignTributarySlots(intent, Pair.of(connIntent.getSrc(), connIntent.getDst())); | 206 | slots = assignTributarySlots(intent, Pair.of(connIntent.getSrc(), connIntent.getDst())); |
... | @@ -302,14 +303,18 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -302,14 +303,18 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
302 | /** | 303 | /** |
303 | * Returns existing and available optical connectivity intent that matches the given circuit intent. | 304 | * Returns existing and available optical connectivity intent that matches the given circuit intent. |
304 | * | 305 | * |
305 | - * @param circuitIntent optical circuit intent | 306 | + * @param src source connect point of optical circuit intent |
307 | + * @param dst destination connect point of optical circuit intent | ||
308 | + * @param signalType signal type of optical circuit intent | ||
306 | * @param multiplexingSupported indicates whether ODU multiplexing is supported | 309 | * @param multiplexingSupported indicates whether ODU multiplexing is supported |
307 | * @return existing optical connectivity intent, null otherwise. | 310 | * @return existing optical connectivity intent, null otherwise. |
308 | */ | 311 | */ |
309 | - private OpticalConnectivityIntent findOpticalConnectivityIntent(OpticalCircuitIntent circuitIntent, | 312 | + private OpticalConnectivityIntent findOpticalConnectivityIntent(ConnectPoint src, |
310 | - boolean multiplexingSupported) { | 313 | + ConnectPoint dst, |
314 | + CltSignalType signalType, | ||
315 | + boolean multiplexingSupported) { | ||
311 | 316 | ||
312 | - OduSignalType oduSignalType = mappingCltSignalTypeToOduSignalType(circuitIntent.getSignalType()); | 317 | + OduSignalType oduSignalType = mappingCltSignalTypeToOduSignalType(signalType); |
313 | 318 | ||
314 | for (Intent intent : intentService.getIntents()) { | 319 | for (Intent intent : intentService.getIntents()) { |
315 | if (!(intent instanceof OpticalConnectivityIntent)) { | 320 | if (!(intent instanceof OpticalConnectivityIntent)) { |
... | @@ -318,16 +323,13 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -318,16 +323,13 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
318 | 323 | ||
319 | OpticalConnectivityIntent connIntent = (OpticalConnectivityIntent) intent; | 324 | OpticalConnectivityIntent connIntent = (OpticalConnectivityIntent) intent; |
320 | 325 | ||
321 | - ConnectPoint src = circuitIntent.getSrc(); | ||
322 | - ConnectPoint dst = circuitIntent.getDst(); | ||
323 | // Ignore if the intents don't have identical src and dst devices | 326 | // Ignore if the intents don't have identical src and dst devices |
324 | if (!src.deviceId().equals(connIntent.getSrc().deviceId()) || | 327 | if (!src.deviceId().equals(connIntent.getSrc().deviceId()) || |
325 | !dst.deviceId().equals(connIntent.getDst().deviceId())) { | 328 | !dst.deviceId().equals(connIntent.getDst().deviceId())) { |
326 | continue; | 329 | continue; |
327 | } | 330 | } |
328 | 331 | ||
329 | - if (!(isAllowed(circuitIntent.getSrc(), connIntent.getSrc()) && | 332 | + if (!(isAllowed(src, connIntent.getSrc()) && isAllowed(dst, connIntent.getDst()))) { |
330 | - isAllowed(circuitIntent.getDst(), connIntent.getDst()))) { | ||
331 | continue; | 333 | continue; |
332 | } | 334 | } |
333 | 335 | ... | ... |
-
Please register or login to post a comment