Java 类net.floodlightcontroller.core.module.FloodlightModuleContext 实例源码

项目:iTAP-controller    文件:SyncTorture.java   
@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);
    }
}
项目:iTAP-controller    文件:TopologyManager.java   
@Override
public void startUp(FloodlightModuleContext context) {
    clearCurrentTopology();
    // Initialize role to floodlight provider role.
    this.role = floodlightProviderService.getRole();

    ScheduledExecutorService ses = threadPoolService.getScheduledExecutor();
    newInstanceTask = new SingletonTask(ses, new UpdateTopologyWorker());

    if (role != HARole.STANDBY)
        newInstanceTask.reschedule(TOPOLOGY_COMPUTE_INTERVAL_MS,
                TimeUnit.MILLISECONDS);

    linkDiscoveryService.addListener(this);
    floodlightProviderService.addOFMessageListener(OFType.PACKET_IN, this);
    floodlightProviderService.addHAListener(this.haListener);
    addRestletRoutable();
}
项目:open-kilda    文件:PathVerificationFlowTest.java   
@Before
public void setUp() throws Exception {
    logger = LoggerFactory.getLogger(PathVerificationFlowTest.class);
    cntx = new FloodlightContext();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);

    swDescription = factory.buildDescStatsReply().build();
    swFeatures = factory.buildFeaturesReply().setNBuffers(1000).build();

    sw = EasyMock.createMock(IOFSwitch.class);
    expect(sw.getId()).andReturn(swDpid).anyTimes();
    expect(sw.getOFFactory()).andReturn(factory).anyTimes();
    expect(sw.getBuffers()).andReturn(swFeatures.getNBuffers()).anyTimes();
    expect(sw.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(new SwitchDescription(swDescription)).anyTimes();
    expect(sw.isActive()).andReturn(true).anyTimes();
    expect(sw.getLatency()).andReturn(U64.of(10L)).anyTimes();
    replay(sw);

    pvs = new PathVerificationService();
}
项目:iTAP-controller    文件:SyncClientBase.java   
/**
 * Set up the remote sync manager and prepare for requests
 * @throws Exception
 */
protected void connect() throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    ThreadPool tp = new ThreadPool();
    syncManager = new RemoteSyncManager();
    fmc.addService(IThreadPoolService.class, tp);
    fmc.addService(ISyncService.class, syncManager);
    fmc.addConfigParam(syncManager, "hostname", settings.hostname);
    fmc.addConfigParam(syncManager, "port", 
                       Integer.toString(settings.port));
    if (settings.authScheme != null) {
        fmc.addConfigParam(syncManager, "authScheme", 
                           settings.authScheme.toString());
        fmc.addConfigParam(syncManager, "keyStorePath", settings.keyStorePath);
        fmc.addConfigParam(syncManager, "keyStorePassword", 
                           settings.keyStorePassword);
    }
    tp.init(fmc);
    syncManager.init(fmc);
    tp.startUp(fmc);
    syncManager.startUp(fmc);

    out.println("Using remote sync service at " + 
                settings.hostname + ":" + settings.port);
}
项目:fresco_floodlight    文件:SyncClientBase.java   
/**
 * Set up the remote sync manager and prepare for requests
 * @throws Exception
 */
