use of org.onosproject.net.device.DeviceListener in project onos by opennetworkinglab.
the class ControlPlaneRedirectManagerTest method setUp.
@Before
public void setUp() {
networkConfigListener = createMock(NetworkConfigListener.class);
deviceService = new TestDeviceService();
deviceListener = createMock(DeviceListener.class);
interfaceListener = createMock(InterfaceListener.class);
deviceService.addListener(deviceListener);
setUpInterfaceService();
interfaceService = new InternalInterfaceService();
interfaceService.addListener(interfaceListener);
networkConfigService = new TestNetworkConfigService();
networkConfigService.addListener(networkConfigListener);
flowObjectiveService = createMock(FlowObjectiveService.class);
applicationService = createNiceMock(ApplicationService.class);
replay(applicationService);
setUpFlowObjectiveService();
controlPlaneRedirectManager.coreService = coreService;
controlPlaneRedirectManager.flowObjectiveService = flowObjectiveService;
controlPlaneRedirectManager.networkConfigService = networkConfigService;
controlPlaneRedirectManager.interfaceService = interfaceService;
controlPlaneRedirectManager.deviceService = deviceService;
controlPlaneRedirectManager.hostService = createNiceMock(HostService.class);
controlPlaneRedirectManager.mastershipService = mastershipService;
controlPlaneRedirectManager.applicationService = applicationService;
controlPlaneRedirectManager.activate(new ComponentContextAdapter());
verify(flowObjectiveService);
}
use of org.onosproject.net.device.DeviceListener in project onos by opennetworkinglab.
the class ArtemisDeaggregatorImpl method activate.
@Activate
protected void activate() {
rulesInstalled = false;
// FIXME: add other type of BGP Speakers when Dynamic Configuration is available
bgpSpeakers.add(new QuaggaBgpSpeakers(bgpInfoService));
moasServer = new MoasServerController();
moasServer.start(moasAgent, packetProcessor);
deviceService.addListener(deviceListener);
appId = coreService.getAppId("org.onosproject.artemis");
// enable OVSDB for the switches that we will install the GRE tunnel
artemisService.getConfig().ifPresent(config -> config.moasInfo().getTunnelPoints().forEach(tunnelPoint -> ovsdbController.connect(tunnelPoint.getOvsdbIp(), TpPort.tpPort(6640))));
artemisService.addListener(artemisEventListener);
log.info("Artemis Deaggregator Service Started");
/*
log.info("interfaces {}", interfaceService.getInterfaces());
[{
"name": "",
"connectPoint": "of:000000000000000a/2",
"ipAddresses": "[1.1.1.1/30]",
"macAddress": "00:00:00:00:00:01"
},
{
"name": "",
"connectPoint": "of:000000000000000a/3",
"ipAddresses": "[10.0.0.1/8]",
"macAddress": "00:00:00:00:00:01"
}]
*/
}
use of org.onosproject.net.device.DeviceListener in project onos by opennetworkinglab.
the class FlowObjectiveManagerTest method deviceUpEvent.
/**
* Tests receipt of a device up event.
*
* @throws TestUtilsException if lookup of a field fails
*/
@Test
public void deviceUpEvent() throws TestUtilsException {
TrafficSelector selector = DefaultTrafficSelector.emptySelector();
TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, d2);
DeviceListener listener = TestUtils.getField(manager, "deviceListener");
assertThat(listener, notNullValue());
listener.event(event);
ForwardingObjective forward = DefaultForwardingObjective.builder().fromApp(NetTestTools.APP_ID).withFlag(ForwardingObjective.Flag.SPECIFIC).withSelector(selector).withTreatment(treatment).makePermanent().add();
manager.forward(id2, forward);
// new device should have an objective now
TestTools.assertAfter(RETRY_MS, () -> assertThat(forwardingObjectives, hasSize(1)));
assertThat(forwardingObjectives, hasItem("of:d2"));
assertThat(filteringObjectives, hasSize(0));
assertThat(nextObjectives, hasSize(0));
}
Aggregations