Rimon Ashkenazy
Committed by Gerrit Code Review

Add OpticalCircuitIntentCompiler unit-tests

Change-Id: I9cf002dcda128874b5fd4727ba0f99189fe9143d
......@@ -124,6 +124,10 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
@Modified
public void modified(ComponentContext context) {
if (context == null) {
return;
}
Dictionary properties = context.getProperties();
//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
return flowRule;
}
private OduSignalId buildOduSignalId(OduSignalType ochPortSignalType, Set<TributarySlot> slots) {
protected OduSignalId buildOduSignalId(OduSignalType ochPortSignalType, Set<TributarySlot> slots) {
int tributaryPortNumber = findFirstTributarySlotIndex(slots);
int tributarySlotLen = ochPortSignalType.tributarySlots();
byte[] tributarySlotBitmap = new byte[OduSignalId.TRIBUTARY_SLOT_BITMAP_SIZE];
......
......@@ -17,9 +17,11 @@ package org.onosproject.net.intent.impl.compiler;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
import org.onlab.util.Tools;
import org.onosproject.net.TributarySlot;
import org.onosproject.net.newresource.ContinuousResourceId;
import org.onosproject.net.newresource.DiscreteResource;
import org.onosproject.net.newresource.DiscreteResourceId;
......@@ -108,6 +110,14 @@ class MockResourceService implements ResourceService {
Collection<Resource> resources = new HashSet<>();
resources.add(Resources.discrete(parent).resource().child(VlanId.vlanId((short) 10)));
resources.add(Resources.discrete(parent).resource().child(MplsLabel.mplsLabel(10)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(1)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(2)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(3)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(4)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(5)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(6)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(7)));
resources.add(Resources.discrete(parent).resource().child(TributarySlot.of(8)));
return ImmutableSet.copyOf(resources);
}
......