Commit 6387e9e add support for EDP and FDP protocol

1 file Authored and Committed by Susant Sahani a year ago
add support for EDP and FDP protocol

    
 1 @@ -63,7 +63,7 @@
 2   
 3   [Service]
 4   Type=simple
 5 - EnvironmentFile=tcpdumpd.environment
 6 + 
 7   ExecStart=/usr/sbin/tcpdump -pnnli ladvd ether proto 0x88cc -vvv -w "/tmp/ladvd-tcp-dump.pcap"
 8   [Install]
 9   WantedBy=multi-user.target
10 @@ -80,7 +80,6 @@
11   
12   [Service]
13   Type=simple
14 - EnvironmentFile=tcpdumpd.environment
15   ExecStart=/usr/sbin/tcpdump -pnnli ladvd -c 1 'ether[20:2] == 0x2000' -vvv -w "/tmp/ladvd-tcp-dump.pcap"
16   [Install]
17   WantedBy=multi-user.target
18 @@ -88,6 +87,38 @@
19           subprocess.check_output(['systemctl','daemon-reload'])
20           subprocess.check_output(['systemctl','restart', 'tcpdump.service'])
21   
22 +     def StartCaptureEDPPackets(self):
23 +         """Start tcpdump to capture EDP packets"""
24 +         self.WriteServiceFile('tcpdump.service', '''\
25 + [Unit]
26 + Description=TCPDumpd
27 + After=multi-user.target network.target
28 + 
29 + [Service]
30 + Type=simple
31 + ExecStart=/usr/sbin/tcpdump -pnnli ladvd ether[12:2] <= 1500 and ether[14:4] = 0xaaaa0300 and ether[18:4] = 0xe02b00bb -vv -w "/tmp/ladvd-tcp-dump.pcap"
32 + [Install]
33 + WantedBy=multi-user.target
34 + ''')
35 +         subprocess.check_output(['systemctl','daemon-reload'])
36 +         subprocess.check_output(['systemctl','restart', 'tcpdump.service'])
37 + 
38 +     def StartCaptureFDPPackets(self):
39 +         """Start tcpdump to capture FDP packets"""
40 +         self.WriteServiceFile('tcpdump.service', '''\
41 + [Unit]
42 + Description=TCPDumpd
43 + After=multi-user.target network.target
44 + 
45 + [Service]
46 + Type=simple
47 + ExecStart=/usr/sbin/tcpdump -pnnli ladvd ether[12:2] <= 1500 && ether[14:4] == 0xAAAA0300 && ether[18:4] == 0xE0522000 -vv -w "/tmp/ladvd-tcp-dump.pcap"
48 + [Install]
49 + WantedBy=multi-user.target
50 + ''')
51 +         subprocess.check_output(['systemctl','daemon-reload'])
52 +         subprocess.check_output(['systemctl','restart', 'tcpdump.service'])
53 + 
54       def StopCapturingPackets(self):
55           subprocess.check_output(['systemctl', 'stop', 'tcpdump.service'])
56           time.sleep(3);
57 @@ -185,6 +216,30 @@
58           self.Stopladvd()
59           os.remove(LADVD_TCP_DUMP_FILE)
60   
61 +     def test_ladvd_trasmitted_fdp_packets(self):
62 +         """ verify at the other end of veth ifname ladvd has received FDP (Foundry Discovery Protocol) packets. tcpdump """
63 + 
64 +         self.StartCaptureFDPPackets()
65 +         self.Startladvd()
66 + 
67 +         """ capture for 30 seconds """
68 +         time.sleep(30)
69 + 
70 +         self.StopCapturingPackets()
71 +         self.FindProtocolFieldsinTCPDump(PORT_ID='02:01:02:03:04:09')
72 + 
73 +     def test_ladvd_trasmitted_edp_packets(self):
74 +         """ verify at the other end of veth ifname ladvd has received EDP packets. tcpdump """
75 + 
76 +         self.StartCaptureEDPPackets()
77 +         self.Startladvd()
78 + 
79 +         """ capture for 30 seconds """
80 +         time.sleep(30)
81 + 
82 +         self.StopCapturingPackets()
83 +         self.FindProtocolFieldsinTCPDump(PORT_ID='02:01:02:03:04:09')
84 + 
85       def test_ladvd_trasmitted_cdp_packets(self):
86           """ verify at the other end of veth ifname ladvd has received CDP packets. tcpdump """
87