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]);
}
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");
}
}
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);
}
Aggregations