Jian Li

[ONOS-3494] Add test case for TCPFlags Criterion

Change-Id: I2575e52dc316039e528ff6216cec7c1d3195fe81
...@@ -28,92 +28,136 @@ public interface Criterion { ...@@ -28,92 +28,136 @@ public interface Criterion {
28 enum Type { 28 enum Type {
29 /** Switch input port. */ 29 /** Switch input port. */
30 IN_PORT, 30 IN_PORT,
31 +
31 /** Switch physical input port. */ 32 /** Switch physical input port. */
32 IN_PHY_PORT, 33 IN_PHY_PORT,
34 +
33 /** Metadata passed between tables. */ 35 /** Metadata passed between tables. */
34 METADATA, 36 METADATA,
37 +
35 /** Ethernet destination address. */ 38 /** Ethernet destination address. */
36 ETH_DST, 39 ETH_DST,
40 +
37 /** Ethernet source address. */ 41 /** Ethernet source address. */
38 ETH_SRC, 42 ETH_SRC,
43 +
39 /** Ethernet frame type. */ 44 /** Ethernet frame type. */
40 ETH_TYPE, 45 ETH_TYPE,
46 +
41 /** VLAN id. */ 47 /** VLAN id. */
42 VLAN_VID, 48 VLAN_VID,
49 +
43 /** VLAN priority. */ 50 /** VLAN priority. */
44 VLAN_PCP, 51 VLAN_PCP,
52 +
45 /** IP DSCP (6 bits in ToS field). */ 53 /** IP DSCP (6 bits in ToS field). */
46 IP_DSCP, 54 IP_DSCP,
55 +
47 /** IP ECN (2 bits in ToS field). */ 56 /** IP ECN (2 bits in ToS field). */
48 IP_ECN, 57 IP_ECN,
58 +
49 /** IP protocol. */ 59 /** IP protocol. */
50 IP_PROTO, 60 IP_PROTO,
61 +
51 /** IPv4 source address. */ 62 /** IPv4 source address. */
52 IPV4_SRC, 63 IPV4_SRC,
64 +
53 /** IPv4 destination address. */ 65 /** IPv4 destination address. */
54 IPV4_DST, 66 IPV4_DST,
67 +
55 /** TCP source port. */ 68 /** TCP source port. */
56 TCP_SRC, 69 TCP_SRC,
70 +
57 /** TCP destination port. */ 71 /** TCP destination port. */
58 TCP_DST, 72 TCP_DST,
73 +
59 /** UDP source port. */ 74 /** UDP source port. */
60 UDP_SRC, 75 UDP_SRC,
76 +
61 /** UDP destination port. */ 77 /** UDP destination port. */
62 UDP_DST, 78 UDP_DST,
79 +
63 /** SCTP source port. */ 80 /** SCTP source port. */
64 SCTP_SRC, 81 SCTP_SRC,
82 +
65 /** SCTP destination port. */ 83 /** SCTP destination port. */
66 SCTP_DST, 84 SCTP_DST,
85 +
67 /** ICMP type. */ 86 /** ICMP type. */
68 ICMPV4_TYPE, 87 ICMPV4_TYPE,
88 +
69 /** ICMP code. */ 89 /** ICMP code. */
70 ICMPV4_CODE, 90 ICMPV4_CODE,
91 +
71 /** ARP opcode. */ 92 /** ARP opcode. */
72 ARP_OP, 93 ARP_OP,
94 +
73 /** ARP source IPv4 address. */ 95 /** ARP source IPv4 address. */
74 ARP_SPA, 96 ARP_SPA,
97 +
75 /** ARP target IPv4 address. */ 98 /** ARP target IPv4 address. */
76 ARP_TPA, 99 ARP_TPA,
100 +
77 /** ARP source hardware address. */ 101 /** ARP source hardware address. */
78 ARP_SHA, 102 ARP_SHA,
103 +
79 /** ARP target hardware address. */ 104 /** ARP target hardware address. */
80 ARP_THA, 105 ARP_THA,
106 +
81 /** IPv6 source address. */ 107 /** IPv6 source address. */
82 IPV6_SRC, 108 IPV6_SRC,
109 +
83 /** IPv6 destination address. */ 110 /** IPv6 destination address. */
84 IPV6_DST, 111 IPV6_DST,
112 +
85 /** IPv6 Flow Label. */ 113 /** IPv6 Flow Label. */
86 IPV6_FLABEL, 114 IPV6_FLABEL,
115 +
87 /** ICMPv6 type. */ 116 /** ICMPv6 type. */
88 ICMPV6_TYPE, 117 ICMPV6_TYPE,
118 +
89 /** ICMPv6 code. */ 119 /** ICMPv6 code. */
90 ICMPV6_CODE, 120 ICMPV6_CODE,
121 +
91 /** Target address for ND. */ 122 /** Target address for ND. */
92 IPV6_ND_TARGET, 123 IPV6_ND_TARGET,
124 +
93 /** Source link-layer for ND. */ 125 /** Source link-layer for ND. */
94 IPV6_ND_SLL, 126 IPV6_ND_SLL,
127 +
95 /** Target link-layer for ND. */ 128 /** Target link-layer for ND. */
96 IPV6_ND_TLL, 129 IPV6_ND_TLL,
130 +
97 /** MPLS label. */ 131 /** MPLS label. */
98 MPLS_LABEL, 132 MPLS_LABEL,
133 +
99 /** MPLS TC. */ 134 /** MPLS TC. */
100 MPLS_TC, 135 MPLS_TC,
101 - /** MPLS BoS bit. */ 136 +
137 + /** MPLS BoS bit. */
102 MPLS_BOS, 138 MPLS_BOS,
139 +
103 /** PBB I-SID. */ 140 /** PBB I-SID. */
104 PBB_ISID, 141 PBB_ISID,
142 +
105 /** Logical Port Metadata. */ 143 /** Logical Port Metadata. */
106 TUNNEL_ID, 144 TUNNEL_ID,
145 +
107 /** IPv6 Extension Header pseudo-field. */ 146 /** IPv6 Extension Header pseudo-field. */
108 IPV6_EXTHDR, 147 IPV6_EXTHDR,
148 +
109 /** Unassigned value: 40. */ 149 /** Unassigned value: 40. */
110 UNASSIGNED_40, 150 UNASSIGNED_40,
151 +
111 /** PBB UCA header field. */ 152 /** PBB UCA header field. */
112 PBB_UCA, 153 PBB_UCA,
154 +
113 /** TCP flags. */ 155 /** TCP flags. */
114 TCP_FLAGS, 156 TCP_FLAGS,
157 +
115 /** Output port from action set metadata. */ 158 /** Output port from action set metadata. */
116 ACTSET_OUTPUT, 159 ACTSET_OUTPUT,
160 +
117 /** Packet type value. */ 161 /** Packet type value. */
118 PACKET_TYPE, 162 PACKET_TYPE,
119 163
...@@ -123,16 +167,17 @@ public interface Criterion { ...@@ -123,16 +167,17 @@ public interface Criterion {
123 // 167 //
124 /** Optical channel signal ID (lambda). */ 168 /** Optical channel signal ID (lambda). */
125 OCH_SIGID, 169 OCH_SIGID,
170 +
126 /** Optical channel signal type (fixed or flexible). */ 171 /** Optical channel signal type (fixed or flexible). */
127 OCH_SIGTYPE, 172 OCH_SIGTYPE,
173 +
128 /** ODU (Optical channel Data Unit) signal ID. */ 174 /** ODU (Optical channel Data Unit) signal ID. */
129 ODU_SIGID, 175 ODU_SIGID,
176 +
130 /** ODU (Optical channel Data Unit) signal type. */ 177 /** ODU (Optical channel Data Unit) signal type. */
131 ODU_SIGTYPE, 178 ODU_SIGTYPE,
132 179
133 - /** 180 + /** An empty criterion. */
134 - * An empty criterion.
135 - */
136 DUMMY 181 DUMMY
137 } 182 }
138 183
...@@ -182,4 +227,41 @@ public interface Criterion { ...@@ -182,4 +227,41 @@ public interface Criterion {
182 return this.value; 227 return this.value;
183 } 228 }
184 } 229 }
230 +
231 + enum TCPFlags {
232 +
233 + /** ECN-nonce concealment protection. */
234 + NS((short) (1 << 0)),
235 + /** Congestion Window Reduced. */
236 + CWR((short) (1 << 1)),
237 + /** ECN-Echo. **/
238 + ECE((short) (1 << 2)),
239 + /** Urgent pointer field is significant. */
240 + URG((short) (1 << 3)),
241 + /** Acknowledgment field is significant. */
242 + ACK((short) (1 << 4)),
243 + /** Push the buffered data to the receiving application. */
244 + PSH((short) (1 << 5)),
245 + /** Reset the connection. */
246 + RST((short) (1 << 6)),
247 + /** Synchronize sequence numbers. */
248 + SYN((short) (1 << 7)),
249 + /** No more data from sender. */
250 + FIN((short) (1 << 8));
251 +
252 + private short value;
253 +
254 + TCPFlags(short value) {
255 + this.value = value;
256 + }
257 +
258 + /**
259 + * Gets the value as an integer.
260 + *
261 + * @return the value as an integer
262 + */
263 + public short getValue() {
264 + return this.value;
265 + }
266 + }
185 } 267 }
......