X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=test%2Ftest_nfvbench.py;h=4a8a574a65e115b89cd89c3194e348f5e9b99dfe;hb=95f2491ed89ac99b0d8bd006b4a13cbeb1eb96ce;hp=2a7ca772b808b49174c043e9f8d048420dd26c94;hpb=4a80fac56ca122a34de5d03c0876e424cc7c6c56;p=nfvbench.git diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py index 2a7ca77..4a8a574 100644 --- a/test/test_nfvbench.py +++ b/test/test_nfvbench.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. # -from mock_trex import no_op - import json import logging import sys @@ -34,6 +32,7 @@ from nfvbench.traffic_client import IpBlock from nfvbench.traffic_client import TrafficClient import nfvbench.traffic_gen.traffic_utils as traffic_utils +from .mock_trex import no_op # just to get rid of the unused function warning no_op() @@ -152,6 +151,19 @@ def test_ip_block(): assert ipb.get_ip(255) == '10.0.0.255' with pytest.raises(IndexError): ipb.get_ip(256) + ipb = IpBlock('10.0.0.0', '0.0.0.1', 1) + assert ipb.get_ip() == '10.0.0.0' + with pytest.raises(IndexError): + ipb.get_ip(1) + + ipb = IpBlock('10.0.0.0', '0.0.0.2', 256) + assert ipb.get_ip() == '10.0.0.0' + assert ipb.get_ip(1) == '10.0.0.2' + assert ipb.get_ip(127) == '10.0.0.254' + assert ipb.get_ip(128) == '10.0.1.0' + with pytest.raises(IndexError): + ipb.get_ip(256) + # verify with step larger than 1 ipb = IpBlock('10.0.0.0', '0.0.0.2', 256) assert ipb.get_ip() == '10.0.0.0' @@ -316,7 +328,14 @@ def _get_dummy_tg_config(chain_type, rate, scc=1, fc=10, step_ip='0.0.0.1', 'measurement': {'NDR': 0.001, 'PDR': 0.1, 'load_epsilon': 0.1}, 'l2_loopback': False, 'cores': None, - 'mbuf_factor': None + 'mbuf_factor': None, + 'disable_hdrh': None, + 'mbuf_64': None, + 'service_mode': False, + 'no_flow_stats': False, + 'no_latency_stats': False, + 'no_latency_streams': False + }) def _get_traffic_client(): @@ -341,7 +360,7 @@ def test_ndr_at_lr(): # tx packets should be line rate for 64B and no drops... assert tg.get_tx_pps_dropped_pps(100) == (LR_64B_PPS, 0) # NDR and PDR should be at 100% - traffic_client.ensure_end_to_end() + # traffic_client.ensure_end_to_end() results = traffic_client.get_ndr_and_pdr() assert_ndr_pdr(results, 200.0, 0.0, 200.0, 0.0)