blob: 989b2979ef4c8ef51723955b205683ea59f512d0 [file] [log] [blame]
gaurav36785932016-03-10 17:24:04 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
gaurav36785932016-03-10 17:24:04 +05303 *
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 */
16package org.onosproject.routing.impl;
17
Jonathan Hartf04b7d92016-03-29 09:39:11 -070018import com.google.common.collect.Sets;
gaurav36785932016-03-10 17:24:04 +053019import org.easymock.EasyMock;
20import org.junit.Before;
21import org.junit.Test;
22import org.onlab.packet.Ethernet;
gaurav36785932016-03-10 17:24:04 +053023import org.onlab.packet.Ip4Prefix;
24import org.onlab.packet.IpAddress;
25import org.onlab.packet.IpPrefix;
26import org.onlab.packet.MacAddress;
27import org.onlab.packet.VlanId;
28import org.onosproject.TestApplicationId;
Jonathan Hartf04b7d92016-03-29 09:39:11 -070029import org.onosproject.cfg.ComponentConfigService;
gaurav36785932016-03-10 17:24:04 +053030import org.onosproject.core.ApplicationId;
31import org.onosproject.core.CoreService;
gaurav36785932016-03-10 17:24:04 +053032import org.onosproject.incubator.net.intf.Interface;
gaurav164cf6d2016-03-25 21:43:04 +053033import org.onosproject.incubator.net.intf.InterfaceListener;
gaurav36785932016-03-10 17:24:04 +053034import org.onosproject.incubator.net.intf.InterfaceService;
gaurav164cf6d2016-03-25 21:43:04 +053035import org.onosproject.incubator.net.intf.InterfaceServiceAdapter;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070036import org.onosproject.incubator.net.routing.ResolvedRoute;
37import org.onosproject.incubator.net.routing.RouteEvent;
38import org.onosproject.incubator.net.routing.RouteListener;
39import org.onosproject.incubator.net.routing.RouteServiceAdapter;
gaurav36785932016-03-10 17:24:04 +053040import org.onosproject.net.ConnectPoint;
41import org.onosproject.net.DeviceId;
42import org.onosproject.net.PortNumber;
43import org.onosproject.net.config.NetworkConfigService;
44import org.onosproject.net.device.DeviceListener;
45import org.onosproject.net.device.DeviceService;
46import org.onosproject.net.device.DeviceServiceAdapter;
47import org.onosproject.net.flow.DefaultTrafficSelector;
48import org.onosproject.net.flow.DefaultTrafficTreatment;
49import org.onosproject.net.flow.TrafficSelector;
50import org.onosproject.net.flow.TrafficTreatment;
51import org.onosproject.net.flowobjective.DefaultForwardingObjective;
52import org.onosproject.net.flowobjective.DefaultNextObjective;
53import org.onosproject.net.flowobjective.FlowObjectiveService;
54import org.onosproject.net.flowobjective.ForwardingObjective;
55import org.onosproject.net.flowobjective.NextObjective;
56import org.onosproject.net.host.InterfaceIpAddress;
gaurav36785932016-03-10 17:24:04 +053057import org.onosproject.routing.RoutingService;
gaurav36785932016-03-10 17:24:04 +053058import org.onosproject.routing.config.RouterConfig;
Jonathan Hartf04b7d92016-03-29 09:39:11 -070059import org.osgi.service.component.ComponentContext;
60
61import java.util.ArrayList;
62import java.util.Collections;
Jonathan Hartf04b7d92016-03-29 09:39:11 -070063import java.util.List;
64import java.util.Set;
65
66import static org.easymock.EasyMock.anyObject;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070067import static org.easymock.EasyMock.anyString;
Jonathan Hartf04b7d92016-03-29 09:39:11 -070068import static org.easymock.EasyMock.createMock;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070069import static org.easymock.EasyMock.createNiceMock;
70import static org.easymock.EasyMock.eq;
Jonathan Hartf04b7d92016-03-29 09:39:11 -070071import static org.easymock.EasyMock.expect;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070072import static org.easymock.EasyMock.expectLastCall;
Jonathan Hartf04b7d92016-03-29 09:39:11 -070073import static org.easymock.EasyMock.replay;
74import static org.easymock.EasyMock.reset;
75import static org.easymock.EasyMock.verify;
gaurav36785932016-03-10 17:24:04 +053076
77/**
78 * Unit tests for SingleSwitchFibInstaller.
79 */
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070080public class SingleSwitchFibInstallerTest {
gaurav36785932016-03-10 17:24:04 +053081
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070082 private static final DeviceId DEVICE_ID = DeviceId.deviceId("of:0000000000000001");
83
gaurav36785932016-03-10 17:24:04 +053084 private static final ConnectPoint SW1_ETH1 = new ConnectPoint(
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070085 DEVICE_ID, PortNumber.portNumber(1));
gaurav36785932016-03-10 17:24:04 +053086
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070087 private static final ConnectPoint SW1_ETH2 = new ConnectPoint(
88 DEVICE_ID, PortNumber.portNumber(2));
gaurav36785932016-03-10 17:24:04 +053089
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070090 private static final int NEXT_ID = 11;
gaurav36785932016-03-10 17:24:04 +053091
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070092 private static final VlanId VLAN1 = VlanId.vlanId((short) 1);
93 private static final MacAddress MAC1 = MacAddress.valueOf("00:00:00:00:00:01");
94 private static final MacAddress MAC2 = MacAddress.valueOf("00:00:00:00:00:02");
gaurav36785932016-03-10 17:24:04 +053095
Jonathan Harta2eb9ff2016-04-13 21:27:06 -070096 private static final IpPrefix PREFIX1 = Ip4Prefix.valueOf("1.1.1.0/24");
97 private static final IpAddress NEXT_HOP1 = IpAddress.valueOf("192.168.10.1");
98 private static final IpAddress NEXT_HOP2 = IpAddress.valueOf("192.168.20.1");
99 private static final InterfaceIpAddress INTF1 =
100 InterfaceIpAddress.valueOf("192.168.10.2/24");
101 private static final InterfaceIpAddress INTF2 =
102 InterfaceIpAddress.valueOf("192.168.20.2/24");
103
104
gaurav36785932016-03-10 17:24:04 +0530105 private final Set<Interface> interfaces = Sets.newHashSet();
106 private InterfaceService interfaceService;
107 private NetworkConfigService networkConfigService;
108 private FlowObjectiveService flowObjectiveService;
109 private DeviceService deviceService;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700110 private static final ApplicationId APPID = TestApplicationId.create("foo");
111
112 private RouteListener routeListener;
gaurav36785932016-03-10 17:24:04 +0530113 private DeviceListener deviceListener;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700114
gaurav36785932016-03-10 17:24:04 +0530115 private RouterConfig routerConfig;
gaurav164cf6d2016-03-25 21:43:04 +0530116 private SingleSwitchFibInstaller sSfibInstaller;
117 private InterfaceListener interfaceListener;
gaurav36785932016-03-10 17:24:04 +0530118
119 @Before
120 public void setUp() throws Exception {
gaurav36785932016-03-10 17:24:04 +0530121 sSfibInstaller = new SingleSwitchFibInstaller();
122
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700123 sSfibInstaller.componentConfigService = createNiceMock(ComponentConfigService.class);
gaurav36785932016-03-10 17:24:04 +0530124
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700125 ComponentContext mockContext = createNiceMock(ComponentContext.class);
gaurav36785932016-03-10 17:24:04 +0530126
gaurav36785932016-03-10 17:24:04 +0530127 routerConfig = new TestRouterConfig();
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700128 interfaceService = createMock(InterfaceService.class);
129
gaurav36785932016-03-10 17:24:04 +0530130 networkConfigService = createMock(NetworkConfigService.class);
131 flowObjectiveService = createMock(FlowObjectiveService.class);
132 deviceService = new TestDeviceService();
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700133 CoreService coreService = createNiceMock(CoreService.class);
134 expect(coreService.registerApplication(anyString())).andReturn(APPID);
135 replay(coreService);
gaurav36785932016-03-10 17:24:04 +0530136
137 sSfibInstaller.networkConfigService = networkConfigService;
138 sSfibInstaller.interfaceService = interfaceService;
139 sSfibInstaller.flowObjectiveService = flowObjectiveService;
140 sSfibInstaller.coreService = coreService;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700141 sSfibInstaller.routeService = new TestRouteService();
gaurav36785932016-03-10 17:24:04 +0530142 sSfibInstaller.deviceService = deviceService;
143
144 setUpNetworkConfigService();
145 setUpInterfaceService();
146 sSfibInstaller.activate(mockContext);
147 }
148
149 /**
150 * Sets up InterfaceService.
151 */
152 private void setUpInterfaceService() {
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700153 interfaceService.addListener(anyObject(InterfaceListener.class));
154 expectLastCall().andDelegateTo(new TestInterfaceService());
155
156 // Interface with no VLAN
157 Interface sw1Eth1 = new Interface("intf1", SW1_ETH1,
158 Collections.singletonList(INTF1), MAC1, VlanId.NONE);
159 expect(interfaceService.getMatchingInterface(NEXT_HOP1)).andReturn(sw1Eth1);
gaurav36785932016-03-10 17:24:04 +0530160 interfaces.add(sw1Eth1);
161
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700162 // Interface with a VLAN
163 Interface sw2Eth1 = new Interface("intf2", SW1_ETH2,
164 Collections.singletonList(INTF2), MAC2, VLAN1);
165 expect(interfaceService.getMatchingInterface(NEXT_HOP2)).andReturn(sw2Eth1);
gaurav36785932016-03-10 17:24:04 +0530166 interfaces.add(sw2Eth1);
167
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700168 expect(interfaceService.getInterfaces()).andReturn(interfaces);
gaurav36785932016-03-10 17:24:04 +0530169
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700170 replay(interfaceService);
gaurav36785932016-03-10 17:24:04 +0530171 }
172
173 /*
174 * Sets up NetworkConfigService.
Jonathan Hartf04b7d92016-03-29 09:39:11 -0700175 */
gaurav36785932016-03-10 17:24:04 +0530176 private void setUpNetworkConfigService() {
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700177 expect(networkConfigService.getConfig(
178 anyObject(ApplicationId.class), eq(RoutingService.ROUTER_CONFIG_CLASS))).
gaurav36785932016-03-10 17:24:04 +0530179 andReturn(routerConfig);
180 replay(networkConfigService);
181 }
182
183 /**
184 * Sets up FlowObjectiveService.
185 */
186 private void setUpFlowObjectiveService() {
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700187 expect(flowObjectiveService.allocateNextId()).andReturn(NEXT_ID);
gaurav36785932016-03-10 17:24:04 +0530188 replay(flowObjectiveService);
189 }
190
191 /**
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700192 * Creates a next objective with the given parameters.
gaurav36785932016-03-10 17:24:04 +0530193 *
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700194 * @param srcMac source MAC address
195 * @param dstMac destination MAC address
196 * @param port port number
197 * @param vlan vlan ID
198 * @param add whether to create an add objective or remove objective
199 * @return new next objective
gaurav36785932016-03-10 17:24:04 +0530200 */
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700201 private NextObjective createNextObjective(MacAddress srcMac,
202 MacAddress dstMac,
203 PortNumber port,
204 VlanId vlan,
205 boolean add) {
gaurav36785932016-03-10 17:24:04 +0530206 TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700207 .setEthSrc(srcMac)
208 .setEthDst(dstMac);
gaurav36785932016-03-10 17:24:04 +0530209 TrafficSelector.Builder metabuilder = null;
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700210 if (!vlan.equals(VlanId.NONE)) {
gaurav36785932016-03-10 17:24:04 +0530211 treatment.pushVlan()
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700212 .setVlanId(vlan)
213 .setVlanPcp((byte) 0);
gaurav36785932016-03-10 17:24:04 +0530214 } else {
215 metabuilder = DefaultTrafficSelector.builder();
216 metabuilder.matchVlanId(VlanId.vlanId(SingleSwitchFibInstaller.ASSIGNED_VLAN));
217 }
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700218
219 treatment.setOutput(port);
gaurav36785932016-03-10 17:24:04 +0530220 NextObjective.Builder nextBuilder = DefaultNextObjective.builder()
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700221 .withId(NEXT_ID)
gaurav36785932016-03-10 17:24:04 +0530222 .addTreatment(treatment.build())
223 .withType(NextObjective.Type.SIMPLE)
224 .fromApp(APPID);
225 if (metabuilder != null) {
226 nextBuilder.withMeta(metabuilder.build());
227 }
228
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700229 return add ? nextBuilder.add() : nextBuilder.remove();
230 }
gaurav36785932016-03-10 17:24:04 +0530231
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700232 /**
233 * Creates a new forwarding objective with the given parameters.
234 *
235 * @param prefix IP prefix
236 * @param add whether to create an add objective or a remove objective
237 * @return new forwarding objective
238 */
239 private ForwardingObjective createForwardingObjective(IpPrefix prefix,
240 boolean add) {
gaurav36785932016-03-10 17:24:04 +0530241 TrafficSelector selector = DefaultTrafficSelector.builder()
242 .matchEthType(Ethernet.TYPE_IPV4)
243 .matchIPDst(prefix)
244 .build();
245
246 int priority = prefix.prefixLength() * 5 + 100;
247 ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder()
248 .fromApp(APPID)
249 .makePermanent()
250 .withSelector(selector)
251 .withPriority(priority)
252 .withFlag(ForwardingObjective.Flag.SPECIFIC);
253
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700254 if (add) {
255 fwdBuilder.nextStep(NEXT_ID);
256 } else {
257 fwdBuilder.withTreatment(DefaultTrafficTreatment.builder().build());
258 }
259
260 return add ? fwdBuilder.add() : fwdBuilder.remove();
261 }
262
263 /**
264 * Tests adding a route.
265 *
266 * We verify that the flowObjectiveService records the correct state and that the
267 * correct flow is submitted to the flowObjectiveService.
268 */
269 @Test
270 public void testRouteAdd() {
271 ResolvedRoute resolvedRoute = new ResolvedRoute(PREFIX1, NEXT_HOP1, MAC1);
272
273 // Create the next objective
274 NextObjective nextObjective = createNextObjective(MAC1, MAC1, SW1_ETH1.port(), VlanId.NONE, true);
275 flowObjectiveService.next(DEVICE_ID, nextObjective);
276
277 // Create the flow objective
278 ForwardingObjective fwd = createForwardingObjective(PREFIX1, true);
279 flowObjectiveService.forward(DEVICE_ID, fwd);
gaurav36785932016-03-10 17:24:04 +0530280 EasyMock.expectLastCall().once();
281 setUpFlowObjectiveService();
282
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700283 // Send in the add event
284 RouteEvent routeEvent = new RouteEvent(RouteEvent.Type.ROUTE_ADDED, resolvedRoute);
285 routeListener.event(routeEvent);
gaurav36785932016-03-10 17:24:04 +0530286 verify(flowObjectiveService);
287 }
288
289 /**
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700290 * Tests adding a route with to a next hop in a VLAN.
gaurav36785932016-03-10 17:24:04 +0530291 *
292 * We verify that the flowObjectiveService records the correct state and that the
293 * correct flowObjectiveService is submitted to the flowObjectiveService.
294 */
295 @Test
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700296 public void testRouteAddWithVlan() {
297 ResolvedRoute route = new ResolvedRoute(PREFIX1, NEXT_HOP2, MAC2);
gaurav36785932016-03-10 17:24:04 +0530298
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700299 // Create the next objective
300 NextObjective nextObjective = createNextObjective(MAC2, MAC2, SW1_ETH2.port(), VLAN1, true);
301 flowObjectiveService.next(DEVICE_ID, nextObjective);
gaurav36785932016-03-10 17:24:04 +0530302
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700303 // Create the flow objective
304 ForwardingObjective fwd = createForwardingObjective(PREFIX1, true);
305 flowObjectiveService.forward(DEVICE_ID, fwd);
gaurav36785932016-03-10 17:24:04 +0530306 EasyMock.expectLastCall().once();
307 setUpFlowObjectiveService();
308
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700309 // Send in the add event
310 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_ADDED, route));
gaurav36785932016-03-10 17:24:04 +0530311
312 verify(flowObjectiveService);
313 }
314
315 /**
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700316 * Tests updating a route.
gaurav36785932016-03-10 17:24:04 +0530317 *
318 * We verify that the flowObjectiveService records the correct state and that the
319 * correct flow is submitted to the flowObjectiveService.
320 */
321 @Test
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700322 public void testRouteUpdate() {
gaurav36785932016-03-10 17:24:04 +0530323 // Firstly add a route
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700324 testRouteAdd();
gaurav36785932016-03-10 17:24:04 +0530325 reset(flowObjectiveService);
gaurav36785932016-03-10 17:24:04 +0530326
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700327 ResolvedRoute route = new ResolvedRoute(PREFIX1, NEXT_HOP2, MAC2);
gaurav36785932016-03-10 17:24:04 +0530328
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700329 // Create the next objective
330 NextObjective nextObjective = createNextObjective(MAC2, MAC2, SW1_ETH2.port(), VLAN1, true);
331 flowObjectiveService.next(DEVICE_ID, nextObjective);
gaurav36785932016-03-10 17:24:04 +0530332
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700333 // Create the flow objective
334 ForwardingObjective fwd = createForwardingObjective(PREFIX1, true);
335 flowObjectiveService.forward(DEVICE_ID, fwd);
gaurav36785932016-03-10 17:24:04 +0530336 EasyMock.expectLastCall().once();
337 setUpFlowObjectiveService();
338
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700339 // Send in the update event
340 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_UPDATED, route));
gaurav36785932016-03-10 17:24:04 +0530341
342 verify(flowObjectiveService);
343 }
344
Jonathan Hartf04b7d92016-03-29 09:39:11 -0700345 /**
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700346 * Tests deleting a route.
gaurav36785932016-03-10 17:24:04 +0530347 *
348 * We verify that the flowObjectiveService records the correct state and that the
349 * correct flow is withdrawn from the flowObjectiveService.
350 */
gaurav36785932016-03-10 17:24:04 +0530351 @Test
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700352 public void testRouteDelete() {
gaurav36785932016-03-10 17:24:04 +0530353 // Firstly add a route
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700354 testRouteAdd();
gaurav36785932016-03-10 17:24:04 +0530355
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700356 // Construct the existing route
357 ResolvedRoute route = new ResolvedRoute(PREFIX1, null, null);
gaurav36785932016-03-10 17:24:04 +0530358
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700359 // Create the flow objective
gaurav36785932016-03-10 17:24:04 +0530360 reset(flowObjectiveService);
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700361 ForwardingObjective fwd = createForwardingObjective(PREFIX1, false);
362 flowObjectiveService.forward(DEVICE_ID, fwd);
gaurav36785932016-03-10 17:24:04 +0530363 replay(flowObjectiveService);
364
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700365 // Send in the delete event
366 routeListener.event(new RouteEvent(RouteEvent.Type.ROUTE_REMOVED, route));
gaurav36785932016-03-10 17:24:04 +0530367
368 verify(flowObjectiveService);
369 }
370
gaurav164cf6d2016-03-25 21:43:04 +0530371 private class TestInterfaceService extends InterfaceServiceAdapter {
gaurav164cf6d2016-03-25 21:43:04 +0530372 @Override
373 public void addListener(InterfaceListener listener) {
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700374 interfaceListener = listener;
gaurav164cf6d2016-03-25 21:43:04 +0530375 }
376 }
377
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700378 private class TestRouteService extends RouteServiceAdapter {
gaurav36785932016-03-10 17:24:04 +0530379 @Override
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700380 public void addListener(RouteListener listener) {
381 SingleSwitchFibInstallerTest.this.routeListener = listener;
gaurav36785932016-03-10 17:24:04 +0530382 }
383 }
384
385 private class TestRouterConfig extends RouterConfig {
386
387 @Override
388 public List<String> getInterfaces() {
389 ArrayList<String> interfaces = new ArrayList<>();
390 interfaces.add("of:0000000000000001/1");
Jonathan Harta2eb9ff2016-04-13 21:27:06 -0700391 interfaces.add("of:0000000000000001/2");
gaurav36785932016-03-10 17:24:04 +0530392 return interfaces;
393 }
394
395 @Override
396 public ConnectPoint getControlPlaneConnectPoint() {
397 return SW1_ETH1;
398 }
399
400 @Override
401 public boolean getOspfEnabled() {
402 return true;
403 }
404 }
405
406 private class TestDeviceService extends DeviceServiceAdapter {
407
408 @Override
409 public boolean isAvailable(DeviceId deviceId) {
410 return true;
411 }
412
413 @Override
414 public void addListener(DeviceListener listener) {
415 SingleSwitchFibInstallerTest.this.deviceListener = listener;
416 }
417 }
418}