@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { linkDiscoveryService = context.getServiceImpl(ILinkDiscoveryService.class); threadPoolService = context.getServiceImpl(IThreadPoolService.class); floodlightProviderService = context.getServiceImpl(IFloodlightProviderService.class); switchService = context.getServiceImpl(IOFSwitchService.class); restApiService = context.getServiceImpl(IRestApiService.class); debugCounterService = context.getServiceImpl(IDebugCounterService.class); debugEventService = context.getServiceImpl(IDebugEventService.class); switchPorts = new HashMap<DatapathId, Set<OFPort>>(); switchPortLinks = new HashMap<NodePortTuple, Set<Link>>(); directLinks = new HashMap<NodePortTuple, Set<Link>>(); portBroadcastDomainLinks = new HashMap<NodePortTuple, Set<Link>>(); tunnelPorts = new HashSet<NodePortTuple>(); topologyAware = new ArrayList<ITopologyListener>(); ldUpdates = new LinkedBlockingQueue<LDUpdate>(); haListener = new HAListenerDelegate(); registerTopologyDebugCounters(); registerTopologyDebugEvents(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); deviceService = context.getServiceImpl(IDeviceService.class); routingService = context.getServiceImpl(IRoutingService.class); switchService = context.getServiceImpl(IOFSwitchService.class); linkService = context.getServiceImpl(ILinkDiscoveryService.class); messageDamper = new OFMessageDamper(OFMESSAGE_DAMPER_CAPACITY, EnumSet.of(OFType.FLOW_MOD), OFMESSAGE_DAMPER_TIMEOUT); library = new FP_LibFloodlight( LoggerFactory.getLogger( getClass() )); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { syncService = context.getServiceImpl(ISyncService.class); debugCounter = context.getServiceImpl(IDebugCounterService.class); try { syncService.registerStore(SYNC_STORE_NAME, Scope.GLOBAL); } catch (SyncException e) { throw new FloodlightModuleException(e); } Map<String,String> config = context.getConfigParams(this); if (config.containsKey("numWorkers")) { numWorkers = Integer.parseInt(config.get("numWorkers")); } if (config.containsKey("keysPerWorker")) { keysPerWorker = Integer.parseInt(config.get("keysPerWorker")); } if (config.containsKey("iterations")) { iterations = Integer.parseInt(config.get("iterations")); } if (config.containsKey("delay")) { delay = Integer.parseInt(config.get("delay")); } }
@Override public void startUp(FloodlightModuleContext context) throws FloodlightModuleException { shutdown = false; workerExecutor = new NioEventLoopGroup(); timer = new HashedWheelTimer(); pipelineFactory = new RemoteSyncChannelInitializer(timer, this); final Bootstrap bootstrap = new Bootstrap() .channel(NioSocketChannel.class) .group(workerExecutor) .option(ChannelOption.SO_REUSEADDR, true) .option(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.SO_SNDBUF, RPCService.SEND_BUFFER_SIZE) .option(ChannelOption.SO_RCVBUF, RPCService.SEND_BUFFER_SIZE) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, RPCService.CONNECT_TIMEOUT) .handler(pipelineFactory); clientBootstrap = bootstrap; }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProviderService = context.getServiceImpl(IFloodlightProviderService.class); threadPoolService = context.getServiceImpl(IThreadPoolService.class); debugCounterService = context.getServiceImpl(IDebugCounterService.class); flowQueue = new PriorityPendingQueue<OFMatchReconcile>(); flowReconcileListeners = new ListenerDispatcher<OFType, IFlowReconcileListener>(); Map<String, String> configParam = context.getConfigParams(this); String enableValue = configParam.get(EnableConfigKey); registerFlowReconcileManagerDebugCounters(); // Set flowReconcile default to true flowReconcileEnabled = true; if (enableValue != null && enableValue.equalsIgnoreCase("false")) { flowReconcileEnabled = false; } flowReconcileThreadRunCount = new AtomicInteger(0); lastReconcileTime = new Date(0); logger.debug("FlowReconcile is {}", flowReconcileEnabled); }
/** * Initialize internal data structures */ public void init(Map<String, String> configParams) throws FloodlightModuleException { this.moduleLoaderState = ModuleLoaderState.INIT; // These data structures are initialized here because other // module's startUp() might be called before ours this.messageListeners = new ConcurrentHashMap<OFType, ListenerDispatcher<OFType, IOFMessageListener>>(); this.haListeners = new ListenerDispatcher<HAListenerTypeMarker, IHAListener>(); this.controllerNodeIPsCache = new HashMap<String, String>(); this.updates = new LinkedBlockingQueue<IUpdate>(); this.providerMap = new HashMap<String, List<IInfoProvider>>(); setConfigParams(configParams); HARole initialRole = getInitialRole(configParams); this.notifiedRole = initialRole; this.shutdownService = new ShutdownServiceImpl(); this.roleManager = new RoleManager(this, this.shutdownService, this.notifiedRole, INITIAL_ROLE_CHANGE_DESCRIPTION); this.timer = new HashedWheelTimer(); // Switch Service Startup this.switchService.registerLogicalOFMessageCategory(LogicalOFMessageCategory.MAIN); this.switchService.addOFSwitchListener(new NotificationSwitchListener()); this.counters = new ControllerCounters(debugCounterService); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProviderService = context.getServiceImpl(IFloodlightProviderService.class); restApiService = context.getServiceImpl(IRestApiService.class); deviceService = context.getServiceImpl(IDeviceService.class); vNetsByGuid = new ConcurrentHashMap<String, VirtualNetwork>(); nameToGuid = new ConcurrentHashMap<String, String>(); guidToGateway = new ConcurrentHashMap<String, IPv4Address>(); gatewayToGuid = new ConcurrentHashMap<IPv4Address, Set<String>>(); macToGuid = new ConcurrentHashMap<MacAddress, String>(); portToMac = new ConcurrentHashMap<String, MacAddress>(); macToGateway = new ConcurrentHashMap<MacAddress, IPv4Address>(); deviceListener = new DeviceListenerImpl(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProviderService = context.getServiceImpl(IFloodlightProviderService.class); restApiService = context.getServiceImpl(IRestApiService.class); debugCounterService = context.getServiceImpl(IDebugCounterService.class); deviceManagerService = context.getServiceImpl(IDeviceService.class); routingEngineService = context.getServiceImpl(IRoutingService.class); topologyService = context.getServiceImpl(ITopologyService.class); sfpService = context.getServiceImpl(IStaticFlowEntryPusherService.class); switchService = context.getServiceImpl(IOFSwitchService.class); vips = new HashMap<String, LBVip>(); pools = new HashMap<String, LBPool>(); members = new HashMap<String, LBMember>(); vipIpToId = new HashMap<Integer, String>(); vipIpToMac = new HashMap<Integer, MacAddress>(); memberIpToId = new HashMap<Integer, String>(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { controller.setStorageSourceService( context.getServiceImpl(IStorageSourceService.class)); controller.setPktInProcessingService( context.getServiceImpl(IPktInProcessingTimeService.class)); controller.setDebugCounter( context.getServiceImpl(IDebugCounterService.class)); controller.setDebugEvent( context.getServiceImpl(IDebugEventService.class)); controller.setRestApiService( context.getServiceImpl(IRestApiService.class)); controller.setThreadPoolService( context.getServiceImpl(IThreadPoolService.class)); controller.setSyncService( context.getServiceImpl(ISyncService.class)); controller.setSwitchService( context.getServiceImpl(IOFSwitchService.class)); controller.init(context.getConfigParams(this)); }
@Override public void startUp(FloodlightModuleContext context) throws FloodlightModuleException { try { final IStoreClient<String, TortureValue> storeClient = syncService.getStoreClient(SYNC_STORE_NAME, String.class, TortureValue.class); for (int i = 0; i < numWorkers; i++) { Thread thread = new Thread(new TortureWorker(storeClient, i), "Torture-" + i); thread.setPriority(Thread.MIN_PRIORITY); thread.start(); } } catch (Exception e) { throw new FloodlightModuleException(e); } }
/** * {@inheritDoc} */ @Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); ofSwitchService = context.getServiceImpl(IOFSwitchService.class); restApiService = context.getServiceImpl(IRestApiService.class); kafkaProducer = context.getServiceImpl(KafkaMessageProducer.class); // TODO: Ensure Kafka Topics are created.. }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProvider = context .getServiceImpl(IFloodlightProviderService.class); switchStates = new HashMap<IOFSwitch,ObfuscationSwitchState>(); oMaskManager = context.getServiceImpl(IObfuscationMaskManager.class); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { switchService = context.getServiceImpl(IOFSwitchService.class); threadPoolService = context.getServiceImpl(IThreadPoolService.class); kafkaProducer = context.getServiceImpl(KafkaMessageProducer.class); Map<String, String> configParameters = context.getConfigParams(this); interval = Integer.valueOf(configParameters.get("interval")); }
protected void registerTopologyDebugEvents() throws FloodlightModuleException { if (debugEventService == null) { log.error("debugEventService should not be null. Has IDebugEventService been loaded previously?"); } eventCategory = debugEventService.buildEvent(TopologyEvent.class) .setModuleName(PACKAGE) .setEventName("topologyevent") .setEventDescription("Topology Computation") .setEventType(EventType.ALWAYS_LOG) .setBufferCapacity(100) .register(); }
@Before public void setUp() throws FloodlightModuleException { ofSwitchService = createMock(IOFSwitchService.class); restApiService = createMock(IRestApiService.class); iofSwitch = createMock(IOFSwitch.class); switchDescription = createMock(SwitchDescription.class); dpid = createMock(DatapathId.class); context.addService(IRestApiService.class, restApiService); context.addService(IOFSwitchService.class, ofSwitchService); switchManager = new SwitchManager(); switchManager.init(context); }
/** * Set a new IEntityClassifier * Use this as a quick way to use a particular entity classifier in a * single test without having to setup the full FloodlightModuleContext * again. * @param ecs */ public void setEntityClassifier(IEntityClassifierService ecs) { this.entityClassifier = ecs; try { this.startUp(null); } catch (FloodlightModuleException e) { throw new RuntimeException(e); } }
@Test public void testSignPacketMissedSign() throws PacketParsingException, FloodlightModuleException { OFPacketOut noSignPacket = pvs.generateVerificationPacket(sw1, OFPort.of(1), null, false); IPacket noSignPacketData = new Ethernet().deserialize(noSignPacket.getData(), 0, noSignPacket.getData().length); context.getStorage().put(IFloodlightProviderService.CONTEXT_PI_PAYLOAD, noSignPacketData); expect(producer.send(anyObject())).andThrow(new AssertionFailedError()).anyTimes(); replay(producer); assertEquals(Command.STOP, pvs.receive(sw2, ofPacketIn, context)); verify(producer); }
@Test public void testSignPacketInvalidSign() throws PacketParsingException, FloodlightModuleException { expect(producer.send(anyObject())).andThrow(new AssertionFailedError()).anyTimes(); replay(producer); pvs.initAlgorithm("secret2"); assertEquals(Command.STOP, pvs.receive(sw2, ofPacketIn, context)); verify(producer); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); storageSource = context.getServiceImpl(IStorageSourceService.class); restApi = context.getServiceImpl(IRestApiService.class); rules = new ArrayList<FirewallRule>(); logger = LoggerFactory.getLogger(Firewall.class); // start disabled enabled = false; }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProvider = context .getServiceImpl(IFloodlightProviderService.class); restApi = context.getServiceImpl(IRestApiService.class); }
@Override public void startUp(FloodlightModuleContext context) throws FloodlightModuleException { HashMap<String,Object> flow = new HashMap<String,Object>(); flow.put(StaticFlowEntryPusher.COLUMN_TP_DST, "80"); flow.put(StaticFlowEntryPusher.COLUMN_NW_DST, "10.0.0.2"); flow.put(StaticFlowEntryPusher.COLUMN_NW_SRC, "10.0.0.1"); flow.put(StaticFlowEntryPusher.COLUMN_PRIORITY, "30001"); flow.put(StaticFlowEntryPusher.COLUMN_NAME, "flow1"); flow.put(StaticFlowEntryPusher.COLUMN_ACTIVE, Boolean.toString(true)); flow.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, "2048"); flow.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, "6"); flow.put(StaticFlowEntryPusher.COLUMN_SWITCH, "00:00:00:00:00:00:00:01"); flow.put(StaticFlowEntryPusher.COLUMN_ACTIONS, "output=controller"); storageSource.insertRowAsync(StaticFlowEntryPusher.TABLE_NAME, flow); // flow.put("tp_dst", "80"); // flow.put("nw_dst", "10.0.0.3"); // flow.put("nw_src", "10.0.0.1"); // flow.put("priority", "30001"); // flow.put("name", "flow2"); // flow.put("active", Boolean.toString(true)); // flow.put("dl_type", "2048"); // flow.put("nw_proto", "6"); // flow.put("switch_id", "00:00:00:00:00:00:00:01"); // flow.put("actions", "output=controller"); // // storageSource.insertRowAsync("controller_staticflowtableentry", flow); // storageSource.deleteRowAsync("controller_staticflowtableentry", "flow1"); }
@Override public void startUp(FloodlightModuleContext context) throws FloodlightModuleException { // TODO Auto-generated method stub switchService.addOFSwitchListener(this); }
/** * Startup all of the controller's components * @param floodlightModuleLoader */ @LogMessageDoc(message="Waiting for storage source", explanation="The system database is not yet ready", recommendation="If this message persists, this indicates " + "that the system database has failed to start. " + LogMessageDoc.CHECK_CONTROLLER) public void startupComponents(FloodlightModuleLoader floodlightModuleLoader) throws FloodlightModuleException { this.moduleLoaderState = ModuleLoaderState.STARTUP; // Create the table names we use storageSourceService.createTable(CONTROLLER_TABLE_NAME, null); storageSourceService.createTable(CONTROLLER_INTERFACE_TABLE_NAME, null); storageSourceService.createTable(SWITCH_CONFIG_TABLE_NAME, null); storageSourceService.setTablePrimaryKeyName(CONTROLLER_TABLE_NAME, CONTROLLER_ID); storageSourceService.addListener(CONTROLLER_INTERFACE_TABLE_NAME, this); storageSourceService.createTable(FLOW_PRIORITY_TABLE_NAME, null); storageSourceService.setTablePrimaryKeyName(FLOW_PRIORITY_TABLE_NAME, FLOW_COLUMN_PRIMARY_KEY); storageSourceService.addListener(FLOW_PRIORITY_TABLE_NAME, this); readFlowPriorityConfigurationFromStorage(); // // Startup load monitoring if (overload_drop) { this.loadmonitor.startMonitoring(this.threadPoolService.getScheduledExecutor()); } // Add our REST API restApiService.addRestletRoutable(new CoreWebRoutable()); try { this.syncService.registerStore(OFSwitchManager.SWITCH_SYNC_STORE_NAME, Scope.LOCAL); } catch (SyncException e) { throw new FloodlightModuleException("Error while setting up sync service", e); } addInfoProvider("summary", this); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); log = LoggerFactory.getLogger(DHCPServer.class); sfp = context.getServiceImpl(IStaticFlowEntryPusherService.class); switchService = context.getServiceImpl(IOFSwitchService.class); }
private void registerLinkDiscoveryDebugEvents() throws FloodlightModuleException { if (debugEventService == null) { log.error("Debug Event Service not found."); } eventCategory = debugEventService.buildEvent(DirectLinkEvent.class) .setModuleName(PACKAGE) .setEventName("linkevent") .setEventDescription("Direct OpenFlow links discovered or timed-out") .setEventType(EventType.ALWAYS_LOG) .setBufferCapacity(100) .register(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { restApi = context.getServiceImpl(IRestApiService.class); deviceManager = context.getServiceImpl(IDeviceService.class); logger = LoggerFactory.getLogger(ACL.class); storageSource = context.getServiceImpl(IStorageSourceService.class); ruleSet = new ArrayList<ACLRule>(); apManager = new APManager(); ruleId2FlowName = new HashMap<Integer, Set<String>>(); ruleId2Dpid = new HashMap<Integer, Set<String>>(); dpid2FlowPriority = new HashMap<String, Integer>(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { switchService = context.getServiceImpl(IOFSwitchService.class); topology = context.getServiceImpl(ITopologyService.class); frm = context.getServiceImpl(IFlowReconcileService.class); lds = context.getServiceImpl(ILinkDiscoveryService.class); cntx = new FloodlightContext(); }
private void registerFlowReconcileManagerDebugCounters() throws FloodlightModuleException { if (debugCounterService == null) { logger.error("Debug Counter Service not found."); } try { debugCounterService.registerModule(PACKAGE); ctrFlowReconcileRequest = debugCounterService.registerCounter(PACKAGE, "flow-reconcile-request", "All flow reconcile requests received by this module"); ctrReconciledFlows = debugCounterService.registerCounter(PACKAGE, "reconciled-flows", "All flows reconciled successfully by this module"); } catch (Exception e) { throw new FloodlightModuleException(e.getMessage()); } }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { restApi = context.getServiceImpl(IRestApiService.class); deviceManager = context.getServiceImpl(IDeviceService.class); logger = LoggerFactory.getLogger(ACL.class); storageSource = context.getServiceImpl(IStorageSourceService.class); aclRules = new TreeMap<>(); apManager = new APManager(); ruleId2FlowName = new HashMap<>(); ruleId2Dpid = new HashMap<>(); dpid2FlowPriority = new HashMap<>(); deny2Allow = new HashMap<>(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { restApi = context.getServiceImpl(IRestApiService.class); debugCounterService = context.getServiceImpl(IDebugCounterService.class); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { floodlightProviderService = context.getServiceImpl(IFloodlightProviderService.class); switchService = context.getServiceImpl(IOFSwitchService.class); storageSourceService = context.getServiceImpl(IStorageSourceService.class); restApiService = context.getServiceImpl(IRestApiService.class); haListener = new HAListenerDelegate(); }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { }
@Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { final ThreadGroup tg = new ThreadGroup("Scheduled Task Threads"); ThreadFactory f = new ThreadFactory() { AtomicInteger id = new AtomicInteger(); @Override public Thread newThread(Runnable runnable) { return new Thread(tg, runnable, "Scheduled-" + id.getAndIncrement()); } }; executor = Executors.newScheduledThreadPool(5, f); }