protected void connect() throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    ThreadPool tp = new ThreadPool();
    syncManager = new RemoteSyncManager();
    fmc.addService(IThreadPoolService.class, tp);
    fmc.addService(ISyncService.class, syncManager);
    fmc.addConfigParam(syncManager, "hostname", settings.hostname);
    fmc.addConfigParam(syncManager, "port", 
                       Integer.toString(settings.port));
    if (settings.authScheme != null) {
        fmc.addConfigParam(syncManager, "authScheme", 
                           settings.authScheme.toString());
        fmc.addConfigParam(syncManager, "keyStorePath", settings.keyStorePath);
        fmc.addConfigParam(syncManager, "keyStorePassword", 
                           settings.keyStorePassword);
    }
    tp.init(fmc);
    syncManager.init(fmc);
    tp.startUp(fmc);
    syncManager.startUp(fmc);

    out.println("Using remote sync service at " + 
                settings.hostname + ":" + settings.port);
}
项目:fresco_floodlight    文件:SyncTorture.java   
@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"));
    }
}
项目:fresco_floodlight    文件:SyncTorture.java   
@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);
    }
}
项目:iTAP-controller    文件:FlowReconcileManager.java   
@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);
}
项目:fresco_floodlight    文件:SyncManagerTest.java   
@Test
@Ignore
public void testPerfOneNode() throws Exception {
    tearDown();
    tp = new ThreadPool();
    tp.init(null);
    tp.startUp(null);
    nodes = new ArrayList<Node>();
    nodes.add(new Node("localhost", 40101, (short)1, (short)1));
    nodeString = mapper.writeValueAsString(nodes);
    SyncManager sm = new SyncManager();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    setupSyncManager(fmc, sm, nodes.get(0));
    fmc.addService(ISyncService.class, sm);
    SyncTorture st = new SyncTorture();
    //fmc.addConfigParam(st, "iterations", "1");
    st.init(fmc);
    st.startUp(fmc);
    Thread.sleep(10000);
}
项目:iTAP-controller    文件:SyncManagerTest.java   
@Test
@Ignore
public void testPerfOneNode() throws Exception {
    tearDown();
    tp = new ThreadPool();
    tp.init(null);
    tp.startUp(null);
    nodes = new ArrayList<Node>();
    nodes.add(new Node("localhost", 40101, (short)1, (short)1));
    nodeString = mapper.writeValueAsString(nodes);
    SyncManager sm = new SyncManager();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    setupSyncManager(fmc, sm, nodes.get(0));
    fmc.addService(ISyncService.class, sm);
    SyncTorture st = new SyncTorture();
    //fmc.addConfigParam(st, "iterations", "1");
    st.init(fmc);
    st.startUp(fmc);
    Thread.sleep(10000);
}
项目:fresco_floodlight    文件:VirtualNetworkFilter.java   
@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();

}
项目:fresco_floodlight    文件:SyncManagerTest.java   
protected void setupSyncManager(FloodlightModuleContext fmc,
                                SyncManager syncManager, Node thisNode)
        throws Exception {        
    fmc.addService(IThreadPoolService.class, tp);
    fmc.addService(IDebugCounterService.class, new MockDebugCounterService());
    fmc.addService(IDebugEventService.class, new MockDebugEventService());
    fmc.addConfigParam(syncManager, "configProviders", 
                       PropertyCCProvider.class.getName());
    fmc.addConfigParam(syncManager, "nodes", nodeString);
    fmc.addConfigParam(syncManager, "thisNode", ""+thisNode.getNodeId());
    fmc.addConfigParam(syncManager, "persistenceEnabled", "false");
    fmc.addConfigParam(syncManager, "authScheme", "CHALLENGE_RESPONSE");
    fmc.addConfigParam(syncManager, "keyStorePath", 
                       keyStoreFile.getAbsolutePath());
    fmc.addConfigParam(syncManager, "keyStorePassword", keyStorePassword);
    tp.init(fmc);
    syncManager.init(fmc);

    tp.startUp(fmc);
    syncManager.startUp(fmc);

    syncManager.registerStore("global", Scope.GLOBAL);
    syncManager.registerStore("local", Scope.LOCAL);
}
项目:fresco_floodlight    文件:FloodlightProvider.java   
@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));
}
项目:iTAP-controller    文件:SyncStoreCCProvider.java   
@Override
public void init(SyncManager syncManager, FloodlightModuleContext context) 
        throws SyncException {
    this.syncManager = syncManager;
    threadPool = context.getServiceImpl(IThreadPoolService.class);
    syncManager.registerPersistentStore(SYSTEM_NODE_STORE, Scope.GLOBAL);
    syncManager.registerPersistentStore(SYSTEM_UNSYNC_STORE, 
                                        Scope.UNSYNCHRONIZED);
    this.nodeStoreClient = 
            syncManager.getStoreClient(SYSTEM_NODE_STORE, 
                                       Short.class, Node.class);
    this.nodeStoreClient.addStoreListener(new ShortListener());
    this.unsyncStoreClient = 
            syncManager.getStoreClient(SYSTEM_UNSYNC_STORE, 
                                       String.class, String.class);
    this.unsyncStoreClient.addStoreListener(new StringListener());

    config = context.getConfigParams(syncManager);
}
项目:iTAP-controller    文件:PktInProcessingTime.java   
@Override
@LogMessageDoc(level="INFO",
    message="Packet processing time threshold for warning" +
        " set to {time} ms.",
    explanation="Performance monitoring will log a warning if " +
        "packet processing time exceeds the configured threshold")
