From: Ben Pfaff Date: Wed, 12 Jan 2011 21:57:53 +0000 (-0800) Subject: ofp-print: Add tests for OpenFlow message formatting. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fec00620d6f2a011a0a1c1a18e0d061f59606113;p=openvswitch ofp-print: Add tests for OpenFlow message formatting. It's become clear over the past few weeks that some people really depend on the formatting of ofp-print output. It has also become clear that OVS doesn't have anything that actually checks or enforces the formatting of the output. The former is not something I want to encourage, but the latter is somewhat worrisome because the formatting does change from time to time and I want to make sure that that is intentional. So this commit adds at least one test for each supported OpenFlow and Nicira extension message, so that we can better keep track of changes. --- diff --git a/tests/automake.mk b/tests/automake.mk index 0098c203..f67c0e78 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -12,6 +12,7 @@ TESTSUITE_AT = \ tests/check-structs.at \ tests/daemon.at \ tests/daemon-py.at \ + tests/ofp-print.at \ tests/ovs-ofctl.at \ tests/multipath.at \ tests/vconn.at \ diff --git a/tests/ofp-print.at b/tests/ofp-print.at new file mode 100644 index 00000000..c0e72cfd --- /dev/null +++ b/tests/ofp-print.at @@ -0,0 +1,889 @@ +AT_BANNER([ofp-print]) + +AT_SETUP([empty]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print ''], [0], [OpenFlow message is empty +]) +AT_CLEANUP + +AT_SETUP([too short]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print aabb], [0], [dnl +OpenFlow packet too short (only 2 bytes): +00000000 aa bb |.. | +]) +AT_CLEANUP + +AT_SETUP([wrong OpenFlow version]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print aabbccddeeff0011], [0], [dnl +Bad OpenFlow version 170: +00000000 aa bb cc dd ee ff 00 11- |........ | +]) +AT_CLEANUP + +AT_SETUP([truncated message]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print 01bbccddeeff0011], [0], [dnl +(***truncated to 8 bytes from 52445***) +00000000 01 bb cc dd ee ff 00 11- |........ | +]) +AT_CLEANUP + +AT_SETUP([message only uses part of buffer]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print 01bb0009eeff00112233], [0], [dnl +(***only uses 9 bytes out of 10***) +00000000 01 bb 00 09 ee ff 00 11-22 33 |........"3 | +]) +# " +AT_CLEANUP + +AT_SETUP([OFPT_HELLO - ordinary]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print 0100000800000000], [0], [dnl +OFPT_HELLO (xid=0x0): +]) +AT_CLEANUP + +AT_SETUP([OFPT_HELLO with extra data]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print 0100001300000000657874726120646174610a], [0], +[dnl +OFPT_HELLO (xid=0x0): +00000000 65 78 74 72 61 20 64 61-74 61 0a |extra data. | +]) +AT_CLEANUP + +AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print 010100170000000000000001657874726120646174610a], [0], [dnl +OFPT_ERROR (xid=0x0): type OFPET_HELLO_FAILED, code OFPHFC_EPERM +extra data\012 +]) +AT_CLEANUP + +AT_SETUP([OFPT_ERROR with type OFPET_BAD_REQUEST]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print 01010014000000000001000601bbccddeeff0011], [0], [dnl +OFPT_ERROR (xid=0x0): type OFPET_BAD_REQUEST, code OFPBRC_BAD_LEN +(***truncated to 8 bytes from 52445***) +00000000 01 bb cc dd ee ff 00 11- |........ | +]) +AT_CLEANUP + +AT_SETUP([OFPT_ERROR with code NXBRC_NXM_BAD_PREREQ]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '0101001c55555555 b0c20000 0000232000010104 0102000811111111'], [0], [dnl +OFPT_ERROR (xid=0x55555555): type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ +OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload +]) +AT_CLEANUP + +AT_SETUP([OFPT_ECHO_REQUEST, empty payload]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '01 02 00 08 00 00 00 01'], [0], [dnl +OFPT_ECHO_REQUEST (xid=0x1): 0 bytes of payload +]) +AT_CLEANUP + +AT_SETUP([OFPT_ECHO_REQUEST, 5-byte payload]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '0102000d00000001 25 53 54 1a 9d'], [0], [dnl +OFPT_ECHO_REQUEST (xid=0x1): 5 bytes of payload +00000000 25 53 54 1a 9d |%ST.. | +]) +AT_CLEANUP + +AT_SETUP([OFPT_ECHO_REPLY, empty payload]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '01 03 00 08 00 00 00 01'], [0], [dnl +OFPT_ECHO_REPLY (xid=0x1): 0 bytes of payload +]) +AT_CLEANUP + +AT_SETUP([OFPT_ECHO_REPLY, 5-byte payload]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '0103000d0000000ba330efaf9e'], [0], [dnl +OFPT_ECHO_REPLY (xid=0xb): 5 bytes of payload +00000000 a3 30 ef af 9e |.0... | +]) +AT_CLEANUP + +AT_SETUP([OFPT_FEATURES_REQUEST]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '0105000800000001'], [0], [dnl +OFPT_FEATURES_REQUEST (xid=0x1): +]) +AT_CLEANUP + +AT_SETUP([OFPT_FEATURES_REPLY]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 06 00 e0 00 00 00 01 00 00 50 54 00 00 00 01 \ +00 00 01 00 02 00 00 00 00 00 00 87 00 00 0f ff \ +ff fe 50 54 00 00 00 01 62 72 30 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 03 50 54 00 00 00 01 65 74 68 30 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 08 00 00 02 8f 00 00 02 8f 00 00 00 00 \ +00 02 50 54 00 00 00 03 65 74 68 32 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 08 00 00 02 8f 00 00 02 8f 00 00 00 00 \ +00 01 50 54 00 00 00 02 65 74 68 31 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 08 00 00 02 8f 00 00 02 8f 00 00 00 00 \ +"], [0], [dnl +OFPT_FEATURES_REPLY (xid=0x1): ver:0x1, dpid:0000505400000001 +n_tables:2, n_buffers:256 +features: capabilities:0x87, actions:0xfff + 1(eth1): addr:50:54:00:00:00:02, config: 0, state:0 + current: 100MB-FD AUTO_NEG @&t@ + advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + 2(eth2): addr:50:54:00:00:00:03, config: 0, state:0 + current: 100MB-FD AUTO_NEG @&t@ + advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + 3(eth0): addr:50:54:00:00:00:01, config: 0, state:0 + current: 100MB-FD AUTO_NEG @&t@ + advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + LOCAL(br0): addr:50:54:00:00:00:01, config: 0x1, state:0x1 +]) +AT_CLEANUP + +AT_SETUP([OFPT_FEATURES_REPLY cut off mid-port]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 06 00 dc 00 00 00 01 00 00 50 54 00 00 00 01 \ +00 00 01 00 02 00 00 00 00 00 00 87 00 00 0f ff \ +ff fe 50 54 00 00 00 01 62 72 30 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 03 50 54 00 00 00 01 65 74 68 30 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 08 00 00 02 8f 00 00 02 8f 00 00 00 00 \ +00 02 50 54 00 00 00 03 65 74 68 32 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 08 00 00 02 8f 00 00 02 8f 00 00 00 00 \ +00 01 50 54 00 00 00 02 65 74 68 31 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 08 00 00 02 8f 00 00 02 8f \ +"], [0], [dnl +***decode error: type OFPET_BAD_REQUEST, code OFPBRC_BAD_LEN*** +00000000 01 06 00 dc 00 00 00 01-00 00 50 54 00 00 00 01 |..........PT....| +00000010 00 00 01 00 02 00 00 00-00 00 00 87 00 00 0f ff |................| +00000020 ff fe 50 54 00 00 00 01-62 72 30 00 00 00 00 00 |..PT....br0.....| +00000030 00 00 00 00 00 00 00 00-00 00 00 01 00 00 00 01 |................| +00000040 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................| +00000050 00 03 50 54 00 00 00 01-65 74 68 30 00 00 00 00 |..PT....eth0....| +00000060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................| +00000070 00 00 02 08 00 00 02 8f-00 00 02 8f 00 00 00 00 |................| +00000080 00 02 50 54 00 00 00 03-65 74 68 32 00 00 00 00 |..PT....eth2....| +00000090 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................| +000000a0 00 00 02 08 00 00 02 8f-00 00 02 8f 00 00 00 00 |................| +000000b0 00 01 50 54 00 00 00 02-65 74 68 31 00 00 00 00 |..PT....eth1....| +000000c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |................| +000000d0 00 00 02 08 00 00 02 8f-00 00 02 8f |............ | +], [stderr]) +AT_CHECK([sed 's/.*|//' stderr], [0], [dnl +received OpenFlow message OFPT_FEATURES_REPLY with incorrect length 220 (must be exactly 32 bytes or longer by an integer multiple of 48 bytes) +]) +AT_CLEANUP + +AT_SETUP([OFPT_GET_CONFIG_REQUEST]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '0107000800000001'], [0], [dnl +OFPT_GET_CONFIG_REQUEST (xid=0x1): +]) +AT_CLEANUP + +AT_SETUP([OFPT_GET_CONFIG_REPLY, most common form]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '01 08 00 0c 00 00 00 03 00 00 00 00'], [0], [dnl +OFPT_GET_CONFIG_REPLY (xid=0x3): frags=normal miss_send_len=0 +]) +AT_CLEANUP + + +AT_SETUP([OFPT_GET_CONFIG_REPLY, frags and miss_send_len]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '01 08 00 0c 00 00 00 03 00 02 00 ff'], [0], [dnl +OFPT_GET_CONFIG_REPLY (xid=0x3): frags=reassemble miss_send_len=255 +]) +AT_CLEANUP + +AT_SETUP([OFPT_PACKET_IN]) +AT_KEYWORDS([ofp-print]) +AT_SKIP_IF([test ! -x /usr/sbin/tcpdump]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0a 00 4e 00 00 00 00 00 00 01 11 00 3c 00 03 \ +00 00 50 54 00 00 00 06 50 54 00 00 00 05 08 00 \ +45 00 00 28 bd 12 00 00 40 06 3c 6a c0 a8 00 01 \ +c0 a8 00 02 27 2f 00 00 78 50 cc 5b 57 af 42 1e \ +50 00 02 00 26 e8 00 00 00 00 00 00 00 00 \ +"], [0], [dnl +OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=3 data_len=60 buffer=0x00000111 +tunnel0:in_port0003:tci(0) mac50:54:00:00:00:05->50:54:00:00:00:06 type0800 proto6 tos0 ip192.168.0.1->192.168.0.2 port10031->0 +-8:00:00.000000 50:54:00:00:00:05 > 50:54:00:00:00:06, ethertype IPv4 (0x0800), length 60: 192.168.0.1.10031 > 192.168.0.2.0: . win 512 +]) +AT_CLEANUP + +AT_SETUP([OFPT_FLOW_REMOVED]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0b 00 58 00 00 00 00 00 00 00 00 00 03 50 54 \ +00 00 00 05 50 54 00 00 00 06 ff ff 00 00 08 06 \ +00 02 00 00 c0 a8 00 01 c0 a8 00 02 00 00 00 00 \ +00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 05 \ +30 e0 35 00 00 05 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c \ +"], [0], [dnl +OFPT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,opcode=2,nw_tos=0,tp_src=0,tp_dst=0 reason=idle duration5.82s idle5 pkts1 bytes60 +]) +AT_CLEANUP + +AT_SETUP([OFPT_PORT_STATUS]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0c 00 40 00 00 00 00 02 00 00 00 00 00 00 00 \ +00 03 50 54 00 00 00 01 65 74 68 30 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 \ +00 00 02 08 00 00 02 8f 00 00 02 8f 00 00 00 00 \ +"], [0], [dnl +OFPT_PORT_STATUS (xid=0x0): MOD: 3(eth0): addr:50:54:00:00:00:01, config: 0x1, state:0x1 + current: 100MB-FD AUTO_NEG @&t@ + advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ + supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD COPPER AUTO_NEG @&t@ +]) +AT_CLEANUP + +AT_SETUP([OFPT_PACKET_OUT]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0d 00 54 00 00 00 00 00 00 01 14 00 01 00 08 \ +00 00 00 08 00 03 00 00 50 54 00 00 00 05 50 54 \ +00 00 00 06 08 00 45 00 00 28 00 00 40 00 40 06 \ +b9 7c c0 a8 00 02 c0 a8 00 01 00 00 2b 60 00 00 \ +00 00 6a 4f 2b 58 50 14 00 00 6d 75 00 00 00 00 \ +00 00 00 00 \ +"], [0], [dnl +OFPT_PACKET_OUT (xid=0x0): in_port=1 actions_len=8 actions=output:3 buffer=0x00000114 +]) +AT_CLEANUP + +# The flow is formatted with cls_rule_format() for the low-verbosity case. +AT_SETUP([OFPT_FLOW_MOD - low verbosity]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0e 00 50 00 00 00 00 00 00 00 00 00 01 50 54 \ +00 00 00 06 50 54 00 00 00 05 ff ff 00 00 08 06 \ +00 02 00 00 c0 a8 00 02 c0 a8 00 01 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 00 \ +00 00 01 0e 00 00 00 00 00 00 00 08 00 03 00 00 \ +" 2], [0], [dnl +OFPT_FLOW_MOD (xid=0x0): ADD priority=65535,arp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,opcode=2,nw_tos=0,tp_src=0,tp_dst=0 idle:5 buf:0x10e actions=output:3 +]) +AT_CLEANUP + +# The flow is formatted with ofp_match_to_string() for the low-verbosity case. +AT_SETUP([OFPT_FLOW_MOD - high verbosity]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0e 00 50 00 00 00 00 00 00 00 00 00 01 50 54 \ +00 00 00 06 50 54 00 00 00 05 ff ff 00 00 08 06 \ +00 02 00 00 c0 a8 00 02 c0 a8 00 01 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 00 \ +00 00 01 0e 00 00 00 00 00 00 00 08 00 03 00 00 \ +" 3], [0], [dnl +OFPT_FLOW_MOD (xid=0x0): ADD arp,in_port=1,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,opcode=2,nw_tos=0,tp_src=0,tp_dst=0 idle:5 pri:65535 buf:0x10e actions=output:3 +]) +AT_CLEANUP + +AT_SETUP([OFPT_PORT_MOD]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 0f 00 20 00 00 00 03 00 03 50 54 00 00 00 01 \ +00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 00 \ +" 3], [0], [dnl +OFPT_PORT_MOD (xid=0x3):port: 3: addr:50:54:00:00:00:01, config: 0x1, mask:0x1 + advertise: UNCHANGED +]) +AT_CLEANUP + +AT_SETUP([OFPST_DESC request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "0110000c0000000100000000"], [0], [dnl +OFPST_DESC request (xid=0x1): +]) +AT_CLEANUP + +AT_SETUP([OFPST_DESC reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 04 2c 00 00 00 01 00 00 00 00 4e 69 63 69 \ +72 61 20 4e 65 74 77 6f 72 6b 73 2c 20 49 6e 63 \ +2e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 4f 70 65 6e \ +20 76 53 77 69 74 63 68 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 31 2e 31 2e \ +30 70 72 65 32 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 4e 6f 6e 65 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 4e 6f 6e 65 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 \ +"], [0], [dnl +OFPST_DESC reply (xid=0x1): +Manufacturer: Nicira Networks, Inc. +Hardware: Open vSwitch +Software: 1.1.0pre2 +Serial Num: None +DP Description: None +]) +AT_CLEANUP + +AT_SETUP([OFPST_FLOW request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 10 00 38 00 00 00 04 00 01 00 00 00 38 20 ff \ +ff fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 ff 00 ff ff \ +"], [0], [dnl +OFPST_FLOW request (xid=0x4): priority=0 +]) +AT_CLEANUP + +AT_SETUP([OFPST_FLOW reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 01 8c 00 00 00 04 00 01 00 00 00 60 00 00 \ +00 00 00 00 00 03 50 54 00 00 00 05 50 54 00 00 \ +00 06 ff ff 00 00 08 06 00 02 00 00 c0 a8 00 01 \ +c0 a8 00 02 00 00 00 00 00 00 00 04 0b eb c2 00 \ +ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 \ +00 00 00 3c 00 00 00 08 00 01 00 00 00 60 00 00 \ +00 00 00 00 00 01 50 54 00 00 00 06 50 54 00 00 \ +00 05 ff ff 00 00 08 00 00 01 00 00 c0 a8 00 02 \ +c0 a8 00 01 00 00 00 00 00 00 00 08 35 a4 e9 00 \ +ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 0d 00 00 00 00 \ +00 00 04 fa 00 00 00 08 00 03 00 00 00 60 00 00 \ +00 00 00 00 00 01 50 54 00 00 00 06 50 54 00 00 \ +00 05 ff ff 00 00 08 06 00 01 00 00 c0 a8 00 02 \ +c0 a8 00 01 00 00 00 00 00 00 00 04 10 b0 76 00 \ +ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 \ +00 00 00 3c 00 00 00 08 00 03 00 00 00 60 00 00 \ +00 00 00 00 00 03 50 54 00 00 00 05 50 54 00 00 \ +00 06 ff ff 00 00 08 00 00 01 00 00 c0 a8 00 01 \ +c0 a8 00 02 00 08 00 00 00 00 00 09 05 b8 d8 00 \ +ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 0d 00 00 00 00 \ +00 00 04 fa 00 00 00 08 00 01 00 00 \ +"], [0], [dnl +OFPST_FLOW reply (xid=0x4): + cookie=0x0, duration=4.2s, table_id=0, priority=65535, n_packets=1, n_bytes=60, idle_timeout=5,arp,in_port=3,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,opcode=2,nw_tos=0,tp_src=0,tp_dst=0 actions=output:1 + cookie=0x0, duration=8.9s, table_id=0, priority=65535, n_packets=13, n_bytes=1274, idle_timeout=5,icmp,in_port=1,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3 + cookie=0x0, duration=4.28s, table_id=0, priority=65535, n_packets=1, n_bytes=60, idle_timeout=5,arp,in_port=1,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,opcode=1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3 + cookie=0x0, duration=9.096s, table_id=0, priority=65535, n_packets=13, n_bytes=1274, idle_timeout=5,icmp,in_port=3,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1 +]) +AT_CLEANUP + +AT_SETUP([OFPST_AGGREGATE request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 10 00 38 00 00 00 04 00 02 00 00 00 38 20 ff \ +ff fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 ff 00 ff ff \ +"], [0], [dnl +OFPST_AGGREGATE request (xid=0x4): priority=0 +]) +AT_CLEANUP + +AT_SETUP([OFPST_AGGREGATE reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 00 24 00 00 00 04 00 02 00 00 00 00 00 00 \ +00 00 01 82 00 00 00 00 00 00 93 78 00 00 00 04 \ +00 00 00 00 \ +"], [0], [dnl +OFPST_AGGREGATE reply (xid=0x4): packet_count=386 byte_count=37752 flow_count=4 +]) +AT_CLEANUP + +AT_SETUP([OFPST_TABLE request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "0110000c0000000100030000"], [0], [dnl +OFPST_TABLE request (xid=0x1): +]) +AT_CLEANUP + +AT_SETUP([OFPST_TABLE reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 00 4c 00 00 00 01 00 03 00 00 00 00 00 00 \ +63 6c 61 73 73 69 66 69 65 72 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 3f ff ff 00 10 00 00 00 00 00 0b 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 \ +"], [0], [dnl +OFPST_TABLE reply (xid=0x1): 1 tables + 0: classifier: wild=0x3fffff, max=1048576, active=11 + lookup=0, matched=0 +]) +AT_CLEANUP + +AT_SETUP([OFPST_PORT request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 10 00 14 00 00 00 01 00 04 00 00 ff ff 00 00 \ +00 00 00 00 \ +"], [0], [dnl +OFPST_PORT request (xid=0x1): port_no=65535 +]) +AT_CLEANUP + +AT_SETUP([OFPST_PORT reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 01 ac 00 00 00 01 00 04 00 00 00 03 00 00 \ +00 00 00 00 00 00 00 00 00 00 4d 20 00 00 00 00 \ +00 00 14 32 00 00 00 00 00 0f 60 4e 00 00 00 00 \ +00 05 71 bc 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 ff fe 00 00 00 00 00 00 00 00 00 00 \ +00 00 02 ac 00 00 00 00 00 00 01 f5 00 00 00 00 \ +00 01 0c 8c 00 00 00 00 00 00 db 1c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 \ +00 00 00 00 00 00 00 00 00 00 06 be 00 00 00 00 \ +00 00 05 84 00 00 00 00 00 02 34 b4 00 00 00 00 \ +00 02 23 d4 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 \ +00 00 14 12 00 00 00 00 00 00 14 66 00 00 00 00 \ +00 04 a2 54 00 00 00 00 00 05 8a 1e 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 \ +"], [0], [dnl +OFPST_PORT reply (xid=0x1): 4 ports + port 3: rx pkts=19744, bytes=1007694, drop=0, errs=0, frame=0, over=0, crc=0 + tx pkts=5170, bytes=356796, drop=0, errs=0, coll=0 + port 65534: rx pkts=684, bytes=68748, drop=0, errs=0, frame=0, over=0, crc=0 + tx pkts=501, bytes=56092, drop=0, errs=0, coll=0 + port 2: rx pkts=1726, bytes=144564, drop=0, errs=0, frame=0, over=0, crc=0 + tx pkts=1412, bytes=140244, drop=0, errs=0, coll=0 + port 1: rx pkts=5138, bytes=303700, drop=0, errs=0, frame=0, over=0, crc=0 + tx pkts=5222, bytes=363038, drop=0, errs=0, coll=0 +]) +AT_CLEANUP + +AT_SETUP([OFPST_QUEUE request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 10 00 14 00 00 00 01 00 05 00 00 ff fc 00 00 \ +ff ff ff ff \ +"], [0], [dnl +OFPST_QUEUE request (xid=0x1):port=ALL queue=ALL +]) +AT_CLEANUP + +AT_SETUP([OFPST_QUEUE reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 00 cc 00 00 00 01 00 05 00 00 00 03 00 00 \ +00 00 00 01 00 00 00 00 00 00 01 2e 00 00 00 00 \ +00 00 00 01 00 00 00 00 00 00 00 00 00 03 00 00 \ +00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 \ +00 00 00 01 00 00 00 00 00 00 08 34 00 00 00 00 \ +00 00 00 14 00 00 00 00 00 00 00 00 00 02 00 00 \ +00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 \ +00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 \ +00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 \ +"], [0], [dnl +OFPST_QUEUE reply (xid=0x1): 6 queues + port 3 queue 1: bytes=302, pkts=1, errors=0 + port 3 queue 2: bytes=0, pkts=0, errors=0 + port 2 queue 1: bytes=2100, pkts=20, errors=0 + port 2 queue 2: bytes=0, pkts=0, errors=0 + port 1 queue 1: bytes=0, pkts=0, errors=0 + port 1 queue 2: bytes=0, pkts=0, errors=0 +]) +AT_CLEANUP + +AT_SETUP([OFPT_BARRIER_REQUEST]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '01 12 00 08 00 00 00 01'], [0], [dnl +OFPT_BARRIER_REQUEST (xid=0x1): +]) +AT_CLEANUP + +AT_SETUP([OFPT_BARRIER_REPLY]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print '01 13 00 08 00 00 00 01'], [0], [dnl +OFPT_BARRIER_REPLY (xid=0x1): +]) +AT_CLEANUP + +AT_SETUP([NXT_STATUS_REQUEST]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 16 00 00 00 01 00 00 23 20 00 00 00 00 \ +73 77 69 74 63 68 \ +"], [0], [dnl +NXT_STATUS_REQUEST (xid=0x1): "switch" +]) +AT_CLEANUP + +AT_SETUP([NXT_STATUS_REPLY]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 43 00 00 00 01 00 00 23 20 00 00 00 01 \ +73 77 69 74 63 68 2e 6e 6f 77 3d 31 30 36 31 36 \ +0a 73 77 69 74 63 68 2e 75 70 74 69 6d 65 3d 31 \ +31 33 36 0a 73 77 69 74 63 68 2e 70 69 64 3d 38 \ +31 31 0a \ +"], [0], [dnl +NXT_STATUS_REPLY (xid=0x1): "switch.now=10616\012switch.uptime=1136\012switch.pid=811\012" +]) +AT_CLEANUP + +AT_SETUP([NXT_TUN_ID_FROM_COOKIE]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 18 00 00 00 02 00 00 23 20 00 00 00 09 \ +01 00 00 00 00 00 00 00 \ +"], [0], [dnl +NXT_TUN_ID_FROM_COOKIE (xid=0x2): set=1 +]) +AT_CLEANUP + +AT_SETUP([NXT_ROLE_REQUEST]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0a \ +00 00 00 01 \ +"], [0], [dnl +NXT_ROLE_REQUEST (xid=0x2): role=master +]) +AT_CLEANUP + +AT_SETUP([NXT_ROLE_REPLY]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0b \ +00 00 00 02 \ +"], [0], [dnl +NXT_ROLE_REPLY (xid=0x2): role=slave +]) +AT_CLEANUP + +AT_SETUP([NXT_SET_FLOW_FORMAT]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 14 00 00 00 02 00 00 23 20 00 00 00 0c \ +00 00 00 02 \ +"], [0], [dnl +NXT_SET_FLOW_FORMAT (xid=0x2): format=nxm +]) +AT_CLEANUP + +# The flow is formatted with cls_rule_format() for the low-verbosity case. +AT_SETUP([NXT_FLOW_MOD, low verbosity]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 60 00 00 00 02 00 00 23 20 00 00 00 0d \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 \ +ff ff ff ff ff ff 00 00 00 14 00 00 00 00 00 00 \ +00 01 20 08 00 00 00 00 00 00 01 c8 00 01 00 04 \ +00 00 00 7b 00 00 00 00 ff ff 00 18 00 00 23 20 \ +00 07 00 1f 00 01 00 04 00 00 00 00 00 00 00 05 \ +" 2], [0], [dnl +NXT_FLOW_MOD (xid=0x2): ADD reg0=0x7b,tun_id=0x1c8 actions=load:5->NXM_NX_REG0[[0..31]] +]) +AT_CLEANUP + +# The flow is formatted with ofp_match_to_string() for the low-verbosity case. +AT_SETUP([NXT_FLOW_MOD, high verbosity]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 60 00 00 00 02 00 00 23 20 00 00 00 0d \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 \ +ff ff ff ff ff ff 00 00 00 14 00 00 00 00 00 00 \ +00 01 20 08 00 00 00 00 00 00 01 c8 00 01 00 04 \ +00 00 00 7b 00 00 00 00 ff ff 00 18 00 00 23 20 \ +00 07 00 1f 00 01 00 04 00 00 00 00 00 00 00 05 \ +" 3], [0], [dnl +NXT_FLOW_MOD (xid=0x2): ADD NXM_NX_TUN_ID(00000000000001c8), NXM_NX_REG0(0000007b) actions=load:5->NXM_NX_REG0[[0..31]] +]) +AT_CLEANUP + +AT_SETUP([NXT_FLOW_REMOVED]) +AT_KEYWORDS([ofp-print]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 04 00 78 00 00 00 00 00 00 23 20 00 00 00 0e \ +00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 06 \ +01 6e 36 00 00 05 00 3c 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 03 00 00 \ +02 06 50 54 00 00 00 06 00 00 04 06 50 54 00 00 \ +00 05 00 00 06 02 08 06 00 00 08 02 00 00 00 00 \ +1e 02 00 02 00 00 20 04 c0 a8 00 01 00 00 22 04 \ +c0 a8 00 02 00 00 00 00 \ +"], [0], [dnl +NXT_FLOW_REMOVED (xid=0x0): priority=65535,arp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,opcode=2 reason=idle duration6.024s idle5 pkts1 bytes60 +]) +AT_CLEANUP + +AT_SETUP([NXST_FLOW request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 10 00 20 00 00 00 04 ff ff 00 00 00 00 23 20 \ +00 00 00 00 00 00 00 00 ff ff 00 00 ff 00 00 00 \ +"], [0], [dnl +NXST_FLOW request (xid=0x4): priority=0 +]) +AT_CLEANUP + +AT_SETUP([NXST_FLOW reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 07 e8 00 00 00 04 ff ff 00 00 00 00 23 20 \ +00 00 00 00 00 00 00 00 00 88 00 00 00 00 00 01 \ +02 dc 6c 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 03 00 00 \ +02 06 50 54 00 00 00 06 00 00 04 06 50 54 00 00 \ +00 05 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 01 00 00 10 04 c0 \ +a8 00 02 00 00 0c 01 06 00 00 12 02 09 e7 00 00 \ +14 02 00 00 00 00 00 00 00 00 00 08 00 01 00 00 \ +00 88 00 00 00 00 00 03 32 11 62 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 03 00 00 02 06 50 54 00 00 00 06 \ +00 00 04 06 50 54 00 00 00 05 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 01 00 00 10 04 c0 a8 00 02 00 00 0c 01 06 \ +00 00 12 02 09 e4 00 00 14 02 00 00 00 00 00 00 \ +00 00 00 08 00 01 00 00 00 88 00 00 00 00 00 02 \ +33 f9 aa 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 01 00 00 \ +02 06 50 54 00 00 00 05 00 00 04 06 50 54 00 00 \ +00 06 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 02 00 00 10 04 c0 \ +a8 00 01 00 00 0c 01 06 00 00 12 02 00 00 00 00 \ +14 02 09 e5 00 00 00 00 00 00 00 08 00 03 00 00 \ +00 88 00 00 00 00 00 04 2d 0f a5 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 03 00 00 02 06 50 54 00 00 00 06 \ +00 00 04 06 50 54 00 00 00 05 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 01 00 00 10 04 c0 a8 00 02 00 00 0c 01 06 \ +00 00 12 02 09 e3 00 00 14 02 00 00 00 00 00 00 \ +00 00 00 08 00 01 00 00 00 88 00 00 00 00 00 02 \ +34 73 bc 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 03 00 00 \ +02 06 50 54 00 00 00 06 00 00 04 06 50 54 00 00 \ +00 05 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 01 00 00 10 04 c0 \ +a8 00 02 00 00 0c 01 06 00 00 12 02 09 e5 00 00 \ +14 02 00 00 00 00 00 00 00 00 00 08 00 01 00 00 \ +00 88 00 00 00 00 00 05 28 0d e8 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 03 00 00 02 06 50 54 00 00 00 06 \ +00 00 04 06 50 54 00 00 00 05 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 01 00 00 10 04 c0 a8 00 02 00 00 0c 01 06 \ +00 00 12 02 09 e2 00 00 14 02 00 00 00 00 00 00 \ +00 00 00 08 00 01 00 00 00 88 00 00 00 00 00 01 \ +02 62 5a 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 01 00 00 \ +02 06 50 54 00 00 00 05 00 00 04 06 50 54 00 00 \ +00 06 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 02 00 00 10 04 c0 \ +a8 00 01 00 00 0c 01 06 00 00 12 02 00 00 00 00 \ +14 02 09 e7 00 00 00 00 00 00 00 08 00 03 00 00 \ +00 88 00 00 00 00 00 01 38 be 5e 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 01 00 00 02 06 50 54 00 00 00 05 \ +00 00 04 06 50 54 00 00 00 06 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 02 00 00 10 04 c0 a8 00 01 00 00 0c 01 06 \ +00 00 12 02 00 00 00 00 14 02 09 e6 00 00 00 00 \ +00 00 00 08 00 03 00 00 00 88 00 00 00 00 00 04 \ +27 d0 df 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 01 00 00 \ +02 06 50 54 00 00 00 05 00 00 04 06 50 54 00 00 \ +00 06 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 02 00 00 10 04 c0 \ +a8 00 01 00 00 0c 01 06 00 00 12 02 00 00 00 00 \ +14 02 09 e3 00 00 00 00 00 00 00 08 00 03 00 00 \ +00 88 00 00 00 00 00 03 2c d2 9c 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 01 00 00 02 06 50 54 00 00 00 05 \ +00 00 04 06 50 54 00 00 00 06 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 02 00 00 10 04 c0 a8 00 01 00 00 0c 01 06 \ +00 00 12 02 00 00 00 00 14 02 09 e4 00 00 00 00 \ +00 00 00 08 00 03 00 00 00 88 00 00 00 00 00 00 \ +0a 40 83 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 03 00 00 \ +02 06 50 54 00 00 00 06 00 00 04 06 50 54 00 00 \ +00 05 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 01 00 00 10 04 c0 \ +a8 00 02 00 00 0c 01 06 00 00 12 02 09 e8 00 00 \ +14 02 00 00 00 00 00 00 00 00 00 08 00 01 00 00 \ +00 88 00 00 00 00 00 05 25 31 7c 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 01 00 00 02 06 50 54 00 00 00 05 \ +00 00 04 06 50 54 00 00 00 06 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 02 00 00 10 04 c0 a8 00 01 00 00 0c 01 06 \ +00 00 12 02 00 00 00 00 14 02 09 e2 00 00 00 00 \ +00 00 00 08 00 03 00 00 00 88 00 00 00 00 00 00 \ +04 c4 b4 00 ff ff 00 05 00 00 00 4c 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 \ +00 00 00 00 00 00 00 3c 00 00 00 02 00 01 00 00 \ +02 06 50 54 00 00 00 05 00 00 04 06 50 54 00 00 \ +00 06 00 00 06 02 08 00 00 00 08 02 00 00 00 00 \ +0a 01 00 00 00 0e 04 c0 a8 00 02 00 00 10 04 c0 \ +a8 00 01 00 00 0c 01 06 00 00 12 02 00 00 00 00 \ +14 02 09 e8 00 00 00 00 00 00 00 08 00 03 00 00 \ +00 88 00 00 00 00 00 01 39 38 70 00 ff ff 00 05 \ +00 00 00 4c 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 3c \ +00 00 00 02 00 03 00 00 02 06 50 54 00 00 00 06 \ +00 00 04 06 50 54 00 00 00 05 00 00 06 02 08 00 \ +00 00 08 02 00 00 00 00 0a 01 00 00 00 0e 04 c0 \ +a8 00 01 00 00 10 04 c0 a8 00 02 00 00 0c 01 06 \ +00 00 12 02 09 e6 00 00 14 02 00 00 00 00 00 00 \ +00 00 00 08 00 01 00 00 00 60 00 00 00 00 00 e4 \ +2e 7d db 00 80 00 00 00 00 00 00 14 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ +00 00 00 00 00 00 00 00 00 01 20 08 00 00 00 00 \ +00 00 01 c8 00 01 00 04 00 00 00 7b 00 00 00 00 \ +ff ff 00 18 00 00 23 20 00 07 00 1f 00 01 00 04 \ +00 00 00 00 00 00 00 05 \ +"], [0], +[[NXST_FLOW reply (xid=0x4): + cookie=0x0, duration=1.048s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2535,tp_dst=0 actions=output:1 + cookie=0x0, duration=3.84s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2532,tp_dst=0 actions=output:1 + cookie=0x0, duration=2.872s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2533 actions=output:3 + cookie=0x0, duration=4.756s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2531,tp_dst=0 actions=output:1 + cookie=0x0, duration=2.88s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2533,tp_dst=0 actions=output:1 + cookie=0x0, duration=5.672s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2530,tp_dst=0 actions=output:1 + cookie=0x0, duration=1.04s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2535 actions=output:3 + cookie=0x0, duration=1.952s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2534 actions=output:3 + cookie=0x0, duration=4.668s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2531 actions=output:3 + cookie=0x0, duration=3.752s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2532 actions=output:3 + cookie=0x0, duration=0.172s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2536,tp_dst=0 actions=output:1 + cookie=0x0, duration=5.624s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2530 actions=output:3 + cookie=0x0, duration=0.08s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=1,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,tp_src=0,tp_dst=2536 actions=output:3 + cookie=0x0, duration=1.96s, table_id=0, n_packets=1, n_bytes=60, idle_timeout=5,priority=65535,tcp,in_port=3,vlan_tci=0x0000/0xffff,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,tp_src=2534,tp_dst=0 actions=output:1 + cookie=0x0, duration=228.78s, table_id=0, n_packets=0, n_bytes=0, reg0=0x7b,tun_id=0x1c8 actions=load:5->NXM_NX_REG0[0..31] +]]) +AT_CLEANUP + +AT_SETUP([NXST_AGGREGATE request]) +AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 10 00 20 00 00 00 04 ff ff 00 00 00 00 23 20 \ +00 00 00 01 00 00 00 00 ff ff 00 00 ff 00 00 00 \ +"], [0], [dnl +NXST_AGGREGATE request (xid=0x4): priority=0 +]) +AT_CLEANUP + +AT_SETUP([NXST_AGGREGATE reply]) +AT_KEYWORDS([ofp-print OFPT_STATS_REPLY]) +AT_CHECK([ovs-ofctl ofp-print "\ +01 11 00 30 00 00 00 04 ff ff 00 00 00 00 23 20 \ +00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 07 \ +00 00 00 00 00 00 01 a4 00 00 00 07 00 00 00 00 \ +"], [0], [dnl +NXST_AGGREGATE reply (xid=0x4): packet_count=7 byte_count=420 flow_count=7 +]) +AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index 4642902b..d41f504b 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -42,6 +42,7 @@ m4_include([tests/classifier.at]) m4_include([tests/check-structs.at]) m4_include([tests/daemon.at]) m4_include([tests/daemon-py.at]) +m4_include([tests/ofp-print.at]) m4_include([tests/ovs-ofctl.at]) m4_include([tests/multipath.at]) m4_include([tests/vconn.at]) diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 8da6e1a0..68f2edaf 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -884,6 +884,8 @@ do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) /* Undocumented commands for unit testing. */ +/* "parse-flows FILENAME": reads the named file as a sequence of flows (like + * add-flows) and prints each of the flows back to stdout. */ static void do_parse_flows(int argc OVS_UNUSED, char *argv[]) { @@ -914,6 +916,9 @@ do_parse_flows(int argc OVS_UNUSED, char *argv[]) fclose(file); } +/* "parse-nx-match": reads a series of nx_match specifications as strings from + * stdin, does some internal fussing with them, and then prints them back as + * strings on stdout. */ static void do_parse_nx_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { @@ -968,6 +973,22 @@ do_parse_nx_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) ds_destroy(&in); } +/* "ofp-print HEXSTRING [VERBOSITY]": Converts the hex digits in HEXSTRING into + * binary data, interpreting them as an OpenFlow message, and prints the + * OpenFlow message on stdout, at VERBOSITY (level 2 by default). */ +static void +do_ofp_print(int argc, char *argv[]) +{ + struct ofpbuf packet; + + ofpbuf_init(&packet, strlen(argv[1]) / 2); + if (ofpbuf_put_hex(&packet, argv[1], NULL)[0] != '\0') { + ovs_fatal(0, "trailing garbage following hex bytes"); + } + ofp_print(stdout, packet.data, packet.size, argc > 2 ? atoi(argv[2]) : 2); + ofpbuf_uninit(&packet); +} + static const struct command all_commands[] = { { "show", 1, 1, do_show }, { "status", 1, 2, do_status }, @@ -992,6 +1013,7 @@ static const struct command all_commands[] = { /* Undocumented commands for testing. */ { "parse-flows", 1, 1, do_parse_flows }, { "parse-nx-match", 0, 0, do_parse_nx_match }, + { "ofp-print", 1, 2, do_ofp_print }, { NULL, 0, 0, NULL }, };