aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-01-12 15:48:19 -0800
committerBen Pfaff <blp@nicira.com>2012-01-12 15:54:25 -0800
commit90bf1e0732ac9b11dd51ca856b635cac1f0269c1 (patch)
tree05e5852229f3b6f85218a74f9401b3b765459599 /tests
parente25c55d28f30b537aa657797c41483a9bab59b93 (diff)
Better abstract OpenFlow error codes.
This commit switches from using the actual protocol values of error codes internally in Open vSwitch, to using abstract values that are translated to and from protocol values at message parsing and serialization time. I believe that this makes the code easier to read and to write. This is also one step along the way toward OpenFlow 1.1 support because OpenFlow 1.1 renumbered a bunch of error codes. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ofp-print.at57
-rw-r--r--tests/ovs-ofctl.at94
2 files changed, 94 insertions, 57 deletions
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 2ca07c46..0619e986 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -16,9 +16,11 @@ 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_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' ofp-print 00bb0008eeff0011],
+ [0], [dnl
+***decode error: OFPBRC_BAD_TYPE***
+00000000 00 bb 00 08 ee ff 00 11- |........ |
+], [ofp_util|WARN|received OpenFlow message of unknown type 187
])
AT_CLEANUP
@@ -55,31 +57,66 @@ OFPT_HELLO (xid=0x0):
])
AT_CLEANUP
-AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED])
+AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED - OF1.0])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print 010100170000000000000001657874726120646174610a], [0], [dnl
-OFPT_ERROR (xid=0x0): type OFPET_HELLO_FAILED, code OFPHFC_EPERM
+OFPT_ERROR (xid=0x0): OFPHFC_EPERM
extra data\012
])
AT_CLEANUP
-AT_SETUP([OFPT_ERROR with type OFPET_BAD_REQUEST])
+AT_SETUP([OFPT_ERROR with type OFPET_HELLO_FAILED - OF1.1])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print 020100170000000000000001657874726120646174610a], [0], [dnl
+OFPT_ERROR (xid=0x0): OFPHFC_EPERM
+extra data\012
+])
+AT_CLEANUP
+
+AT_SETUP([OFPT_ERROR with type OFPET_BAD_REQUEST - OF1.0])
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
+OFPT_ERROR (xid=0x0): 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_SETUP([OFPT_ERROR with code NXBRC_NXM_BAD_PREREQ - OF1.0])
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_ERROR (xid=0x55555555): NXBRC_NXM_BAD_PREREQ
+OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
+])
+AT_CLEANUP
+
+AT_SETUP([OFPT_ERROR with code NXBRC_NXM_BAD_PREREQ - OF1.1])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print '0201001c55555555 b0c20000 0000232000010104 0102000811111111'], [0], [dnl
+OFPT_ERROR (xid=0x55555555): NXBRC_NXM_BAD_PREREQ
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
AT_CLEANUP
+dnl Error type 3, code 1 is OFPFMFC_OVERLAP in OF1.0
+dnl and OFPBIC_UNSUP_INST in OF1.1, so check that value in both versions.
+AT_SETUP([OFPT_ERROR with type OFPFMFC_OVERLAP - OF1.0])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print 01010014000000000003000101bbccddeeff0011], [0], [dnl
+OFPT_ERROR (xid=0x0): OFPFMFC_OVERLAP
+(***truncated to 8 bytes from 52445***)
+00000000 01 bb cc dd ee ff 00 11- |........ |
+])
+AT_CLEANUP
+AT_SETUP([OFPT_ERROR with type OFPBIC_UNSUP_INST - OF1.1])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print 02010014000000000003000102bbccddeeff0011], [0], [dnl
+OFPT_ERROR (xid=0x0): OFPBIC_UNSUP_INST
+(***truncated to 8 bytes from 52445***)
+00000000 02 bb cc dd ee ff 00 11- |........ |
+])
+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
@@ -180,7 +217,7 @@ 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 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***
+***decode error: 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.....|
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 57712c06..0b58b3da 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -394,7 +394,7 @@ NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800)
# vlan tci
NXM_OF_VLAN_TCI(f009)
-nx_pull_match() returned error 44010105 (type OFPET_BAD_REQUEST, code NXBRC_NXM_DUP_TYPE)
+nx_pull_match() returned error NXBRC_NXM_DUP_TYPE
NXM_OF_VLAN_TCI(0000)
NXM_OF_VLAN_TCI(3123)
NXM_OF_VLAN_TCI(0123)
@@ -404,114 +404,114 @@ NXM_OF_VLAN_TCI_W(0000/e000)
# IP TOS
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
-nx_pull_match() returned error 44010102 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_VALUE)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_VALUE
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IP ECN
NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
-nx_pull_match() returned error 44010102 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_VALUE)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_VALUE
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IP protocol
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IP TTL
NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IP source
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IP destination
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# TCP source port
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# TCP destination port
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# UDP source port
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# UDP destination port
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ICMP type
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ICMP code
NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ARP opcode
NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
-nx_pull_match() returned error 44010102 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_VALUE)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010105 (type OFPET_BAD_REQUEST, code NXBRC_NXM_DUP_TYPE)
+nx_pull_match() returned error NXBRC_NXM_BAD_VALUE
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_DUP_TYPE
# ARP source protocol address
NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ARP destination protocol address
NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ARP source hardware address
NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ARP destination hardware address
NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IPv6 source
NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IPv6 destination
NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ND source hardware address
NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005), NXM_NX_ND_SLL(0002e30f80a4)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# ND destination hardware address
NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005), NXM_NX_ND_TLL(0002e30f80a4)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
-nx_pull_match() returned error 44010104 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_PREREQ)
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
+nx_pull_match() returned error NXBRC_NXM_BAD_PREREQ
# IPv4 fragments.
NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
@@ -524,7 +524,7 @@ NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
-nx_pull_match() returned error 44010102 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_VALUE)
+nx_pull_match() returned error NXBRC_NXM_BAD_VALUE
# IPv6 fragments.
NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
@@ -537,7 +537,7 @@ NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
-nx_pull_match() returned error 44010102 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_VALUE)
+nx_pull_match() returned error NXBRC_NXM_BAD_VALUE
# Flow cookie.
NXM_NX_COOKIE(00000000abcdef01)
@@ -552,7 +552,7 @@ NXM_NX_REG0(acebdf56)
NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
# Invalid field number.
-nx_pull_match() returned error 44010101 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_TYPE)
+nx_pull_match() returned error NXBRC_NXM_BAD_TYPE
# Unimplemented registers.
#
@@ -560,8 +560,8 @@ nx_pull_match() returned error 44010101 (type OFPET_BAD_REQUEST, code NXBRC_NXM_
# registers are implemented.
NXM_NX_REG0(12345678)
NXM_NX_REG0_W(12345678/12345678)
-nx_pull_match() returned error 44010101 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_TYPE)
-nx_pull_match() returned error 44010101 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_TYPE)
+nx_pull_match() returned error NXBRC_NXM_BAD_TYPE
+nx_pull_match() returned error NXBRC_NXM_BAD_TYPE
])
AT_CLEANUP
@@ -572,7 +572,7 @@ NXM_OF_IN_PORT(0001), 01020304(1111/2222), NXM_OF_ETH_TYPE(0800)
])
AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
-nx_pull_match() returned error 44010101 (type OFPET_BAD_REQUEST, code NXBRC_NXM_BAD_TYPE)
+nx_pull_match() returned error NXBRC_NXM_BAD_TYPE
])
AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl