Extract method to create a FlowRule
Change-Id: Ib40b557a724e9c11ea9c6c30ab99b903ecb21823
Showing
1 changed file
with
15 additions
and
11 deletions
| ... | @@ -241,27 +241,31 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -241,27 +241,31 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
| 241 | intentService.submit(connIntent); | 241 | intentService.submit(connIntent); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | + // Save circuit to connectivity intent mapping | ||
| 245 | + intentSetMultimap.allocateMapping(connIntent.id(), intent.id()); | ||
| 246 | + | ||
| 247 | + FlowRuleIntent circuitIntent = createFlowRule(intent, connIntent, slots); | ||
| 248 | + return ImmutableList.of(circuitIntent); | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + private FlowRuleIntent createFlowRule(OpticalCircuitIntent higherIntent, | ||
| 252 | + OpticalConnectivityIntent lowerIntent, Set<TributarySlot> slots) { | ||
| 244 | // Create optical circuit intent | 253 | // Create optical circuit intent |
| 245 | List<FlowRule> rules = new LinkedList<>(); | 254 | List<FlowRule> rules = new LinkedList<>(); |
| 246 | // at the source: ODUCLT port mapping to OCH port | 255 | // at the source: ODUCLT port mapping to OCH port |
| 247 | - rules.add(connectPorts(src, connIntent.getSrc(), intent.priority(), slots)); | 256 | + rules.add(connectPorts(higherIntent.getSrc(), lowerIntent.getSrc(), higherIntent.priority(), slots)); |
| 248 | // at the destination: OCH port mapping to ODUCLT port | 257 | // at the destination: OCH port mapping to ODUCLT port |
| 249 | - rules.add(connectPorts(connIntent.getDst(), dst, intent.priority(), slots)); | 258 | + rules.add(connectPorts(lowerIntent.getDst(), higherIntent.getDst(), higherIntent.priority(), slots)); |
| 250 | 259 | ||
| 251 | // Create flow rules for reverse path | 260 | // Create flow rules for reverse path |
| 252 | - if (intent.isBidirectional()) { | 261 | + if (higherIntent.isBidirectional()) { |
| 253 | // at the destination: OCH port mapping to ODUCLT port | 262 | // at the destination: OCH port mapping to ODUCLT port |
| 254 | - rules.add(connectPorts(connIntent.getSrc(), src, intent.priority(), slots)); | 263 | + rules.add(connectPorts(lowerIntent.getSrc(), higherIntent.getSrc(), higherIntent.priority(), slots)); |
| 255 | // at the source: ODUCLT port mapping to OCH port | 264 | // at the source: ODUCLT port mapping to OCH port |
| 256 | - rules.add(connectPorts(dst, connIntent.getDst(), intent.priority(), slots)); | 265 | + rules.add(connectPorts(higherIntent.getDst(), lowerIntent.getDst(), higherIntent.priority(), slots)); |
| 257 | } | 266 | } |
| 258 | 267 | ||
| 259 | - FlowRuleIntent circuitIntent = new FlowRuleIntent(appId, rules, intent.resources()); | 268 | + return new FlowRuleIntent(appId, rules, higherIntent.resources()); |
| 260 | - | ||
| 261 | - // Save circuit to connectivity intent mapping | ||
| 262 | - intentSetMultimap.allocateMapping(connIntent.id(), intent.id()); | ||
| 263 | - | ||
| 264 | - return ImmutableList.of(circuitIntent); | ||
| 265 | } | 269 | } |
| 266 | 270 | ||
| 267 | /** | 271 | /** | ... | ... |
-
Please register or login to post a comment