org.onosproject.net.behaviour.Pipeliner Java Examples
The following examples show how to use
org.onosproject.net.behaviour.Pipeliner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PipeconfLoader.java From onos with Apache License 2.0 | 6 votes |
private static PiPipeconf buildBasicPipeconf() { final URL jsonUrl = PipeconfLoader.class.getResource(BASIC_JSON_PATH); final URL p4InfoUrl = PipeconfLoader.class.getResource(BASIC_P4INFO); return DefaultPiPipeconf.builder() .withId(BASIC_PIPECONF_ID) .withPipelineModel(parseP4Info(p4InfoUrl)) .addBehaviour(PiPipelineInterpreter.class, BasicInterpreterImpl.class) .addBehaviour(Pipeliner.class, BasicPipelinerImpl.class) .addBehaviour(PortStatisticsDiscovery.class, PortStatisticsDiscoveryImpl.class) .addExtension(P4_INFO_TEXT, p4InfoUrl) .addExtension(BMV2_JSON, jsonUrl) // Put here other target-specific extensions, // e.g. Tofino's bin and context.json. .build(); }
Example #2
Source File: PipeconfLoader.java From onos with Apache License 2.0 | 6 votes |
private static PiPipeconf buildIntPipeconf() { final URL jsonUrl = PipeconfLoader.class.getResource(INT_JSON_PATH); final URL p4InfoUrl = PipeconfLoader.class.getResource(INT_P4INFO); // INT behavior is controlled using pipeline-specific flow rule, // not using flow objectives, so we just borrow pipeliner to basic pipeconf. return DefaultPiPipeconf.builder() .withId(INT_PIPECONF_ID) .withPipelineModel(parseP4Info(p4InfoUrl)) .addBehaviour(PiPipelineInterpreter.class, BasicInterpreterImpl.class) .addBehaviour(Pipeliner.class, BasicPipelinerImpl.class) .addBehaviour(PortStatisticsDiscovery.class, PortStatisticsDiscoveryImpl.class) .addBehaviour(IntProgrammable.class, IntProgrammableImpl.class) .addExtension(P4_INFO_TEXT, p4InfoUrl) .addExtension(BMV2_JSON, jsonUrl) .build(); }
Example #3
Source File: FlowObjectiveCompositionManager.java From onos with Apache License 2.0 | 6 votes |
@Override public void run() { try { Pipeliner pipeliner = getDevicePipeliner(deviceId); if (pipeliner != null) { if (objective instanceof NextObjective) { pipeliner.next((NextObjective) objective); } else if (objective instanceof ForwardingObjective) { pipeliner.forward((ForwardingObjective) objective); } else { pipeliner.filter((FilteringObjective) objective); } } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) { Thread.sleep(INSTALL_RETRY_INTERVAL); executorService.execute(new ObjectiveInstaller(deviceId, objective, numAttempts + 1)); } else { // Otherwise we've tried a few times and failed, report an // error back to the user. objective.context().ifPresent( c -> c.onError(objective, ObjectiveError.NOPIPELINER)); } } catch (Exception e) { log.warn("Exception while installing flow objective", e); } }
Example #4
Source File: PipeconfLoader.java From onos-p4-tutorial with Apache License 2.0 | 5 votes |
private PiPipeconf buildPipeconf() throws P4InfoParserException { final URL p4InfoUrl = PipeconfLoader.class.getResource(P4INFO_PATH); final URL bmv2JsonUrlUrl = PipeconfLoader.class.getResource(BMV2_JSON_PATH); final PiPipelineModel pipelineModel = P4InfoParser.parse(p4InfoUrl); return DefaultPiPipeconf.builder() .withId(PIPECONF_ID) .withPipelineModel(pipelineModel) .addBehaviour(PiPipelineInterpreter.class, InterpreterImpl.class) .addBehaviour(Pipeliner.class, PipelinerImpl.class) .addExtension(P4_INFO_TEXT, p4InfoUrl) .addExtension(BMV2_JSON, bmv2JsonUrlUrl) .build(); }
Example #5
Source File: FlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public Map<Pair<Integer, DeviceId>, List<String>> getNextMappingsChain() { Map<Pair<Integer, DeviceId>, List<String>> nextObjGroupMap = new HashMap<>(); Map<Integer, NextGroup> allnexts = flowObjectiveStore.getAllGroups(); // XXX if the NextGroup after de-serialization actually stored info of the deviceId // then info on any nextObj could be retrieved from one controller instance. // Right now the drivers on one instance can only fetch for next-ids that came // to them. // Also, we still need to send the right next-id to the right driver as potentially // there can be different drivers for different devices. But on that account, // no instance should be decoding for another instance's nextIds. for (Map.Entry<Integer, NextGroup> e : allnexts.entrySet()) { // get the device this next Objective was sent to DeviceId deviceId = nextToDevice.get(e.getKey()); if (deviceId != null) { // this instance of the controller sent the nextObj to a driver Pipeliner pipeliner = getDevicePipeliner(deviceId); List<String> nextMappings = pipeliner.getNextMappings(e.getValue()); if (nextMappings != null) { //mappings.addAll(nextMappings); nextObjGroupMap.put(Pair.of(e.getKey(), deviceId), nextMappings); } } else { nextObjGroupMap.put(Pair.of(e.getKey(), deviceId), ImmutableList.of("nextId not in this onos instance")); } } return nextObjGroupMap; }
Example #6
Source File: FlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public List<String> getNextMappings() { List<String> mappings = new ArrayList<>(); Map<Integer, NextGroup> allnexts = flowObjectiveStore.getAllGroups(); // XXX if the NextGroup after de-serialization actually stored info of the deviceId // then info on any nextObj could be retrieved from one controller instance. // Right now the drivers on one instance can only fetch for next-ids that came // to them. // Also, we still need to send the right next-id to the right driver as potentially // there can be different drivers for different devices. But on that account, // no instance should be decoding for another instance's nextIds. for (Map.Entry<Integer, NextGroup> e : allnexts.entrySet()) { // get the device this next Objective was sent to DeviceId deviceId = nextToDevice.get(e.getKey()); mappings.add("NextId " + e.getKey() + ": " + ((deviceId != null) ? deviceId : "nextId not in this onos instance")); if (deviceId != null) { // this instance of the controller sent the nextObj to a driver Pipeliner pipeliner = getDevicePipeliner(deviceId); List<String> nextMappings = pipeliner.getNextMappings(e.getValue()); if (nextMappings != null) { mappings.addAll(nextMappings); } } } return mappings; }
Example #7
Source File: FlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
/** * Creates and initialize {@link Pipeliner}. * <p> * Note: Expected to be called under per-Device lock. * e.g., {@code pipeliners}' Map#compute family methods * * @param deviceId Device to initialize pipeliner * @return {@link Pipeliner} instance or null */ private Pipeliner initPipelineHandler(DeviceId deviceId) { start = now(); // Attempt to lookup the handler in the cache DriverHandler handler = driverHandlers.get(deviceId); cTime = now(); if (handler == null) { try { // Otherwise create it and if it has pipeline behaviour, cache it handler = driverService.createHandler(deviceId); dTime = now(); if (!handler.driver().hasBehaviour(Pipeliner.class)) { log.debug("Pipeline behaviour not supported for device {}", deviceId); return null; } } catch (ItemNotFoundException e) { log.warn("No applicable driver for device {}", deviceId); return null; } driverHandlers.put(deviceId, handler); eTime = now(); } // Always (re)initialize the pipeline behaviour log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId); hTime = now(); Pipeliner pipeliner = handler.behaviour(Pipeliner.class); hbTime = now(); pipeliner.init(deviceId, context); stopWatch(); return pipeliner; }
Example #8
Source File: FlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public void run() { try { Pipeliner pipeliner = getDevicePipeliner(deviceId); if (pipeliner != null) { if (objective instanceof NextObjective) { nextToDevice.put(objective.id(), deviceId); pipeliner.next((NextObjective) objective); } else if (objective instanceof ForwardingObjective) { pipeliner.forward((ForwardingObjective) objective); } else { pipeliner.filter((FilteringObjective) objective); } //Attempts to check if pipeliner is null for retry attempts } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) { Thread.sleep(INSTALL_RETRY_INTERVAL); executor.execute(new ObjectiveProcessor(deviceId, objective, numAttempts + 1, executor)); } else { // Otherwise we've tried a few times and failed, report an // error back to the user. objective.context().ifPresent( c -> c.onError(objective, ObjectiveError.NOPIPELINER)); } //Exception thrown } catch (Exception e) { log.warn("Exception while processing flow objective", e); } }
Example #9
Source File: FlowObjectiveCompositionManager.java From onos with Apache License 2.0 | 5 votes |
private void setupPipelineHandler(DeviceId deviceId) { // Attempt to lookup the handler in the cache DriverHandler handler = driverHandlers.get(deviceId); if (handler == null) { try { // Otherwise create it and if it has pipeline behaviour, cache it handler = driverService.createHandler(deviceId); if (!handler.driver().hasBehaviour(Pipeliner.class)) { log.warn("Pipeline behaviour not supported for device {}", deviceId); return; } } catch (ItemNotFoundException e) { log.warn("No applicable driver for device {}", deviceId); return; } driverHandlers.put(deviceId, handler); } // Always (re)initialize the pipeline behaviour log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId); Pipeliner pipeliner = handler.behaviour(Pipeliner.class); pipeliner.init(deviceId, context); pipeliners.putIfAbsent(deviceId, pipeliner); }
Example #10
Source File: PipeconfFactory.java From onos with Apache License 2.0 | 5 votes |
private PiPipeconf buildPipeconf() throws P4InfoParserException { final PiPipelineModel pipelineModel = P4InfoParser.parse(P4INFO_URL); return DefaultPiPipeconf.builder() .withId(PIPECONF_ID) .withPipelineModel(pipelineModel) .addBehaviour(PiPipelineInterpreter.class, PipelineInterpreterImpl.class) .addBehaviour(PortStatisticsDiscovery.class, PortStatisticsDiscoveryImpl.class) // Since mytunnel.p4 defines only 1 table, we re-use the existing single-table pipeliner. .addBehaviour(Pipeliner.class, DefaultSingleTablePipeline.class) .addExtension(P4_INFO_TEXT, P4INFO_URL) .addExtension(BMV2_JSON, BMV2_JSON_URL) .build(); }
Example #11
Source File: VirtualNetworkFlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public void run() { try { Pipeliner pipeliner = getDevicePipeliner(deviceId); if (pipeliner != null) { if (objective instanceof NextObjective) { nextToDevice.put(objective.id(), deviceId); pipeliner.next((NextObjective) objective); } else if (objective instanceof ForwardingObjective) { pipeliner.forward((ForwardingObjective) objective); } else { pipeliner.filter((FilteringObjective) objective); } //Attempts to check if pipeliner is null for retry attempts } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) { Thread.sleep(INSTALL_RETRY_INTERVAL); executorService.execute(new ObjectiveInstaller(deviceId, objective, numAttempts + 1)); } else { // Otherwise we've tried a few times and failed, report an // error back to the user. objective.context().ifPresent( c -> c.onError(objective, ObjectiveError.NOPIPELINER)); } //Exception thrown } catch (Exception e) { log.warn("Exception while installing flow objective", e); } }
Example #12
Source File: VirtualNetworkFlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public List<String> getNextMappings() { List<String> mappings = new ArrayList<>(); Map<Integer, NextGroup> allnexts = flowObjectiveStore.getAllGroups(); // XXX if the NextGroup after de-serialization actually stored info of the deviceId // then info on any nextObj could be retrieved from one controller instance. // Right now the drivers on one instance can only fetch for next-ids that came // to them. // Also, we still need to send the right next-id to the right driver as potentially // there can be different drivers for different devices. But on that account, // no instance should be decoding for another instance's nextIds. for (Map.Entry<Integer, NextGroup> e : allnexts.entrySet()) { // get the device this next Objective was sent to DeviceId deviceId = nextToDevice.get(e.getKey()); mappings.add("NextId " + e.getKey() + ": " + ((deviceId != null) ? deviceId : "nextId not in this onos instance")); if (deviceId != null) { // this instance of the controller sent the nextObj to a driver Pipeliner pipeliner = getDevicePipeliner(deviceId); List<String> nextMappings = pipeliner.getNextMappings(e.getValue()); if (nextMappings != null) { mappings.addAll(nextMappings); } } } return mappings; }
Example #13
Source File: DhcpRelayManagerTest.java From onos with Apache License 2.0 | 5 votes |
/** * 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())); }
Example #14
Source File: DhcpRelayManagerTest.java From onos with Apache License 2.0 | 5 votes |
/** * 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()); }
Example #15
Source File: FabricPipeconfManager.java From onos with Apache License 2.0 | 5 votes |
static PiPipeconf build( DefaultPiPipeconf.Builder pipeconfBuilder, String profileName, URL p4InfoUrl, URL cpuPortUrl) { checkNotNull(pipeconfBuilder, "pipeconfBuilder cannot be null"); checkArgument(profileName != null && !profileName.isEmpty(), "profileName cannot be null or empty"); checkNotNull(p4InfoUrl, "p4InfoUrl cannot be null (check if file exists)"); checkNotNull(cpuPortUrl, "cpuPortUrl cannot be null (check if file exists)"); pipeconfBuilder .withPipelineModel(parseP4Info(p4InfoUrl)) .addBehaviour(PiPipelineInterpreter.class, FabricInterpreter.class) .addBehaviour(Pipeliner.class, FabricPipeliner.class) .addExtension(PiPipeconf.ExtensionType.P4_INFO_TEXT, p4InfoUrl) .addExtension(PiPipeconf.ExtensionType.CPU_PORT_TXT, cpuPortUrl); // Add IntProgrammable behaviour for INT-enabled profiles. if (profileName.endsWith(INT_PROFILE_SUFFIX) || profileName.endsWith(FULL_PROFILE_SUFFIX)) { pipeconfBuilder.addBehaviour(IntProgrammable.class, FabricIntProgrammable.class); } // Add BngProgrammable behavior for BNG-enabled pipelines. if (profileName.endsWith(BNG_PROFILE_SUFFIX)) { pipeconfBuilder.addBehaviour(BngProgrammable.class, FabricBngProgrammable.class); } return pipeconfBuilder.build(); }
Example #16
Source File: PipeconfLoader.java From onos-p4-tutorial with Apache License 2.0 | 5 votes |
private PiPipeconf buildPipeconf() throws P4InfoParserException { final URL p4InfoUrl = PipeconfLoader.class.getResource(P4INFO_PATH); final URL bmv2JsonUrlUrl = PipeconfLoader.class.getResource(BMV2_JSON_PATH); final PiPipelineModel pipelineModel = P4InfoParser.parse(p4InfoUrl); return DefaultPiPipeconf.builder() .withId(PIPECONF_ID) .withPipelineModel(pipelineModel) .addBehaviour(PiPipelineInterpreter.class, InterpreterImpl.class) .addBehaviour(Pipeliner.class, PipelinerImpl.class) .addExtension(P4_INFO_TEXT, p4InfoUrl) .addExtension(BMV2_JSON, bmv2JsonUrlUrl) .build(); }
Example #17
Source File: PipeconfLoader.java From ngsdn-tutorial with Apache License 2.0 | 5 votes |
private PiPipeconf buildPipeconf() throws P4InfoParserException { final URL p4InfoUrl = PipeconfLoader.class.getResource(P4INFO_PATH); final URL bmv2JsonUrlUrl = PipeconfLoader.class.getResource(BMV2_JSON_PATH); final PiPipelineModel pipelineModel = P4InfoParser.parse(p4InfoUrl); return DefaultPiPipeconf.builder() .withId(PIPECONF_ID) .withPipelineModel(pipelineModel) .addBehaviour(PiPipelineInterpreter.class, InterpreterImpl.class) .addBehaviour(Pipeliner.class, PipelinerImpl.class) .addExtension(P4_INFO_TEXT, p4InfoUrl) .addExtension(BMV2_JSON, bmv2JsonUrlUrl) .build(); }
Example #18
Source File: FlowObjectiveCompositionManager.java From onos with Apache License 2.0 | 4 votes |
private Pipeliner getDevicePipeliner(DeviceId deviceId) { return pipeliners.get(deviceId); }
Example #19
Source File: DhcpRelayManagerTest.java From onos with Apache License 2.0 | 4 votes |
@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); }
Example #20
Source File: VirtualNetworkFlowObjectiveManager.java From onos with Apache License 2.0 | 3 votes |
/** * Creates and initialize {@link Pipeliner}. * <p> * Note: Expected to be called under per-Device lock. * e.g., {@code pipeliners}' Map#compute family methods * * @param deviceId Device to initialize pipeliner * @return {@link Pipeliner} instance or null */ private Pipeliner initPipelineHandler(DeviceId deviceId) { //FIXME: do we need a standard pipeline for virtual device? Pipeliner pipeliner = new DefaultVirtualDevicePipeline(); pipeliner.init(deviceId, context); return pipeliner; }
Example #21
Source File: FlowObjectiveManager.java From onos with Apache License 2.0 | 3 votes |
/** * Retrieves (if it exists) the device pipeline behaviour from the cache and * and triggers the init method of the pipeline. Otherwise (DEVICE_ADDED) it warms * the caches and triggers the init method of the Pipeline. The rationale of this * method is for managing the scenario of a switch that goes down for a failure * and goes up after a while. * * @param deviceId the id of the device associated to the pipeline * @return the implementation of the Pipeliner behaviour */ private Pipeliner getAndInitDevicePipeliner(DeviceId deviceId) { return pipeliners.compute(deviceId, (deviceIdValue, pipelinerValue) -> { if (pipelinerValue != null) { pipelinerValue.init(deviceId, context); return pipelinerValue; } return this.initPipelineHandler(deviceId); }); }
Example #22
Source File: VirtualNetworkFlowObjectiveManager.java From onos with Apache License 2.0 | 2 votes |
/** * Retrieves (if it exists) the device pipeline behaviour from the cache. * Otherwise it warms the caches and triggers the init method of the Pipeline. * For virtual network, it returns OVS pipeliner. * * @param deviceId the id of the device associated to the pipeline * @return the implementation of the Pipeliner behaviour */ private Pipeliner getDevicePipeliner(DeviceId deviceId) { return pipeliners.computeIfAbsent(deviceId, this::initPipelineHandler); }
Example #23
Source File: FlowObjectiveManager.java From onos with Apache License 2.0 | 2 votes |
/** * Retrieves (if it exists) the device pipeline behaviour from the cache. * Otherwise it warms the caches and triggers the init method of the Pipeline. * * @param deviceId the id of the device associated to the pipeline * @return the implementation of the Pipeliner behaviour */ private Pipeliner getDevicePipeliner(DeviceId deviceId) { return pipeliners.computeIfAbsent(deviceId, this::initPipelineHandler); }