Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 1 | package net.onrc.onos.intent.runtime; |
| 2 | |
Pavlin Radoslavov | 74986ce | 2014-02-20 13:17:20 -0800 | [diff] [blame] | 3 | import java.util.LinkedList; |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 4 | import java.util.List; |
| 5 | import java.util.Set; |
| 6 | |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 7 | import net.floodlightcontroller.core.module.FloodlightModuleContext; |
| 8 | import net.floodlightcontroller.core.module.FloodlightModuleException; |
| 9 | import net.onrc.onos.datagrid.IDatagridService; |
| 10 | import net.onrc.onos.datagrid.IEventChannel; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 11 | import net.onrc.onos.intent.ConstrainedShortestPathIntent; |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 12 | import net.onrc.onos.intent.FlowEntry; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 13 | import net.onrc.onos.intent.Intent; |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 14 | import net.onrc.onos.intent.IntentOperation.Operator; |
| 15 | import net.onrc.onos.intent.IntentOperationList; |
Toshio Koide | ebdbb62 | 2014-02-12 20:28:38 -0800 | [diff] [blame] | 16 | import net.onrc.onos.intent.MockNetworkGraph; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 17 | import net.onrc.onos.intent.PathIntent; |
Toshio Koide | 4f30873 | 2014-02-18 15:19:48 -0800 | [diff] [blame] | 18 | import net.onrc.onos.intent.PathIntentMap; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 19 | import net.onrc.onos.intent.ShortestPathIntent; |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 20 | import net.onrc.onos.intent.persist.PersistIntent; |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 21 | import net.onrc.onos.ofcontroller.networkgraph.INetworkGraphListener; |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 22 | import net.onrc.onos.ofcontroller.networkgraph.INetworkGraphService; |
Pavlin Radoslavov | 74986ce | 2014-02-20 13:17:20 -0800 | [diff] [blame] | 23 | import net.onrc.onos.ofcontroller.networkgraph.DeviceEvent; |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 24 | import net.onrc.onos.ofcontroller.networkgraph.LinkEvent; |
Pavlin Radoslavov | 74986ce | 2014-02-20 13:17:20 -0800 | [diff] [blame] | 25 | import net.onrc.onos.ofcontroller.networkgraph.PortEvent; |
| 26 | import net.onrc.onos.ofcontroller.networkgraph.SwitchEvent; |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 27 | import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph; |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 28 | import net.onrc.onos.registry.controller.IControllerRegistryService; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 29 | |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 30 | import org.easymock.EasyMock; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 31 | import org.junit.After; |
| 32 | import org.junit.Before; |
| 33 | import org.junit.Test; |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 34 | import org.junit.runner.RunWith; |
| 35 | import org.powermock.api.easymock.PowerMock; |
| 36 | import org.powermock.core.classloader.annotations.PrepareForTest; |
| 37 | import org.powermock.modules.junit4.PowerMockRunner; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * @author Toshio Koide (t-koide@onlab.us) |
| 41 | */ |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 42 | @RunWith(PowerMockRunner.class) |
| 43 | @PrepareForTest(PathCalcRuntimeModule.class) |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 44 | public class UseCaseTest { |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 45 | private NetworkGraph g; |
| 46 | private FloodlightModuleContext modContext; |
| 47 | private IDatagridService datagridService; |
| 48 | private INetworkGraphService networkGraphService; |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 49 | private IControllerRegistryService controllerRegistryService; |
| 50 | private PersistIntent persistIntent; |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 51 | @SuppressWarnings("rawtypes") |
| 52 | private IEventChannel eventChannel; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 53 | |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 54 | @SuppressWarnings("unchecked") |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 55 | @Before |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 56 | public void setUp() throws Exception { |
Toshio Koide | ebdbb62 | 2014-02-12 20:28:38 -0800 | [diff] [blame] | 57 | MockNetworkGraph graph = new MockNetworkGraph(); |
| 58 | graph.createSampleTopology(); |
| 59 | g = graph; |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 60 | |
| 61 | datagridService = EasyMock.createMock(IDatagridService.class); |
| 62 | networkGraphService = EasyMock.createMock(INetworkGraphService.class); |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 63 | controllerRegistryService = EasyMock.createMock(IControllerRegistryService.class); |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 64 | modContext = EasyMock.createMock(FloodlightModuleContext.class); |
| 65 | eventChannel = EasyMock.createMock(IEventChannel.class); |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 66 | persistIntent = PowerMock.createMock(PersistIntent.class); |
| 67 | |
| 68 | PowerMock.expectNew(PersistIntent.class, |
| 69 | EasyMock.anyObject(IControllerRegistryService.class), |
| 70 | EasyMock.anyObject(INetworkGraphService.class)).andReturn(persistIntent); |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 71 | |
| 72 | EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IDatagridService.class))) |
| 73 | .andReturn(datagridService).once(); |
| 74 | EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(INetworkGraphService.class))) |
| 75 | .andReturn(networkGraphService).once(); |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 76 | EasyMock.expect(modContext.getServiceImpl(EasyMock.eq(IControllerRegistryService.class))) |
| 77 | .andReturn(controllerRegistryService).once(); |
| 78 | EasyMock.expect(persistIntent.getKey()).andReturn(1L).anyTimes(); |
| 79 | EasyMock.expect(persistIntent.persistIfLeader(EasyMock.eq(1L), |
| 80 | EasyMock.anyObject(IntentOperationList.class))).andReturn(true).anyTimes(); |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 81 | |
| 82 | EasyMock.expect(networkGraphService.getNetworkGraph()).andReturn(g).anyTimes(); |
| 83 | networkGraphService.registerNetworkGraphListener(EasyMock.anyObject(INetworkGraphListener.class)); |
| 84 | EasyMock.expectLastCall(); |
| 85 | |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 86 | EasyMock.expect(datagridService.createChannel("onos.pathintent", Long.class, IntentOperationList.class)) |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 87 | .andReturn(eventChannel).once(); |
| 88 | |
| 89 | EasyMock.replay(datagridService); |
| 90 | EasyMock.replay(networkGraphService); |
| 91 | EasyMock.replay(modContext); |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 92 | EasyMock.replay(controllerRegistryService); |
| 93 | PowerMock.replay(persistIntent, PersistIntent.class); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | @After |
| 97 | public void tearDown() { |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 98 | EasyMock.verify(datagridService); |
| 99 | EasyMock.verify(networkGraphService); |
| 100 | EasyMock.verify(modContext); |
Nick Karanatsios | 8abe717 | 2014-02-19 20:31:48 -0800 | [diff] [blame] | 101 | EasyMock.verify(controllerRegistryService); |
| 102 | PowerMock.verify(persistIntent, PersistIntent.class); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 103 | } |
| 104 | |
Toshio Koide | 4f30873 | 2014-02-18 15:19:48 -0800 | [diff] [blame] | 105 | private void showResult(PathIntentMap intents) { |
| 106 | for (Intent intent: intents.getAllIntents()) { |
| 107 | PathIntent pathIntent = (PathIntent)intent; |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 108 | System.out.println("Parent intent: " + pathIntent.getParentIntent().toString()); |
| 109 | System.out.println("Path:"); |
Toshio Koide | d9fa2a8 | 2014-02-19 17:35:18 -0800 | [diff] [blame] | 110 | for (LinkEvent linkEvent: pathIntent.getPath()) { |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 111 | System.out.println(linkEvent); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | @Test |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 117 | public void createShortestPaths() throws FloodlightModuleException { |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 118 | // create shortest path intents |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 119 | IntentOperationList opList = new IntentOperationList(); |
| 120 | opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 4L)); |
| 121 | opList.add(Operator.ADD, new ShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 5L)); |
| 122 | opList.add(Operator.ADD, new ShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 6L)); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 123 | |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 124 | // compile high-level intent operations into low-level intent operations (calculate paths) |
| 125 | PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule(); |
| 126 | runtime1.init(modContext); |
| 127 | runtime1.startUp(modContext); |
| 128 | IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList); |
| 129 | |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 130 | // compile low-level intents into flow entry installation plan |
| 131 | PlanCalcRuntime runtime2 = new PlanCalcRuntime(g); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 132 | List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 133 | |
| 134 | // show results |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 135 | showResult((PathIntentMap) runtime1.getPathIntents()); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 136 | System.out.println(plan); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | @Test |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 140 | public void createConstrainedShortestPaths() throws FloodlightModuleException { |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 141 | // create constrained shortest path intents |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 142 | IntentOperationList opList = new IntentOperationList(); |
| 143 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 17L, 400.0)); |
| 144 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 18L, 400.0)); |
| 145 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 19L, 400.0)); |
| 146 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("4", 3L, 20L, 4L, 8L, 20L, 20L, 400.0)); |
| 147 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 4L, 20L, 5L, 8L, 20L, 21L, 400.0)); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 148 | |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 149 | // compile high-level intent operations into low-level intent operations (calculate paths) |
| 150 | PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule(); |
| 151 | runtime1.init(modContext); |
| 152 | runtime1.startUp(modContext); |
| 153 | IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 154 | |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 155 | // compile low-level intents into flow entry installation plan |
| 156 | PlanCalcRuntime runtime2 = new PlanCalcRuntime(g); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 157 | List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList); |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 158 | |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 159 | // show results |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 160 | showResult((PathIntentMap) runtime1.getPathIntents()); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 161 | System.out.println(plan); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | @Test |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 165 | public void createMixedShortestPaths() throws FloodlightModuleException { |
| 166 | // create constrained & best effort shortest path intents |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 167 | IntentOperationList opList = new IntentOperationList(); |
| 168 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 6L, 600.0)); |
| 169 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 7L, 600.0)); |
| 170 | opList.add(Operator.ADD, new ShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 8L)); |
| 171 | opList.add(Operator.ADD, new ShortestPathIntent("4", 4L, 20L, 4L, 8L, 20L, 9L)); |
| 172 | opList.add(Operator.ADD, new ConstrainedShortestPathIntent("5", 4L, 20L, 5L, 8L, 20L, 10L, 600.0)); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 173 | |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 174 | // compile high-level intent operations into low-level intent operations (calculate paths) |
| 175 | PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule(); |
| 176 | runtime1.init(modContext); |
| 177 | runtime1.startUp(modContext); |
| 178 | IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 179 | |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 180 | // compile low-level intents into flow entry installation plan |
| 181 | PlanCalcRuntime runtime2 = new PlanCalcRuntime(g); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 182 | List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList); |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 183 | |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 184 | // show results |
Toshio Koide | 27ffd41 | 2014-02-18 19:15:27 -0800 | [diff] [blame] | 185 | showResult((PathIntentMap) runtime1.getPathIntents()); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 186 | System.out.println(plan); |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 187 | } |
Toshio Koide | d9fa2a8 | 2014-02-19 17:35:18 -0800 | [diff] [blame] | 188 | |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 189 | @Test |
| 190 | public void rerouteShortestPaths() throws FloodlightModuleException { |
Pavlin Radoslavov | 74986ce | 2014-02-20 13:17:20 -0800 | [diff] [blame] | 191 | List<SwitchEvent> addedSwitchEvents = new LinkedList<>(); |
| 192 | List<SwitchEvent> removedSwitchEvents = new LinkedList<>(); |
| 193 | List<PortEvent> addedPortEvents = new LinkedList<>(); |
| 194 | List<PortEvent> removedPortEvents = new LinkedList<>(); |
| 195 | List<LinkEvent> addedLinkEvents = new LinkedList<>(); |
| 196 | List<LinkEvent> removedLinkEvents = new LinkedList<>(); |
| 197 | List<DeviceEvent> addedDeviceEvents = new LinkedList<>(); |
| 198 | List<DeviceEvent> removedDeviceEvents = new LinkedList<>(); |
| 199 | |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 200 | // create shortest path intents |
| 201 | IntentOperationList opList = new IntentOperationList(); |
| 202 | opList.add(Operator.ADD, new ShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 4L)); |
| 203 | opList.add(Operator.ADD, new ShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 5L)); |
| 204 | opList.add(Operator.ADD, new ShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 6L)); |
| 205 | |
| 206 | // compile high-level intent operations into low-level intent operations (calculate paths) |
| 207 | PathCalcRuntimeModule runtime1 = new PathCalcRuntimeModule(); |
| 208 | runtime1.init(modContext); |
| 209 | runtime1.startUp(modContext); |
| 210 | IntentOperationList pathIntentOpList = runtime1.executeIntentOperations(opList); |
| 211 | |
| 212 | // compile low-level intents into flow entry installation plan |
| 213 | PlanCalcRuntime runtime2 = new PlanCalcRuntime(g); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 214 | List<Set<FlowEntry>> plan = runtime2.computePlan(pathIntentOpList); |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 215 | |
| 216 | // show results step1 |
| 217 | showResult((PathIntentMap) runtime1.getPathIntents()); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 218 | System.out.println(plan); |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 219 | |
| 220 | // link down |
| 221 | ((MockNetworkGraph)g).removeLink(1L, 2L, 9L, 1L); // This link is used by the intent "1" |
| 222 | LinkEvent linkEvent = new LinkEvent(1L, 2L, 9L, 1L); |
Pavlin Radoslavov | 74986ce | 2014-02-20 13:17:20 -0800 | [diff] [blame] | 223 | removedLinkEvents.clear(); |
| 224 | removedLinkEvents.add(linkEvent); |
| 225 | runtime1.networkGraphEvents(addedSwitchEvents, |
| 226 | removedSwitchEvents, |
| 227 | addedPortEvents, |
| 228 | removedPortEvents, |
| 229 | addedLinkEvents, |
| 230 | removedLinkEvents, |
| 231 | addedDeviceEvents, |
| 232 | removedDeviceEvents); |
| 233 | |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 234 | ((MockNetworkGraph)g).removeLink(9L, 1L, 1L, 2L); |
| 235 | linkEvent = new LinkEvent(9L, 1L, 1L, 2L); |
Pavlin Radoslavov | 74986ce | 2014-02-20 13:17:20 -0800 | [diff] [blame] | 236 | removedLinkEvents.clear(); |
| 237 | removedLinkEvents.add(linkEvent); |
| 238 | runtime1.networkGraphEvents(addedSwitchEvents, |
| 239 | removedSwitchEvents, |
| 240 | addedPortEvents, |
| 241 | removedPortEvents, |
| 242 | addedLinkEvents, |
| 243 | removedLinkEvents, |
| 244 | addedDeviceEvents, |
| 245 | removedDeviceEvents); |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 246 | System.out.println("Link goes down."); |
| 247 | |
| 248 | // show results step2 |
| 249 | showResult((PathIntentMap) runtime1.getPathIntents()); |
Brian O'Connor | 12861f7 | 2014-02-19 20:40:32 -0800 | [diff] [blame] | 250 | // TODO: show results of plan computation |
Toshio Koide | 0c9106d | 2014-02-19 15:26:38 -0800 | [diff] [blame] | 251 | } |
Toshio Koide | c87810e | 2014-02-11 13:03:21 -0800 | [diff] [blame] | 252 | } |