public void startUp(FloodlightModuleContext context) {
    // Add our REST API
    restApi.addRestletRoutable(new PerfWebRoutable());

    // TODO - Alex - change this to a config option
    ptWarningThresholdInNano = Long.parseLong(System.getProperty(
         "net.floodlightcontroller.core.PTWarningThresholdInMilli", "0")) * 1000000;
    if (ptWarningThresholdInNano > 0) {
        logger.info("Packet processing time threshold for warning" +
                " set to {} ms.", ptWarningThresholdInNano/1000000);
    }
}
项目:fresco_floodlight    文件:TopologyManager.java   
@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();
}
项目:iTAP-controller    文件:FlowReconcileManager.java   
@Override
public void startUp(FloodlightModuleContext context) {
    // thread to do flow reconcile
    ScheduledExecutorService ses = threadPoolService.getScheduledExecutor();
    flowReconcileTask = new SingletonTask(ses, new Runnable() {
        @Override
        public void run() {
            try {
                if (doReconcile()) {
                    flowReconcileTask.reschedule(
                            FLOW_RECONCILE_DELAY_MILLISEC,
                            TimeUnit.MILLISECONDS);
                }
            } catch (Exception e) {
                logger.warn("Exception in doReconcile(): {}", e);
            }
        }
    });

    String packetInName = OFType.PACKET_IN.getClass().getName();
    packetInName = packetInName.substring(packetInName.lastIndexOf('.')+1);
}
项目:open-kilda    文件:SwitchManager.java   
/**
 * {@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..
}
项目:open-kilda    文件:SwitchManager.java   
/**
 * {@inheritDoc}
 */
