Ejemplo n.º 1
0
  @ScriptUsage(
      description = "create virtual server",
      arguments = {
        @ScriptArgument(name = "name", type = "string", description = "name of the virtual server"),
        @ScriptArgument(name = "profile name", type = "string", description = "profile name"),
        @ScriptArgument(
            name = "port type",
            type = "string",
            description = "type 'auth' for authentication, or 'acct' for accounting",
            optional = true)
      })
  public void createVirtualServer(String[] args) {
    try {
      String name = args[0];
      String profileName = args[1];
      RadiusPortType portType = RadiusPortType.Authentication;
      if (args.length >= 3) portType = RadiusPortType.parse(args[2]);

      RadiusVirtualServer vs = server.createVirtualServer(name, portType, profileName);
      vs.open();

      context.println("opened " + vs.getBindAddress());
    } catch (Exception e) {
      context.println(e.getMessage());
      logger.error("kraken radius: cannot create virtual server", e);
    }
  }