use of com.exalttech.trex.ui.views.models.AssignedProfile in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method updateCurrentProfileMultiplier.
/**
* Update current loaded profile multiplier
*/
private void updateCurrentProfileMultiplier() {
profileLoaded = false;
AssignedProfile assignedProf = assignedPortProfileMap.get(lastLoadedPortPtofileIndex);
if (assignedProf != null) {
assignedProf.setHasDuration(multiplierView.isDurationEnable());
updateMultiplierValues(assignedProf);
}
if (!updateBtn.isDisabled()) {
doUpdateAssignedProfile(lastLoadedPortPtofileIndex);
}
}
use of com.exalttech.trex.ui.views.models.AssignedProfile 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.ui.views.models.AssignedProfile in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method unloadProfile.
private void unloadProfile() {
if (currentSelectedProfile == null) {
return;
}
Task<Void> unloadProfileTask = new Task<Void>() {
@Override
protected Void call() throws Exception {
TRexClient trexClient = ConnectionManager.getInstance().getTrexClient();
trexClient.stopTraffic(lastSelectedPortIndex);
trexClient.removeAllStreams(lastSelectedPortIndex);
return null;
}
};
unloadProfileTask.setOnSucceeded(event -> {
LogsController.getInstance().appendText(LogType.INFO, currentSelectedProfile + " profile unloaded");
currentSelectedProfile = Constants.SELECT_PROFILE;
assignedPortProfileMap.put(lastSelectedPortIndex, new AssignedProfile());
trafficProfileLoadedProperty.set(false);
portManager.updatedPorts(Arrays.asList(lastSelectedPortIndex));
});
LogsController.getInstance().appendText(LogType.INFO, "Unloading " + currentSelectedProfile + " profile");
new Thread(unloadProfileTask).start();
}
use of com.exalttech.trex.ui.views.models.AssignedProfile in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method viewProfile.
/**
* Show profile view
*/
private void viewProfile() {
try {
hideShowStatTable(false);
int portIndex = getSelectedPortIndex();
lastSelectedPortIndex = portIndex;
profileLoaded = true;
disableProfileProperty.set(!portManager.isCurrentUserOwner(portIndex));
disableProfileNote.visibleProperty().bind(disableProfileProperty);
AssignedProfile assigned = assignedPortProfileMap.get(portIndex);
if (assigned == null || !portManager.isCurrentUserOwner(portIndex)) {
assigned = new AssignedProfile();
assignedPortProfileMap.put(portIndex, assigned);
}
if (assigned.isProfileAssigned()) {
profileListBox.getSelectionModel().select(assigned.getProfileName());
profileDetailContainer.setVisible(true);
} else {
profileDetailContainer.setVisible(false);
profileListBox.getSelectionModel().select(Constants.SELECT_PROFILE);
}
tableView.reset();
if (!Util.isNullOrEmpty(assigned.getProfileName())) {
loadStreamTable(assigned.getProfileName());
// fill multiplier values
multiplierView.fillAssignedProfileValues(assigned);
}
previousSelectedPortIndex = portIndex;
} catch (Exception ex) {
LOG.error("Error loading profile", ex);
}
}
use of com.exalttech.trex.ui.views.models.AssignedProfile 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);
}
}
Aggregations