use of com.exalttech.trex.remote.models.validate.StreamValidation in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method assignProfile.
/**
* Assign profile to selected port
*
* @param profileName
*/
private void assignProfile(String profileName, double currentBandwidth, boolean assignPrevBandwidth, int portID) {
try {
// update selected profile
AssignedProfile assignedProf = assignedPortProfileMap.get(portID);
if (assignedProf == null) {
return;
}
assignedProf.setProfileName(profileName);
assignedProf.setAllStreamsWithLatency(allStreamWithLatency);
PortModel port = PortsManager.getInstance().getPortModel(portID);
String portState = port.getPortStatus();
StreamValidation streamValidationGraph = serverRPCMethods.assignTrafficProfile(portID, loadedProfiles);
portManager.getPortModel(portID).setStreamLoaded(true);
startStream.setDisable(false);
// update current multiplier data
assignedProf.setRate(streamValidationGraph.getResult().getRate());
multiplierView.assignNewProfile(assignedProf);
// update multiplier value according to previous bandwidth value
if (assignPrevBandwidth) {
multiplierView.setSliderValue(currentBandwidth);
}
updateMultiplierValues(assignedProf);
if (portState.equalsIgnoreCase("tx")) {
startTraffic(portID);
}
} catch (IOException | InvalidRPCResponseException | IncorrectRPCMethodException ex) {
startStream.setDisable(true);
portManager.getPortModel(portID).setStreamLoaded(false);
LOG.error("Failed to load Stream", ex);
} catch (Exception ex) {
java.util.logging.Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
} finally {
portManager.updatedPorts(Arrays.asList(portID));
}
}
use of com.exalttech.trex.remote.models.validate.StreamValidation in project trex-stateless-gui by cisco-system-traffic-generator.
the class RPCMethods method validateStream.
/**
* @param portID
* @return true if the methods was executed successfully , false otherwise
* @throws java.lang.Exception
*/
public StreamValidation validateStream(int portID) throws Exception {
LOG.trace("Validating Stream on port(s) [" + portID + "]:");
LogsController.getInstance().appendText(LogType.INFO, "Validating Stream on port(s) [" + portID + "]:");
String handler = (String) connectionHandler.get(portID);
CommonParams params = new CommonParams(portID, handler);
ObjectMapper mapper = new ObjectMapper();
String response = serverConnectionManager.sendRPCRequest(Constants.VALIDATE_METHOD, params);
response = Util.removeFirstBrackets(response);
StreamValidation streamValidationResponse = mapper.readValue(response, StreamValidation.class);
LOG.trace("Stream Validation response :" + streamValidationResponse.getResult().getRate().toString());
LogsController.getInstance().appendText(LogType.INFO, "Stream Validation response :" + streamValidationResponse.getResult().getRate().toString());
return streamValidationResponse;
}
Aggregations