Search in sources :

Example 1 with FlowObjectiveService

use of org.onosproject.net.flowobjective.FlowObjectiveService 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);
}
Also used : HostService(org.onosproject.net.host.HostService) DeviceListener(org.onosproject.net.device.DeviceListener) ComponentContextAdapter(org.onlab.osgi.ComponentContextAdapter) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) InterfaceListener(org.onosproject.net.intf.InterfaceListener) ApplicationService(org.onosproject.app.ApplicationService) Before(org.junit.Before)

Example 2 with FlowObjectiveService

use of org.onosproject.net.flowobjective.FlowObjectiveService in project onos by opennetworkinglab.

the class FibInstallerTest method setUp.

@Before
public void setUp() throws Exception {
    sSfibInstaller = new FibInstaller();
    sSfibInstaller.componentConfigService = createNiceMock(ComponentConfigService.class);
    ComponentContext mockContext = createNiceMock(ComponentContext.class);
    routerConfig = new TestRouterConfig();
    interfaceService = createMock(InterfaceService.class);
    networkConfigService = createMock(NetworkConfigService.class);
    networkConfigService.addListener(anyObject(NetworkConfigListener.class));
    expectLastCall().anyTimes();
    networkConfigRegistry = createMock(NetworkConfigRegistry.class);
    flowObjectiveService = createMock(FlowObjectiveService.class);
    applicationService = createNiceMock(ApplicationService.class);
    replay(applicationService);
    deviceService = new TestDeviceService();
    CoreService coreService = createNiceMock(CoreService.class);
    expect(coreService.registerApplication(anyString())).andReturn(APPID).anyTimes();
    replay(coreService);
    sSfibInstaller.networkConfigService = networkConfigService;
    sSfibInstaller.networkConfigRegistry = networkConfigRegistry;
    sSfibInstaller.interfaceService = interfaceService;
    sSfibInstaller.flowObjectiveService = flowObjectiveService;
    sSfibInstaller.applicationService = applicationService;
    sSfibInstaller.coreService = coreService;
    sSfibInstaller.routeService = new TestRouteService();
    sSfibInstaller.deviceService = deviceService;
    setUpNetworkConfigService();
    setUpInterfaceService();
    sSfibInstaller.activate(mockContext);
}
Also used : ComponentConfigService(org.onosproject.cfg.ComponentConfigService) ComponentContext(org.osgi.service.component.ComponentContext) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) CoreService(org.onosproject.core.CoreService) InterfaceService(org.onosproject.net.intf.InterfaceService) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) ApplicationService(org.onosproject.app.ApplicationService) Before(org.junit.Before)

Example 3 with FlowObjectiveService

use of org.onosproject.net.flowobjective.FlowObjectiveService in project onos by opennetworkinglab.

the class DhcpRelayManagerTest method testRemoveIgnoreVlan.

/**
 * "IgnoreVlan" policy should be removed when the config removed.
 */