@Override
public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
    logger.info("Starting " + SwitchEventCollector.class.getCanonicalName());
    restApiService.addRestletRoutable(new SwitchManagerWebRoutable());
    floodlightProvider.addOFMessageListener(OFType.ERROR, this);
}
项目:open-kilda    文件:SwitchEventCollector.java   
/**
 * {@inheritDoc}
 */
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
    switchService = context.getServiceImpl(IOFSwitchService.class);
    kafkaProducer = context.getServiceImpl(KafkaMessageProducer.class);
    switchManager = context.getServiceImpl(ISwitchManager.class);
}
项目:open-kilda    文件:PathVerificationService.java   
@VisibleForTesting
void initServices(FloodlightModuleContext context)
{
    floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
    switchService = context.getServiceImpl(IOFSwitchService.class);
    restApiService = context.getServiceImpl(IRestApiService.class);
}
项目:fresco_floodlight    文件:ACLRuleResourceTest.java   
@Test
public void testRemove(){
    ACL s = new ACL();
       FloodlightModuleContext fmc = new FloodlightModuleContext();
    try {
        s.init(fmc);
    } catch (FloodlightModuleException e) {
        e.printStackTrace();
    }

    ACLRuleResource r = new ACLRuleResource();
    Context ctx = new Context();
    r.init(ctx, null, null);
    r.getContext().getAttributes().putIfAbsent(IACLService.class.getCanonicalName(), s);

    // input a valid JSON string
       String json = "{\"nw-proto\":\"TCP\",\"src-ip\":\"10.0.0.1/32\",\"dst-ip\": \"10.0.0.2/32\",\"tp-dst\":\"80\",\"action\":\"ALLOW\"}";
       assertEquals(r.store(json),"{\"status\" : \"" + "Success! New rule added." + "\"}");

       // input a invalid JSON string that contains a invalid ruleid value
       json = "{\"ruleid\":\"a\"}";
       assertEquals(r.remove(json),"{\"status\" : \"" + "Failed! ruleid must be specified as a number." + "\"}");

       // input a invalid JSON string that contains a non-existing ruleid value
       json = "{\"ruleid\":\"2\"}";
       assertEquals(r.remove(json),"{\"status\" : \"" + "Failed! a rule with this ID doesn't exist." + "\"}");

       // input a valid JSON string that removes an existing ACL rule
       json = "{\"ruleid\":\"1\"}";
       assertEquals(r.remove(json),"{\"status\" : \"" + "Success! Rule deleted" + "\"}");

}
项目:iTAP-controller    文件:ObfuscationController.java   
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
    floodlightProvider = context .getServiceImpl(IFloodlightProviderService.class);
    log = LoggerFactory.getLogger(ObfuscationController.class);
    switchService = context.getServiceImpl(IOFSwitchService.class);
    routingService = context.getServiceImpl(IObfuscationRoutingService.class);
    linkDiscoveryService = context.getServiceImpl(ILinkDiscoveryService.class);
    oSwitchStateManager = context.getServiceImpl(IObfuscationSwitchStateManager.class);
    oLinkStateManager = context.getServiceImpl(IObfuscationLinkStateManager.class);
    oTopologyManager = new ObfuscationTopologyManager();
    oMaskManager = context.getServiceImpl(IObfuscationMaskManager.class);
    oPolicy = new ObfuscationPolicy();
    arpRequestBuffer = new ArpRequestBuffer();
    rand = new Random();
}
项目:open-kilda    文件:PathVerificationPacketOutTest.java   
@Before
public void setUp() throws Exception {
    super.setUp();
    cntx = new FloodlightContext();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    fmc.addService(IOFSwitchService.class, getMockSwitchService());
    swDescription = factory.buildDescStatsReply().build();
    pvs = new PathVerificationService();
    pvs.initAlgorithm("secret");
    srcIpTarget = new InetSocketAddress("192.168.10.1", 200);
    dstIpTarget = new InetSocketAddress("192.168.10.101", 100);
    sw1HwAddrTarget = "11:22:33:44:55:66";
    sw2HwAddrTarget = "AA:BB:CC:DD:EE:FF";

    OFPortDesc sw1Port1 = EasyMock.createMock(OFPortDesc.class);
    expect(sw1Port1.getHwAddr()).andReturn(MacAddress.of(sw1HwAddrTarget)).anyTimes();
    OFPortDesc sw2Port1 = EasyMock.createMock(OFPortDesc.class);
    expect(sw2Port1.getHwAddr()).andReturn(MacAddress.of(sw2HwAddrTarget)).anyTimes();
    replay(sw1Port1);
    replay(sw2Port1);

    sw1 = buildMockIOFSwitch(1L, sw1Port1, factory, swDescription, srcIpTarget);
    sw2 = buildMockIOFSwitch(2L, sw2Port1, factory, swDescription, dstIpTarget);
    replay(sw1);
    replay(sw2);
}
项目:iTAP-controller    文件:DebugEventService.java   
@Override
public void startUp(FloodlightModuleContext context) {
    IShutdownService shutdownService =
            context.getServiceImpl(IShutdownService.class);
    shutdownService.registerShutdownListener(new ShutdownListenenerDelegate());
    DebugEventAppender.setDebugEventServiceImpl(this);
}
项目:fresco_floodlight    文件:FP_FloodlightRTE.java   
@Override
public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
    // TODO : packet listeners.
    floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);

    parseScripts();
}
项目:iTAP-controller    文件:ObfuscationLinkStateManager.java   
@Override
public void init(FloodlightModuleContext context)
        throws FloodlightModuleException {

    linkStates = new HashMap<Link,ObfuscationLinkState>();
    oMaskManager = context.getServiceImpl(IObfuscationMaskManager.class);

}
项目:iTAP-controller    文件:ThreadPool.java   
@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);
}
项目:fresco_floodlight    文件:PktInProcessingTime.java   
@Override
public void init(FloodlightModuleContext context)
                                         throws FloodlightModuleException {
    floodlightProvider = context
            .getServiceImpl(IFloodlightProviderService.class);
    restApi = context.getServiceImpl(IRestApiService.class);
}
项目:iTAP-controller    文件:ObfuscationSwitchStateManager.java   
@Override
public void init(FloodlightModuleContext context)
        throws FloodlightModuleException {
    floodlightProvider = context .getServiceImpl(IFloodlightProviderService.class);
    switchStates = new HashMap<IOFSwitch,ObfuscationSwitchState>();
    oMaskManager = context.getServiceImpl(IObfuscationMaskManager.class);

}
项目:iTAP-controller    文件:MockDebugEventService.java   
@Override
public
        void
        init(FloodlightModuleContext context)
                                             throws FloodlightModuleException {

}
项目:iTAP-controller    文件:JythonDebugInterface.java   
@Override
public void startUp(FloodlightModuleContext context) {
    Map<String, Object> locals = new HashMap<String, Object>();     
    // add all existing module references to the debug server
    for (Class<? extends IFloodlightService> s : context.getAllServices()) {
        // Put only the last part of the name
        String[] bits = s.getCanonicalName().split("\\.");
        String name = bits[bits.length-1];
        locals.put(name, context.getServiceImpl(s));
    }

    // read our config options
    Map<String, String> configOptions = context.getConfigParams(this);
    jythonHost = configOptions.get("host");
    if (jythonHost == null) {
        Map<String, String> providerConfigOptions = context.getConfigParams(
                FloodlightProvider.class);
        jythonHost = providerConfigOptions.get("openflowhost");
    }
    if (jythonHost != null) {
        log.debug("Jython host set to {}", jythonHost);
    }
    String port = configOptions.get("port");
    if (port != null) {
        jythonPort = Integer.parseInt(port);
    }
    log.debug("Jython port set to {}", jythonPort);

    JythonServer debug_server = new JythonServer(jythonHost, jythonPort, locals);
    debug_server.start();
}
项目:fresco_floodlight    文件:DebugEventService.java   
@Override
public void startUp(FloodlightModuleContext context) {
    IShutdownService shutdownService =
            context.getServiceImpl(IShutdownService.class);
    shutdownService.registerShutdownListener(new ShutdownListenenerDelegate());
    DebugEventAppender.setDebugEventServiceImpl(this);
}
项目:iTAP-controller    文件:Firewall.java   
@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;
}
项目:fresco_floodlight    文件:MockDebugEventService.java   
@Override
public
        void
        startUp(FloodlightModuleContext context)
                                                throws FloodlightModuleException {

}
项目:iTAP-controller    文件:FlowPusher.java   
@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");
    }
