Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.t3.impl; |
| 17 | |
| 18 | import com.google.common.collect.ImmutableList; |
| 19 | import com.google.common.collect.ImmutableSet; |
| 20 | import org.junit.Before; |
| 21 | import org.junit.Test; |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 22 | import org.onlab.packet.ChassisId; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 23 | import org.onlab.packet.EthType; |
| 24 | import org.onlab.packet.IpAddress; |
| 25 | import org.onlab.packet.MacAddress; |
| 26 | import org.onlab.packet.VlanId; |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 27 | import org.onosproject.cluster.NodeId; |
| 28 | import org.onosproject.mastership.MastershipServiceAdapter; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 29 | import org.onosproject.net.ConnectPoint; |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 30 | import org.onosproject.net.DefaultAnnotations; |
| 31 | import org.onosproject.net.DefaultDevice; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 32 | import org.onosproject.net.DefaultLink; |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 33 | import org.onosproject.net.DefaultPort; |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 34 | import org.onosproject.net.Device; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 35 | import org.onosproject.net.DeviceId; |
| 36 | import org.onosproject.net.Host; |
| 37 | import org.onosproject.net.Link; |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 38 | import org.onosproject.net.Port; |
Andrea Campanella | 94dfb9e | 2018-02-27 12:36:00 +0100 | [diff] [blame] | 39 | import org.onosproject.net.PortNumber; |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 40 | import org.onosproject.net.device.DeviceServiceAdapter; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 41 | import org.onosproject.net.driver.DefaultDriver; |
| 42 | import org.onosproject.net.driver.Driver; |
| 43 | import org.onosproject.net.driver.DriverServiceAdapter; |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 44 | import org.onosproject.net.edge.EdgePortServiceAdapter; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 45 | import org.onosproject.net.flow.FlowEntry; |
| 46 | import org.onosproject.net.flow.FlowRuleServiceAdapter; |
| 47 | import org.onosproject.net.flow.TrafficSelector; |
| 48 | import org.onosproject.net.flow.criteria.Criterion; |
| 49 | import org.onosproject.net.flow.criteria.EthTypeCriterion; |
| 50 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
| 51 | import org.onosproject.net.group.Group; |
| 52 | import org.onosproject.net.group.GroupServiceAdapter; |
| 53 | import org.onosproject.net.host.HostServiceAdapter; |
| 54 | import org.onosproject.net.link.LinkServiceAdapter; |
| 55 | import org.onosproject.net.provider.ProviderId; |
| 56 | import org.onosproject.t3.api.StaticPacketTrace; |
| 57 | import org.slf4j.Logger; |
| 58 | |
| 59 | import java.util.HashMap; |
| 60 | import java.util.Set; |
| 61 | |
| 62 | import static org.junit.Assert.assertEquals; |
| 63 | import static org.junit.Assert.assertNotNull; |
| 64 | import static org.junit.Assert.assertNull; |
| 65 | import static org.junit.Assert.assertTrue; |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 66 | import static org.onosproject.net.Device.Type.SWITCH; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 67 | import static org.onosproject.t3.impl.T3TestObjects.*; |
Andrea Campanella | 1445f7a | 2018-02-07 12:00:12 +0100 | [diff] [blame] | 68 | import static org.onosproject.t3.impl.TroubleshootManager.PACKET_TO_CONTROLLER; |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 69 | import static org.slf4j.LoggerFactory.getLogger; |
| 70 | |
| 71 | /** |
| 72 | * Test Class for Troubleshoot Manager. |
| 73 | */ |
| 74 | public class TroubleshootManagerTest { |
| 75 | |
| 76 | private static final Logger log = getLogger(TroubleshootManager.class); |
| 77 | |
| 78 | private TroubleshootManager mngr; |
| 79 | |
| 80 | @Before |
| 81 | public void setUp() throws Exception { |
| 82 | mngr = new TroubleshootManager(); |
| 83 | mngr.flowRuleService = new TestFlowRuleService(); |
| 84 | mngr.hostService = new TestHostService(); |
| 85 | mngr.linkService = new TestLinkService(); |
| 86 | mngr.driverService = new TestDriverService(); |
| 87 | mngr.groupService = new TestGroupService(); |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 88 | mngr.deviceService = new TestDeviceService(); |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 89 | mngr.mastershipService = new TestMastershipService(); |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 90 | mngr.edgePortService = new TestEdgePortService(); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 91 | |
| 92 | assertNotNull("Manager should not be null", mngr); |
| 93 | |
| 94 | assertNotNull("Flow rule Service should not be null", mngr.flowRuleService); |
| 95 | assertNotNull("Host Service should not be null", mngr.hostService); |
| 96 | assertNotNull("Group Service should not be null", mngr.groupService); |
| 97 | assertNotNull("Driver Service should not be null", mngr.driverService); |
| 98 | assertNotNull("Link Service should not be null", mngr.linkService); |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 99 | assertNotNull("Device Service should not be null", mngr.deviceService); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Tests failure on non existent device. |
| 104 | */ |
| 105 | @Test(expected = NullPointerException.class) |
| 106 | public void nonExistentDevice() { |
| 107 | StaticPacketTrace traceFail = mngr.trace(PACKET_OK, ConnectPoint.deviceConnectPoint("nonexistent" + "/1")); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Tests failure on offline device. |
| 112 | */ |
| 113 | @Test |
| 114 | public void offlineDevice() { |
| 115 | StaticPacketTrace traceFail = mngr.trace(PACKET_OK, ConnectPoint.deviceConnectPoint(OFFLINE_DEVICE + "/1")); |
| 116 | assertNotNull("Trace should not be null", traceFail); |
| 117 | assertNull("Trace should have 0 output", traceFail.getGroupOuputs(SINGLE_FLOW_DEVICE)); |
Andrea Campanella | 7d3cf65 | 2018-01-22 15:10:30 +0100 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Tests failure on same output. |
| 122 | */ |
| 123 | @Test |
| 124 | public void sameOutput() { |
| 125 | StaticPacketTrace traceFail = mngr.trace(PACKET_OK, SAME_OUTPUT_FLOW_CP); |
| 126 | assertNotNull("Trace should not be null", traceFail); |
| 127 | assertTrue("Trace should be unsuccessful", |
| 128 | traceFail.resultMessage().contains("is same as initial input")); |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 129 | log.info("trace {}", traceFail.resultMessage()); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 130 | } |
| 131 | |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 132 | /** |
| 133 | * Tests ARP to controller. |
| 134 | */ |
| 135 | @Test |
| 136 | public void arpToController() { |
| 137 | StaticPacketTrace traceSuccess = mngr.trace(PACKET_ARP, ARP_FLOW_CP); |
| 138 | assertNotNull("Trace should not be null", traceSuccess); |
| 139 | assertTrue("Trace should be successful", |
Andrea Campanella | 1445f7a | 2018-02-07 12:00:12 +0100 | [diff] [blame] | 140 | traceSuccess.resultMessage().contains(PACKET_TO_CONTROLLER)); |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 141 | assertTrue("Master should be Master1", |
| 142 | traceSuccess.resultMessage().contains(MASTER_1)); |
| 143 | ConnectPoint connectPoint = traceSuccess.getGroupOuputs(ARP_FLOW_DEVICE).get(0).getOutput(); |
| 144 | assertEquals("Packet Should go to CONTROLLER", PortNumber.CONTROLLER, connectPoint.port()); |
Andrea Campanella | e679801 | 2018-02-06 15:46:52 +0100 | [diff] [blame] | 145 | assertNull("VlanId should be null", traceSuccess.getGroupOuputs(ARP_FLOW_DEVICE).get(0) |
| 146 | .getFinalPacket().getCriterion(Criterion.Type.VLAN_VID)); |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 147 | log.info("trace {}", traceSuccess.resultMessage()); |
| 148 | } |
| 149 | |
Andrea Campanella | 7d3cf65 | 2018-01-22 15:10:30 +0100 | [diff] [blame] | 150 | |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 151 | /** |
Andrea Campanella | 4401bd7 | 2018-01-18 16:54:34 +0100 | [diff] [blame] | 152 | * Tests failure on device with no flows. |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 153 | */ |
| 154 | @Test |
| 155 | public void noFlows() { |
| 156 | StaticPacketTrace traceFail = mngr.trace(PACKET_OK, ConnectPoint.deviceConnectPoint("test/1")); |
| 157 | assertNotNull("Trace should not be null", traceFail); |
| 158 | assertNull("Trace should have 0 output", traceFail.getGroupOuputs(SINGLE_FLOW_DEVICE)); |
| 159 | log.info("trace {}", traceFail.resultMessage()); |
| 160 | } |
| 161 | |
| 162 | /** |
Andrea Campanella | 94dfb9e | 2018-02-27 12:36:00 +0100 | [diff] [blame] | 163 | * Test group with no buckets. |
| 164 | */ |
| 165 | @Test |
| 166 | public void noBucketsTest() throws Exception { |
| 167 | |
| 168 | StaticPacketTrace traceFail = mngr.trace(PACKET_OK, NO_BUCKET_CP); |
| 169 | assertNotNull("Trace should not be null", traceFail); |
| 170 | assertTrue("Trace should be unsuccessful", |
| 171 | traceFail.resultMessage().contains("no buckets")); |
| 172 | log.info("trace {}", traceFail.resultMessage()); |
| 173 | |
| 174 | } |
| 175 | |
| 176 | /** |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 177 | * Test a single flow rule that has output port in it. |
| 178 | */ |
| 179 | @Test |
| 180 | public void testSingleFlowRule() { |
| 181 | |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 182 | testSuccess(PACKET_OK, SINGLE_FLOW_IN_CP, SINGLE_FLOW_DEVICE, SINGLE_FLOW_OUT_CP, 1, 1); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 183 | |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 184 | testFailure(PACKET_FAIL, SINGLE_FLOW_IN_CP, SINGLE_FLOW_DEVICE); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Tests two flow rule the last one of which has output port in it. |
| 189 | */ |
| 190 | @Test |
| 191 | public void testDualFlowRule() { |
| 192 | |
| 193 | //Test Success |
| 194 | |
Andrea Campanella | 4401bd7 | 2018-01-18 16:54:34 +0100 | [diff] [blame] | 195 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK, DUAL_FLOW_IN_CP, DUAL_FLOW_DEVICE, |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 196 | DUAL_FLOW_OUT_CP, 1, 1); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 197 | |
| 198 | //Testing Vlan |
| 199 | Criterion criterion = traceSuccess.getGroupOuputs(DUAL_FLOW_DEVICE).get(0). |
| 200 | getFinalPacket().getCriterion(Criterion.Type.VLAN_VID); |
| 201 | assertNotNull("Packet Should have Vlan", criterion); |
| 202 | |
| 203 | VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) criterion; |
| 204 | |
| 205 | assertEquals("Vlan should be 100", VlanId.vlanId((short) 100), vlanIdCriterion.vlanId()); |
| 206 | |
| 207 | //Test Faliure |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 208 | testFailure(PACKET_FAIL, DUAL_FLOW_IN_CP, DUAL_FLOW_DEVICE); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 209 | |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * Test a single flow rule that points to a group with output port in it. |
| 214 | */ |
| 215 | @Test |
| 216 | public void flowAndGroup() throws Exception { |
| 217 | |
Andrea Campanella | 4401bd7 | 2018-01-18 16:54:34 +0100 | [diff] [blame] | 218 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK, GROUP_FLOW_IN_CP, GROUP_FLOW_DEVICE, |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 219 | GROUP_FLOW_OUT_CP, 1, 1); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 220 | |
| 221 | assertTrue("Wrong Output Group", traceSuccess.getGroupOuputs(GROUP_FLOW_DEVICE) |
| 222 | .get(0).getGroups().contains(GROUP)); |
Andrea Campanella | 3970e47 | 2018-01-25 16:44:04 +0100 | [diff] [blame] | 223 | assertEquals("Packet should not have MPLS Label", EthType.EtherType.IPV4.ethType(), |
| 224 | ((EthTypeCriterion) traceSuccess.getGroupOuputs(GROUP_FLOW_DEVICE) |
| 225 | .get(0).getFinalPacket().getCriterion(Criterion.Type.ETH_TYPE)).ethType()); |
| 226 | assertNull("Packet should not have MPLS Label", traceSuccess.getGroupOuputs(GROUP_FLOW_DEVICE) |
| 227 | .get(0).getFinalPacket().getCriterion(Criterion.Type.MPLS_LABEL)); |
| 228 | assertNull("Packet should not have MPLS Label", traceSuccess.getGroupOuputs(GROUP_FLOW_DEVICE) |
| 229 | .get(0).getFinalPacket().getCriterion(Criterion.Type.MPLS_BOS)); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 230 | |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Test path through a 3 device topology. |
| 235 | */ |
| 236 | @Test |
| 237 | public void singlePathTopology() throws Exception { |
| 238 | |
| 239 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK_TOPO, TOPO_FLOW_1_IN_CP, |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 240 | TOPO_FLOW_3_DEVICE, TOPO_FLOW_3_OUT_CP, 1, 1); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 241 | |
| 242 | assertTrue("Incorrect path", |
| 243 | traceSuccess.getCompletePaths().get(0).contains(TOPO_FLOW_2_IN_CP)); |
| 244 | assertTrue("Incorrect path", |
| 245 | traceSuccess.getCompletePaths().get(0).contains(TOPO_FLOW_2_OUT_CP)); |
| 246 | assertTrue("Incorrect path", |
| 247 | traceSuccess.getCompletePaths().get(0).contains(TOPO_FLOW_3_IN_CP)); |
| 248 | |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Test path through a 4 device topology with first device that has groups with multiple output buckets. |
| 253 | */ |
| 254 | @Test |
| 255 | public void testGroupTopo() throws Exception { |
| 256 | |
| 257 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK_TOPO, TOPO_FLOW_IN_CP, |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 258 | TOPO_FLOW_3_DEVICE, TOPO_FLOW_3_OUT_CP, 2, 1); |
| 259 | |
| 260 | log.info("{}", traceSuccess); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 261 | |
| 262 | assertTrue("Incorrect groups", |
| 263 | traceSuccess.getGroupOuputs(TOPO_GROUP_FLOW_DEVICE).get(0).getGroups().contains(TOPO_GROUP)); |
| 264 | assertTrue("Incorrect bucket", |
| 265 | traceSuccess.getGroupOuputs(TOPO_GROUP_FLOW_DEVICE).get(1).getGroups().contains(TOPO_GROUP)); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Test HW support in a single device with 2 flow rules to check hit of static HW rules. |
| 270 | */ |
| 271 | @Test |
| 272 | public void hardwareTest() throws Exception { |
| 273 | |
| 274 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK, HARDWARE_DEVICE_IN_CP, |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 275 | HARDWARE_DEVICE, HARDWARE_DEVICE_OUT_CP, 1, 1); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 276 | |
| 277 | assertEquals("wrong ETH type", EthType.EtherType.IPV4.ethType(), |
| 278 | ((EthTypeCriterion) traceSuccess.getGroupOuputs(HARDWARE_DEVICE).get(0).getFinalPacket() |
| 279 | .getCriterion(Criterion.Type.ETH_TYPE)).ethType()); |
| 280 | |
| 281 | } |
| 282 | |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 283 | /** |
Andrea Campanella | 94c594a | 2018-02-06 18:58:40 +0100 | [diff] [blame] | 284 | * Test that HW has two rules on table 10 for untagged packets. |
| 285 | */ |
| 286 | @Test |
| 287 | public void hardwareTable10Test() throws Exception { |
| 288 | |
| 289 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK, HARDWARE_DEVICE_10_IN_CP, |
| 290 | HARDWARE_DEVICE_10, HARDWARE_DEVICE_10_OUT_CP, 1, 1); |
| 291 | |
| 292 | assertTrue("Second flow rule is absent", traceSuccess.getFlowsForDevice(HARDWARE_DEVICE_10) |
| 293 | .contains(HARDWARE_10_SECOND_FLOW_ENTRY)); |
| 294 | |
| 295 | } |
| 296 | |
| 297 | /** |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 298 | * Test dual links between 3 topology elements. |
| 299 | */ |
| 300 | @Test |
| 301 | public void dualLinks() throws Exception { |
| 302 | |
| 303 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK, DUAL_LINK_1_CP_1_IN, |
| 304 | DUAL_LINK_3, DUAL_LINK_3_CP_3_OUT, 4, 1); |
| 305 | |
| 306 | //TODO tests |
| 307 | |
| 308 | } |
| 309 | |
Andrea Campanella | 8292ba6 | 2018-01-31 16:43:23 +0100 | [diff] [blame] | 310 | /** |
| 311 | * Test proper clear deferred behaviour. |
| 312 | */ |
| 313 | @Test |
| 314 | public void clearDeferred() throws Exception { |
| 315 | |
| 316 | StaticPacketTrace traceSuccess = testSuccess(PACKET_OK, DEFERRED_CP_1_IN, |
| 317 | DEFERRED_1, DEFERRED_CP_2_OUT, 1, 1); |
| 318 | |
| 319 | assertNull("MPLS should have been not applied due to clear deferred", traceSuccess |
| 320 | .getGroupOuputs(DEFERRED_1).get(0).getFinalPacket().getCriterion(Criterion.Type.MPLS_LABEL)); |
| 321 | |
| 322 | } |
| 323 | |
| 324 | |
Andrea Campanella | 1445f7a | 2018-02-07 12:00:12 +0100 | [diff] [blame] | 325 | /** |
| 326 | * Test LLDP output to controller. |
| 327 | */ |
| 328 | @Test |
| 329 | public void lldpToController() { |
| 330 | StaticPacketTrace traceSuccess = mngr.trace(PACKET_LLDP, LLDP_FLOW_CP); |
| 331 | assertNotNull("Trace should not be null", traceSuccess); |
| 332 | assertTrue("Trace should be successful", |
| 333 | traceSuccess.resultMessage().contains("Packet goes to the controller")); |
| 334 | assertTrue("Master should be Master1", |
| 335 | traceSuccess.resultMessage().contains(MASTER_1)); |
| 336 | ConnectPoint connectPoint = traceSuccess.getGroupOuputs(LLDP_FLOW_DEVICE).get(0).getOutput(); |
| 337 | assertEquals("Packet Should go to CONTROLLER", PortNumber.CONTROLLER, connectPoint.port()); |
| 338 | log.info("trace {}", traceSuccess.resultMessage()); |
| 339 | } |
| 340 | |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 341 | /** |
| 342 | * Test multicast in single device. |
| 343 | */ |
| 344 | @Test |
| 345 | public void multicastTest() throws Exception { |
| 346 | |
| 347 | StaticPacketTrace traceSuccess = mngr.trace(PACKET_OK_MULTICAST, MULTICAST_IN_CP); |
| 348 | |
| 349 | log.info("trace {}", traceSuccess); |
| 350 | |
| 351 | log.info("trace {}", traceSuccess.resultMessage()); |
| 352 | |
| 353 | assertNotNull("trace should not be null", traceSuccess); |
| 354 | assertEquals("Trace should have " + 2 + " output", 2, |
| 355 | traceSuccess.getGroupOuputs(MULTICAST_GROUP_FLOW_DEVICE).size()); |
| 356 | assertEquals("Trace should only have " + 2 + "output", 2, |
| 357 | traceSuccess.getCompletePaths().size()); |
| 358 | assertTrue("Trace should be successful", |
| 359 | traceSuccess.resultMessage().contains("reached output")); |
| 360 | assertEquals("Incorrect Output CP", MULTICAST_OUT_CP_2, |
| 361 | traceSuccess.getGroupOuputs(MULTICAST_GROUP_FLOW_DEVICE).get(0).getOutput()); |
| 362 | assertEquals("Incorrect Output CP", MULTICAST_OUT_CP, |
| 363 | traceSuccess.getGroupOuputs(MULTICAST_GROUP_FLOW_DEVICE).get(1).getOutput()); |
| 364 | |
| 365 | } |
| 366 | |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 367 | /** |
| 368 | * Tests dual homing of a host. |
| 369 | */ |
| 370 | @Test |
| 371 | public void dualhomedTest() throws Exception { |
| 372 | StaticPacketTrace traceSuccess = mngr.trace(PACKET_DUAL_HOME, DUAL_HOME_CP_1_1); |
| 373 | |
| 374 | assertNotNull("trace should not be null", traceSuccess); |
| 375 | assertTrue("Should have 2 output paths", traceSuccess.getCompletePaths().size() == 2); |
| 376 | assertTrue("Should contain proper path", traceSuccess.getCompletePaths() |
| 377 | .contains(ImmutableList.of(DUAL_HOME_CP_1_1, DUAL_HOME_CP_1_2, DUAL_HOME_CP_2_1, DUAL_HOME_CP_2_2))); |
| 378 | assertTrue("Should contain proper path", traceSuccess.getCompletePaths() |
| 379 | .contains(ImmutableList.of(DUAL_HOME_CP_1_1, DUAL_HOME_CP_1_3, DUAL_HOME_CP_3_1, DUAL_HOME_CP_3_2))); |
| 380 | |
| 381 | } |
| 382 | |
| 383 | |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 384 | private StaticPacketTrace testSuccess(TrafficSelector packet, ConnectPoint in, DeviceId deviceId, ConnectPoint out, |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 385 | int paths, int outputs) { |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 386 | StaticPacketTrace traceSuccess = mngr.trace(packet, in); |
| 387 | |
| 388 | log.info("trace {}", traceSuccess); |
| 389 | |
| 390 | log.info("trace {}", traceSuccess.resultMessage()); |
| 391 | |
| 392 | assertNotNull("trace should not be null", traceSuccess); |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 393 | assertEquals("Trace should have " + outputs + " output", outputs, |
| 394 | traceSuccess.getGroupOuputs(deviceId).size()); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 395 | assertEquals("Trace should only have " + paths + "output", paths, traceSuccess.getCompletePaths().size()); |
| 396 | assertTrue("Trace should be successful", |
| 397 | traceSuccess.resultMessage().contains("Reached required destination Host")); |
| 398 | assertEquals("Incorrect Output CP", out, |
| 399 | traceSuccess.getGroupOuputs(deviceId).get(0).getOutput()); |
| 400 | |
| 401 | return traceSuccess; |
| 402 | } |
| 403 | |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 404 | private void testFailure(TrafficSelector packet, ConnectPoint in, DeviceId deviceId) { |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 405 | StaticPacketTrace traceFail = mngr.trace(packet, in); |
| 406 | |
| 407 | log.info("trace {}", traceFail.resultMessage()); |
| 408 | |
| 409 | assertNotNull("Trace should not be null", traceFail); |
| 410 | assertNull("Trace should have 0 output", traceFail.getGroupOuputs(deviceId)); |
| 411 | } |
| 412 | |
| 413 | private class TestFlowRuleService extends FlowRuleServiceAdapter { |
| 414 | @Override |
| 415 | public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { |
| 416 | if (deviceId.equals(SINGLE_FLOW_DEVICE)) { |
| 417 | return ImmutableList.of(SINGLE_FLOW_ENTRY); |
| 418 | } else if (deviceId.equals(DUAL_FLOW_DEVICE)) { |
| 419 | return ImmutableList.of(FIRST_FLOW_ENTRY, SECOND_FLOW_ENTRY); |
| 420 | } else if (deviceId.equals(GROUP_FLOW_DEVICE)) { |
| 421 | return ImmutableList.of(GROUP_FLOW_ENTRY); |
| 422 | } else if (deviceId.equals(TOPO_FLOW_DEVICE) || |
| 423 | deviceId.equals(TOPO_FLOW_2_DEVICE) || |
| 424 | deviceId.equals(TOPO_FLOW_3_DEVICE) || |
| 425 | deviceId.equals(TOPO_FLOW_4_DEVICE)) { |
| 426 | return ImmutableList.of(TOPO_SINGLE_FLOW_ENTRY, TOPO_SECOND_INPUT_FLOW_ENTRY); |
| 427 | } else if (deviceId.equals(TOPO_GROUP_FLOW_DEVICE)) { |
| 428 | return ImmutableList.of(TOPO_GROUP_FLOW_ENTRY); |
Andrea Campanella | 4401bd7 | 2018-01-18 16:54:34 +0100 | [diff] [blame] | 429 | } else if (deviceId.equals(HARDWARE_DEVICE)) { |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 430 | return ImmutableList.of(HARDWARE_ETH_FLOW_ENTRY, HARDWARE_FLOW_ENTRY); |
Andrea Campanella | 7d3cf65 | 2018-01-22 15:10:30 +0100 | [diff] [blame] | 431 | } else if (deviceId.equals(SAME_OUTPUT_FLOW_DEVICE)) { |
| 432 | return ImmutableList.of(SAME_OUTPUT_FLOW_ENTRY); |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 433 | } else if (deviceId.equals(ARP_FLOW_DEVICE)) { |
| 434 | return ImmutableList.of(ARP_FLOW_ENTRY); |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 435 | } else if (deviceId.equals(DUAL_LINK_1)) { |
| 436 | return ImmutableList.of(DUAL_LINK_1_GROUP_FLOW_ENTRY); |
| 437 | } else if (deviceId.equals(DUAL_LINK_2)) { |
| 438 | return ImmutableList.of(DUAL_LINK_1_GROUP_FLOW_ENTRY, DUAL_LINK_2_GROUP_FLOW_ENTRY); |
| 439 | } else if (deviceId.equals(DUAL_LINK_3)) { |
| 440 | return ImmutableList.of(DUAL_LINK_3_FLOW_ENTRY, DUAL_LINK_3_FLOW_ENTRY_2); |
Andrea Campanella | 8292ba6 | 2018-01-31 16:43:23 +0100 | [diff] [blame] | 441 | } else if (deviceId.equals(DEFERRED_1)) { |
| 442 | return ImmutableList.of(DEFERRED_FLOW_ENTRY, DEFERRED_CLEAR_FLOW_ENTRY); |
Andrea Campanella | 94c594a | 2018-02-06 18:58:40 +0100 | [diff] [blame] | 443 | } else if (deviceId.equals(HARDWARE_DEVICE_10)) { |
| 444 | return ImmutableList.of(HARDWARE_10_FLOW_ENTRY, HARDWARE_10_SECOND_FLOW_ENTRY, |
| 445 | HARDWARE_10_OUTPUT_FLOW_ENTRY); |
Andrea Campanella | 1445f7a | 2018-02-07 12:00:12 +0100 | [diff] [blame] | 446 | } else if (deviceId.equals(LLDP_FLOW_DEVICE)) { |
| 447 | return ImmutableList.of(LLDP_FLOW_ENTRY); |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 448 | } else if (deviceId.equals(MULTICAST_GROUP_FLOW_DEVICE)) { |
| 449 | return ImmutableList.of(MULTICAST_GROUP_FLOW_ENTRY); |
Andrea Campanella | 94dfb9e | 2018-02-27 12:36:00 +0100 | [diff] [blame] | 450 | } else if (deviceId.equals(NO_BUCKET_DEVICE)) { |
| 451 | return ImmutableList.of(NO_BUCKET_ENTRY); |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 452 | } else if (deviceId.equals(DUAL_HOME_DEVICE_1)) { |
| 453 | return ImmutableList.of(DUAL_HOME_FLOW_ENTRY); |
| 454 | } else if (deviceId.equals(DUAL_HOME_DEVICE_2) || deviceId.equals(DUAL_HOME_DEVICE_3)) { |
| 455 | return ImmutableList.of(DUAL_HOME_OUT_FLOW_ENTRY); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 456 | } |
| 457 | return ImmutableList.of(); |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | private class TestDriverService extends DriverServiceAdapter { |
| 462 | @Override |
| 463 | public Driver getDriver(DeviceId deviceId) { |
Andrea Campanella | 94c594a | 2018-02-06 18:58:40 +0100 | [diff] [blame] | 464 | if (deviceId.equals(HARDWARE_DEVICE) || deviceId.equals(HARDWARE_DEVICE_10)) { |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 465 | return new DefaultDriver("ofdpa", ImmutableList.of(), |
| 466 | "test", "test", "test", new HashMap<>(), new HashMap<>()); |
| 467 | } |
| 468 | return new DefaultDriver("NotHWDriver", ImmutableList.of(), |
| 469 | "test", "test", "test", new HashMap<>(), new HashMap<>()); |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | private class TestGroupService extends GroupServiceAdapter { |
| 474 | @Override |
| 475 | public Iterable<Group> getGroups(DeviceId deviceId) { |
| 476 | if (deviceId.equals(GROUP_FLOW_DEVICE)) { |
| 477 | return ImmutableList.of(GROUP); |
| 478 | } else if (deviceId.equals(TOPO_GROUP_FLOW_DEVICE)) { |
| 479 | return ImmutableList.of(TOPO_GROUP); |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 480 | } else if (deviceId.equals(DUAL_LINK_1) || deviceId.equals(DUAL_LINK_2)) { |
| 481 | return ImmutableList.of(DUAL_LINK_GROUP); |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 482 | } else if (deviceId.equals(MULTICAST_GROUP_FLOW_DEVICE)) { |
| 483 | return ImmutableList.of(MULTICAST_GROUP); |
Andrea Campanella | 94dfb9e | 2018-02-27 12:36:00 +0100 | [diff] [blame] | 484 | } else if (deviceId.equals(NO_BUCKET_DEVICE)) { |
| 485 | return ImmutableList.of(NO_BUCKET_GROUP); |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 486 | } else if (deviceId.equals(DUAL_HOME_DEVICE_1)) { |
| 487 | return ImmutableList.of(DUAL_HOME_GROUP); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 488 | } |
| 489 | return ImmutableList.of(); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | private class TestHostService extends HostServiceAdapter { |
| 494 | @Override |
| 495 | public Set<Host> getConnectedHosts(ConnectPoint connectPoint) { |
| 496 | if (connectPoint.equals(TOPO_FLOW_3_OUT_CP)) { |
| 497 | return ImmutableSet.of(H2); |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 498 | } else if (connectPoint.equals(DUAL_LINK_1_CP_2_OUT) || connectPoint.equals(DUAL_LINK_1_CP_3_OUT) || |
| 499 | connectPoint.equals(DUAL_LINK_2_CP_2_OUT) || connectPoint.equals(DUAL_LINK_2_CP_3_OUT)) { |
| 500 | return ImmutableSet.of(); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 501 | } |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 502 | if (connectPoint.equals(SINGLE_FLOW_OUT_CP) || |
| 503 | connectPoint.equals(DUAL_FLOW_OUT_CP) || |
| 504 | connectPoint.equals(GROUP_FLOW_OUT_CP) || |
| 505 | connectPoint.equals(HARDWARE_DEVICE_OUT_CP) || |
| 506 | connectPoint.equals(HARDWARE_DEVICE_10_OUT_CP) || |
| 507 | connectPoint.equals(DEFERRED_CP_2_OUT) || |
| 508 | connectPoint.equals(DUAL_LINK_3_CP_3_OUT)) { |
| 509 | return ImmutableSet.of(H1); |
| 510 | } |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 511 | if (connectPoint.equals(DUAL_HOME_CP_2_2) || connectPoint.equals(DUAL_HOME_CP_3_2)) { |
| 512 | return ImmutableSet.of(DUAL_HOME_H); |
| 513 | } |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 514 | return ImmutableSet.of(); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | @Override |
| 518 | public Set<Host> getHostsByMac(MacAddress mac) { |
| 519 | if (mac.equals(H1.mac())) { |
| 520 | return ImmutableSet.of(H1); |
| 521 | } else if (mac.equals(H2.mac())) { |
| 522 | return ImmutableSet.of(H2); |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 523 | } else if (mac.equals(DUAL_HOME_H.mac())) { |
| 524 | return ImmutableSet.of(DUAL_HOME_H); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 525 | } |
| 526 | return ImmutableSet.of(); |
| 527 | } |
| 528 | |
| 529 | @Override |
| 530 | public Set<Host> getHostsByIp(IpAddress ip) { |
| 531 | if ((H1.ipAddresses().contains(ip))) { |
| 532 | return ImmutableSet.of(H1); |
| 533 | } else if ((H2.ipAddresses().contains(ip))) { |
| 534 | return ImmutableSet.of(H2); |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 535 | } else if ((DUAL_HOME_H.ipAddresses().contains(ip))) { |
| 536 | return ImmutableSet.of(DUAL_HOME_H); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 537 | } |
| 538 | return ImmutableSet.of(); |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | private class TestLinkService extends LinkServiceAdapter { |
| 543 | @Override |
| 544 | public Set<Link> getEgressLinks(ConnectPoint connectPoint) { |
| 545 | if (connectPoint.equals(TOPO_FLOW_1_OUT_CP) |
| 546 | || connectPoint.equals(TOPO_FLOW_OUT_CP_1)) { |
| 547 | return ImmutableSet.of(DefaultLink.builder() |
| 548 | .providerId(ProviderId.NONE) |
| 549 | .type(Link.Type.DIRECT) |
| 550 | .src(connectPoint) |
| 551 | .dst(TOPO_FLOW_2_IN_CP) |
| 552 | .build()); |
| 553 | } else if (connectPoint.equals(TOPO_FLOW_2_OUT_CP)) { |
| 554 | return ImmutableSet.of(DefaultLink.builder() |
| 555 | .providerId(ProviderId.NONE) |
| 556 | .type(Link.Type.DIRECT) |
| 557 | .src(TOPO_FLOW_2_OUT_CP) |
| 558 | .dst(TOPO_FLOW_3_IN_CP) |
| 559 | .build()); |
| 560 | } else if (connectPoint.equals(TOPO_FLOW_OUT_CP_2)) { |
| 561 | return ImmutableSet.of(DefaultLink.builder() |
| 562 | .providerId(ProviderId.NONE) |
| 563 | .type(Link.Type.DIRECT) |
| 564 | .src(TOPO_FLOW_OUT_CP_2) |
| 565 | .dst(TOPO_FLOW_4_IN_CP) |
| 566 | .build()); |
| 567 | } else if (connectPoint.equals(TOPO_FLOW_4_OUT_CP)) { |
| 568 | return ImmutableSet.of(DefaultLink.builder() |
| 569 | .providerId(ProviderId.NONE) |
| 570 | .type(Link.Type.DIRECT) |
| 571 | .src(TOPO_FLOW_4_OUT_CP) |
| 572 | .dst(TOPO_FLOW_3_IN_2_CP) |
| 573 | .build()); |
Andrea Campanella | b022b5e | 2018-01-31 14:59:03 +0100 | [diff] [blame] | 574 | } else if (connectPoint.equals(DUAL_LINK_1_CP_2_OUT)) { |
| 575 | return ImmutableSet.of(DefaultLink.builder() |
| 576 | .providerId(ProviderId.NONE) |
| 577 | .type(Link.Type.DIRECT) |
| 578 | .src(DUAL_LINK_1_CP_2_OUT) |
| 579 | .dst(DUAL_LINK_2_CP_1_IN) |
| 580 | .build()); |
| 581 | } else if (connectPoint.equals(DUAL_LINK_1_CP_3_OUT)) { |
| 582 | return ImmutableSet.of(DefaultLink.builder() |
| 583 | .providerId(ProviderId.NONE) |
| 584 | .type(Link.Type.DIRECT) |
| 585 | .src(DUAL_LINK_1_CP_3_OUT) |
| 586 | .dst(DUAL_LINK_2_CP_4_IN) |
| 587 | .build()); |
| 588 | } else if (connectPoint.equals(DUAL_LINK_2_CP_2_OUT)) { |
| 589 | return ImmutableSet.of(DefaultLink.builder() |
| 590 | .providerId(ProviderId.NONE) |
| 591 | .type(Link.Type.DIRECT) |
| 592 | .src(DUAL_LINK_2_CP_2_OUT) |
| 593 | .dst(DUAL_LINK_3_CP_1_IN) |
| 594 | .build()); |
| 595 | } else if (connectPoint.equals(DUAL_LINK_2_CP_3_OUT)) { |
| 596 | return ImmutableSet.of(DefaultLink.builder() |
| 597 | .providerId(ProviderId.NONE) |
| 598 | .type(Link.Type.DIRECT) |
| 599 | .src(DUAL_LINK_2_CP_3_OUT) |
| 600 | .dst(DUAL_LINK_3_CP_2_IN) |
| 601 | .build()); |
Andrea Campanella | 4906ba7 | 2018-03-01 16:22:21 +0100 | [diff] [blame^] | 602 | } else if (connectPoint.equals(DUAL_HOME_CP_1_2)) { |
| 603 | return ImmutableSet.of(DefaultLink.builder() |
| 604 | .providerId(ProviderId.NONE) |
| 605 | .type(Link.Type.DIRECT) |
| 606 | .src(DUAL_HOME_CP_1_2) |
| 607 | .dst(DUAL_HOME_CP_2_1) |
| 608 | .build()); |
| 609 | } else if (connectPoint.equals(DUAL_HOME_CP_1_3)) { |
| 610 | return ImmutableSet.of(DefaultLink.builder() |
| 611 | .providerId(ProviderId.NONE) |
| 612 | .type(Link.Type.DIRECT) |
| 613 | .src(DUAL_HOME_CP_1_3) |
| 614 | .dst(DUAL_HOME_CP_3_1) |
| 615 | .build()); |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 616 | } |
| 617 | return ImmutableSet.of(); |
| 618 | } |
| 619 | } |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 620 | |
| 621 | private class TestDeviceService extends DeviceServiceAdapter { |
| 622 | @Override |
| 623 | public Device getDevice(DeviceId deviceId) { |
| 624 | if (deviceId.equals(DeviceId.deviceId("nonexistent"))) { |
| 625 | return null; |
| 626 | } |
| 627 | return new DefaultDevice(ProviderId.NONE, DeviceId.deviceId("test"), SWITCH, |
| 628 | "test", "test", "test", "test", new ChassisId(), |
| 629 | DefaultAnnotations.builder().set("foo", "bar").build()); |
| 630 | } |
| 631 | |
| 632 | @Override |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 633 | public Port getPort(ConnectPoint cp) { |
| 634 | return new DefaultPort(null, cp.port(), true, DefaultAnnotations.builder().build()); |
| 635 | } |
| 636 | |
| 637 | @Override |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 638 | public boolean isAvailable(DeviceId deviceId) { |
Andrea Campanella | 4c6170a | 2018-01-17 16:34:51 +0100 | [diff] [blame] | 639 | return !deviceId.equals(OFFLINE_DEVICE); |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | private class TestEdgePortService extends EdgePortServiceAdapter { |
| 644 | |
| 645 | @Override |
| 646 | public boolean isEdgePoint(ConnectPoint point) { |
| 647 | return point.equals(MULTICAST_OUT_CP) || |
| 648 | point.equals(MULTICAST_OUT_CP_2); |
Andrea Campanella | 17d4519 | 2018-01-18 17:11:42 +0100 | [diff] [blame] | 649 | } |
| 650 | } |
Andrea Campanella | 54923d6 | 2018-01-23 12:46:04 +0100 | [diff] [blame] | 651 | |
| 652 | private class TestMastershipService extends MastershipServiceAdapter { |
| 653 | @Override |
| 654 | public NodeId getMasterFor(DeviceId deviceId) { |
| 655 | return NodeId.nodeId(MASTER_1); |
| 656 | } |
| 657 | } |
Andrea Campanella | e408440 | 2017-12-15 15:27:31 +0100 | [diff] [blame] | 658 | } |