summaryrefslogtreecommitdiff
path: root/test/ptf_test/endpoint_dev_test.py
blob: da136e6002bbf7fa92ce95eb001d70db085ee3d6 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import ptf
from ptf.base_tests import BaseTest
from ptf.testutils import *
from scapy.all import *
from mrzcpd import Mrzcpd
from common_pkt import *
import ptf.mask as mask

icmp_conf = """
[device]
device=veth0
sz_tunnel=8192
sz_buffer=0

[device:veth0]
in_addr=172.17.16.1
in_mask=255.255.255.0
promisc=1
mtu=1500
driver=2
role=3

[service]
iocore=1
distmode=2
hashmode=0

[limits]
nr_max_ef_adapters=32
nr_max_vwires=32
nr_max_tera_adapters=32
nr_max_link_dbs=32

[eal]
virtaddr=0x600000000000
loglevel=7
nohuge=1
mem=65535

[keepalive]
check_spinlock=1

[http_server]
listen_addr=127.0.0.1
[ctrlzone]
ctrlzone0=tunnat,128

[pool]
create_mode=3
sz_direct_pktmbuf=4096
sz_indirect_pktmbuf=4096
sz_cache=256
sz_data=3000

[ctrlmsg]
listen_addr=0.0.0.0
listen_port=46789

[rpc]
addr=127.0.0.1
port=56789

# sid
[ef_adapters]
sid_start=100
sid_end=200
max_rules=256

[vwires]
sid_start=300
sid_end=400
max_rules=256

# vwire
[vwire:0]
interface_int=veth0

[service_lb]
sid_start=1000
sid_end=2000

"""

"""
    +------------+         +-------------------------+        
    |     PTF    |         |          MRZCPD         |
    +------------+  icmp   +-------------------------+
    | veth0-ptf0 |  <--->  |   veth0 (172.17.16.1)   |
    +------------+         +-------------------------+
"""

@group("icmp_reply_test")
class IcmpReplyTest(BaseTest):
    def setUp(self):
        self.dataplane = ptf.dataplane_instance

    def __init__(self):
        BaseTest.__init__(self)

    def runTest(self):
        try:
            # Init & Start mrzcpd
            mrzcpd = Mrzcpd(icmp_conf,"")
            mrzcpd.start()
            send_pkt = simple_icmp_packet(eth_dst='00:01:02:03:04:05',eth_src='00:06:07:08:09:0a',ip_src='172.17.16.2', ip_dst='172.17.16.1', icmp_type=8, icmp_code=0,icmp_data='icmp test\n')
            send_packet(self, 0,send_pkt)

            # Verify
            exp_pkt = simple_icmp_packet(eth_dst='00:06:07:08:09:0a',eth_src='00:01:02:03:04:05',ip_src='172.17.16.1', ip_dst='172.17.16.2', icmp_type=0, icmp_code=0,icmp_data='icmp test\n')
            verify_packet(self, exp_pkt, 0)

        finally:
            mrzcpd.stop()