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