Search in sources :

Example 11 with FlowObjectiveService

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

the class FlowObjectiveCompositionCommand method doExecute.

@Override
protected void doExecute() {
    FlowObjectiveService service = get(FlowObjectiveService.class);
    service.initPolicy(policies[0]);
    print("Policy %s installed", policies[0]);
}
Also used : FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService)

Example 12 with FlowObjectiveService

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

the class FlowObjectiveQueueListCommand method doExecute.

@Override
protected void doExecute() {
    try {
        FlowObjectiveService service = get(FlowObjectiveService.class);
        ListMultimap<FilteringObjQueueKey, Objective> filtObjQueue = service.getFilteringObjQueue();
        ListMultimap<ForwardingObjQueueKey, Objective> fwdObjQueue = service.getForwardingObjQueue();
        ListMultimap<NextObjQueueKey, Objective> nextObjQueue = service.getNextObjQueue();
        Map<FilteringObjQueueKey, Objective> filtObjQueueHead = service.getFilteringObjQueueHead();
        Map<ForwardingObjQueueKey, Objective> fwdObjQueueHead = service.getForwardingObjQueueHead();
        Map<NextObjQueueKey, Objective> nextObjQueueHead = service.getNextObjQueueHead();
        if (cache) {
            printMap("Filtering objective cache", filtObjQueueHead, sizeOnly);
            printMap("Forwarding objective cache", fwdObjQueueHead, sizeOnly);
            printMap("Next objective cache", nextObjQueueHead, sizeOnly);
        } else {
            printMap("Filtering objective queue", filtObjQueue.asMap(), sizeOnly);
            printMap("Forwarding objective queue", fwdObjQueue.asMap(), sizeOnly);
            printMap("Next objective queue", nextObjQueue.asMap(), sizeOnly);
        }
    } catch (ServiceNotFoundException e) {
        print("FlowObjectiveService unavailable");
    }
}
Also used : Objective(org.onosproject.net.flowobjective.Objective) ForwardingObjQueueKey(org.onosproject.net.flowobjective.ForwardingObjQueueKey) FilteringObjQueueKey(org.onosproject.net.flowobjective.FilteringObjQueueKey) ServiceNotFoundException(org.onlab.osgi.ServiceNotFoundException) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) NextObjQueueKey(org.onosproject.net.flowobjective.NextObjQueueKey)

Example 13 with FlowObjectiveService

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

the class DhcpRelayManagerTest method setup.

