Пример #1
0
  public void init() {
    FVLog.log(LogLevel.DEBUG, this, "initializing new FVSlicer");

    // snag controller info from config
    try {
      hostname = FVConfig.getSliceHost(sliceName);
      port = FVConfig.getSlicePort(sliceName);
      lldpOptIn = FVConfig.getLLDPSpam(sliceName);
      SliceImpl.addListener(sliceName, this);
    } catch (ConfigError e) {
      FVLog.log(
          LogLevel.CRIT, this, "ignoring slice ", sliceName, " malformed slice definition: ", e);
      this.tearDown();
      return;
    }
    this.updatePortList();
    this.reconnect();
    this.keepAlive = new OFKeepAlive(this, this, loop);
    this.keepAlive.scheduleNextCheck();
    fvClassifier.loadLimit(sliceName);
    fvClassifier.loadRateLimit(sliceName);
    try {
      this.fmlimit = SliceImpl.getProxy().getMaxFlowMods(sliceName);
    } catch (ConfigError e) {
      FVLog.log(LogLevel.WARN, this, "Global slice flow mod limit unreadable; disabling.");
      this.fmlimit = -1;
    }
  }
Пример #2
0
 @Override
 public boolean setMaximumFlowMods(String sliceName, String dpid, String maxFlowMods)
     throws PermissionDeniedException {
   String user = APIUserCred.getUserName();
   if (!APIAuth.transitivelyCreated(user, sliceName) && !FVConfig.isSupervisor(user))
     throw new PermissionDeniedException(
         "User " + user + " does not have perms to set the flow mod limit for slice " + sliceName);
   Long dp = FlowSpaceUtil.parseDPID(dpid);
   int limit = Integer.parseInt(maxFlowMods);
   FVLog.log(
       LogLevel.DEBUG,
       null,
       "Setting flowmod limit for slice "
           + sliceName
           + " for dpid "
           + dpid
           + " to "
           + maxFlowMods);
   try {
     if (dp == FlowEntry.ALL_DPIDS) SliceImpl.getProxy().setMaxFlowMods(sliceName, limit);
     else SwitchImpl.getProxy().setMaxFlowMods(sliceName, dp, limit);
   } catch (ConfigError e) {
     return false;
   }
   return true;
 }
Пример #3
0
  public void closeDown(boolean unregisterClassifier) {
    FVLog.log(LogLevel.DEBUG, this, "tearing down");
    this.isShutdown = true;
    this.loop.unregister(this.sock, this);
    if (this.sock != null) {
      try {
        this.sock.close(); // FIXME will this also cancel() the key in
        // the event loop?
      } catch (IOException e) {
        // ignore if error... we're shutting down already
      }
    }
    // tell the classifier to forget about us
    if (unregisterClassifier) fvClassifier.tearDownSlice(this.sliceName);

    this.msgStream = null; // force this to GC, in case we have a memleak on
    // "this"

    HashMap<String, Object> info = this.getStatusInfo();
    TopologyController tc = TopologyController.getRunningInstance();
    if (tc != null)
      tc.sliceConnectionJustChanged(info, TopologyCallback.EventType.SLICE_DISCONNECTED);
    SliceImpl.removeListener(sliceName, this);
    FlowvisorImpl.removeListener(this);
  }
Пример #4
0
 @Override
 public Integer getMaximumFlowMods(String sliceName, String dpid)
     throws PermissionDeniedException {
   String user = APIUserCred.getUserName();
   if (!APIAuth.transitivelyCreated(user, sliceName) && !FVConfig.isSupervisor(user))
     throw new PermissionDeniedException(
         "User " + user + " does not have perms to get the flow mod limit for slice " + sliceName);
   Long dp = FlowSpaceUtil.parseDPID(dpid);
   try {
     if (dp == FlowEntry.ALL_DPIDS) return SliceImpl.getProxy().getMaxFlowMods(sliceName);
     else return SwitchImpl.getProxy().getMaxFlowMods(sliceName, dp);
   } catch (ConfigError e) {
     FVLog.log(LogLevel.DEBUG, null, "Unable to get flow mod limit; " + e.getMessage());
     return null;
   }
 }
Пример #5
0
 public boolean isUp() {
   return SliceImpl.getProxy().isSliceUp(this.sliceName);
 }