Skip to content

Commit

Permalink
removing e2e tag from custom and ipv6_imix.
Browse files Browse the repository at this point in the history
add ipsec_imix and tcp_imix tests
  • Loading branch information
dipendughosh committed Sep 26, 2024
1 parent 361c26f commit 783fd4c
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 18 deletions.
20 changes: 10 additions & 10 deletions tests/imix/test_custom_imix_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import time


@pytest.mark.e2e
def test_stats_filter_e2e(api, b2b_raw_config, utils):
"""
configure flows with ipv4 imix
- Send ipv4 imix predefined traffic
Validation:
1) Get port statistics based on port name & column names and assert
Expand All @@ -20,17 +19,17 @@ def test_stats_filter_e2e(api, b2b_raw_config, utils):

b2b_raw_config.flows.clear()
config = b2b_raw_config

d1, d2 = config.devices.device(name="d1").device(name="d2")

eth1 = d1.ethernets.add()
eth1.name = "eth1"
eth1.port_name = config.ports[0].name
eth1.connection.port_name = config.ports[0].name
eth1.mac = "00:ad:aa:13:11:01"

eth2 = d2.ethernets.add()
eth2.name = "eth2"
eth2.port_name = config.ports[1].name
eth2.connection.port_name = config.ports[1].name
eth2.mac = "00:ad:aa:13:11:02"

ip1 = eth1.ipv4_addresses.add()
Expand Down Expand Up @@ -69,7 +68,9 @@ def test_stats_filter_e2e(api, b2b_raw_config, utils):
timeout_seconds=20,
)
utils.stop_traffic(api, b2b_raw_config)
captures_ok(api, b2b_raw_config, utils, no_of_packets, config.ports[1].name )
captures_ok(
api, b2b_raw_config, utils, no_of_packets, config.ports[1].name
)


def results_ok(api, utils, packets):
Expand All @@ -83,9 +84,9 @@ def results_ok(api, utils, packets):
print("Checking byte count")
flow_rx = sum([f.bytes_rx for f in flow_results])
bytes_ok = 300000 <= flow_rx <= 500000
print ("fraemes ok {}" .format(frames_ok))
print ("bytes ok {}".format(bytes_ok))

print("fraemes ok {}".format(frames_ok))
print("bytes ok {}".format(bytes_ok))
return frames_ok and bytes_ok


Expand All @@ -99,4 +100,3 @@ def captures_ok(api, cfg, utils, packets, name):
assert len(buf) in [92, 560, 600]
pkt_count += 1
assert pkt_count == packets

86 changes: 86 additions & 0 deletions tests/imix/test_ipsec_imix_predefined_e2e.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import pytest
import time


def test_stats_filter_e2e(api, b2b_raw_config, utils):
"""
configure flows with ipv4 imix
- Send ipv4 imix predefined traffic
Validation:
1) Get port statistics based on port name & column names and assert
each port & column has returned the values and assert
2) Get flow statistics based on flow name & column names and assert
each flow & column has returned the values and assert
"""

no_of_packets = 1000

b2b_raw_config.flows.clear()
config = b2b_raw_config

d1, d2 = config.devices.device(name="d1").device(name="d2")

eth1 = d1.ethernets.add()
eth1.name = "eth1"
eth1.connection.port_name = config.ports[0].name
eth1.mac = "00:ad:aa:13:11:01"

eth2 = d2.ethernets.add()
eth2.name = "eth2"
eth2.connection.port_name = config.ports[1].name
eth2.mac = "00:ad:aa:13:11:02"

ip1 = eth1.ipv4_addresses.add()
ip1.name = "ipv41"
ip1.address = "10.1.1.1"
ip1.gateway = "10.1.1.2"

ip2 = eth2.ipv4_addresses.add()
ip2.name = "ipv42"
ip2.address = "10.1.1.2"
ip2.gateway = "10.1.1.1"

f1 = config.flows.flow(name="f1")[-1]
f1.tx_rx.device.tx_names = [ip1.name]
f1.tx_rx.device.rx_names = [ip2.name]
f1.size.weight_pairs.predefined = "imix"
f1.rate.pps = 1000
f1.duration.fixed_packets.packets = no_of_packets
f1.metrics.enable = True
eth, ip = f1.packet.ethernet().ipv4()
api.set_config(config)

utils.start_traffic(api, b2b_raw_config)

utils.wait_for(
lambda: results_ok(api, utils, no_of_packets),
"stats to be as expected",
timeout_seconds=20,
)
utils.stop_traffic(api, b2b_raw_config)
captures_ok(api, b2b_raw_config, utils, no_of_packets, config.ports[1].name )


def results_ok(api, utils, packets):
"""
Returns true if stats are as expected, false otherwise.
"""
port_results, flow_results = utils.get_all_stats(api)
frames_ok = utils.total_frames_ok(port_results, flow_results, packets)
flow_rx = sum([f.bytes_rx for f in flow_results])
bytes_ok = 300000 <= flow_rx <= 500000
return frames_ok and bytes_ok

def captures_ok(api, cfg, utils, packets, name):
"""
Returns normally if patterns in captured packets are as expected.
"""
pkt_count = 0
cap_dict = utils.get_all_captures(api, cfg)
for buf in cap_dict[name]:
assert len(buf) in [64, 570, 1518]
pkt_count += 1
assert pkt_count == packets

16 changes: 8 additions & 8 deletions tests/imix/test_ipv6_imix_predefined_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import time


@pytest.mark.e2e
def test_stats_filter_e2e(api, b2b_raw_config, utils):
"""
configure flows with ipv4 imix
- Send ipv4 imix predefined traffic
Validation:
1) Get port statistics based on port name & column names and assert
Expand All @@ -20,7 +19,7 @@ def test_stats_filter_e2e(api, b2b_raw_config, utils):

