HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.util; |
| 2 | |
| 3 | import static org.junit.Assert.assertEquals; |
| 4 | import net.floodlightcontroller.util.MACAddress; |
| 5 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionEnqueue; |
| 6 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionOutput; |
| 7 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetEthernetAddr; |
| 8 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetIPv4Addr; |
| 9 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetIpToS; |
| 10 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetTcpUdpPort; |
| 11 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetVlanId; |
| 12 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionSetVlanPriority; |
| 13 | import net.onrc.onos.ofcontroller.util.FlowEntryAction.ActionStripVlan; |
| 14 | |
| 15 | import org.junit.Test; |
| 16 | |
| 17 | public class FlowEntryActionTest { |
| 18 | |
| 19 | @Test |
| 20 | public void testSetActionOutputActionOutput(){ |
| 21 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 22 | ActionOutput actout = new FlowEntryAction.ActionOutput(new Port((short)42)); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 23 | act.setActionOutput(actout); |
| 24 | |
| 25 | assertEquals("action output",FlowEntryAction.ActionValues.ACTION_OUTPUT , act.actionType()); |
| 26 | assertEquals("actionOutput port should be the same", actout.port(), act.actionOutput().port()); |
| 27 | assertEquals("actionOutput maxlen should be the same", actout.maxLen(), act.actionOutput().maxLen()); |
| 28 | |
| 29 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 30 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 31 | |
| 32 | assertEquals("toString must match between copies", act.toString(), |
| 33 | act_copy.toString()); |
| 34 | assertEquals("toString must match between copies", act.toString(), |
| 35 | act_copy2.toString()); |
| 36 | } |
| 37 | |
| 38 | @Test |
| 39 | public void testSetActionOutputPort(){ |
| 40 | FlowEntryAction act = new FlowEntryAction(); |
| 41 | act.setActionOutput(new Port((short)42)); |
| 42 | |
| 43 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 44 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 45 | |
| 46 | assertEquals("toString must match between copies", act.toString(), |
| 47 | act_copy.toString()); |
| 48 | assertEquals("toString must match between copies", act.toString(), |
| 49 | act_copy2.toString()); |
| 50 | } |
| 51 | |
| 52 | @Test |
| 53 | public void testSetActionOutputToController(){ |
| 54 | FlowEntryAction act = new FlowEntryAction(); |
| 55 | act.setActionOutputToController((short)0); |
| 56 | |
| 57 | FlowEntryAction act_copy = new FlowEntryAction(); |
| 58 | act_copy.setActionOutput(new Port(Port.PortValues.PORT_CONTROLLER)); |
| 59 | ; |
| 60 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 61 | |
| 62 | assertEquals("toString must match between copies", act.toString(), |
| 63 | act_copy.toString()); |
| 64 | assertEquals("toString must match between copies", act.toString(), |
| 65 | act_copy2.toString()); |
| 66 | } |
| 67 | |
| 68 | @Test |
| 69 | public void testSetActionSetVlanIdActionSetVlanId(){ |
| 70 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 71 | ActionSetVlanId actVlan = new FlowEntryAction.ActionSetVlanId((short)42); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 72 | act.setActionSetVlanId(actVlan); |
| 73 | |
| 74 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_VID , act.actionType()); |
| 75 | assertEquals("vlanid should be the same", actVlan.vlanId(), act.actionSetVlanId().vlanId()); |
| 76 | |
| 77 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 78 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 79 | |
| 80 | assertEquals("toString must match between copies", act.toString(), |
| 81 | act_copy.toString()); |
| 82 | assertEquals("toString must match between copies", act.toString(), |
| 83 | act_copy2.toString()); |
| 84 | } |
| 85 | |
| 86 | @Test |
| 87 | public void testSetActionSetVlanIdShort(){ |
| 88 | FlowEntryAction act = new FlowEntryAction(); |
| 89 | act.setActionSetVlanId((short)42); |
| 90 | |
| 91 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 92 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 93 | |
| 94 | assertEquals("toString must match between copies", act.toString(), |
| 95 | act_copy.toString()); |
| 96 | assertEquals("toString must match between copies", act.toString(), |
| 97 | act_copy2.toString()); |
| 98 | } |
| 99 | |
| 100 | @Test |
| 101 | public void testSetActionSetVlanPriorityActionSetVlanPriority(){ |
| 102 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 103 | ActionSetVlanPriority actVlan = new FlowEntryAction.ActionSetVlanPriority((byte)42); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 104 | act.setActionSetVlanPriority(actVlan); |
| 105 | |
| 106 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_VLAN_PCP , act.actionType()); |
| 107 | assertEquals("vlan priority should be the same", actVlan.vlanPriority(), act.actionSetVlanPriority().vlanPriority()); |
| 108 | |
| 109 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 110 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 111 | |
| 112 | assertEquals("toString must match between copies", act.toString(), |
| 113 | act_copy.toString()); |
| 114 | assertEquals("toString must match between copies", act.toString(), |
| 115 | act_copy2.toString()); |
| 116 | } |
| 117 | |
| 118 | @Test |
| 119 | public void testSetActionSetVlanPriorityByte(){ |
| 120 | FlowEntryAction act = new FlowEntryAction(); |
| 121 | act.setActionSetVlanPriority((byte)42); |
| 122 | |
| 123 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 124 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 125 | |
| 126 | assertEquals("toString must match between copies", act.toString(), |
| 127 | act_copy.toString()); |
| 128 | assertEquals("toString must match between copies", act.toString(), |
| 129 | act_copy2.toString()); |
| 130 | } |
| 131 | |
| 132 | @Test |
| 133 | public void testSetActionStripVlanActionStripVlan(){ |
| 134 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 135 | ActionStripVlan actVlan = new FlowEntryAction.ActionStripVlan(); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 136 | act.setActionStripVlan(actVlan); |
| 137 | |
| 138 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_STRIP_VLAN , act.actionType()); |
| 139 | assertEquals("vlanid should be the same", actVlan.stripVlan(), act.actionStripVlan().stripVlan()); |
| 140 | |
| 141 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 142 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 143 | |
| 144 | assertEquals("toString must match between copies", act.toString(), |
| 145 | act_copy.toString()); |
| 146 | assertEquals("toString must match between copies", act.toString(), |
| 147 | act_copy2.toString()); |
| 148 | } |
| 149 | |
| 150 | @Test |
| 151 | public void testSetActionStripVlanBoolean(){ |
| 152 | FlowEntryAction act = new FlowEntryAction(); |
| 153 | act.setActionStripVlan(true); |
| 154 | |
| 155 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 156 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 157 | |
| 158 | assertEquals("toString must match between copies", act.toString(), |
| 159 | act_copy.toString()); |
| 160 | assertEquals("toString must match between copies", act.toString(), |
| 161 | act_copy2.toString()); |
| 162 | } |
| 163 | |
| 164 | @Test |
| 165 | public void testSetActionSetEthernetSrcAddrActionSetEthernetAddr(){ |
| 166 | FlowEntryAction act = new FlowEntryAction(); |
| 167 | byte[] mac = { 1, 2, 3, 4, 5, 6 }; |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 168 | ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac)); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 169 | act.setActionSetEthernetSrcAddr( setEth ); |
| 170 | |
| 171 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_SRC , act.actionType()); |
| 172 | assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetSrcAddr().addr()); |
| 173 | |
| 174 | |
| 175 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 176 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 177 | |
| 178 | assertEquals("toString must match between copies", act.toString(), |
| 179 | act_copy.toString()); |
| 180 | assertEquals("toString must match between copies", act.toString(), |
| 181 | act_copy2.toString()); |
| 182 | } |
| 183 | |
| 184 | @Test |
| 185 | public void testSetActionSetEthernetSrcAddrMACAddress(){ |
| 186 | FlowEntryAction act = new FlowEntryAction(); |
| 187 | byte[] mac = { 1, 2, 3, 4, 5, 6 }; |
| 188 | act.setActionSetEthernetSrcAddr(new MACAddress(mac)); |
| 189 | |
| 190 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 191 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 192 | |
| 193 | assertEquals("toString must match between copies", act.toString(), |
| 194 | act_copy.toString()); |
| 195 | assertEquals("toString must match between copies", act.toString(), |
| 196 | act_copy2.toString()); |
| 197 | } |
| 198 | |
| 199 | @Test |
| 200 | public void testSetActionSetEthernetDstAddrActionSetEthernetAddr(){ |
| 201 | FlowEntryAction act = new FlowEntryAction(); |
| 202 | byte[] mac = { 1, 2, 3, 4, 5, 6 }; |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 203 | ActionSetEthernetAddr setEth = new FlowEntryAction.ActionSetEthernetAddr(new MACAddress(mac)); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 204 | act.setActionSetEthernetDstAddr( setEth ); |
| 205 | |
| 206 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_DL_DST , act.actionType()); |
| 207 | assertEquals("addr should be the same", setEth.addr(), act.actionSetEthernetDstAddr().addr()); |
| 208 | |
| 209 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 210 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 211 | |
| 212 | assertEquals("toString must match between copies", act.toString(), |
| 213 | act_copy.toString()); |
| 214 | assertEquals("toString must match between copies", act.toString(), |
| 215 | act_copy2.toString()); |
| 216 | } |
| 217 | |
| 218 | @Test |
| 219 | public void testSetActionSetEthernetDstAddrMACAddress(){ |
| 220 | FlowEntryAction act = new FlowEntryAction(); |
| 221 | byte[] mac = { 1, 2, 3, 4, 5, 6 }; |
| 222 | act.setActionSetEthernetDstAddr(new MACAddress(mac)); |
| 223 | |
| 224 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 225 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 226 | |
| 227 | assertEquals("toString must match between copies", act.toString(), |
| 228 | act_copy.toString()); |
| 229 | assertEquals("toString must match between copies", act.toString(), |
| 230 | act_copy2.toString()); |
| 231 | } |
| 232 | |
| 233 | @Test |
| 234 | public void testSetActionSetIPv4SrcAddrActionSetIPv4Addr(){ |
| 235 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 236 | ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1")); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 237 | act.setActionSetIPv4SrcAddr( setIp ); |
| 238 | |
| 239 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_SRC , act.actionType()); |
| 240 | assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4SrcAddr().addr()); |
| 241 | |
| 242 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 243 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 244 | |
| 245 | |
| 246 | assertEquals("toString must match between copies", act.toString(), |
| 247 | act_copy.toString()); |
| 248 | assertEquals("toString must match between copies", act.toString(), |
| 249 | act_copy2.toString()); |
| 250 | } |
| 251 | |
| 252 | @Test |
| 253 | public void testSetActionSetIPv4SrcAddrIPv4(){ |
| 254 | FlowEntryAction act = new FlowEntryAction(); |
| 255 | act.setActionSetIPv4SrcAddr(new IPv4("127.0.0.1")); |
| 256 | |
| 257 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 258 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 259 | |
| 260 | assertEquals("toString must match between copies", act.toString(), |
| 261 | act_copy.toString()); |
| 262 | assertEquals("toString must match between copies", act.toString(), |
| 263 | act_copy2.toString()); |
| 264 | } |
| 265 | |
| 266 | @Test |
| 267 | public void testSetActionSetIPv4DstAddrActionSetIPv4Addr(){ |
| 268 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 269 | ActionSetIPv4Addr setIp = new FlowEntryAction.ActionSetIPv4Addr(new IPv4("127.0.0.1")); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 270 | act.setActionSetIPv4DstAddr( setIp ); |
| 271 | |
| 272 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_DST , act.actionType()); |
| 273 | assertEquals("addr should be the same", setIp.addr(), act.actionSetIPv4DstAddr().addr()); |
| 274 | |
| 275 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 276 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 277 | |
| 278 | assertEquals("toString must match between copies", act.toString(), |
| 279 | act_copy.toString()); |
| 280 | assertEquals("toString must match between copies", act.toString(), |
| 281 | act_copy2.toString()); |
| 282 | } |
| 283 | |
| 284 | @Test |
| 285 | public void testSetActionSetIPv4DstAddrIPv4(){ |
| 286 | FlowEntryAction act = new FlowEntryAction(); |
| 287 | act.setActionSetIPv4DstAddr(new IPv4("127.0.0.1")); |
| 288 | |
| 289 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 290 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 291 | |
| 292 | assertEquals("toString must match between copies", act.toString(), |
| 293 | act_copy.toString()); |
| 294 | assertEquals("toString must match between copies", act.toString(), |
| 295 | act_copy2.toString()); |
| 296 | } |
| 297 | |
| 298 | @Test |
| 299 | public void testSetActionSetIpToSActionSetIpToS(){ |
| 300 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 301 | ActionSetIpToS setIpTos = new FlowEntryAction.ActionSetIpToS((byte)42); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 302 | act.setActionSetIpToS( setIpTos ); |
| 303 | |
| 304 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_NW_TOS , act.actionType()); |
| 305 | assertEquals("tos should be the same", setIpTos.ipToS(), act.actionSetIpToS().ipToS()); |
| 306 | |
| 307 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 308 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 309 | |
| 310 | assertEquals("toString must match between copies", act.toString(), |
| 311 | act_copy.toString()); |
| 312 | assertEquals("toString must match between copies", act.toString(), |
| 313 | act_copy2.toString()); |
| 314 | } |
| 315 | |
| 316 | @Test |
| 317 | public void testSetActionSetIpToSByte(){ |
| 318 | FlowEntryAction act = new FlowEntryAction(); |
| 319 | act.setActionSetIpToS((byte)1); |
| 320 | |
| 321 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 322 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 323 | |
| 324 | assertEquals("toString must match between copies", act.toString(), |
| 325 | act_copy.toString()); |
| 326 | assertEquals("toString must match between copies", act.toString(), |
| 327 | act_copy2.toString()); |
| 328 | } |
| 329 | |
| 330 | @Test |
| 331 | public void testSetActionSetTcpUdpSrcPortActionSetTcpUdpPort(){ |
| 332 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 333 | ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 334 | act.setActionSetTcpUdpSrcPort( setPorts ); |
| 335 | |
| 336 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_SRC , act.actionType()); |
| 337 | assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpSrcPort().port()); |
| 338 | |
| 339 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 340 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 341 | |
| 342 | assertEquals("toString must match between copies", act.toString(), |
| 343 | act_copy.toString()); |
| 344 | assertEquals("toString must match between copies", act.toString(), |
| 345 | act_copy2.toString()); |
| 346 | } |
| 347 | |
| 348 | @Test |
| 349 | public void testSetActionSetTcpUdpSrcPortShort(){ |
| 350 | FlowEntryAction act = new FlowEntryAction(); |
| 351 | act.setActionSetTcpUdpSrcPort((short)1); |
| 352 | |
| 353 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 354 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 355 | |
| 356 | assertEquals("toString must match between copies", act.toString(), |
| 357 | act_copy.toString()); |
| 358 | assertEquals("toString must match between copies", act.toString(), |
| 359 | act_copy2.toString()); |
| 360 | } |
| 361 | |
| 362 | @Test |
| 363 | public void testSetActionSetTcpUdpDstPortActionSetTcpUdpPort(){ |
| 364 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 365 | ActionSetTcpUdpPort setPorts = new FlowEntryAction.ActionSetTcpUdpPort((short)42); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 366 | act.setActionSetTcpUdpDstPort( setPorts ); |
| 367 | |
| 368 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_SET_TP_DST , act.actionType()); |
| 369 | assertEquals("port should be the same", setPorts.port(), act.actionSetTcpUdpDstPort().port()); |
| 370 | |
| 371 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 372 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 373 | |
| 374 | assertEquals("toString must match between copies", act.toString(), |
| 375 | act_copy.toString()); |
| 376 | assertEquals("toString must match between copies", act.toString(), |
| 377 | act_copy2.toString()); |
| 378 | } |
| 379 | |
| 380 | @Test |
| 381 | public void testSetActionSetTcpUdpDstPortShort(){ |
| 382 | FlowEntryAction act = new FlowEntryAction(); |
| 383 | act.setActionSetTcpUdpDstPort((short)1); |
| 384 | |
| 385 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 386 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 387 | |
| 388 | assertEquals("toString must match between copies", act.toString(), |
| 389 | act_copy.toString()); |
| 390 | assertEquals("toString must match between copies", act.toString(), |
| 391 | act_copy2.toString()); |
| 392 | } |
| 393 | |
| 394 | @Test |
| 395 | public void testSetActionEnqueueActionEnqueue(){ |
| 396 | FlowEntryAction act = new FlowEntryAction(); |
Yuta HIGUCHI | 382827f | 2013-10-14 16:06:43 -0700 | [diff] [blame] | 397 | ActionEnqueue enq = new FlowEntryAction.ActionEnqueue(new Port((short)42), 1); |
HIGUCHI Yuta | d8dc9c0 | 2013-08-04 06:16:30 +0900 | [diff] [blame] | 398 | act.setActionEnqueue( enq ); |
| 399 | |
| 400 | assertEquals("action type",FlowEntryAction.ActionValues.ACTION_ENQUEUE , act.actionType()); |
| 401 | assertEquals("port should be the same", enq.port(), act.actionEnqueue().port()); |
| 402 | assertEquals("queue id should be the same", enq.queueId(), act.actionEnqueue().queueId()); |
| 403 | |
| 404 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 405 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 406 | |
| 407 | assertEquals("toString must match between copies", act.toString(), |
| 408 | act_copy.toString()); |
| 409 | assertEquals("toString must match between copies", act.toString(), |
| 410 | act_copy2.toString()); |
| 411 | } |
| 412 | |
| 413 | @Test |
| 414 | public void testSetActionEnqueuePortInt(){ |
| 415 | FlowEntryAction act = new FlowEntryAction(); |
| 416 | act.setActionEnqueue(new Port((short)42), 1); |
| 417 | |
| 418 | FlowEntryAction act_copy = new FlowEntryAction(act); |
| 419 | FlowEntryAction act_copy2 = new FlowEntryAction(act.toString()); |
| 420 | |
| 421 | assertEquals("toString must match between copies", act.toString(), |
| 422 | act_copy.toString()); |
| 423 | assertEquals("toString must match between copies", act.toString(), |
| 424 | act_copy2.toString()); |
| 425 | } |
| 426 | |
| 427 | } |