Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index 3532abc..93f01ca 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -52,13 +52,12 @@
/**
* @author Ray Milkey (ray@onlab.us)
- *
- * Unit tests for the Path Calculation Runtime module (PathCalcRuntimeModule).
- * These test cases check the results of creating paths, deleting paths, and
- * rerouting paths. The network graph, controller registry, and data grid are
- * mocked out. The individual tests check the high level intents and the
- * resulting operation lists to be sure they match the intended APIs.
- *
+ * <p/>
+ * Unit tests for the Path Calculation Runtime module (PathCalcRuntimeModule).
+ * These test cases check the results of creating paths, deleting paths, and
+ * rerouting paths. The network graph, controller registry, and data grid are
+ * mocked out. The individual tests check the high level intents and the
+ * resulting operation lists to be sure they match the intended APIs.
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(PathCalcRuntimeModule.class)
@@ -139,7 +138,7 @@
@Override
public boolean matchesSafely(Collection<Intent> intents) {
assertThat(intents,
- hasItem(Matchers.<Intent>hasProperty("id", equalTo(id))));
+ hasItem(Matchers.<Intent>hasProperty("id", equalTo(id))));
return true;
}
@@ -155,6 +154,7 @@
/**
* Factory method to create an Intent entry Matcher. Returns a matcher
* for the Intent with the given id.
+ *
* @param id id of the intent to match
* @return Matcher object
*/
@@ -203,7 +203,7 @@
Description mismatchDescription) {
if (intent != null) {
mismatchDescription.appendText("was ").
- appendText(intent.getState().toString());
+ appendText(intent.getState().toString());
} else {
mismatchDescription.appendText("that intent was not found");
}
@@ -215,7 +215,7 @@
* Factory method to create a Matcher for an IntentMap that looks for an
* Intent with a given id and state.
*
- * @param id id of the Intent to match
+ * @param id id of the Intent to match
* @param state if the Intent is found, its state must match this
* @return Matcher object
*/
@@ -239,7 +239,7 @@
* Test the result of executing a path calculation on an
* Intent Operation List which contains a path that references a
* non-existent switch.
- *
+ * <p/>
* A 3 path list is created where one of the paths references a switch
* that is not in the topology. The test checks that the resulting
* Operation List has entries for the 2 correct paths, and that the
@@ -302,7 +302,7 @@
/**
* Test the result of executing a path calculation on an
* Intent Operation List and then removing one of the switches.
- *
+ * <p/>
* A 3 path list is created and then one of the paths is removed.
* The test checks that the resulting Operation List is correct,
* and that the high level intents contain a proper "delete requested"
@@ -315,13 +315,13 @@
final IntentOperationList opList = new IntentOperationList();
opList.add(Operator.ADD,
new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L,
- LOCAL_PORT));
+ LOCAL_PORT));
opList.add(Operator.ADD,
new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L,
- LOCAL_PORT));
+ LOCAL_PORT));
opList.add(Operator.ADD,
new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L,
- LOCAL_PORT));
+ LOCAL_PORT));
// compile high-level intent operations into low-level intent
// operations (calculate paths)
@@ -351,15 +351,15 @@
// Check that switch 1 was correctly processed
assertThat(highLevelIntents,
- hasIntentWithIdAndState("1", IntentState.INST_REQ));
+ hasIntentWithIdAndState("1", IntentState.INST_REQ));
// Check that switch 2 was correctly processed
assertThat(highLevelIntents,
- hasIntentWithIdAndState("2", IntentState.INST_REQ));
+ hasIntentWithIdAndState("2", IntentState.INST_REQ));
// Check that switch 3 was correctly processed
assertThat(highLevelIntents,
- hasIntentWithIdAndState("3", IntentState.INST_REQ));
+ hasIntentWithIdAndState("3", IntentState.INST_REQ));
// Now delete one path and check the results
final IntentOperationList opListForRemoval = new IntentOperationList();
@@ -402,7 +402,7 @@
/**
* Test the result of executing a path calculation on an
* Intent Operation List and then forcing a reroute.
- *
+ * <p/>
* A 3 path list is created and then one of the links is removed.
* The test checks that the resulting Operation List is correct,
* and that the high level intents contain a proper "reroute requested"
@@ -415,15 +415,15 @@
final IntentOperationList opList = new IntentOperationList();
final ShortestPathIntent pathIntent1 =
new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L,
- LOCAL_PORT);
+ LOCAL_PORT);
opList.add(Operator.ADD, pathIntent1);
opList.add(Operator.ADD,
new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L,
- LOCAL_PORT));
+ LOCAL_PORT));
opList.add(Operator.ADD,
new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L,
- LOCAL_PORT));
+ LOCAL_PORT));
// compile high-level intent operations into low-level intent
// operations (calculate paths)
@@ -453,15 +453,15 @@
// Check that switch 1 was correctly processed
assertThat(highLevelIntents,
- hasIntentWithIdAndState("1", IntentState.INST_REQ));
+ hasIntentWithIdAndState("1", IntentState.INST_REQ));
// Check that switch 2 was correctly processed
assertThat(highLevelIntents,
- hasIntentWithIdAndState("2", IntentState.INST_REQ));
+ hasIntentWithIdAndState("2", IntentState.INST_REQ));
// Check that switch 3 was correctly processed
assertThat(highLevelIntents,
- hasIntentWithIdAndState("3", IntentState.INST_REQ));
+ hasIntentWithIdAndState("3", IntentState.INST_REQ));
// Now add a different path to one of the switches path and check
// the results
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
index 645ffe5..fbb7313 100755
--- a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
@@ -50,257 +50,257 @@
@RunWith(PowerMockRunner.class)
@PrepareForTest(PathCalcRuntimeModule.class)
public class UseCaseTest {
- private NetworkGraph g;
- private FloodlightModuleContext modContext;
- private IDatagridService datagridService;
- private INetworkGraphService networkGraphService;
- private IControllerRegistryService controllerRegistryService;
- private PersistIntent persistIntent;
- @SuppressWarnings("rawtypes")
- private IEventChannel eventChannel;
+ private NetworkGraph g;
+ private FloodlightModuleContext modContext;
+ private IDatagridService datagridService;
+ private INetworkGraphService networkGraphService;
+ private IControllerRegistryService controllerRegistryService;
+ private PersistIntent persistIntent;
+ @SuppressWarnings("rawtypes")
+ private IEventChannel eventChannel;
- private static Long LOCAL_PORT = 0xFFFEL;
+ private static Long LOCAL_PORT = 0xFFFEL;
- @SuppressWarnings("unchecked")
- @Before
- public void setUp() throws Exception {
- MockNetworkGraph graph = new MockNetworkGraph();
- graph.createSampleTopology1();
- g = graph;
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() throws Exception {
+ MockNetworkGraph graph = new MockNetworkGraph();
+ graph.createSampleTopology1();
+ g = graph;
- datagridService = createMock(IDatagridService.class);
- networkGraphService = createMock(INetworkGraphService.class);
- controllerRegistryService = createMock(IControllerRegistryService.class);
- modContext = createMock(FloodlightModuleContext.class);
- eventChannel = createMock(IEventChannel.class);
- persistIntent = PowerMock.createMock(PersistIntent.class);
+ datagridService = createMock(IDatagridService.class);
+ networkGraphService = createMock(INetworkGraphService.class);
+ controllerRegistryService = createMock(IControllerRegistryService.class);
+ modContext = createMock(FloodlightModuleContext.class);
+ eventChannel = createMock(IEventChannel.class);
+ persistIntent = PowerMock.createMock(PersistIntent.class);
- PowerMock.expectNew(PersistIntent.class,
- anyObject(IControllerRegistryService.class),
- anyObject(INetworkGraphService.class)).andReturn(persistIntent);
+ PowerMock.expectNew(PersistIntent.class,
+ anyObject(IControllerRegistryService.class),
+ anyObject(INetworkGraphService.class)).andReturn(persistIntent);
- expect(modContext.getServiceImpl(IDatagridService.class))
- .andReturn(datagridService).once();
- expect(modContext.getServiceImpl(INetworkGraphService.class))
- .andReturn(networkGraphService).once();
- expect(modContext.getServiceImpl(IControllerRegistryService.class))
- .andReturn(controllerRegistryService).once();
- expect(persistIntent.getKey()).andReturn(1L).anyTimes();
- expect(persistIntent.persistIfLeader(eq(1L),
- anyObject(IntentOperationList.class))).andReturn(true).anyTimes();
+ expect(modContext.getServiceImpl(IDatagridService.class))
+ .andReturn(datagridService).once();
+ expect(modContext.getServiceImpl(INetworkGraphService.class))
+ .andReturn(networkGraphService).once();
+ expect(modContext.getServiceImpl(IControllerRegistryService.class))
+ .andReturn(controllerRegistryService).once();
+ expect(persistIntent.getKey()).andReturn(1L).anyTimes();
+ expect(persistIntent.persistIfLeader(eq(1L),
+ anyObject(IntentOperationList.class))).andReturn(true).anyTimes();
- expect(networkGraphService.getNetworkGraph()).andReturn(g).anyTimes();
- networkGraphService.registerNetworkGraphListener(anyObject(INetworkGraphListener.class));
- expectLastCall();
+ expect(networkGraphService.getNetworkGraph()).andReturn(g).anyTimes();
+ networkGraphService.registerNetworkGraphListener(anyObject(INetworkGraphListener.class));
+ expectLastCall();
- expect(datagridService.createChannel("onos.pathintent", Long.class, IntentOperationList.class))
- .andReturn(eventChannel).once();
+ expect(datagridService.createChannel("onos.pathintent", Long.class, IntentOperationList.class))
+ .andReturn(eventChannel).once();
- expect(datagridService.addListener(
- eq("onos.pathintent_state"),
- anyObject(IEventChannelListener.class),
- eq(Long.class),
- eq(IntentStateList.class)))
- .andReturn(eventChannel).once();
+ expect(datagridService.addListener(
+ eq("onos.pathintent_state"),
+ anyObject(IEventChannelListener.class),
+ eq(Long.class),
+ eq(IntentStateList.class)))
+ .andReturn(eventChannel).once();
- replay(datagridService);
- replay(networkGraphService);
- replay(modContext);
- replay(controllerRegistryService);
- PowerMock.replay(persistIntent, PersistIntent.class);
- }
+ replay(datagridService);
+ replay(networkGraphService);
+ replay(modContext);
+ replay(controllerRegistryService);
+ PowerMock.replay(persistIntent, PersistIntent.class);
+ }
- @After
- public void tearDown() {
- verify(datagridService);
- verify(networkGraphService);
- verify(modContext);
- verify(controllerRegistryService);
- PowerMock.verify(persistIntent, PersistIntent.class);
- }
+ @After
+ public void tearDown() {
+ verify(datagridService);
+ verify(networkGraphService);
+ verify(modContext);
+ verify(controllerRegistryService);
+ PowerMock.verify(persistIntent, PersistIntent.class);
+ }
- private void showResult(PathIntentMap intents) {
- for (Intent intent: intents.getAllIntents()) {
- PathIntent pathIntent = (PathIntent)intent;
- System.out.println("Path intent:" + pathIntent);
- System.out.println("Parent intent: " + pathIntent.getParentIntent().toString());
- }
- }
+ private void showResult(PathIntentMap intents) {
+ for (Intent intent : intents.getAllIntents()) {
+ PathIntent pathIntent = (PathIntent) intent;
+ System.out.println("Path intent:" + pathIntent);
+ System.out.println("Parent intent: " + pathIntent.getParentIntent().toString());
+ }
+ }
- @Test
- public void createShortestPaths() throws FloodlightModuleException {
- // create shortest path intents
- IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+ @Test
+ public void createShortestPaths() throws FloodlightModuleException {
+ // create shortest path intents
+ IntentOperationList opList = new IntentOperationList();
+ opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
- // compile high-level intent operations into low-level intent operations (calculate paths)
- PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
- runtime1.init(modContext);
- runtime1.startUp(modContext);
- IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+ // compile high-level intent operations into low-level intent operations (calculate paths)
+ PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+ runtime1.init(modContext);
+ runtime1.startUp(modContext);
+ IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
- // compile low-level intents into flow entry installation plan
- PlanCalcRuntime runtime2 = new PlanCalcRuntime();
- List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+ // compile low-level intents into flow entry installation plan
+ PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+ List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
- // show results
- showResult((PathIntentMap) runtime1.getPathIntents());
- System.out.println(plan);
- }
+ // show results
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ System.out.println(plan);
+ }
- @Test
- public void createConstrainedShortestPaths() throws FloodlightModuleException {
- // create constrained shortest path intents
- IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
+ @Test
+ public void createConstrainedShortestPaths() throws FloodlightModuleException {
+ // create constrained shortest path intents
+ IntentOperationList opList = new IntentOperationList();
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
- // compile high-level intent operations into low-level intent operations (calculate paths)
- PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
- runtime1.init(modContext);
- runtime1.startUp(modContext);
- IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+ // compile high-level intent operations into low-level intent operations (calculate paths)
+ PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+ runtime1.init(modContext);
+ runtime1.startUp(modContext);
+ IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
- // compile low-level intents into flow entry installation plan
- PlanCalcRuntime runtime2 = new PlanCalcRuntime();
- List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+ // compile low-level intents into flow entry installation plan
+ PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+ List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
- // show results
- showResult((PathIntentMap) runtime1.getPathIntents());
- System.out.println(plan);
- }
+ // show results
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ System.out.println(plan);
+ }
- @Test
- public void createMixedShortestPaths() throws FloodlightModuleException {
- // create constrained & best effort shortest path intents
- IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
- opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
- opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
+ @Test
+ public void createMixedShortestPaths() throws FloodlightModuleException {
+ // create constrained & best effort shortest path intents
+ IntentOperationList opList = new IntentOperationList();
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT, 400.0));
+ opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 24L, LOCAL_PORT, 4L, 42L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("4", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 3L, 34L, LOCAL_PORT, 4L, 43L, LOCAL_PORT, 400.0));
- // compile high-level intent operations into low-level intent operations (calculate paths)
- PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
- runtime1.init(modContext);
- runtime1.startUp(modContext);
- IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+ // compile high-level intent operations into low-level intent operations (calculate paths)
+ PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+ runtime1.init(modContext);
+ runtime1.startUp(modContext);
+ IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
- // compile low-level intents into flow entry installation plan
- PlanCalcRuntime runtime2 = new PlanCalcRuntime();
- List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+ // compile low-level intents into flow entry installation plan
+ PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+ List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
- // show results
- showResult((PathIntentMap) runtime1.getPathIntents());
- System.out.println(plan);
- }
+ // show results
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ System.out.println(plan);
+ }
- @Test
- public void rerouteShortestPaths() throws FloodlightModuleException {
- List<SwitchEvent> addedSwitchEvents = new LinkedList<>();
- List<SwitchEvent> removedSwitchEvents = new LinkedList<>();
- List<PortEvent> addedPortEvents = new LinkedList<>();
- List<PortEvent> removedPortEvents = new LinkedList<>();
- List<LinkEvent> addedLinkEvents = new LinkedList<>();
- List<LinkEvent> removedLinkEvents = new LinkedList<>();
- List<DeviceEvent> addedDeviceEvents = new LinkedList<>();
- List<DeviceEvent> removedDeviceEvents = new LinkedList<>();
+ @Test
+ public void rerouteShortestPaths() throws FloodlightModuleException {
+ List<SwitchEvent> addedSwitchEvents = new LinkedList<>();
+ List<SwitchEvent> removedSwitchEvents = new LinkedList<>();
+ List<PortEvent> addedPortEvents = new LinkedList<>();
+ List<PortEvent> removedPortEvents = new LinkedList<>();
+ List<LinkEvent> addedLinkEvents = new LinkedList<>();
+ List<LinkEvent> removedLinkEvents = new LinkedList<>();
+ List<DeviceEvent> addedDeviceEvents = new LinkedList<>();
+ List<DeviceEvent> removedDeviceEvents = new LinkedList<>();
- // create shortest path intents
- IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+ // create shortest path intents
+ IntentOperationList opList = new IntentOperationList();
+ opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
- // compile high-level intent operations into low-level intent operations (calculate paths)
- PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
- runtime1.init(modContext);
- runtime1.startUp(modContext);
- IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+ // compile high-level intent operations into low-level intent operations (calculate paths)
+ PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+ runtime1.init(modContext);
+ runtime1.startUp(modContext);
+ IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
- // compile low-level intents into flow entry installation plan
- PlanCalcRuntime runtime2 = new PlanCalcRuntime();
- List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+ // compile low-level intents into flow entry installation plan
+ PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+ List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
- // show results step1
- showResult((PathIntentMap) runtime1.getPathIntents());
- System.out.println(plan);
+ // show results step1
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ System.out.println(plan);
- // TODO this state changes should be triggered by notification of plan module
- IntentStateList states = new IntentStateList();
- states.put("1", IntentState.INST_ACK);
- states.put("2", IntentState.INST_ACK);
- states.put("3", IntentState.INST_ACK);
- runtime1.getHighLevelIntents().changeStates(states);
- states.clear();
- states.put("1___0", IntentState.INST_ACK);
- states.put("2___0", IntentState.INST_ACK);
- states.put("3___0", IntentState.INST_ACK);
- runtime1.getPathIntents().changeStates(states);
+ // TODO this state changes should be triggered by notification of plan module
+ IntentStateList states = new IntentStateList();
+ states.put("1", IntentState.INST_ACK);
+ states.put("2", IntentState.INST_ACK);
+ states.put("3", IntentState.INST_ACK);
+ runtime1.getHighLevelIntents().changeStates(states);
+ states.clear();
+ states.put("1___0", IntentState.INST_ACK);
+ states.put("2___0", IntentState.INST_ACK);
+ states.put("3___0", IntentState.INST_ACK);
+ runtime1.getPathIntents().changeStates(states);
- // link down
- ((MockNetworkGraph)g).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
- ((MockNetworkGraph)g).removeLink(2L, 21L, 1L, 12L);
- LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
- LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
- removedLinkEvents.clear();
- removedLinkEvents.add(linkEvent1);
- removedLinkEvents.add(linkEvent2);
- runtime1.networkGraphEvents(
- addedSwitchEvents,
- removedSwitchEvents,
- addedPortEvents,
- removedPortEvents,
- addedLinkEvents,
- removedLinkEvents,
- addedDeviceEvents,
- removedDeviceEvents);
- System.out.println("Link goes down.");
+ // link down
+ ((MockNetworkGraph) g).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
+ ((MockNetworkGraph) g).removeLink(2L, 21L, 1L, 12L);
+ LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
+ LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
+ removedLinkEvents.clear();
+ removedLinkEvents.add(linkEvent1);
+ removedLinkEvents.add(linkEvent2);
+ runtime1.networkGraphEvents(
+ addedSwitchEvents,
+ removedSwitchEvents,
+ addedPortEvents,
+ removedPortEvents,
+ addedLinkEvents,
+ removedLinkEvents,
+ addedDeviceEvents,
+ removedDeviceEvents);
+ System.out.println("Link goes down.");
- // show results step2
- showResult((PathIntentMap) runtime1.getPathIntents());
- // TODO: show results of plan computation
- }
+ // show results step2
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ // TODO: show results of plan computation
+ }
- @Test
- public void createAndRemoveShortestPaths() throws FloodlightModuleException {
- // create shortest path intents
- IntentOperationList opList = new IntentOperationList();
- opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
- opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
+ @Test
+ public void createAndRemoveShortestPaths() throws FloodlightModuleException {
+ // create shortest path intents
+ IntentOperationList opList = new IntentOperationList();
+ opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 12L, LOCAL_PORT, 2L, 21L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("2", 1L, 14L, LOCAL_PORT, 4L, 41L, LOCAL_PORT));
+ opList.add(Operator.ADD, new ShortestPathIntent("3", 2L, 23L, LOCAL_PORT, 3L, 32L, LOCAL_PORT));
- // compile high-level intent operations into low-level intent operations (calculate paths)
- PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
- runtime1.init(modContext);
- runtime1.startUp(modContext);
- IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
+ // compile high-level intent operations into low-level intent operations (calculate paths)
+ PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule();
+ runtime1.init(modContext);
+ runtime1.startUp(modContext);
+ IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList);
- // compile low-level intents into flow entry installation plan
- PlanCalcRuntime runtime2 = new PlanCalcRuntime();
- List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
+ // compile low-level intents into flow entry installation plan
+ PlanCalcRuntime runtime2 = new PlanCalcRuntime();
+ List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList);
- // show results
- showResult((PathIntentMap) runtime1.getPathIntents());
- System.out.println(plan);
+ // show results
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ System.out.println(plan);
- // create remove operations
- opList.clear();
- opList.add(Operator.REMOVE, new Intent("1"));
- opList.add(Operator.REMOVE, new Intent("2"));
+ // create remove operations
+ opList.clear();
+ opList.add(Operator.REMOVE, new Intent("1"));
+ opList.add(Operator.REMOVE, new Intent("2"));
- // compile
- runtime1.executeIntentOperations(opList);
+ // compile
+ runtime1.executeIntentOperations(opList);
- // show results
- showResult((PathIntentMap) runtime1.getPathIntents());
- System.out.println(plan);
- }
+ // show results
+ showResult((PathIntentMap) runtime1.getPathIntents());
+ System.out.println(plan);
+ }
}