]> git.proxmox.com Git - ovs.git/blob - tests/ofp-util.at
tests: Convert ovsdb-monitor-sort utility from Perl to Python.
[ovs.git] / tests / ofp-util.at
1 AT_BANNER([OpenFlow utilities])
2
3 AT_SETUP([encoding hellos])
4 dnl All versions up to a max version supported:
5 AT_CHECK([ovs-ofctl encode-hello 0x2], [0], [dnl
6 00000000 01 00 00 08 00 00 00 01
7 OFPT_HELLO (xid=0x1):
8 version bitmap: 0x01
9 ])
10 AT_CHECK([ovs-ofctl encode-hello 0x6], [0], [dnl
11 00000000 02 00 00 08 00 00 00 01
12 OFPT_HELLO (OF1.1) (xid=0x1):
13 version bitmap: 0x01, 0x02
14 ])
15 AT_CHECK([ovs-ofctl encode-hello 0xe], [0], [dnl
16 00000000 03 00 00 08 00 00 00 01
17 OFPT_HELLO (OF1.2) (xid=0x1):
18 version bitmap: 0x01, 0x02, 0x03
19 ])
20 AT_CHECK([ovs-ofctl encode-hello 0x1e], [0], [dnl
21 00000000 04 00 00 08 00 00 00 01
22 OFPT_HELLO (OF1.3) (xid=0x1):
23 version bitmap: 0x01, 0x02, 0x03, 0x04
24 ])
25 AT_CHECK([ovs-ofctl encode-hello 0x3e], [0], [dnl
26 00000000 05 00 00 08 00 00 00 01
27 OFPT_HELLO (OF1.4) (xid=0x1):
28 version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05
29 ])
30
31 dnl Some versions below max version missing.
32 AT_CHECK([ovs-ofctl encode-hello 0xc], [0], [dnl
33 00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0c
34 OFPT_HELLO (OF1.2) (xid=0x1):
35 version bitmap: 0x02, 0x03
36 ])
37 AT_CHECK([ovs-ofctl encode-hello 0xa], [0], [dnl
38 00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0a
39 OFPT_HELLO (OF1.2) (xid=0x1):
40 version bitmap: 0x01, 0x03
41 ])
42 AT_CHECK([ovs-ofctl encode-hello 0x8], [0], [dnl
43 00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 08
44 OFPT_HELLO (OF1.2) (xid=0x1):
45 version bitmap: 0x03
46 ])
47 AT_CHECK([ovs-ofctl encode-hello 0x4], [0], [dnl
48 00000000 02 00 00 10 00 00 00 01-00 01 00 08 00 00 00 04
49 OFPT_HELLO (OF1.1) (xid=0x1):
50 version bitmap: 0x02
51 ])
52 AT_CLEANUP
53
54 AT_SETUP([parsing key-value pairs])
55 dnl Key-only basics.
56 AT_CHECK([ovs-ofctl parse-key-value a a,b 'a b' 'a b' 'a
57 b'], 0, [a
58 a, b
59 a, b
60 a, b
61 a, b
62 ])
63
64 dnl Key-value basics.
65 AT_CHECK([ovs-ofctl parse-key-value a:b a=b a:b,c=d 'a=b c' 'a(b)' 'a(b),c(d)'], 0,
66 [a=b
67 a=b
68 a=b, c=d
69 a=b, c
70 a=b
71 a=b, c=d
72 ])
73
74 dnl Values that contain nested delimiters.
75 AT_CHECK([ovs-ofctl parse-key-value 'a:(b,c)' 'a:b(c,d)e' 'a(b,c(d,e),f)'], 0,
76 [a=(b,c)
77 a=b(c,d)e
78 a=b,c(d,e),f
79 ])
80
81 dnl Extraneous delimiters.
82 AT_CHECK([ovs-ofctl parse-key-value a,,b ',a b' ' a b ,'], 0, [a, b
83 a, b
84 a, b
85 ])
86
87 dnl Missing right parentheses.
88 dnl
89 dnl m4 can't handle unbalanced parentheses so we use @{:@, which
90 dnl Autotest replaces by a left parenthesis.
91 AT_CHECK([ovs-ofctl parse-key-value 'a@{:@b' 'a@{:@b(c)' 'a=b@{:@c'], 0, [a=b
92 a=b(c)
93 a=b@{:@c
94 ])
95 AT_CLEANUP