@Test
public void testRemoveIgnoreVlan() {
    v4Handler.ignoredVlans.put(DEV_1_ID, IGNORED_VLAN);
    v4Handler.ignoredVlans.put(DEV_2_ID, IGNORED_VLAN);
    v6Handler.ignoredVlans.put(DEV_1_ID, IGNORED_VLAN);
    v6Handler.ignoredVlans.put(DEV_2_ID, IGNORED_VLAN);
    IgnoreDhcpConfig config = new IgnoreDhcpConfig();
    Capture<Objective> capturedFromDev1 = newCapture(CaptureType.ALL);
    flowObjectiveService.apply(eq(DEV_1_ID), capture(capturedFromDev1));
    expectLastCall().times(DHCP_SELECTORS.size());
    Capture<Objective> capturedFromDev2 = newCapture(CaptureType.ALL);
    flowObjectiveService.apply(eq(DEV_2_ID), capture(capturedFromDev2));
    expectLastCall().times(DHCP_SELECTORS.size());
    replay(flowObjectiveService);
    manager.removeConfig(config);
    verify(flowObjectiveService);
    List<Objective> objectivesFromDev1 = capturedFromDev1.getValues();
    List<Objective> objectivesFromDev2 = capturedFromDev2.getValues();
    assertTrue(objectivesFromDev1.containsAll(objectivesFromDev2));
    assertTrue(objectivesFromDev2.containsAll(objectivesFromDev1));
    for (int index = 0; index < objectivesFromDev1.size(); index++) {
        TrafficSelector selector = DefaultTrafficSelector.builder(DHCP_SELECTORS.get(index)).matchVlanId(IGNORED_VLAN).build();
        ForwardingObjective fwd = (ForwardingObjective) objectivesFromDev1.get(index);
        assertEquals(selector, fwd.selector());
        assertEquals(DefaultTrafficTreatment.emptyTreatment(), fwd.treatment());
        assertEquals(IGNORE_CONTROL_PRIORITY, fwd.priority());
        assertEquals(ForwardingObjective.Flag.VERSATILE, fwd.flag());
        assertEquals(Objective.Operation.REMOVE, fwd.op());
        fwd.context().ifPresent(ctx -> {
            ctx.onSuccess(fwd);
        });
    }
    objectivesFromDev2.forEach(obj -> obj.context().ifPresent(ctx -> ctx.onSuccess(obj)));
    assertEquals(0, v4Handler.ignoredVlans.size());
    assertEquals(0, v6Handler.ignoredVlans.size());
}
Also used : NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) Dhcp6IaPdOption(org.onlab.packet.dhcp.Dhcp6IaPdOption) DeviceService(org.onosproject.net.device.DeviceService) ARP(org.onlab.packet.ARP) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) InterfaceServiceAdapter(org.onosproject.net.intf.InterfaceServiceAdapter) Pair(org.apache.commons.lang3.tuple.Pair) IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) JsonNode(com.fasterxml.jackson.databind.JsonNode) DhcpRelayCounters(org.onosproject.dhcprelay.store.DhcpRelayCounters) Dhcp6IaNaOption(org.onlab.packet.dhcp.Dhcp6IaNaOption) Ip6Address(org.onlab.packet.Ip6Address) DhcpRelayStore(org.onosproject.dhcprelay.store.DhcpRelayStore) Ip4Address(org.onlab.packet.Ip4Address) Set(java.util.Set) StoreDelegate(org.onosproject.store.StoreDelegate) DeviceEvent(org.onosproject.net.device.DeviceEvent) DhcpServerConfig(org.onosproject.dhcprelay.config.DhcpServerConfig) DeviceId(org.onosproject.net.DeviceId) Dictionary(java.util.Dictionary) Pipeliner(org.onosproject.net.behaviour.Pipeliner) Host(org.onosproject.net.Host) ComponentContext(org.osgi.service.component.ComponentContext) HostService(org.onosproject.net.host.HostService) ArrayList(java.util.ArrayList) Dhcp6InterfaceIdOption(org.onlab.packet.dhcp.Dhcp6InterfaceIdOption) DhcpRelayStoreEvent(org.onosproject.dhcprelay.store.DhcpRelayStoreEvent) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DeserializationException(org.onlab.packet.DeserializationException) CircuitId(org.onlab.packet.dhcp.CircuitId) DhcpRelayAgentOption(org.onlab.packet.dhcp.DhcpRelayAgentOption) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Before(org.junit.Before) Charsets(org.apache.commons.io.Charsets) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Capture(org.easymock.Capture) Resources(com.google.common.io.Resources) VlanId(org.onlab.packet.VlanId) Test(org.junit.Test) IOException(java.io.IOException) EasyMock(org.easymock.EasyMock) Dhcp6IaAddressOption(org.onlab.packet.dhcp.Dhcp6IaAddressOption) IPv6(org.onlab.packet.IPv6) IPv4(org.onlab.packet.IPv4) DHCP6(org.onlab.packet.DHCP6) DhcpRecord(org.onosproject.dhcprelay.store.DhcpRecord) Objective(org.onosproject.net.flowobjective.Objective) MacAddress(org.onlab.packet.MacAddress) Dhcp6Duid(org.onlab.packet.dhcp.Dhcp6Duid) DHCP(org.onlab.packet.DHCP) Assert(org.junit.Assert) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig) Route(org.onosproject.routeservice.Route) HostLocation(org.onosproject.net.HostLocation) Interface(org.onosproject.net.intf.Interface) TestApplicationId(org.onosproject.TestApplicationId) CoreService(org.onosproject.core.CoreService) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) Dhcp6ClientIdOption(org.onlab.packet.dhcp.Dhcp6ClientIdOption) ByteBuffer(java.nio.ByteBuffer) Ethernet(org.onlab.packet.Ethernet) HostProviderService(org.onosproject.net.host.HostProviderService) Dhcp6IaPrefixOption(org.onlab.packet.dhcp.Dhcp6IaPrefixOption) After(org.junit.After) ImmutableSet(com.google.common.collect.ImmutableSet) Device(org.onosproject.net.Device) Collection(java.util.Collection) PacketProcessor(org.onosproject.net.packet.PacketProcessor) Streams(com.google.common.collect.Streams) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) TestTools.assertAfter(org.onlab.junit.TestTools.assertAfter) IndirectDhcpRelayConfig(org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig) List(java.util.List) InboundPacket(org.onosproject.net.packet.InboundPacket) PacketContext(org.onosproject.net.packet.PacketContext) Optional(java.util.Optional) HostDescription(org.onosproject.net.host.HostDescription) IpPrefix(org.onlab.packet.IpPrefix) PacketContextAdapter(org.onosproject.net.packet.PacketContextAdapter) RouteStoreAdapter(org.onosproject.routeservice.RouteStoreAdapter) Dhcp6RelayOption(org.onlab.packet.dhcp.Dhcp6RelayOption) DhcpRelayCountersStore(org.onosproject.dhcprelay.store.DhcpRelayCountersStore) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) DefaultHost(org.onosproject.net.DefaultHost) ImmutableList(com.google.common.collect.ImmutableList) OutboundPacket(org.onosproject.net.packet.OutboundPacket) PacketServiceAdapter(org.onosproject.net.packet.PacketServiceAdapter) HostId(org.onosproject.net.HostId) DHCP_RELAY_APP(org.onosproject.dhcprelay.DhcpRelayManager.DHCP_RELAY_APP) IpAddress(org.onlab.packet.IpAddress) DefaultInboundPacket(org.onosproject.net.packet.DefaultInboundPacket) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Dhcp6Option(org.onlab.packet.dhcp.Dhcp6Option) Maps(com.google.common.collect.Maps) UDP(org.onlab.packet.UDP) DhcpOption(org.onlab.packet.dhcp.DhcpOption) CaptureType(org.easymock.CaptureType) PacketPriority(org.onosproject.net.packet.PacketPriority) IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) Objective(org.onosproject.net.flowobjective.Objective) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) ConnectPoint(org.onosproject.net.ConnectPoint) Test(org.junit.Test)