项目:iTAP-controller    文件:DeviceManagerImpl.java   
@Override
public void init(FloodlightModuleContext fmc) throws FloodlightModuleException {
    this.perClassIndices =
            new HashSet<EnumSet<DeviceField>>();
    addIndex(true, EnumSet.of(DeviceField.IPV4));

    this.deviceListeners = new ListenerDispatcher<String, IDeviceListener>();
    this.suppressAPs = Collections.newSetFromMap(
            new ConcurrentHashMap<SwitchPort, Boolean>());

    this.floodlightProvider =
            fmc.getServiceImpl(IFloodlightProviderService.class);
    this.storageSource =
            fmc.getServiceImpl(IStorageSourceService.class);
    this.topology =
            fmc.getServiceImpl(ITopologyService.class);
    this.restApi = fmc.getServiceImpl(IRestApiService.class);
    this.threadPool = fmc.getServiceImpl(IThreadPoolService.class);
    this.entityClassifier = fmc.getServiceImpl(IEntityClassifierService.class);
    this.debugCounters = fmc.getServiceImpl(IDebugCounterService.class);
    this.debugEventService = fmc.getServiceImpl(IDebugEventService.class);
    this.syncService = fmc.getServiceImpl(ISyncService.class);
    this.deviceSyncManager = new DeviceSyncManager();
    this.haListenerDelegate = new HAListenerDelegate();
    registerDeviceManagerDebugCounters();
    registerDeviceManagerDebugEvents();
    this.addListener(new DeviceDebugEventLogger());
}
项目:fresco_floodlight    文件:LearningSwitch.java   
@Override
public void init(FloodlightModuleContext context) throws FloodlightModuleException {
    macVlanToSwitchPortMap = new ConcurrentHashMap<IOFSwitch, Map<MacVlanPair, OFPort>>();
    floodlightProviderService = context.getServiceImpl(IFloodlightProviderService.class);
    debugCounterService = context.getServiceImpl(IDebugCounterService.class);
    restApiService = context.getServiceImpl(IRestApiService.class);
}
项目:iTAP-controller    文件:SyncManager.java   
@Override
public void startUp(FloodlightModuleContext context)
        throws FloodlightModuleException {

    rpcService = new RPCService(this, debugCounter);

    cleanupTask = new SingletonTask(threadPool.getScheduledExecutor(),
                                    new CleanupTask());
    cleanupTask.reschedule(CLEANUP_INTERVAL +
                           random.nextInt(30), TimeUnit.SECONDS);

    antientropyTask = new SingletonTask(threadPool.getScheduledExecutor(),
                                   new AntientropyTask());
    antientropyTask.reschedule(ANTIENTROPY_INTERVAL +
                               random.nextInt(30), TimeUnit.SECONDS);

    final ThreadGroup tg = new ThreadGroup("Hint Workers");
    tg.setMaxPriority(Thread.NORM_PRIORITY - 2);
    ThreadFactory f = new ThreadFactory() {
        AtomicInteger id = new AtomicInteger();

        @Override
        public Thread newThread(Runnable runnable) {
            return new Thread(tg, runnable,
                              "HintWorker-" + id.getAndIncrement());
        }
    };
    hintThreadPool = Executors.newCachedThreadPool(f);
    for (int i = 0; i < SYNC_WORKER_POOL; i++) {
        hintThreadPool.execute(new HintWorker());
    }

    doUpdateConfiguration();
    rpcService.run();

    updateConfigTask =
            new SingletonTask(threadPool.getScheduledExecutor(),
                              new UpdateConfigTask());
    updateConfigTask.reschedule(CONFIG_RESCAN_INTERVAL, TimeUnit.SECONDS);
}
项目:iTAP-controller    文件:RemoteSyncManager.java   
@Override
public void init(FloodlightModuleContext context)
        throws FloodlightModuleException {
    Map<String, String> config = context.getConfigParams(this);
    if (null != config.get("hostname"))
        hostname = config.get("hostname");
    if (null != config.get("port"))
        port = Integer.parseInt(config.get("port"));
    keyStorePath = config.get("keyStorePath");
    keyStorePassword = config.get("keyStorePassword");
    authScheme = AuthScheme.NO_AUTH;
    try {
        authScheme = AuthScheme.valueOf(config.get("authScheme"));
    } catch (Exception e) {}
}