Refactor: Narrow data provided to method
Change-Id: Ib871410d36214457eb1291f308332f35e4e807c5
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index 29fdb24..8f538bc 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -199,7 +199,8 @@
// slots are used only for devices supporting multiplexing
Set<TributarySlot> slots = Collections.emptySet();
- OpticalConnectivityIntent connIntent = findOpticalConnectivityIntent(intent, multiplexingSupported);
+ OpticalConnectivityIntent connIntent = findOpticalConnectivityIntent(intent.getSrc(), intent.getDst(),
+ intent.getSignalType(), multiplexingSupported);
if ((connIntent != null) && multiplexingSupported) {
// Allocate TributarySlots on existing OCH ports
slots = assignTributarySlots(intent, Pair.of(connIntent.getSrc(), connIntent.getDst()));
@@ -302,14 +303,18 @@
/**
* Returns existing and available optical connectivity intent that matches the given circuit intent.
*
- * @param circuitIntent optical circuit intent
+ * @param src source connect point of optical circuit intent
+ * @param dst destination connect point of optical circuit intent
+ * @param signalType signal type of optical circuit intent
* @param multiplexingSupported indicates whether ODU multiplexing is supported
* @return existing optical connectivity intent, null otherwise.
*/
- private OpticalConnectivityIntent findOpticalConnectivityIntent(OpticalCircuitIntent circuitIntent,
- boolean multiplexingSupported) {
+ private OpticalConnectivityIntent findOpticalConnectivityIntent(ConnectPoint src,
+ ConnectPoint dst,
+ CltSignalType signalType,
+ boolean multiplexingSupported) {
- OduSignalType oduSignalType = mappingCltSignalTypeToOduSignalType(circuitIntent.getSignalType());
+ OduSignalType oduSignalType = mappingCltSignalTypeToOduSignalType(signalType);
for (Intent intent : intentService.getIntents()) {
if (!(intent instanceof OpticalConnectivityIntent)) {
@@ -318,16 +323,13 @@
OpticalConnectivityIntent connIntent = (OpticalConnectivityIntent) intent;
- ConnectPoint src = circuitIntent.getSrc();
- ConnectPoint dst = circuitIntent.getDst();
// Ignore if the intents don't have identical src and dst devices
if (!src.deviceId().equals(connIntent.getSrc().deviceId()) ||
!dst.deviceId().equals(connIntent.getDst().deviceId())) {
continue;
}
- if (!(isAllowed(circuitIntent.getSrc(), connIntent.getSrc()) &&
- isAllowed(circuitIntent.getDst(), connIntent.getDst()))) {
+ if (!(isAllowed(src, connIntent.getSrc()) && isAllowed(dst, connIntent.getDst()))) {
continue;
}