aboutsummaryrefslogtreecommitdiffstats
path: root/docs/scripts/sphinx-make.sh
blob: b00fb228ca751d6ac43e3eeb798a41076834a0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash -ex

# Not refactored to root Makefile because CI calls this from
# makefile in /docs (as if 'make -C docs').
if [ -z "$PYTHON" ]
then
PYTHON_INTERP=python3
else
PYTHON_INTERP=$(PYTHON)
fi

# Get the OS
OS_ID=$(grep '^ID=' /etc/os-release  | cut -f2- -d= | sed -e 's/\"//g')
OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release  | cut -f2- -d= | sed -e 's/\"//g')

if [ "$1" == "venv" ]
then
    # We need to install the venv package on new systems
    if [ "$OS_ID" == "ubuntu" ]
    then
	sudo apt-get install $CONFIRM python3-venv
    fi
    if [ "$OS_ID" == "centos" ]
    then
	if [ "$OS_VERSION" == "8" ]
	then
	    sudo yum install $CONFIRM python3-virtualenv
	else
	    sudo yum install $CONFIRM python3-venv
	fi
    fi

    # Install the virtual environment
    $PYTHON_INTERP -m venv $VENV_DIR
    source $VENV_DIR/bin/activate;
    $PYTHON_INTERP -m pip install wheel==0.34.2
    $PYTHON_INTERP -m pip install -r $DOCS_DIR/etc/requirements.txt
else
    source $VENV_DIR/bin/activate;
    VERSION=`source $WS_ROOT/src/scripts/version`
    TM=`TZ=GMT date`
    sed -ie "s/**VPP Version:\*\* .*/**VPP Version:** $VERSION/" $DOCS_DIR/about.rst
    sed -ie "s/**Built on:\*\* .*/**Built on:** $TM/" $DOCS_DIR/about.rst
    rm $DOCS_DIR/about.rste
    make -C $DOCS_DIR $1
fi

deactivate
ss="n">format(self.rx_port)) self.c.reset(ports = [self.tx_port, self.rx_port]) self.pkt = STLPktBuilder(pkt = Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)/IP()/'a_payload_example') @classmethod def tearDownClass(cls): # connect back at end of tests if not cls.is_connected(): CTRexScenario.stl_trex.connect() def __verify_flow (self, pg_id, total_pkts, pkt_len): flow_stats = self.c.get_stats()['flow_stats'].get(pg_id) if not flow_stats: assert False, "no flow stats available" tx_pkts = flow_stats['tx_pkts'].get(self.tx_port, 0) tx_bytes = flow_stats['tx_bytes'].get(self.tx_port, 0) rx_pkts = flow_stats['rx_pkts'].get(self.rx_port, 0) if tx_pkts != total_pkts: pprint.pprint(flow_stats) assert False, 'TX pkts mismatch - got: {0}, expected: {1}'.format(tx_pkts, total_pkts) if tx_bytes != (total_pkts * pkt_len): pprint.pprint(flow_stats) assert False, 'TX bytes mismatch - got: {0}, expected: {1}'.format(tx_bytes, (total_pkts * pkt_len)) if rx_pkts != total_pkts: pprint.pprint(flow_stats) assert False, 'RX pkts mismatch - got: {0}, expected: {1}'.format(rx_pkts, total_pkts) # RX itreation def __rx_iteration (self, exp_list): self.c.clear_stats() self.c.start(ports = [self.tx_port]) self.c.wait_on_traffic(ports = [self.tx_port]) for exp in exp_list: self.__verify_flow(exp['pg_id'], exp['total_pkts'], exp['pkt_len']) # one simple stream on TX --> RX def test_one_stream(self): total_pkts = 500000 try: s1 = STLStream(name = 'rx', packet = self.pkt, flow_stats = STLFlowStats(pg_id = 5), mode = STLTXSingleBurst(total_pkts = total_pkts, percentage = 80 )) # add both streams to ports self.c.add_streams([s1], ports = [self.tx_port]) print "\ninjecting {0} packets on port {1}\n".format(total_pkts, self.tx_port) exp = {'pg_id': 5, 'total_pkts': total_pkts, 'pkt_len': self.pkt.get_pkt_len()} self.__rx_iteration( [exp] ) except STLError as e: assert False , '{0}'.format(e) # one simple stream on TX --> RX def test_multiple_streams(self): total_pkts = 500000 try: streams = [] exp = [] # 10 identical streams for pg_id in range(1, 10): streams.append(STLStream(name = 'rx {0}'.format(pg_id), packet = self.pkt, flow_stats = STLFlowStats(pg_id = pg_id), mode = STLTXSingleBurst(total_pkts = total_pkts * pg_id, pps = total_pkts * pg_id))) exp.append({'pg_id': pg_id, 'total_pkts': total_pkts * pg_id, 'pkt_len': self.pkt.get_pkt_len()}) # add both streams to ports self.c.add_streams(streams, ports = [self.tx_port]) self.__rx_iteration(exp) except STLError as e: assert False , '{0}'.format(e) def test_1_stream_many_iterations (self): total_pkts = 50000 try: s1 = STLStream(name = 'rx', packet = self.pkt, flow_stats = STLFlowStats(pg_id = 5), mode = STLTXSingleBurst(total_pkts = total_pkts, percentage = 80 )) # add both streams to ports self.c.add_streams([s1], ports = [self.tx_port]) #print "\ninjecting {0} packets on port {1}\n".format(total_pkts, self.tx_port) exp = {'pg_id': 5, 'total_pkts': total_pkts, 'pkt_len': self.pkt.get_pkt_len()} for i in range(0, 10): print "starting iteration {0}".format(i) self.__rx_iteration( [exp] ) except STLError as e: assert False , '{0}'.format(e)