@Before public void setUp() throws Exception { idGenerator = new TestIdGenerator(); Intent.bindIdGenerator(idGenerator); applicationService = createMock(ApplicationService.class); coreService = createMock(CoreService.class); expect(coreService.registerApplication(APP_NAME)).andReturn(APPID); replay(coreService); hostsAvailable = Sets.newHashSet(); hostService = new TestHostService(hostsAvailable); intentService = new TestIntentService(); TestIntentSynchronizer intentSynchronizer = new TestIntentSynchronizer(intentService); interfaceService = createMock(InterfaceService.class); interfaceService.addListener(anyObject(InterfaceListener.class)); expectLastCall().anyTimes(); addIntfConfig(); vpls = new Vpls(); vpls.applicationService = applicationService; vpls.coreService = coreService; vpls.hostService = hostService; vpls.intentService = intentService; vpls.interfaceService = interfaceService; vpls.intentSynchronizer = intentSynchronizer; }
@Activate protected void activate() { appId = coreService.registerApplication("org.onosproject.cordvtn"); ruleInstaller = new CordVtnRuleInstaller( appId, flowRuleService, deviceService, driverService, groupService, mastershipService, DEFAULT_TUNNEL); arpProxy = new CordVtnArpProxy(appId, packetService); packetService.addProcessor(packetProcessor, PacketProcessor.director(0)); arpProxy.requestPacket(); hostService.addListener(hostListener); hostProvider = hostProviderRegistry.register(this); configRegistry.registerConfigFactory(configFactory); configService.addListener(configListener); readConfiguration(); log.info("Started"); }
@Override public void init(DeviceId deviceId, PipelinerContext context) { log.debug("Initiate OLT pipeline"); this.serviceDirectory = context.directory(); this.deviceId = deviceId; flowRuleService = serviceDirectory.get(FlowRuleService.class); coreService = serviceDirectory.get(CoreService.class); groupService = serviceDirectory.get(GroupService.class); flowObjectiveStore = context.store(); appId = coreService.registerApplication("org.onosproject.driver.OLTPipeline"); pendingGroups = CacheBuilder.newBuilder() .expireAfterWrite(20, TimeUnit.SECONDS) .removalListener( (RemovalNotification<GroupKey, NextObjective> notification) -> { if (notification.getCause() == RemovalCause.EXPIRED) { fail(notification.getValue(), ObjectiveError.GROUPINSTALLATIONFAILED); } }) .build(); groupService.addListener(new InnerGroupListener()); }
@Activate public void activate() { appId = coreService.registerApplication(APP_NAME); providerService = providerRegistry.register(this); cfgService.registerConfigFactory(factory); cfgService.addListener(cfgLister); connectDevices(); log.info("Started"); }
@Activate public void activate() { String nodeId = clusterService.getLocalNode().ip().toString(); appId = coreService.registerApplication("org.onosproject.demo.installer." + nodeId); worker = Executors.newFixedThreadPool( 1, new ThreadFactoryBuilder().setNameFormat("demo-app-worker").build()); log.info("Started with Application ID {}", appId.id()); }
@Activate public void activate() { providerService = providerRegistry.register(this); appId = coreService.registerApplication(APP_NAME); cfgService.registerConfigFactory(factory); cfgService.addListener(cfgLister); controller.addDeviceListener(innerNodeListener); executor.execute(NetconfDeviceProvider.this::connectDevices); log.info("Started"); }
@Activate public void activate(ComponentContext context) { cfgService.registerProperties(getClass()); appId = coreService.registerApplication("org.onosproject.fwd"); packetService.addProcessor(processor, PacketProcessor.ADVISOR_MAX + 2); readComponentConfiguration(context); requestPackests(); log.info("Started with Application ID {}", appId.id()); }
@Activate protected void activate() { appId = coreService.registerApplication("org.onos.byon"); /* * TODO Lab 6: Remove delegate and event sink * * 1. Add the listener registry to the event dispatcher using eventDispatcher.addSink() * 2. Set the delegate in the store */ log.info("Started"); }
@Activate public void activate(ComponentContext context) { componentConfigService.registerProperties(getClass()); modified(context); appId = coreService.registerApplication(APP_NAME); if (enabled) { enable(); } }
@Activate protected void activate() { appId = coreService.registerApplication("org.onosproject.openstackswitching"); factories.forEach(cfgService::registerConfigFactory); packetService.addProcessor(internalPacketProcessor, PacketProcessor.director(1)); deviceService.addListener(internalDeviceListener); cfgService.addListener(internalConfigListener); internalConfigListener.configureNetwork(); log.info("Started"); }
@Activate public void activate(ComponentContext context) { appId = coreService.registerApplication("org.onosproject.provider.host"); modified(context); providerService = providerRegistry.register(this); pktService.addProcessor(processor, 1); deviceService.addListener(deviceListener); TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); selectorBuilder.matchEthType(Ethernet.TYPE_ARP); pktService.requestPackets(selectorBuilder.build(), PacketPriority.CONTROL, appId); log.info("Started"); }
@Before public void setUp() { coreService = createMock(CoreService.class); expect(coreService.registerApplication(appId.name())).andReturn(appId).anyTimes(); replay(coreService); provider.cfgService = new ComponentConfigAdapter(); provider.coreService = coreService; provider.providerRegistry = hostRegistry; provider.topologyService = topoService; provider.packetService = packetService; provider.deviceService = deviceService; provider.hostService = hostService; provider.activate(CTX_FOR_NO_REMOVE); }
@Override public NextObjective decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } CoreService coreService = context.getService(CoreService.class); final JsonCodec<TrafficSelector> trafficSelectorCodec = context.codec(TrafficSelector.class); final JsonCodec<TrafficTreatment> trafficTreatmentCodec = context.codec(TrafficTreatment.class); ObjectiveCodecHelper och = new ObjectiveCodecHelper(); DefaultNextObjective.Builder baseBuilder = DefaultNextObjective.builder(); final DefaultNextObjective.Builder builder = (DefaultNextObjective.Builder) och.decode(json, baseBuilder, context); // decode id JsonNode idJson = json.get(ID); checkNotNull(idJson); builder.withId(idJson.asInt()); // decode application id ApplicationId appId = coreService.registerApplication(REST_APP_ID); builder.fromApp(appId); // decode type String typeStr = nullIsIllegal(json.get(TYPE), TYPE + MISSING_MEMBER_MESSAGE).asText(); switch (typeStr) { case "HASHED": builder.withType(NextObjective.Type.HASHED); break; case "BROADCAST": builder.withType(NextObjective.Type.BROADCAST); break; case "FAILOVER": builder.withType(NextObjective.Type.FAILOVER); break; case "SIMPLE": builder.withType(NextObjective.Type.SIMPLE); break; default: log.warn(INVALID_TYPE_MESSAGE, typeStr); return null; } // decode treatments JsonNode treatmentsJson = json.get(TREATMENTS); checkNotNull(treatmentsJson); if (treatmentsJson != null) { IntStream.range(0, treatmentsJson.size()) .forEach( i -> { ObjectNode treatmentJson = get(treatmentsJson, i); builder.addTreatment(trafficTreatmentCodec.decode(treatmentJson, context)); }); } // decode meta JsonNode metaJson = json.get(META); if (metaJson != null) { TrafficSelector trafficSelector = trafficSelectorCodec.decode((ObjectNode) metaJson, context); builder.withMeta(trafficSelector); } // decode operation String opStr = nullIsIllegal(json.get(OPERATION), OPERATION + MISSING_MEMBER_MESSAGE).asText(); NextObjective nextObjective; switch (opStr) { case "ADD": nextObjective = builder.add(); break; case "REMOVE": nextObjective = builder.remove(); break; default: log.warn(INVALID_OP_MESSAGE, opStr); return null; } return nextObjective; }
@Activate public void activate(ComponentContext context) { appId = coreSerivice.registerApplication("org.onosproject.Mao.Mao-Ether-igmp"); log.info("Mao Started, id: {}, name: {}", appId.id(), appId.name()); }
@Override public ApplicationId createSubject(String key) { return coreService.registerApplication(key); }