summaryrefslogtreecommitdiff
path: root/tests/ofp-errors.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-08-21 10:38:15 -0700
committerBen Pfaff <blp@nicira.com>2014-09-04 12:31:00 -0700
commitd12f128a31210ed936820cea68c2f42c07ead5cf (patch)
tree23239ff4d137909339f06762814497638c957e1e /tests/ofp-errors.at
parenta678b23e666049866dc54ca6e8ecd643e145bf96 (diff)
downloadopenvswitch-d12f128a31210ed936820cea68c2f42c07ead5cf.tar.gz
ofp-errors: Fix bugs in treatment of OpenFlow experimenter errors.
OpenFlow 1.2 and later have "experimenter errors". The OVS implementation was buggy in a few ways. First, a bug in extract-ofp-errors prevented OF1.2+ experimenter errors from being properly decoded. Second, OF1.2+ experimenter errors have only a type, not a code, whereas all other types of errors (standard errors, OF1.0/1.1 Nicira extension errors) have both, but extract-ofp-errors didn't properly enforce that. This commit fixes both problems and improves existing tests to verify that encoding and decoding of experimenter errors now works properly. This commit also fixes the definition of OFPBIC_DUP_INST. It claimed to have an OF1.1 experimenter error value although OF1.1 didn't have experimenter errors. This commit changes it to use a Nicira extension error in OF1.1 instead. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Diffstat (limited to 'tests/ofp-errors.at')
-rw-r--r--tests/ofp-errors.at47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/ofp-errors.at b/tests/ofp-errors.at
index f8c5cc482..daf7ddd24 100644
--- a/tests/ofp-errors.at
+++ b/tests/ofp-errors.at
@@ -163,10 +163,29 @@ AT_CHECK([ovs-ofctl ofp-print '0301001855555555 ffff0004 00002320 01020008111111
OFPT_ERROR (OF1.2) (xid=0x55555555): NXBRC_MUST_BE_ZERO
OFPT_ECHO_REQUEST (xid=0x11111111): 0 bytes of payload
])
+
+AT_CHECK([ovs-ofctl ofp-print '0301001812345678 ffff0a28 4f4e4600 0300000812345678'], [0], [dnl
+OFPT_ERROR (OF1.2) (xid=0x12345678): OFPBIC_DUP_INST
+OFPT_HELLO (OF1.2) (xid=0x12345678):
+ version bitmap: 0x01, 0x02, 0x03
+])
+AT_CHECK([ovs-ofctl ofp-print '0401001812345678 ffff0a28 4f4e4600 0400000812345678'], [0], [dnl
+OFPT_ERROR (OF1.3) (xid=0x12345678): OFPBIC_DUP_INST
+OFPT_HELLO (OF1.3) (xid=0x12345678):
+ version bitmap: 0x01, 0x02, 0x03, 0x04
+])
+AT_CHECK([ovs-ofctl ofp-print '0501001412345678 00030009 0500000812345678'], [0], [dnl
+OFPT_ERROR (OF1.4) (xid=0x12345678): OFPBIC_DUP_INST
+OFPT_HELLO (OF1.4) (xid=0x12345678):
+ version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05
+])
AT_CLEANUP
AT_SETUP([encoding experimenter errors])
AT_KEYWORDS([ofp-print ofp-errors])
+# Demonstrate that a Nicira extension error gets encoded correctly
+# using the Nicira error extension format in OF1.0 and OF1.1, and
+# correctly using the standard experimenter format in OF1.2.
AT_CHECK(
[ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0100000812345678], [0], [dnl
00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
@@ -182,4 +201,32 @@ AT_CHECK(
00000000 03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20 @&t@
00000010 03 00 00 08 12 34 56 78-
])
+
+# Check that OFPERR_OFPBIC_DUP_INST is:
+# - not encodable in OF1.0 (OF1.0 doesn't have instructions, after all).
+# - encoded as a Nicira extension in OF1.1.
+# - encoded as an ONF extension in OF1.2 and OF1.3.
+# - encoded in the standard form in OF1.4.
+AT_CHECK(
+ [ovs-ofctl '-vPATTERN:console:%c|%p|%m' encode-error-reply OFPBIC_DUP_INST 0100000812345678], [0], [dnl
+00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
+00000010 00 01 02 09 01 00 00 08-12 34 56 78 @&t@
+], [ofp_errors|ERR|cannot encode OFPBIC_DUP_INST for OpenFlow 1.0
+])
+AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0200000812345678], [0],
+[00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@
+00000010 00 03 01 00 02 00 00 08-12 34 56 78 @&t@
+])
+AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0300000812345678], [0],
+[00000000 03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@
+00000010 03 00 00 08 12 34 56 78-
+])
+AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0400000812345678], [0],
+[00000000 04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@
+00000010 04 00 00 08 12 34 56 78-
+])
+AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0500000812345678], [0],
+[00000000 05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08 @&t@
+00000010 12 34 56 78 @&t@
+])
AT_CLEANUP