b2b_raw_config.flows.clear()
config = b2b_raw_config

d1, d2 = config.devices.device(name="d1").device(name="d2")

eth1 = d1.ethernets.add()
Expand Down Expand Up @@ -61,7 +60,9 @@ def test_stats_filter_e2e(api, b2b_raw_config, utils):
timeout_seconds=20,
)
utils.stop_traffic(api, b2b_raw_config)
captures_ok(api, b2b_raw_config, utils, no_of_packets, config.ports[1].name )
captures_ok(
api, b2b_raw_config, utils, no_of_packets, config.ports[1].name
)


def results_ok(api, utils, packets):
Expand All @@ -75,9 +76,9 @@ def results_ok(api, utils, packets):
print("Checking byte count")
flow_rx = sum([f.bytes_rx for f in flow_results])
bytes_ok = 300000 <= flow_rx <= 500000
print ("fraemes ok {}" .format(frames_ok))
print ("bytes ok {}".format(bytes_ok))

print("fraemes ok {}".format(frames_ok))
print("bytes ok {}".format(bytes_ok))
return frames_ok and bytes_ok


Expand All @@ -91,4 +92,3 @@ def captures_ok(api, cfg, utils, packets, name):
assert len(buf) in [60, 496, 594, 1518]
pkt_count += 1
assert pkt_count == packets

88 changes: 88 additions & 0 deletions tests/imix/test_tcp_imix_predefined_e2e.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import pytest
import time


def test_stats_filter_e2e(api, b2b_raw_config, utils):
"""
configure flows with ipv4 imix
- Send ipv4 imix predefined traffic
Validation:
1) Get port statistics based on port name & column names and assert
each port & column has returned the values and assert
2) Get flow statistics based on flow name & column names and assert
each flow & column has returned the values and assert
"""

no_of_packets = 1000

b2b_raw_config.flows.clear()
config = b2b_raw_config

d1, d2 = config.devices.device(name="d1").device(name="d2")

eth1 = d1.ethernets.add()
eth1.name = "eth1"
eth1.connection.port_name = config.ports[0].name
eth1.mac = "00:ad:aa:13:11:01"

eth2 = d2.ethernets.add()
eth2.name = "eth2"
eth2.connection.port_name = config.ports[1].name
eth2.mac = "00:ad:aa:13:11:02"

ip1 = eth1.ipv4_addresses.add()
ip1.name = "ipv41"
ip1.address = "10.1.1.1"
ip1.gateway = "10.1.1.2"

ip2 = eth2.ipv4_addresses.add()
ip2.name = "ipv42"
ip2.address = "10.1.1.2"
ip2.gateway = "10.1.1.1"

f1 = config.flows.flow(name="f1")[-1]
f1.tx_rx.device.tx_names = [ip1.name]
f1.tx_rx.device.rx_names = [ip2.name]
f1.size.weight_pairs.predefined = "tcp_imix"
f1.rate.pps = 1000
f1.duration.fixed_packets.packets = no_of_packets
f1.metrics.enable = True
eth, ip = f1.packet.ethernet().ipv4()
api.set_config(config)

utils.start_traffic(api, b2b_raw_config)

utils.wait_for(
lambda: results_ok(api, utils, no_of_packets),
"stats to be as expected",
timeout_seconds=20,
)
utils.stop_traffic(api, b2b_raw_config)
captures_ok(
api, b2b_raw_config, utils, no_of_packets, config.ports[1].name
)


def results_ok(api, utils, packets):
"""
Returns true if stats are as expected, false otherwise.
"""
port_results, flow_results = utils.get_all_stats(api)
frames_ok = utils.total_frames_ok(port_results, flow_results, packets)
flow_rx = sum([f.bytes_rx for f in flow_results])
bytes_ok = 300000 <= flow_rx <= 500000
return frames_ok and bytes_ok


def captures_ok(api, cfg, utils, packets, name):
"""
Returns normally if patterns in captured packets are as expected.
"""
pkt_count = 0
cap_dict = utils.get_all_captures(api, cfg)
for buf in cap_dict[name]:
assert len(buf) in [64, 570, 1518]
pkt_count += 1
assert pkt_count == packets

0 comments on commit 783fd4c

Please sign in to comment.