diff --git a/README.md b/README.md index 184b5b6..3cde157 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ snappi-trex is a snappi plugin that allows executing scripts written using [snappi](https://github.com/open-traffic-generator/snappi) with Cisco's [TRex Traffic Generator](https://trex-tgn.cisco.com). -snappi-trex is currently compatible with snappi v0.6.1 and Open Traffic Generator v0.6.1 +snappi-trex is currently compatible with snappi v0.6.4 and Open Traffic Generator v0.6.4 ## Design snappi-trex converts snappi Open Traffic Generator API configuration into the equivalent TRex STL Client configuration. This allows users to use the TRex Traffic Generator and its useful features without having to write complex TRex scripts. diff --git a/VERSION b/VERSION index def9a01..a192233 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.5 \ No newline at end of file +0.1.6 \ No newline at end of file diff --git a/docs/quickstart.md b/docs/quickstart.md index 44ab539..a1a9f39 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -22,7 +22,7 @@ sudo apt-get install python3-pip ``` Install snappi ```sh -pip3 install snappi==0.6.1 +pip3 install snappi==0.6.4 ``` Now, install the snappi-trex extension. ```sh diff --git a/requirements.txt b/requirements.txt index ea82458..cebac18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ setuptools wheel twine python-dotenv -snappi==0.4.38 \ No newline at end of file +snappi==0.6.4 \ No newline at end of file diff --git a/snappi_trex/setconfig.py b/snappi_trex/setconfig.py index 9af97fc..bb95e11 100644 --- a/snappi_trex/setconfig.py +++ b/snappi_trex/setconfig.py @@ -27,6 +27,12 @@ def set_rate(rate): bps = rate['gbps'] * 1000000000 elif rate['choice'] == 'percentage': percent = rate['percentage'] + if pps: + pps = int(pps) + if bps: + bps = int(bps) + if percent: + percent = int(percent) return pps, bps, percent diff --git a/snappi_trex/validation.py b/snappi_trex/validation.py index 3373a34..38ef532 100644 --- a/snappi_trex/validation.py +++ b/snappi_trex/validation.py @@ -62,14 +62,14 @@ def validate_rate(rate): raise SnappiTrexException('Invalid \'rate\' choice') if pps is not None: - if not isinstance(pps, float) and not isinstance(pps, int): + if not isinstance(pps, str) and not isinstance(pps, int): print(isinstance(pps, float)) raise SnappiTrexException('\'pps\' must be integer or float') if bps is not None: - if not isinstance(bps, float) and not isinstance(bps, int): + if not isinstance(bps, str) and not isinstance(bps, int): raise SnappiTrexException('\'(k/m/g)bps\' must be integer or float') if percent is not None: - if not isinstance(percent, float) and not isinstance(percent, int): + if not isinstance(percent, str) and not isinstance(percent, int): raise SnappiTrexException('\'percentage\' must be integer or float') @staticmethod @@ -299,8 +299,8 @@ def validate_capture_settings(settings, port_ids): raise SnappiTrexException('\'{}\' is not a supported capture format'.format(s['format'])) if 'packet_size' in s and s['packet_size'] is not None: raise SnappiTrexException('maximum capture packet size options are not supported') - if s['overwrite']: - raise SnappiTrexException('overwrite not supported for captures') + # if not s['overwrite']: + # raise SnappiTrexException('overwrite not supported for captures') capture_filter_info = Info.get_capture_filter_info() if 'filters' in s: diff --git a/tests/data/setrate_validation_bad.json b/tests/data/setrate_validation_bad.json index f064fff..795d3ca 100644 --- a/tests/data/setrate_validation_bad.json +++ b/tests/data/setrate_validation_bad.json @@ -10,7 +10,7 @@ }, { "choice": "pps", - "pps": "19.4d", + "pps": 1203.321, "bps": 10923.52, "kbps": 123.34, "mbps": 0.9823, @@ -20,7 +20,7 @@ { "choice": "bps", "pps": "19.4d", - "bps": "10923.52", + "bps": 10923.52, "kbps": "123.34", "mbps": "0.9823", "gbps": "0.0032", @@ -30,7 +30,7 @@ "choice": "kbps", "pps": "19.4d", "bps": "10923.52", - "kbps": "123.34", + "kbps": 123.34, "mbps": "0.9823", "gbps": "0.0032", "percentage": "23.41" @@ -40,7 +40,7 @@ "pps": "19.4d", "bps": "10923.52", "kbps": "123.34", - "mbps": "0.9823", + "mbps": 0.9823, "gbps": "0.0032", "percentage": "23.41" }, @@ -50,7 +50,7 @@ "bps": "10923.52", "kbps": "123.34", "mbps": "0.9823", - "gbps": "0.0032", + "gbps": 0.0032, "percentage": "23.41" } ] \ No newline at end of file diff --git a/tests/data/setrate_validation_good.json b/tests/data/setrate_validation_good.json index 9642c79..6673926 100644 --- a/tests/data/setrate_validation_good.json +++ b/tests/data/setrate_validation_good.json @@ -1,7 +1,7 @@ [ { "choice": "pps", - "pps": 19.4, + "pps": 19, "bps": 10923.52, "kbps": 123.34, "mbps": 0.9823, @@ -11,7 +11,7 @@ { "choice": "bps", "pps": 19.4, - "bps": 10923.52, + "bps": 10923, "kbps": 123.34, "mbps": 0.9823, "gbps": 0.0032, @@ -21,7 +21,7 @@ "choice": "kbps", "pps": 19.4, "bps": 10923.52, - "kbps": 123.34, + "kbps": 123, "mbps": 0.9823, "gbps": 0.0032, "percentage": 23.41 @@ -31,7 +31,7 @@ "pps": 19.4, "bps": 10923.52, "kbps": 123.34, - "mbps": 0.9823, + "mbps": 1, "gbps": 0.0032, "percentage": 23.41 }, @@ -41,7 +41,7 @@ "bps": 10923.52, "kbps": 123.34, "mbps": 0.9823, - "gbps": 0.0032, + "gbps": 1, "percentage": 23.41 } ] \ No newline at end of file