当前位置: 首页>>代码示例>>Java>>正文


Java ScalingAction类代码示例

本文整理汇总了Java中org.openbaton.catalogue.mano.common.ScalingAction的典型用法代码示例。如果您正苦于以下问题:Java ScalingAction类的具体用法?Java ScalingAction怎么用?Java ScalingAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ScalingAction类属于org.openbaton.catalogue.mano.common包,在下文中一共展示了ScalingAction类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.openbaton.catalogue.mano.common.ScalingAction; //导入依赖的package包/类
/**
 * Activates autoscaling for the passed NSR
 *
 * @param msg : NSR in payload to add for autoscaling
 */
@RequestMapping(
  value = "",
  method = RequestMethod.POST,
  consumes = MediaType.APPLICATION_JSON_VALUE,
  produces = MediaType.APPLICATION_JSON_VALUE
)
@ResponseStatus(HttpStatus.CREATED)
public void execute(@RequestBody String msg) throws NotFoundException, SDKException {
  log.debug("========================");
  log.debug("msg=" + msg);
  JsonParser jsonParser = new JsonParser();
  JsonObject json = jsonParser.parse(msg).getAsJsonObject();
  Gson mapper = new GsonBuilder().create();
  //        String actionsString = json.get("actions");
  //        Set<Action> actions = mapper.fromJson(actionsString, Action.class);
  //        log.debug("ACTION=" + action);
  //        NetworkServiceRecord nsr = mapper.fromJson(json.get("payload"), NetworkServiceRecord.class);
  //        log.debug("NSR=" + nsr);
  //        detectionEngine.activate(nsr);
  String projectId = mapper.fromJson(json.get("project_id"), String.class);
  String nsrId = mapper.fromJson(json.get("nsr_id"), String.class);
  String vnfrId = mapper.fromJson(json.get("vnfr_id"), String.class);
  Long cooldown = mapper.fromJson(json.get("cooldown"), Long.class);
  executionManagement.executeActions(
      projectId, nsrId, new HashMap(), new HashSet<ScalingAction>(), cooldown);
}
 
开发者ID:openbaton,项目名称:autoscaling-engine,代码行数:32,代码来源:RestExecutionInterface.java

示例2: ExecutionTask

import org.openbaton.catalogue.mano.common.ScalingAction; //导入依赖的package包/类
public ExecutionTask(
    String projectId,
    String nsr_id,
    Map actionVnfrMap,
    Set<ScalingAction> actions,
    long cooldown,
    ExecutionEngine executionEngine,
    ActionMonitor actionMonitor,
    NfvoProperties nfvoProperties,
    AutoScalingProperties autoScalingProperties)
    throws SDKException {
  this.actionMonitor = actionMonitor;
  log.debug("Initializing ExecutionTask for NSR with id: " + nsr_id + ". Actions: " + actions);
  this.projectId = projectId;
  this.nsr_id = nsr_id;
  this.actionVnfrMap = actionVnfrMap;
  this.actions = actions;
  this.cooldown = cooldown;
  this.executionEngine = executionEngine;
  this.name = "ExecutionTask#" + nsr_id;
  this.nfvoRequestor =
      new NFVORequestor(
          "autoscaling-engine",
          projectId,
          nfvoProperties.getIp(),
          nfvoProperties.getPort(),
          "1",
          nfvoProperties.getSsl().isEnabled(),
          autoScalingProperties.getService().getKey());
}
 
开发者ID:openbaton,项目名称:autoscaling-engine,代码行数:31,代码来源:ExecutionTask.java

示例3: sendDecision

import org.openbaton.catalogue.mano.common.ScalingAction; //导入依赖的package包/类
public void sendDecision(
    String projectId, String nsr_id, Map actionVnfrMap, Set<ScalingAction> actions, long cooldown)
    throws SDKException {
  //log.info("[DECISION_MAKER] DECIDED_ABOUT_ACTIONS " + new Date().getTime());
  log.debug("Send actions to Executor: " + actions.toString());
  executionManagement.executeActions(projectId, nsr_id, actionVnfrMap, actions, cooldown);
}
 
开发者ID:openbaton,项目名称:autoscaling-engine,代码行数:8,代码来源:DecisionEngine.java

示例4: executeActions

import org.openbaton.catalogue.mano.common.ScalingAction; //导入依赖的package包/类
public void executeActions(
    String projectId, String nsr_id, Map actionVnfrMap, Set<ScalingAction> actions, long cooldown)
    throws SDKException {
  //log.info("[EXECUTOR] RECEIVED_ACTION " + new Date().getTime());
  if (actionMonitor.requestAction(nsr_id, Action.SCALE)) {
    log.info("Executing scaling actions for NSR " + nsr_id + " -> " + actions);
    log.debug(
        "Creating new ExecutionTask of ScalingActions: "
            + actions
            + " for NSR with id: "
            + nsr_id);
    ExecutionTask executionTask =
        new ExecutionTask(
            projectId,
            nsr_id,
            actionVnfrMap,
            actions,
            cooldown,
            executionEngine,
            actionMonitor,
            nfvoProperties,
            autoScalingProperties);
    taskScheduler.execute(executionTask);
  } else {
    if (actionMonitor.getAction(nsr_id) == Action.SCALE) {
      log.debug(
          "Processing already an execution request for NSR with id: "
              + nsr_id
              + ". Cannot create another ExecutionTask for NSR with id: "
              + nsr_id);
    } else if (actionMonitor.getAction(nsr_id) == Action.COOLDOWN) {
      log.debug(
          "Waiting for Cooldown for NSR with id: "
              + nsr_id
              + ". Cannot create another ExecutionTask for NSR with id: "
              + nsr_id);
    } else {
      log.warn(
          "Problem while starting ExecutionThread. Internal Status is: "
              + actionMonitor.getAction(nsr_id));
    }
  }
}
 
开发者ID:openbaton,项目名称:autoscaling-engine,代码行数:44,代码来源:ExecutionManagement.java


注:本文中的org.openbaton.catalogue.mano.common.ScalingAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。