use of com.exalttech.trex.remote.exceptions.TrafficException in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method doUpdateAssignedProfile.
/**
* Update current port
*/
private void doUpdateAssignedProfile(int portIndex) {
try {
if (reAssign) {
reAssign = false;
String assignedProfile = String.valueOf(profileListBox.getValue());
assignProfile(assignedProfile, multiplierView.getSliderValue(), true, portIndex);
} else {
serverRPCMethods.updateTraffic(portIndex, false, MultiplierType.pps.name(), multiplierView.getPPSValue());
// update assigned profile multiplier
AssignedProfile assignedProf = assignedPortProfileMap.get(portIndex);
updateMultiplierValues(assignedProf);
}
updateHeaderBtnStat();
} catch (TrafficException ex) {
LOG.error("Error updating port", ex);
}
enableUpdateBtn(false, false);
}
use of com.exalttech.trex.remote.exceptions.TrafficException in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method startTraffic.
/**
* Start traffic on port
*
* @param portID
*/
private void startTraffic(int portID) {
try {
AssignedProfile assignedProf = assignedPortProfileMap.get(portID);
if (assignedProf != null && assignedProf.isAllStreamsWithLatency()) {
serverRPCMethods.startTraffic(portID, false, "percentage", 100, multiplierView.getDuration());
} else {
serverRPCMethods.startTraffic(portID, false, "pps", multiplierView.getPPSValue(), multiplierView.getDuration());
}
if (assignedProf != null) {
assignedProf.setStreamStarted(true);
assignedProf.setHasDuration(multiplierView.isDurationEnable());
updateMultiplierValues(assignedProf);
}
} catch (TrafficException ex) {
// re-enable start button in case of errors
startStream.setDisable(false);
LOG.error("Error starting traffic", ex);
}
}
use of com.exalttech.trex.remote.exceptions.TrafficException 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 ex) {
throw new TrafficException(ex.toString());
}
}
use of com.exalttech.trex.remote.exceptions.TrafficException 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 ex) {
throw new TrafficException(ex.toString());
}
}
Aggregations