Rimon Ashkenazy
Committed by Gerrit Code Review

Add OpticalCircuitIntentCompiler unit-tests

Change-Id: I9cf002dcda128874b5fd4727ba0f99189fe9143d
...@@ -124,6 +124,10 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu ...@@ -124,6 +124,10 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
124 124
125 @Modified 125 @Modified
126 public void modified(ComponentContext context) { 126 public void modified(ComponentContext context) {
127 + if (context == null) {
128 + return;
129 + }
130 +
127 Dictionary properties = context.getProperties(); 131 Dictionary properties = context.getProperties();
128 132
129 //TODO for reduction check if the new capacity is smaller than the size of the current mapping 133 //TODO for reduction check if the new capacity is smaller than the size of the current mapping
...@@ -556,7 +560,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu ...@@ -556,7 +560,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
556 return flowRule; 560 return flowRule;
557 } 561 }
558 562
559 - private OduSignalId buildOduSignalId(OduSignalType ochPortSignalType, Set<TributarySlot> slots) { 563 + protected OduSignalId buildOduSignalId(OduSignalType ochPortSignalType, Set<TributarySlot> slots) {
560 int tributaryPortNumber = findFirstTributarySlotIndex(slots); 564 int tributaryPortNumber = findFirstTributarySlotIndex(slots);
561 int tributarySlotLen = ochPortSignalType.tributarySlots(); 565 int tributarySlotLen = ochPortSignalType.tributarySlots();
562 byte[] tributarySlotBitmap = new byte[OduSignalId.TRIBUTARY_SLOT_BITMAP_SIZE]; 566 byte[] tributarySlotBitmap = new byte[OduSignalId.TRIBUTARY_SLOT_BITMAP_SIZE];
......
...@@ -17,9 +17,11 @@ package org.onosproject.net.intent.impl.compiler; ...@@ -17,9 +17,11 @@ package org.onosproject.net.intent.impl.compiler;
17 17
18 import com.google.common.collect.ImmutableList; 18 import com.google.common.collect.ImmutableList;
19 import com.google.common.collect.ImmutableSet; 19 import com.google.common.collect.ImmutableSet;
20 +
20 import org.onlab.packet.MplsLabel; 21 import org.onlab.packet.MplsLabel;
21 import org.onlab.packet.VlanId; 22 import org.onlab.packet.VlanId;
22 import org.onlab.util.Tools; 23 import org.onlab.util.Tools;
24 +import org.onosproject.net.TributarySlot;
23 import org.onosproject.net.newresource.ContinuousResourceId; 25 import org.onosproject.net.newresource.ContinuousResourceId;
24 import org.onosproject.net.newresource.DiscreteResource; 26 import org.onosproject.net.newresource.DiscreteResource;
25 import org.onosproject.net.newresource.DiscreteResourceId; 27 import org.onosproject.net.newresource.DiscreteResourceId;
...@@ -108,6 +110,14 @@ class MockResourceService implements ResourceService { ...@@ -108,6 +110,14 @@ class MockResourceService implements ResourceService {
108 Collection<Resource> resources = new HashSet<>(); 110 Collection<Resource> resources = new HashSet<>();
109 resources.add(Resources.discrete(parent).resource().child(VlanId.vlanId((short) 10))); 111 resources.add(Resources.discrete(parent).resource().child(VlanId.vlanId((short) 10)));
110 resources.add(Resources.discrete(parent).resource().child(MplsLabel.mplsLabel(10))); 112 resources.add(Resources.discrete(parent).resource().child(MplsLabel.mplsLabel(10)));
113 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(1)));
114 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(2)));
115 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(3)));
116 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(4)));
117 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(5)));
118 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(6)));
119 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(7)));
120 + resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(8)));
111 return ImmutableSet.copyOf(resources); 121 return ImmutableSet.copyOf(resources);
112 } 122 }
113 123
......