From 66e4d3d99b15ea067d3cb83514d663291fc93af4 Mon Sep 17 00:00:00 2001 From: ASHNA-AGGARWAL-KEYSIGHT <83630156+ASHNA-AGGARWAL-KEYSIGHT@users.noreply.github.com> Date: Wed, 20 Apr 2022 21:38:20 +0530 Subject: [PATCH 1/4] Issue522 --- scripts/hello_snappi.py | 2 +- tests/conftest.py | 2 +- tests/ip/test_ip_device_and_flow.py | 5 +++++ tests/ip/test_ip_one_to_one.py | 6 ++++++ tests/ip/test_ip_v4v6_device_raw_capture.py | 2 +- tests/raw/test_basic_flow_stats.py | 4 ++-- tests/raw/test_tcp_unidir_flows.py | 6 ++++++ tests/utils/common.py | 2 +- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/scripts/hello_snappi.py b/scripts/hello_snappi.py index eb91e6b..09deea8 100644 --- a/scripts/hello_snappi.py +++ b/scripts/hello_snappi.py @@ -122,7 +122,7 @@ def captures_ok(api, cfg): req = api.capture_request() req.port_name = p.name # fetch captured pcap bytes and feed it to pcap parser dpkt - pcap = dpkt.pcap.Reader(api.get_capture(req)) + pcap = dpkt.pcapng.Reader(api.get_capture(req)) for _, buf in pcap: # check if current packet is a valid UDP packet eth = dpkt.ethernet.Ethernet(buf) diff --git a/tests/conftest.py b/tests/conftest.py index c0707b7..c5e79d5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -62,7 +62,7 @@ def b2b_raw_config(api): cap = config.captures.capture(name="c1")[-1] cap.port_names = [rx.name] - cap.format = cap.PCAP + cap.format = cap.PCAPNG return config diff --git a/tests/ip/test_ip_device_and_flow.py b/tests/ip/test_ip_device_and_flow.py index cc3301f..cc887e0 100644 --- a/tests/ip/test_ip_device_and_flow.py +++ b/tests/ip/test_ip_device_and_flow.py @@ -1,3 +1,8 @@ +import pytest + +@pytest.mark.skip( + reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/522" +) def test_ip_device_and_flow(api, b2b_raw_config, utils): """ Configure the devices on Tx and Rx Port. diff --git a/tests/ip/test_ip_one_to_one.py b/tests/ip/test_ip_one_to_one.py index 37f3c2a..7b3aafe 100644 --- a/tests/ip/test_ip_one_to_one.py +++ b/tests/ip/test_ip_one_to_one.py @@ -1,3 +1,9 @@ +import pytest + +@pytest.mark.skip( + reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/522" +) + def test_ip_one_to_one(api, b2b_raw_config, utils): """ Configure the devices on Tx and Rx Port. diff --git a/tests/ip/test_ip_v4v6_device_raw_capture.py b/tests/ip/test_ip_v4v6_device_raw_capture.py index 58d2e5d..793505b 100644 --- a/tests/ip/test_ip_v4v6_device_raw_capture.py +++ b/tests/ip/test_ip_v4v6_device_raw_capture.py @@ -44,7 +44,7 @@ def test_ip_v4v6_device_and_raw_capture(api, utils): cap = config.captures.capture(name="c1")[-1] cap.port_names = [rx.name] - cap.format = cap.PCAP + cap.format = cap.PCAPNG # Device configuration tx_dev, rx_dev = config.devices.device().device() diff --git a/tests/raw/test_basic_flow_stats.py b/tests/raw/test_basic_flow_stats.py index 8843b27..1030473 100644 --- a/tests/raw/test_basic_flow_stats.py +++ b/tests/raw/test_basic_flow_stats.py @@ -30,7 +30,7 @@ def test_basic_flow_stats(settings): # configure capture cap = config.captures.capture(name="cap")[-1] cap.port_names = [rx.name] - cap.format = cap.PCAP + cap.format = cap.PCAPNG # configure flow properties flw = config.flows.flow(name="flw")[-1] # flow endpoints @@ -67,5 +67,5 @@ def test_basic_flow_stats(settings): cr.port_name = rx.name pcap_bytes = api.get_capture(cr) # generate pcap in pwd - with open("out.pcap", "wb") as out: + with open("out.pcapng", "wb") as out: out.write(pcap_bytes.read()) diff --git a/tests/raw/test_tcp_unidir_flows.py b/tests/raw/test_tcp_unidir_flows.py index dec2982..7b46e98 100644 --- a/tests/raw/test_tcp_unidir_flows.py +++ b/tests/raw/test_tcp_unidir_flows.py @@ -1,3 +1,9 @@ +import pytest + +@pytest.mark.skip( + reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/522" +) + def test_tcp_unidir_flows(api, utils): """ Configure a raw TCP flow with, diff --git a/tests/utils/common.py b/tests/utils/common.py index 1bc6999..97b4fc5 100644 --- a/tests/utils/common.py +++ b/tests/utils/common.py @@ -330,7 +330,7 @@ def get_all_captures(api, cfg): pcap_bytes = api.get_capture(request) cap_dict[name] = [] - for ts, pkt in dpkt.pcap.Reader(pcap_bytes): + for ts, pkt in dpkt.pcapng.Reader(pcap_bytes): if sys.version_info[0] == 2: cap_dict[name].append([ord(b) for b in pkt]) else: From 4d26315b58a040cca86ed81fc20fbd51e4c64175 Mon Sep 17 00:00:00 2001 From: ASHNA-AGGARWAL-KEYSIGHT <83630156+ASHNA-AGGARWAL-KEYSIGHT@users.noreply.github.com> Date: Thu, 21 Apr 2022 17:10:42 +0530 Subject: [PATCH 2/4] Capture fix --- tests/ip/test_ip_device_and_flow.py | 5 ----- tests/ip/test_ip_one_to_one.py | 6 ------ tests/ip/test_ip_v4v6_device_raw_capture.py | 4 ---- tests/raw/test_tcp_unidir_flows.py | 6 ------ 4 files changed, 21 deletions(-) diff --git a/tests/ip/test_ip_device_and_flow.py b/tests/ip/test_ip_device_and_flow.py index cc887e0..cc3301f 100644 --- a/tests/ip/test_ip_device_and_flow.py +++ b/tests/ip/test_ip_device_and_flow.py @@ -1,8 +1,3 @@ -import pytest - -@pytest.mark.skip( - reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/522" -) def test_ip_device_and_flow(api, b2b_raw_config, utils): """ Configure the devices on Tx and Rx Port. diff --git a/tests/ip/test_ip_one_to_one.py b/tests/ip/test_ip_one_to_one.py index 7b3aafe..37f3c2a 100644 --- a/tests/ip/test_ip_one_to_one.py +++ b/tests/ip/test_ip_one_to_one.py @@ -1,9 +1,3 @@ -import pytest - -@pytest.mark.skip( - reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/522" -) - def test_ip_one_to_one(api, b2b_raw_config, utils): """ Configure the devices on Tx and Rx Port. diff --git a/tests/ip/test_ip_v4v6_device_raw_capture.py b/tests/ip/test_ip_v4v6_device_raw_capture.py index 793505b..c876081 100644 --- a/tests/ip/test_ip_v4v6_device_raw_capture.py +++ b/tests/ip/test_ip_v4v6_device_raw_capture.py @@ -1,9 +1,5 @@ import pytest - -@pytest.mark.skip( - reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/443" -) @pytest.mark.device def test_ip_v4v6_device_and_raw_capture(api, utils): """ diff --git a/tests/raw/test_tcp_unidir_flows.py b/tests/raw/test_tcp_unidir_flows.py index 7b46e98..dec2982 100644 --- a/tests/raw/test_tcp_unidir_flows.py +++ b/tests/raw/test_tcp_unidir_flows.py @@ -1,9 +1,3 @@ -import pytest - -@pytest.mark.skip( - reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/522" -) - def test_tcp_unidir_flows(api, utils): """ Configure a raw TCP flow with, From 3a5c5872f8e559721ea343a7ce4460ba64ddd4a0 Mon Sep 17 00:00:00 2001 From: ASHNA-AGGARWAL-KEYSIGHT <83630156+ASHNA-AGGARWAL-KEYSIGHT@users.noreply.github.com> Date: Mon, 25 Apr 2022 15:27:39 +0530 Subject: [PATCH 3/4] Update test_ip_v4v6_device_raw_capture.py --- tests/ip/test_ip_v4v6_device_raw_capture.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/ip/test_ip_v4v6_device_raw_capture.py b/tests/ip/test_ip_v4v6_device_raw_capture.py index c876081..793505b 100644 --- a/tests/ip/test_ip_v4v6_device_raw_capture.py +++ b/tests/ip/test_ip_v4v6_device_raw_capture.py @@ -1,5 +1,9 @@ import pytest + +@pytest.mark.skip( + reason="https://github.com/open-traffic-generator/snappi-ixnetwork/issues/443" +) @pytest.mark.device def test_ip_v4v6_device_and_raw_capture(api, utils): """ From d5b30e63dc6bf89786f121fb7ab654c4c70f2d77 Mon Sep 17 00:00:00 2001 From: ASHNA-AGGARWAL-KEYSIGHT <83630156+ASHNA-AGGARWAL-KEYSIGHT@users.noreply.github.com> Date: Mon, 25 Apr 2022 17:01:57 +0530 Subject: [PATCH 4/4] Update do.py --- do.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/do.py b/do.py index 0293301..e1b4ae8 100644 --- a/do.py +++ b/do.py @@ -34,6 +34,8 @@ def get_version(): version_info = re.findall(r"version: (.+)", out) if version_info: version_info = version_info[0] + with open("version.txt", "w+") as f: + f.close() if version_info: new_data = [] with open("requirements.txt") as f: @@ -54,7 +56,6 @@ def get_version(): f.writelines(new_data) elif workflow_id: print(workflow_id) - open("version.txt", "w+") def lint():