Search in sources :

Example 1 with Mode

use of com.exalttech.trex.remote.models.profiles.Mode in project trex-stateless-gui by cisco-system-traffic-generator.

the class StreamPropertiesViewController method handleMultiBurstModeSelection.

private void handleMultiBurstModeSelection() {
    streamModeGroup.selectToggle(multiBurstMode);
    streamModeGroup.setUserData(StreamMode.MULTI_BURST);
    // disable numbers
    numbersContainer.setDisable(false);
    numOfPacketLabel.setDisable(true);
    numOfPacketTB.setDisable(true);
    numOfBurstLabel.setDisable(false);
    numOfBurstTB.setDisable(false);
    packetPBurstTitle.setDisable(false);
    packetPBurstTB.setDisable(false);
    // enable next stream
    afterStreamContainer.setDisable(false);
    // enable ibg
    ibgTF.setDisable(false);
    ibgTitle.setDisable(false);
    // define gaps view
    gapsImageContainer.setImage(new Image("/icons/" + StreamMode.MULTI_BURST.getImageName()));
    // set numOf Burst value
    Mode mode = selectedProfile.getStream().getMode();
    int numOfBurst = mode.getCount();
    if (numOfBurst < 2) {
        numOfBurst = 2;
    }
    numOfBurstTB.setText(String.valueOf(numOfBurst));
}
Also used : Mode(com.exalttech.trex.remote.models.profiles.Mode) Image(javafx.scene.image.Image)

Example 2 with Mode

use of com.exalttech.trex.remote.models.profiles.Mode in project trex-stateless-gui by cisco-system-traffic-generator.

the class StreamPropertiesViewController method fillStreamProperties.

private void fillStreamProperties(int currentSelectedIndex) {
    Mode mode = selectedProfile.getStream().getMode();
    enabledCB.setSelected(selectedProfile.getStream().isEnabled());
    selfStartCB.setSelected(selectedProfile.getStream().isSelfStart());
    numOfPacketTB.setText(String.valueOf(mode.getTotalPkts()));
    packetPBurstTB.setText(String.valueOf(mode.getPacketsPerBurst()));
    numOfBurstTB.setText(String.valueOf(mode.getCount()));
    rateTypeCB.getSelectionModel().select(mode.getRate().getType().replace('_', ' '));
    rateValueTF.setValue(mode.getRate().getValue());
    isgTF.setText(convertNumToUnit(selectedProfile.getStream().getIsg()));
    ibgTF.setText(convertNumToUnit(mode.getIbg()));
    rxStreamID.setText(String.valueOf(selectedProfile.getStream().getFlowStats().getStreamID()));
    rxEnableCB.setSelected(selectedProfile.getStream().getFlowStats().getEnabled());
    fillGotoStreamOption(currentSelectedIndex);
    stopRG.setSelected(true);
    if (!"-1".equals(selectedProfile.getNext())) {
        gotoRG.setSelected(true);
    }
    timeInLoopTF.setText(String.valueOf(selectedProfile.getStream().getActionCount()));
    timeInLoopCB.setSelected(selectedProfile.getStream().getActionCount() > 0);
    StreamMode streamMode = StreamMode.CONTINUOUS;
    if (!Util.isNullOrEmpty(mode.getType())) {
        streamMode = StreamMode.getMode(mode.getType());
    }
    switch(streamMode) {
        case CONTINUOUS:
            handleContinousModeSelection();
            break;
        case SINGLE_BURST:
            handleBurstModeSelection();
            break;
        case MULTI_BURST:
            handleMultiBurstModeSelection();
            break;
        default:
            break;
    }
}
Also used : Mode(com.exalttech.trex.remote.models.profiles.Mode)

Example 3 with Mode

use of com.exalttech.trex.remote.models.profiles.Mode in project trex-stateless-gui by cisco-system-traffic-generator.

the class TrafficProfile method convertProfilesToTableData.

/**
     * Convert profiles to equivalent tableProfile data
     *
     * @param profilesList
     * @return
     */
public List<TableProfileStream> convertProfilesToTableData(Profile[] profilesList) {
    List<TableProfileStream> tableData = new ArrayList<>();
    for (int index = 0; index < profilesList.length; index++) {
        Profile p = profilesList[index];
        TableProfileStream stream = new TableProfileStream();
        Mode modeYaml = p.getStream().getMode();
        stream.setIndex(String.valueOf(index + 1));
        stream.setEnabled(p.getStream().isEnabled());
        stream.setName(p.getName());
        stream.setMode(modeYaml.getType());
        String rateUnits = "";
        switch(modeYaml.getRate().getType()) {
            case Rate.RateTypes.PPS:
                rateUnits = "pps";
                break;
            case Rate.RateTypes.BPS_L1:
                rateUnits = "bps L1";
                break;
            case Rate.RateTypes.BPS_L2:
                rateUnits = "bps L2";
                break;
            case Rate.RateTypes.PERCENTAGE:
                rateUnits = "%";
                break;
        }
        stream.setRate(Util.formattedData((long) modeYaml.getRate().getValue(), true) + rateUnits);
        stream.setNextStream(getNextStreamValue(p.getNext()));
        String packetBinary = p.getStream().getPacket().getBinary();
        String packetModel = p.getStream().getPacket().getModel();
        stream.setPcapBinary(packetBinary);
        stream.setPktModel(packetModel);
        PacketInfo packetInfo = getPacketInfo(packetBinary);
        stream.setLength(String.valueOf(packetInfo.getLength() + Constants.EXTRA_BYTE));
        stream.setPacketType(packetInfo.getType());
        tableData.add(stream);
    }
    return tableData;
}
Also used : TableProfileStream(com.exalttech.trex.ui.views.models.TableProfileStream) Mode(com.exalttech.trex.remote.models.profiles.Mode) ArrayList(java.util.ArrayList) PacketInfo(com.exalttech.trex.remote.models.profiles.PacketInfo) Profile(com.exalttech.trex.remote.models.profiles.Profile)

Aggregations

Mode (com.exalttech.trex.remote.models.profiles.Mode)3 PacketInfo (com.exalttech.trex.remote.models.profiles.PacketInfo)1 Profile (com.exalttech.trex.remote.models.profiles.Profile)1 TableProfileStream (com.exalttech.trex.ui.views.models.TableProfileStream)1 ArrayList (java.util.ArrayList)1 Image (javafx.scene.image.Image)1