Search in sources :

Example 1 with AssignedProfile

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);
    }
}
Also used : AssignedProfile(com.exalttech.trex.ui.views.models.AssignedProfile)

Example 2 with AssignedProfile

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);
}
Also used : AssignedProfile(com.exalttech.trex.ui.views.models.AssignedProfile) TrafficException(com.exalttech.trex.remote.exceptions.TrafficException)

Example 3 with AssignedProfile

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();
}
Also used : Task(javafx.concurrent.Task) TRexClient(com.cisco.trex.stateless.TRexClient) AssignedProfile(com.exalttech.trex.ui.views.models.AssignedProfile)

Example 4 with AssignedProfile

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);
    }
}
Also used : AssignedProfile(com.exalttech.trex.ui.views.models.AssignedProfile) TrafficException(com.exalttech.trex.remote.exceptions.TrafficException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) InvalidRPCResponseException(com.exalttech.trex.remote.exceptions.InvalidRPCResponseException) IncorrectRPCMethodException(com.exalttech.trex.remote.exceptions.IncorrectRPCMethodException) PortAcquireException(com.exalttech.trex.remote.exceptions.PortAcquireException) IOException(java.io.IOException)

Example 5 with AssignedProfile

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);
    }
}
Also used : AssignedProfile(com.exalttech.trex.ui.views.models.AssignedProfile) TrafficException(com.exalttech.trex.remote.exceptions.TrafficException)

Aggregations

AssignedProfile (com.exalttech.trex.ui.views.models.AssignedProfile)9 TrafficException (com.exalttech.trex.remote.exceptions.TrafficException)5 IncorrectRPCMethodException (com.exalttech.trex.remote.exceptions.IncorrectRPCMethodException)2 InvalidRPCResponseException (com.exalttech.trex.remote.exceptions.InvalidRPCResponseException)2 PortAcquireException (com.exalttech.trex.remote.exceptions.PortAcquireException)2 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 TRexClient (com.cisco.trex.stateless.TRexClient)1 StreamValidation (com.exalttech.trex.remote.models.validate.StreamValidation)1 PortState (com.exalttech.trex.ui.PortState)1 Port (com.exalttech.trex.ui.models.Port)1 PortModel (com.exalttech.trex.ui.models.PortModel)1 Task (javafx.concurrent.Task)1