@Before
public void setup() {
    manager = new DhcpRelayManager();
    manager.cfgService = createNiceMock(NetworkConfigRegistry.class);
    expect(manager.cfgService.getConfig(APP_ID, DefaultDhcpRelayConfig.class)).andReturn(CONFIG).anyTimes();
    expect(manager.cfgService.getConfig(APP_ID, IndirectDhcpRelayConfig.class)).andReturn(CONFIG_INDIRECT).anyTimes();
    manager.coreService = createNiceMock(CoreService.class);
    expect(manager.coreService.registerApplication(anyString())).andReturn(APP_ID).anyTimes();
    manager.hostService = createNiceMock(HostService.class);
    expect(manager.hostService.getHostsByIp(OUTER_RELAY_IP_V6)).andReturn(ImmutableSet.of(OUTER_RELAY_HOST)).anyTimes();
    expect(manager.hostService.getHostsByIp(SERVER_IP)).andReturn(ImmutableSet.of(SERVER_HOST)).anyTimes();
    expect(manager.hostService.getHostsByIp(SERVER_IP_V6)).andReturn(ImmutableSet.of(SERVER_HOST)).anyTimes();
    expect(manager.hostService.getHostsByIp(GATEWAY_IP)).andReturn(ImmutableSet.of(SERVER_HOST)).anyTimes();
    expect(manager.hostService.getHostsByIp(GATEWAY_IP_V6)).andReturn(ImmutableSet.of(SERVER_HOST)).anyTimes();
    expect(manager.hostService.getHostsByIp(CLIENT_LL_IP_V6)).andReturn(ImmutableSet.of(EXISTS_HOST)).anyTimes();
    expect(manager.hostService.getHost(OUTER_RELAY_HOST_ID)).andReturn(OUTER_RELAY_HOST).anyTimes();
    packetService = new MockPacketService();
    manager.packetService = packetService;
    manager.compCfgService = createNiceMock(ComponentConfigService.class);
    deviceService = createNiceMock(DeviceService.class);
    Device device = createNiceMock(Device.class);
    expect(device.is(Pipeliner.class)).andReturn(true).anyTimes();
    expect(deviceService.getDevice(DEV_1_ID)).andReturn(device).anyTimes();
    expect(deviceService.getDevice(DEV_2_ID)).andReturn(device).anyTimes();
    replay(deviceService, device);
    mockRouteStore = new MockRouteStore();
    mockDhcpRelayStore = new MockDhcpRelayStore();
    mockDhcpRelayCountersStore = new MockDhcpRelayCountersStore();
    manager.dhcpRelayStore = mockDhcpRelayStore;
    manager.deviceService = deviceService;
    manager.interfaceService = new MockInterfaceService();
    flowObjectiveService = EasyMock.niceMock(FlowObjectiveService.class);
    mockHostProviderService = createNiceMock(HostProviderService.class);
    v4Handler = new Dhcp4HandlerImpl();
    v4Handler.providerService = mockHostProviderService;
    v4Handler.dhcpRelayStore = mockDhcpRelayStore;
    v4Handler.hostService = manager.hostService;
    v4Handler.interfaceService = manager.interfaceService;
    v4Handler.packetService = manager.packetService;
    v4Handler.routeStore = mockRouteStore;
    v4Handler.coreService = createNiceMock(CoreService.class);
    v4Handler.flowObjectiveService = flowObjectiveService;
    v4Handler.appId = TestApplicationId.create(Dhcp4HandlerImpl.DHCP_V4_RELAY_APP);
    v4Handler.deviceService = deviceService;
    manager.v4Handler = v4Handler;
    v6Handler = new Dhcp6HandlerImpl();
    v6Handler.dhcpRelayStore = mockDhcpRelayStore;
    v6Handler.dhcpRelayCountersStore = mockDhcpRelayCountersStore;
    v6Handler.hostService = manager.hostService;
    v6Handler.interfaceService = manager.interfaceService;
    v6Handler.packetService = manager.packetService;
    v6Handler.routeStore = mockRouteStore;
    v6Handler.providerService = mockHostProviderService;
    v6Handler.coreService = createNiceMock(CoreService.class);
    v6Handler.flowObjectiveService = flowObjectiveService;
    v6Handler.appId = TestApplicationId.create(Dhcp6HandlerImpl.DHCP_V6_RELAY_APP);
    v6Handler.deviceService = deviceService;
    manager.v6Handler = v6Handler;
    // properties
    Dictionary<String, Object> dictionary = createNiceMock(Dictionary.class);
    expect(dictionary.get("arpEnabled")).andReturn(true).anyTimes();
    expect(dictionary.get("dhcpPollInterval")).andReturn(120).anyTimes();
    ComponentContext context = createNiceMock(ComponentContext.class);
    expect(context.getProperties()).andReturn(dictionary).anyTimes();
    replay(manager.cfgService, manager.coreService, manager.hostService, manager.compCfgService, dictionary, context);
    manager.activate(context);
}
Also used : HostService(org.onosproject.net.host.HostService) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Pipeliner(org.onosproject.net.behaviour.Pipeliner) ComponentContext(org.osgi.service.component.ComponentContext) Device(org.onosproject.net.Device) HostProviderService(org.onosproject.net.host.HostProviderService) DeviceService(org.onosproject.net.device.DeviceService) CoreService(org.onosproject.core.CoreService) IndirectDhcpRelayConfig(org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig) NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) FlowObjectiveService(org.onosproject.net.flowobjective.FlowObjectiveService) DefaultDhcpRelayConfig(org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig) Before(org.junit.Before)

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