summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py
diff options
context:
space:
mode:
authorAnton Kiselev <anton.kisel@gmail.com>2016-11-08 17:09:32 +0700
committerAnton Kiselev <anton.kisel@gmail.com>2016-11-08 17:32:00 +0700
commit879150e9c79961e07900dfce02c5b53385bc74cb (patch)
tree66e8135e674bf188796e48ef16347ee495934455 /scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py
parent27f7cc1e5e3d750e830253a1986ffb315b3751b7 (diff)
scapy_service payload gen: allow template_code without size property
Signed-off-by: Anton Kiselev <anton.kisel@gmail.com>
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py b/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py
index e9fbcc80..ceb88b47 100644
--- a/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py
+++ b/scripts/automation/trex_control_plane/stl/services/scapy_server/unit_tests/test_utils.py
@@ -49,9 +49,16 @@ def test_generate_ascii_default_seed():
assert(len(res) == 14)
-def test_generate_template_code():
+def test_generate_template_code_no_size():
+ res = generate_bytes({"generate":"template_code", "template_code": "BE EF"})
+ assert(res == bytearray.fromhex('BE EF'))
+
+def test_generate_template_code_less():
+ res = generate_bytes({"generate":"template_code", "template_code": "DE AD BE EF", "size": 2})
+ assert(res == bytearray.fromhex('DE AD'))
+
+def test_generate_template_code_more():
res = generate_bytes({"generate":"template_code", "template_code": "0xDEAD 0xBEEF", "size": 6})
- print(res)
assert(res == bytearray.fromhex('DE AD BE EF DE AD'))
def test_generate_template_base64():