前言
- 关于OFTest的介绍,请戳这里
- 总的来说,就是用python写的测试Openflow协议一致性的测试套件
- 可以将OFTest扩展为测试Openflow的测试平台,例如做压力测试
常见干扰报文:IPv6报文
- 例如在测试过程中发现
======================================================================
FAIL: stress_abnormal.StressAbnormal_2_3
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/centec/workshop/oftest-new/tests-1.3/stress_abnormal.py", line 531, in runTest
verify_packets(self, str(exp_pkt), [out_port2])
File "/home/centec/workshop/oftest-new/src/python/oftest/testutils.py", line 1820, in verify_packets
verify_no_other_packets(test)
File "/home/centec/workshop/oftest-new/src/python/oftest/testutils.py", line 1800, in verify_no_other_packets
test.assertTrue(rcv_pkt == None, "Unexpected packet on port %r" % rcv_port)
File "/home/centec/workshop/oftest-new/src/python/oftest/base_tests.py", line 97, in assertTrue
unittest.TestCase.assertTrue(self, cond, msg)
AssertionError: Unexpected packet on port 4
- 检查ethx,发现eth4有ipv6设置,port flapping的时候会自行发出报文干扰抓包
centec@centec-28:~/workshop/oftest-new$ sudo ifconfig eth4
eth4 Link encap:Ethernet HWaddr 00:10:18:4a:c6:ac
inet6 addr: fe80::210:18ff:fe4a:c6ac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4825 errors:0 dropped:0 overruns:0 frame:0
TX packets:178235 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1109308 (1.1 MB) TX bytes:33826306 (33.8 MB)
- 需要关掉eth4的ipv6,下面是ubuntu的解决方法,在/etc/sysctl.conf 加入下面内容
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
- syctl并查看eth4,发现已经没有ipv6的配置了
centec@centec-28:~/workshop/oftest-new$ sudo sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth4.disable_ipv6 = 1
centec@centec-28:~/workshop/oftest-new$
centec@centec-28:~/workshop/oftest-new$
centec@centec-28:~/workshop/oftest-new$ ifconfig eth4
eth4 Link encap:Ethernet HWaddr 00:10:18:4a:c6:ac
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4825 errors:0 dropped:0 overruns:0 frame:0
TX packets:178394 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1109308 (1.1 MB) TX bytes:33856048 (33.8 MB)
centec@centec-28:~/workshop/oftest-new$
常见干扰报文:DHCP报文
- tcpdump发现
centec@centec-28:~/workshop/oftest-new$ sudo tcpdump -i eth3 -eXXXX
tcpdump: WARNING: eth3: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth3, link-type EN10MB (Ethernet), capture size 65535 bytes
01:37:25.602294 00:10:18:4a:c6:ae (oui Unknown) > Broadcast, ethertype IPv4 (0x0800), length 342: 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:10:18:4a:c6:ae (oui Unknown), length 300
0x0000: ffff ffff ffff 0010 184a c6ae 0800 4510 .........J....E.
0x0010: 0148 0000 0000 8011 3996 0000 0000 ffff .H......9.......
0x0020: ffff 0044 0043 0134 2af1 0101 0600 a326 ...D.C.4*......&
0x0030: bd78 0023 0000 0000 0000 0000 0000 0000 .x.#............
0x0040: 0000 0000 0000 0010 184a c6ae 0000 0000 .........J......
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0110: 0000 0000 0000 6382 5363 3501 010c 0963 ......c.Sc5....c
0x0120: 656e 7465 632d 3238 3712 011c 0203 0f06 entec-287.......
0x0130: 770c 2c2f 1a79 2a79 f921 fc2a ff00 0000 w.,/.y*y.!.*....
0x0140: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0150: 0000 0000 0000 ......
- 该报文会干扰OFTest的测试,参数Unexpected packet的错误
- 如果暂不需要DHCP,就把dhcp-client卸载掉
centec@centec-28:/etc/default$ sudo apt-get remove isc-dhcp-client isc-dhcp-common
本文首发于SDNLAB http://www.sdnlab.com/16874.html