@Override protected void execute() { NetworkConfigService configService = get(NetworkConfigService.class); CoreService coreService = get(CoreService.class); ApplicationId appId = coreService.getAppId(RoutingService.ROUTER_APP_ID); BgpConfig config = configService.addConfig(appId, BgpConfig.class); if (name != null) { BgpConfig.BgpSpeakerConfig speaker = config.getSpeakerWithName(name); if (speaker != null) { log.debug("Speaker already exists: {}", name); return; } } if (vlanId == null || vlanId.isEmpty()) { vlanIdObj = VlanId.NONE; } else { vlanIdObj = VlanId.vlanId(Short.valueOf(vlanId)); } addSpeakerToConf(config); configService.applyConfig(appId, BgpConfig.class, config.node()); print(SPEAKER_ADD_SUCCESS); }
@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"); }
@Deactivate protected void deactivate() { leadershipService.removeListener(leadershipListener); leadershipService.withdraw(appId.name()); configRegistry.unregisterConfigFactory(configFactory); configService.removeListener(configListener); }
@Activate protected void active() { local = clusterService.getLocalNode().id(); appId = coreService.getAppId(CordVtnService.CORDVTN_APP_ID); configService.addListener(configListener); configRegistry.registerConfigFactory(configFactory); leadershipService.addListener(leadershipListener); leadershipService.runForLeadership(CordVtnService.CORDVTN_APP_ID); }
@Deactivate protected void deactivate() { hostProviderRegistry.unregister(this); hostService.removeListener(hostListener); packetService.removeProcessor(packetProcessor); configRegistry.unregisterConfigFactory(configFactory); configService.removeListener(configListener); eventExecutor.shutdown(); log.info("Stopped"); }
/** Initializes peer connectivity testing environment. */ private void initPeerConnectivity() { expect(bgpConfig.bgpSpeakers()).andReturn(bgpSpeakers).anyTimes(); replay(bgpConfig); expect(networkConfigService.getConfig(APPID, BgpConfig.class)).andReturn(bgpConfig).anyTimes(); replay(networkConfigService); replay(interfaceService); intentSynchronizer = createMock(IntentSynchronizationService.class); replay(intentSynchronizer); peerConnectivityManager = new PeerConnectivityManager( APPID, intentSynchronizer, networkConfigService, CONFIG_APP_ID, interfaceService); }
@Before public void setUp() throws Exception { super.setUp(); interfaceService = createMock(InterfaceService.class); interfaceService.addListener(anyObject(InterfaceListener.class)); expectLastCall().anyTimes(); networkConfigService = createMock(NetworkConfigService.class); networkConfigService.addListener(anyObject(NetworkConfigListener.class)); expectLastCall().anyTimes(); bgpConfig = createMock(BgpConfig.class); // These will set expectations on routingConfig and interfaceService bgpSpeakers = setUpBgpSpeakers(); interfaces = Collections.unmodifiableMap(setUpInterfaces()); initPeerConnectivity(); intentList = setUpIntentList(); }