use of com.exalttech.trex.remote.models.multiplier.Multiplier in project trex-stateless-gui by cisco-system-traffic-generator.
the class RPCMethods method startTraffic.
/**
* @param portID
* @param force
* @param type
* @param multiplierValue
* @param duration
* @return multiplier value from the server
* @throws com.exalttech.trex.remote.exceptions.TrafficException
*/
public double startTraffic(int portID, boolean force, String type, double multiplierValue, double duration) throws TrafficException {
LogsController.getInstance().appendText(LogType.INFO, "Starting Traffic on Port " + portID);
String handler = (String) connectionHandler.get(portID);
Multiplier trafficMultiplier = new Multiplier(type, multiplierValue);
TrafficParams trafficParams = new TrafficParams(force, handler, trafficMultiplier, portID);
trafficParams.setDuration(duration);
try {
String updateTrafficResponse = serverConnectionManager.sendRPCRequest(Constants.START_TRAFFIC_METHOD, trafficParams);
LOG.trace("Start Traffic response:" + updateTrafficResponse);
return getMultiplierValue(updateTrafficResponse);
} catch (JsonProcessingException | UnsupportedEncodingException | InvalidRPCResponseException | IncorrectRPCMethodException | NullPointerException | SizeLimitExceededException ex) {
throw new TrafficException(ex.toString());
}
}
use of com.exalttech.trex.remote.models.multiplier.Multiplier in project trex-stateless-gui by cisco-system-traffic-generator.
the class RPCMethods method updateTraffic.
/**
* @param portID
* @param force
* @param type
* @param multiplierValue
* @return multiplier value from the server
* @throws com.exalttech.trex.remote.exceptions.TrafficException
*/
public double updateTraffic(int portID, boolean force, String type, double multiplierValue) throws TrafficException {
LOG.trace("Updating Traffic on port(s) [" + portID + "], setting to " + multiplierValue + " pps");
LogsController.getInstance().appendText(LogType.INFO, "Updating Traffic on port(s) [" + portID + "], setting to " + multiplierValue + " pps");
Multiplier trafficMultiplier = new Multiplier(type, multiplierValue);
String handler = (String) connectionHandler.get(portID);
TrafficParams trafficParams = new TrafficParams(force, handler, trafficMultiplier, portID);
try {
String updateTrafficResponse = serverConnectionManager.sendRPCRequest(Constants.UPDATE_TRAFFIC_METHOD, trafficParams);
return getMultiplierValue(updateTrafficResponse);
} catch (JsonProcessingException | UnsupportedEncodingException | InvalidRPCResponseException | IncorrectRPCMethodException | NullPointerException | SizeLimitExceededException ex) {
throw new TrafficException(ex.toString());
}
}
Aggregations