Example 4 with FlowObjectiveService

use of org.onosproject.net.flowobjective.FlowObjectiveService in project onos by opennetworkinglab.

the class DhcpRelayManagerTest method testIgnoreUnknownDevice.

/**
 * Should ignore ignore rules installation when device not available.
 */
@Test
public void testIgnoreUnknownDevice() throws IOException {
    reset(manager.deviceService);
    Device device = createNiceMock(Device.class);
    expect(device.is(Pipeliner.class)).andReturn(true).anyTimes();
    expect(manager.deviceService.getDevice(DEV_1_ID)).andReturn(device).anyTimes();
    expect(manager.deviceService.getDevice(DEV_2_ID)).andReturn(null).anyTimes();
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(Resources.getResource(CONFIG_FILE_PATH));
    IgnoreDhcpConfig config = new IgnoreDhcpConfig();
    json = json.path("apps").path(DHCP_RELAY_APP).path(IgnoreDhcpConfig.KEY);
    config.init(APP_ID, IgnoreDhcpConfig.KEY, json, om, null);
    Capture<Objective> capturedFromDev1 = newCapture(CaptureType.ALL);
    flowObjectiveService.apply(eq(DEV_1_ID), capture(capturedFromDev1));
    expectLastCall().times(DHCP_SELECTORS.size());
    replay(flowObjectiveService, manager.deviceService, device);
    manager.updateConfig(config);
    capturedFromDev1.getValues().forEach(obj -> obj.context().ifPresent(ctx -> ctx.onSuccess(obj)));
    assertEquals(1, v4Handler.ignoredVlans.size());
    assertEquals(1, v6Handler.ignoredVlans.size());
}
Also used : NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) Dhcp6IaPdOption(org.onlab.packet.dhcp.Dhcp6IaPdOption) DeviceService(org.onosproject.net.device.DeviceService) ARP(org.onlab.packet.ARP) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) InterfaceServiceAdapter(org.onosproject.net.intf.InterfaceServiceAdapter) Pair(org.apache.commons.lang3.tuple.Pair) IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) JsonNode(com.fasterxml.jackson.databind.JsonNode) DhcpRelayCounters(org.onosproject.dhcprelay.store.DhcpRelayCounters) Dhcp6IaNaOption(org.onlab.packet.dhcp.Dhcp6IaNaOption) Ip6Address(org.onlab.packet.Ip6Address) DhcpRelayStore(org.onosproject.dhcprelay.store.DhcpRelayStore) Ip4Address(org.onlab.packet.Ip4Address) Set(java.util.Set) StoreDelegate(org.onosproject.store.StoreDelegate) DeviceEvent(org.onosproject.net.device.DeviceEvent) DhcpServerConfig(org.onosproject.dhcprelay.config.DhcpServerConfig) DeviceId(org.onosproject.net.DeviceId) Dictionary(java.util.Dictionary) Pipeliner(org.onosproject.net.behaviour.Pipeliner) Host(org.onosproject.net.Host) ComponentContext(org.osgi.service.component.ComponentContext) HostService(org.onosproject.net.host.HostService) ArrayList(java.util.ArrayList) Dhcp6InterfaceIdOption(org.onlab.packet.dhcp.Dhcp6InterfaceIdOption) DhcpRelayStoreEvent(org.onosproject.dhcprelay.store.DhcpRelayStoreEvent) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DeserializationException(org.onlab.packet.DeserializationException) CircuitId(org.onlab.packet.dhcp.CircuitId) DhcpRelayAgentOption(org.onlab.packet.dhcp.DhcpRelayAgentOption) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Before(org.junit.Before) Charsets(org.apache.commons.io.Charsets) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Capture(org.easymock.Capture) Resources(com.google.common.io.Resources) VlanId(org.onlab.packet.VlanId) Test(org.junit.Test) IOException(java.io.IOException) EasyMock(org.easymock.EasyMock) Dhcp6IaAddressOption(org.onlab.packet.dhcp.Dhcp6IaAddressOption) IPv6(org.onlab.packet.IPv6) IPv4(org.onlab.packet.IPv4) DHCP6(org.onlab.packet.DHCP6) DhcpRecord(org.onosproject.dhcprelay.store.DhcpRecord) Objective(org.onosproject.net.flowobjective.Objective) MacAddress(org.onlab.packet.MacAddress) Dhcp6Duid(org.onlab.packet.dhcp.Dhcp6Duid) DHCP(org.onlab.packet.DHCP) Assert(org.junit.Assert) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig) Route(org.onosproject.routeservice.Route) HostLocation(org.onosproject.net.HostLocation) Interface(org.onosproject.net.intf.Interface) TestApplicationId(org.onosproject.TestApplicationId) CoreService(org.onosproject.core.CoreService) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) Dhcp6ClientIdOption(org.onlab.packet.dhcp.Dhcp6ClientIdOption) ByteBuffer(java.nio.ByteBuffer) Ethernet(org.onlab.packet.Ethernet) HostProviderService(org.onosproject.net.host.HostProviderService) Dhcp6IaPrefixOption(org.onlab.packet.dhcp.Dhcp6IaPrefixOption) After(org.junit.After) ImmutableSet(com.google.common.collect.ImmutableSet) Device(org.onosproject.net.Device) Collection(java.util.Collection) PacketProcessor(org.onosproject.net.packet.PacketProcessor) Streams(com.google.common.collect.Streams) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) TestTools.assertAfter(org.onlab.junit.TestTools.assertAfter) IndirectDhcpRelayConfig(org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig) List(java.util.List) InboundPacket(org.onosproject.net.packet.InboundPacket) PacketContext(org.onosproject.net.packet.PacketContext) Optional(java.util.Optional) HostDescription(org.onosproject.net.host.HostDescription) IpPrefix(org.onlab.packet.IpPrefix) PacketContextAdapter(org.onosproject.net.packet.PacketContextAdapter) RouteStoreAdapter(org.onosproject.routeservice.RouteStoreAdapter) Dhcp6RelayOption(org.onlab.packet.dhcp.Dhcp6RelayOption) DhcpRelayCountersStore(org.onosproject.dhcprelay.store.DhcpRelayCountersStore) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) DefaultHost(org.onosproject.net.DefaultHost) ImmutableList(com.google.common.collect.ImmutableList) OutboundPacket(org.onosproject.net.packet.OutboundPacket) PacketServiceAdapter(org.onosproject.net.packet.PacketServiceAdapter) HostId(org.onosproject.net.HostId) DHCP_RELAY_APP(org.onosproject.dhcprelay.DhcpRelayManager.DHCP_RELAY_APP) IpAddress(org.onlab.packet.IpAddress) DefaultInboundPacket(org.onosproject.net.packet.DefaultInboundPacket) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Dhcp6Option(org.onlab.packet.dhcp.Dhcp6Option) Maps(com.google.common.collect.Maps) UDP(org.onlab.packet.UDP) DhcpOption(org.onlab.packet.dhcp.DhcpOption) CaptureType(org.easymock.CaptureType) PacketPriority(org.onosproject.net.packet.PacketPriority) IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) Objective(org.onosproject.net.flowobjective.Objective) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) Pipeliner(org.onosproject.net.behaviour.Pipeliner) Device(org.onosproject.net.Device) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 5 with FlowObjectiveService

