/** Loads dependencies and initializes data structures. */
  @Override
  public void init(FloodlightModuleContext context) throws FloodlightModuleException {
    log.info(String.format("Initializing %s...", MODULE_NAME));
    Map<String, String> config = context.getConfigParams(this);
    table = Byte.parseByte(config.get("table"));

    this.floodlightProv = context.getServiceImpl(IFloodlightProviderService.class);
    this.linkDiscProv = context.getServiceImpl(ILinkDiscoveryService.class);
    this.deviceProv = context.getServiceImpl(IDeviceService.class);

    this.knownHosts = new ConcurrentHashMap<IDevice, Host>();
  }
예제 #2
0
  @Override
  @LogMessageDocs({
    @LogMessageDoc(
        level = "WARN",
        message = "Error parsing flow idle timeout, " + "using default of {number} seconds",
        explanation = "The properties file contains an invalid " + "flow idle timeout",
        recommendation = "Correct the idle timeout in the " + "properties file."),
    @LogMessageDoc(
        level = "WARN",
        message = "Error parsing flow hard timeout, " + "using default of {number} seconds",
        explanation = "The properties file contains an invalid " + "flow hard timeout",
        recommendation = "Correct the hard timeout in the " + "properties file."),
  })
  public void init(FloodlightModuleContext context) throws FloodlightModuleException {
    super.init();
    this.floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
    this.deviceManager = context.getServiceImpl(IDeviceService.class);
    this.routingEngine = context.getServiceImpl(IRoutingService.class);
    this.topology = context.getServiceImpl(ITopologyService.class);
    this.counterStore = context.getServiceImpl(ICounterStoreService.class);

    // read our config options
    Map<String, String> configOptions = context.getConfigParams(this);
    try {
      String idleTimeout = configOptions.get("idletimeout");
      if (idleTimeout != null) {
        FLOWMOD_DEFAULT_IDLE_TIMEOUT = Short.parseShort(idleTimeout);
      }
    } catch (NumberFormatException e) {
      log.warn(
          "Error parsing flow idle timeout, " + "using default of {} seconds",
          FLOWMOD_DEFAULT_IDLE_TIMEOUT);
    }
    try {
      String hardTimeout = configOptions.get("hardtimeout");
      if (hardTimeout != null) {
        FLOWMOD_DEFAULT_HARD_TIMEOUT = Short.parseShort(hardTimeout);
      }
    } catch (NumberFormatException e) {
      log.warn(
          "Error parsing flow hard timeout, " + "using default of {} seconds",
          FLOWMOD_DEFAULT_HARD_TIMEOUT);
    }
    log.debug("FlowMod idle timeout set to {} seconds", FLOWMOD_DEFAULT_IDLE_TIMEOUT);
    log.debug("FlowMod hard timeout set to {} seconds", FLOWMOD_DEFAULT_HARD_TIMEOUT);
  }
  @Override
  public void startUp(FloodlightModuleContext context) {
    floodlightProvider.addOFSwitchListener(this);
    Map<String, String> configOptions = context.getConfigParams(this);

    try {
      ROOT_NODE_ROOT_OVS_DPID = configOptions.get("root-node-root-ovs-dpid");
      ROOT_NODE_WIFI_OVS_DPID = configOptions.get("root-node-wifi-ovs-dpid");

      ROOT_NODE_WIMAX_OVS_DPID = configOptions.get("root-node-wimax-ovs-dpid");
      WIFI_NODE_WIFI_OVS_DPID = configOptions.get("wifi-node-wifi-ovs-dpid");
      WIFI_NODE_TUNNEL_OVS_DPID = configOptions.get("wifi-node-tunnel-ovs-dpid");
      ROOT_NODE_ROOT_OVS_IP = IPv4.toIPv4Address(configOptions.get("root-node-root-ovs-ip"));
      ROOT_NODE_WIFI_OVS_PATCH =
          Short.parseShort(configOptions.get("root-node-wifi-ovs-patch-port"));
      ROOT_NODE_WIFI_OVS_TUNNEL =
          Short.parseShort(configOptions.get("root-node-wifi-ovs-tunnel-port"));
      ROOT_NODE_WIMAX_OVS_PATCH =
          Short.parseShort(configOptions.get("root-node-wimax-ovs-patch-port"));
      ROOT_NODE_WIMAX_OVS_VLAN =
          Short.parseShort(configOptions.get("root-node-wimax-ovs-vlan-port"));
      ROOT_NODE_ROOT_OVS_WIFI_PATCH =
          Short.parseShort(configOptions.get("root-node-root-ovs-wifi-patch-port"));
      ROOT_NODE_ROOT_OVS_WIMAX_PATCH =
          Short.parseShort(configOptions.get("root-node-root-ovs-wimax-patch-port"));
      WIFI_NODE_WIFI_OVS_PATCH =
          Short.parseShort(configOptions.get("wifi-node-wifi-ovs-patch-port"));
      WIFI_NODE_TUNNEL_OVS_TUNNEL =
          Short.parseShort(configOptions.get("wifi-node-tunnel-ovs-tunnel-port"));
      WIFI_NODE_TUNNEL_OVS_PATCH =
          Short.parseShort(configOptions.get("wifi-node-tunnel-ovs-patch-port"));
    } catch (IllegalArgumentException ex) {
      log.error("Incorrect DHCP Switch Flow Setter configuration options (illegal arg)", ex);
      throw ex;
    } catch (NullPointerException ex) {
      log.error("Incorrect DHCP Switch Flow Setter configuration options (null ptr)", ex);
      throw ex;
    }
  }