use of org.onosproject.net.flowobjective.FlowObjectiveService in project onos by opennetworkinglab.

the class DhcpRelayManagerTest method testInstallIgnoreRuleWhenDeviceComesUp.

/**
 * Should try install ignore rules when device comes up.
 */
@Test
public void testInstallIgnoreRuleWhenDeviceComesUp() throws IOException {
    ObjectMapper om = new ObjectMapper();
    JsonNode json = om.readTree(Resources.getResource(CONFIG_FILE_PATH));
    IgnoreDhcpConfig config = new IgnoreDhcpConfig();
    json = json.path("apps").path(DHCP_RELAY_APP).path(IgnoreDhcpConfig.KEY);
    config.init(APP_ID, IgnoreDhcpConfig.KEY, json, om, null);
    reset(manager.cfgService, flowObjectiveService, manager.deviceService);
    expect(manager.cfgService.getConfig(APP_ID, IgnoreDhcpConfig.class)).andReturn(config).anyTimes();
    Device device = createNiceMock(Device.class);
    expect(device.is(Pipeliner.class)).andReturn(true).anyTimes();
    expect(device.id()).andReturn(DEV_1_ID).anyTimes();
    expect(manager.deviceService.getDevice(DEV_1_ID)).andReturn(device).anyTimes();
    DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device);
    Capture<Objective> capturedFromDev1 = newCapture(CaptureType.ALL);
    flowObjectiveService.apply(eq(DEV_1_ID), capture(capturedFromDev1));
    expectLastCall().times(DHCP_SELECTORS.size());
    replay(manager.cfgService, flowObjectiveService, manager.deviceService, device);
    manager.deviceListener.event(event);
    // Wait until all flow objective events are captured before triggering onSuccess
    int expectFlowObjCount = Dhcp4HandlerImpl.DHCP_SELECTORS.size() + Dhcp6HandlerImpl.DHCP_SELECTORS.size();
    assertAfter(EVENT_PROCESSING_MS, () -> assertEquals(expectFlowObjCount, capturedFromDev1.getValues().size()));
    capturedFromDev1.getValues().forEach(obj -> obj.context().ifPresent(ctx -> ctx.onSuccess(obj)));
    assertAfter(EVENT_PROCESSING_MS, () -> assertEquals(1, v4Handler.ignoredVlans.size()));
    assertAfter(EVENT_PROCESSING_MS, () -> assertEquals(1, v6Handler.ignoredVlans.size()));
}
Also used : NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) Dhcp6IaPdOption(org.onlab.packet.dhcp.Dhcp6IaPdOption) DeviceService(org.onosproject.net.device.DeviceService) ARP(org.onlab.packet.ARP) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) InterfaceServiceAdapter(org.onosproject.net.intf.InterfaceServiceAdapter) Pair(org.apache.commons.lang3.tuple.Pair) IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) JsonNode(com.fasterxml.jackson.databind.JsonNode) DhcpRelayCounters(org.onosproject.dhcprelay.store.DhcpRelayCounters) Dhcp6IaNaOption(org.onlab.packet.dhcp.Dhcp6IaNaOption) Ip6Address(org.onlab.packet.Ip6Address) DhcpRelayStore(org.onosproject.dhcprelay.store.DhcpRelayStore) Ip4Address(org.onlab.packet.Ip4Address) Set(java.util.Set) StoreDelegate(org.onosproject.store.StoreDelegate) DeviceEvent(org.onosproject.net.device.DeviceEvent) DhcpServerConfig(org.onosproject.dhcprelay.config.DhcpServerConfig) DeviceId(org.onosproject.net.DeviceId) Dictionary(java.util.Dictionary) Pipeliner(org.onosproject.net.behaviour.Pipeliner) Host(org.onosproject.net.Host) ComponentContext(org.osgi.service.component.ComponentContext) HostService(org.onosproject.net.host.HostService) ArrayList(java.util.ArrayList) Dhcp6InterfaceIdOption(org.onlab.packet.dhcp.Dhcp6InterfaceIdOption) DhcpRelayStoreEvent(org.onosproject.dhcprelay.store.DhcpRelayStoreEvent) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DeserializationException(org.onlab.packet.DeserializationException) CircuitId(org.onlab.packet.dhcp.CircuitId) DhcpRelayAgentOption(org.onlab.packet.dhcp.DhcpRelayAgentOption) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Before(org.junit.Before) Charsets(org.apache.commons.io.Charsets) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Capture(org.easymock.Capture) Resources(com.google.common.io.Resources) VlanId(org.onlab.packet.VlanId) Test(org.junit.Test) IOException(java.io.IOException) EasyMock(org.easymock.EasyMock) Dhcp6IaAddressOption(org.onlab.packet.dhcp.Dhcp6IaAddressOption) IPv6(org.onlab.packet.IPv6) IPv4(org.onlab.packet.IPv4) DHCP6(org.onlab.packet.DHCP6) DhcpRecord(org.onosproject.dhcprelay.store.DhcpRecord) Objective(org.onosproject.net.flowobjective.Objective) MacAddress(org.onlab.packet.MacAddress) Dhcp6Duid(org.onlab.packet.dhcp.Dhcp6Duid) DHCP(org.onlab.packet.DHCP) Assert(org.junit.Assert) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig) Route(org.onosproject.routeservice.Route) HostLocation(org.onosproject.net.HostLocation) Interface(org.onosproject.net.intf.Interface) TestApplicationId(org.onosproject.TestApplicationId) CoreService(org.onosproject.core.CoreService) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) Dhcp6ClientIdOption(org.onlab.packet.dhcp.Dhcp6ClientIdOption) ByteBuffer(java.nio.ByteBuffer) Ethernet(org.onlab.packet.Ethernet) HostProviderService(org.onosproject.net.host.HostProviderService) Dhcp6IaPrefixOption(org.onlab.packet.dhcp.Dhcp6IaPrefixOption) After(org.junit.After) ImmutableSet(com.google.common.collect.ImmutableSet) Device(org.onosproject.net.Device) Collection(java.util.Collection) PacketProcessor(org.onosproject.net.packet.PacketProcessor) Streams(com.google.common.collect.Streams) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) TestTools.assertAfter(org.onlab.junit.TestTools.assertAfter) IndirectDhcpRelayConfig(org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig) List(java.util.List) InboundPacket(org.onosproject.net.packet.InboundPacket) PacketContext(org.onosproject.net.packet.PacketContext) Optional(java.util.Optional) HostDescription(org.onosproject.net.host.HostDescription) IpPrefix(org.onlab.packet.IpPrefix) PacketContextAdapter(org.onosproject.net.packet.PacketContextAdapter) RouteStoreAdapter(org.onosproject.routeservice.RouteStoreAdapter) Dhcp6RelayOption(org.onlab.packet.dhcp.Dhcp6RelayOption) DhcpRelayCountersStore(org.onosproject.dhcprelay.store.DhcpRelayCountersStore) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) DefaultHost(org.onosproject.net.DefaultHost) ImmutableList(com.google.common.collect.ImmutableList) OutboundPacket(org.onosproject.net.packet.OutboundPacket) PacketServiceAdapter(org.onosproject.net.packet.PacketServiceAdapter) HostId(org.onosproject.net.HostId) DHCP_RELAY_APP(org.onosproject.dhcprelay.DhcpRelayManager.DHCP_RELAY_APP) IpAddress(org.onlab.packet.IpAddress) DefaultInboundPacket(org.onosproject.net.packet.DefaultInboundPacket) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Dhcp6Option(org.onlab.packet.dhcp.Dhcp6Option) Maps(com.google.common.collect.Maps) UDP(org.onlab.packet.UDP) DhcpOption(org.onlab.packet.dhcp.DhcpOption) CaptureType(org.easymock.CaptureType) PacketPriority(org.onosproject.net.packet.PacketPriority) IgnoreDhcpConfig(org.onosproject.dhcprelay.config.IgnoreDhcpConfig) DeviceEvent(org.onosproject.net.device.DeviceEvent) Objective(org.onosproject.net.flowobjective.Objective) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) Pipeliner(org.onosproject.net.behaviour.Pipeliner) Device(org.onosproject.net.Device) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConnectPoint(org.onosproject.net.ConnectPoint) Test(org.junit.Test)

Aggregations

FlowObjectiveService (org.onosproject.net.flowobjective.FlowObjectiveService)13 Before (org.junit.Before)7 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)6 CoreService (org.onosproject.core.CoreService)6 NetworkConfigRegistry (org.onosproject.net.config.NetworkConfigRegistry)6 HostService (org.onosproject.net.host.HostService)6 ComponentContext (org.osgi.service.component.ComponentContext)6 List (java.util.List)5 Pair (org.apache.commons.lang3.tuple.Pair)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 ImmutableList (com.google.common.collect.ImmutableList)4 ImmutableSet (com.google.common.collect.ImmutableSet)4 Lists (com.google.common.collect.Lists)4 Maps (com.google.common.collect.Maps)4 Sets (com.google.common.collect.Sets)4 Streams (com.google.common.collect.Streams)4 Resources (com.google.common.io.Resources)4 IOException (java.io.IOException)4 ByteBuffer (java.nio.ByteBuffer)4