Remove deprecated instructions() method in the traffic treatment class
Change-Id: I739b35bdcbf9867c639c7b6ca4006f3eeafbb055
Showing
22 changed files
with
66 additions
and
93 deletions
... | @@ -123,7 +123,7 @@ public class FlowsListCommand extends AbstractShellCommand { | ... | @@ -123,7 +123,7 @@ public class FlowsListCommand extends AbstractShellCommand { |
123 | } | 123 | } |
124 | 124 | ||
125 | ArrayNode instr = mapper.createArrayNode(); | 125 | ArrayNode instr = mapper.createArrayNode(); |
126 | - for (Instruction i : flow.treatment().instructions()) { | 126 | + for (Instruction i : flow.treatment().allInstructions()) { |
127 | instr.add(i.toString()); | 127 | instr.add(i.toString()); |
128 | } | 128 | } |
129 | 129 | ... | ... |
... | @@ -354,8 +354,8 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -354,8 +354,8 @@ public class IntentsListCommand extends AbstractShellCommand { |
354 | if (!ci.selector().criteria().isEmpty()) { | 354 | if (!ci.selector().criteria().isEmpty()) { |
355 | print(" selector=%s", ci.selector().criteria()); | 355 | print(" selector=%s", ci.selector().criteria()); |
356 | } | 356 | } |
357 | - if (!ci.treatment().instructions().isEmpty()) { | 357 | + if (!ci.treatment().allInstructions().isEmpty()) { |
358 | - print(" treatment=%s", ci.treatment().instructions()); | 358 | + print(" treatment=%s", ci.treatment().allInstructions()); |
359 | } | 359 | } |
360 | if (ci.constraints() != null && !ci.constraints().isEmpty()) { | 360 | if (ci.constraints() != null && !ci.constraints().isEmpty()) { |
361 | print(" constraints=%s", ci.constraints()); | 361 | print(" constraints=%s", ci.constraints()); |
... | @@ -423,8 +423,8 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -423,8 +423,8 @@ public class IntentsListCommand extends AbstractShellCommand { |
423 | if (!ci.selector().criteria().isEmpty()) { | 423 | if (!ci.selector().criteria().isEmpty()) { |
424 | result.put("selector", ci.selector().criteria().toString()); | 424 | result.put("selector", ci.selector().criteria().toString()); |
425 | } | 425 | } |
426 | - if (!ci.treatment().instructions().isEmpty()) { | 426 | + if (!ci.treatment().allInstructions().isEmpty()) { |
427 | - result.put("treatment", ci.treatment().instructions().toString()); | 427 | + result.put("treatment", ci.treatment().allInstructions().toString()); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ... | ... |
... | @@ -32,6 +32,8 @@ import java.util.Collections; | ... | @@ -32,6 +32,8 @@ import java.util.Collections; |
32 | import java.util.List; | 32 | import java.util.List; |
33 | import java.util.Objects; | 33 | import java.util.Objects; |
34 | 34 | ||
35 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
36 | + | ||
35 | /** | 37 | /** |
36 | * Default traffic treatment implementation. | 38 | * Default traffic treatment implementation. |
37 | */ | 39 | */ |
... | @@ -52,7 +54,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -52,7 +54,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
52 | * @param instructions treatment instructions | 54 | * @param instructions treatment instructions |
53 | */ | 55 | */ |
54 | private DefaultTrafficTreatment(List<Instruction> instructions) { | 56 | private DefaultTrafficTreatment(List<Instruction> instructions) { |
55 | - this.immediate = ImmutableList.copyOf(instructions); | 57 | + this.immediate = ImmutableList.copyOf(checkNotNull(instructions)); |
56 | this.deferred = ImmutableList.of(); | 58 | this.deferred = ImmutableList.of(); |
57 | this.hasClear = false; | 59 | this.hasClear = false; |
58 | this.table = null; | 60 | this.table = null; |
... | @@ -62,19 +64,14 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -62,19 +64,14 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
62 | List<Instruction> immediate, | 64 | List<Instruction> immediate, |
63 | Instructions.TableTypeTransition table, | 65 | Instructions.TableTypeTransition table, |
64 | boolean clear) { | 66 | boolean clear) { |
65 | - this.immediate = ImmutableList.copyOf(immediate); | 67 | + this.immediate = ImmutableList.copyOf(checkNotNull(immediate)); |
66 | - this.deferred = ImmutableList.copyOf(deferred); | 68 | + this.deferred = ImmutableList.copyOf(checkNotNull(deferred)); |
67 | this.table = table; | 69 | this.table = table; |
68 | this.hasClear = clear; | 70 | this.hasClear = clear; |
69 | 71 | ||
70 | } | 72 | } |
71 | 73 | ||
72 | @Override | 74 | @Override |
73 | - public List<Instruction> instructions() { | ||
74 | - return immediate; | ||
75 | - } | ||
76 | - | ||
77 | - @Override | ||
78 | public List<Instruction> deferred() { | 75 | public List<Instruction> deferred() { |
79 | return deferred; | 76 | return deferred; |
80 | } | 77 | } |
... | @@ -184,7 +181,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -184,7 +181,7 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
184 | // Creates a new builder based off an existing treatment | 181 | // Creates a new builder based off an existing treatment |
185 | //FIXME only works for immediate instruction sets. | 182 | //FIXME only works for immediate instruction sets. |
186 | private Builder(TrafficTreatment treatment) { | 183 | private Builder(TrafficTreatment treatment) { |
187 | - for (Instruction instruction : treatment.instructions()) { | 184 | + for (Instruction instruction : treatment.immediate()) { |
188 | add(instruction); | 185 | add(instruction); |
189 | } | 186 | } |
190 | } | 187 | } | ... | ... |
... | @@ -32,14 +32,6 @@ import java.util.List; | ... | @@ -32,14 +32,6 @@ import java.util.List; |
32 | public interface TrafficTreatment { | 32 | public interface TrafficTreatment { |
33 | 33 | ||
34 | /** | 34 | /** |
35 | - * Returns list of instructions on how to treat traffic. | ||
36 | - * | ||
37 | - * @return list of treatment instructions | ||
38 | - */ | ||
39 | - @Deprecated | ||
40 | - List<Instruction> instructions(); | ||
41 | - | ||
42 | - /** | ||
43 | * Returns the list of treatment instructions that will be applied | 35 | * Returns the list of treatment instructions that will be applied |
44 | * further down the pipeline. | 36 | * further down the pipeline. |
45 | * @return list of treatment instructions | 37 | * @return list of treatment instructions | ... | ... |
... | @@ -102,7 +102,7 @@ public class DefaultFlowRuleExt | ... | @@ -102,7 +102,7 @@ public class DefaultFlowRuleExt |
102 | .add("deviceId", deviceId()) | 102 | .add("deviceId", deviceId()) |
103 | .add("priority", priority()) | 103 | .add("priority", priority()) |
104 | .add("selector", selector().criteria()) | 104 | .add("selector", selector().criteria()) |
105 | - .add("treatment", treatment() == null ? "N/A" : treatment().instructions()) | 105 | + .add("treatment", treatment() == null ? "N/A" : treatment().allInstructions()) |
106 | //.add("created", created) | 106 | //.add("created", created) |
107 | .add("flowEntryExtension", flowEntryExtension) | 107 | .add("flowEntryExtension", flowEntryExtension) |
108 | .toString(); | 108 | .toString(); | ... | ... |
... | @@ -15,15 +15,17 @@ | ... | @@ -15,15 +15,17 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.group; | 16 | package org.onosproject.net.group; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | -import static com.google.common.base.Preconditions.checkArgument; | ||
20 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
21 | - | ||
22 | -import java.util.Objects; | ||
23 | - | ||
24 | import org.onosproject.core.GroupId; | 18 | import org.onosproject.core.GroupId; |
25 | import org.onosproject.net.PortNumber; | 19 | import org.onosproject.net.PortNumber; |
26 | import org.onosproject.net.flow.TrafficTreatment; | 20 | import org.onosproject.net.flow.TrafficTreatment; |
21 | +import org.onosproject.net.flow.instructions.Instruction; | ||
22 | + | ||
23 | +import java.util.List; | ||
24 | +import java.util.Objects; | ||
25 | + | ||
26 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
27 | +import static com.google.common.base.Preconditions.checkArgument; | ||
28 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
27 | 29 | ||
28 | /** | 30 | /** |
29 | * Group bucket implementation. A group bucket is collection of | 31 | * Group bucket implementation. A group bucket is collection of |
... | @@ -206,9 +208,12 @@ public final class DefaultGroupBucket implements GroupBucket { | ... | @@ -206,9 +208,12 @@ public final class DefaultGroupBucket implements GroupBucket { |
206 | } | 208 | } |
207 | if (obj instanceof DefaultGroupBucket) { | 209 | if (obj instanceof DefaultGroupBucket) { |
208 | DefaultGroupBucket that = (DefaultGroupBucket) obj; | 210 | DefaultGroupBucket that = (DefaultGroupBucket) obj; |
211 | + List<Instruction> myInstructions = this.treatment.allInstructions(); | ||
212 | + List<Instruction> theirInstructions = that.treatment.allInstructions(); | ||
213 | + | ||
209 | return Objects.equals(type, that.type) && | 214 | return Objects.equals(type, that.type) && |
210 | - this.treatment.instructions().containsAll(that.treatment.instructions()) && | 215 | + myInstructions.containsAll(theirInstructions) && |
211 | - that.treatment.instructions().containsAll(this.treatment.instructions()); | 216 | + theirInstructions.containsAll(myInstructions); |
212 | } | 217 | } |
213 | return false; | 218 | return false; |
214 | } | 219 | } | ... | ... |
... | @@ -75,14 +75,24 @@ public class DefaultTrafficTreatmentTest { | ... | @@ -75,14 +75,24 @@ public class DefaultTrafficTreatmentTest { |
75 | 75 | ||
76 | final TrafficTreatment treatment1 = builder1.build(); | 76 | final TrafficTreatment treatment1 = builder1.build(); |
77 | 77 | ||
78 | - final List<Instruction> instructions1 = treatment1.instructions(); | 78 | + final List<Instruction> instructions1 = treatment1.immediate(); |
79 | assertThat(instructions1, hasSize(9)); | 79 | assertThat(instructions1, hasSize(9)); |
80 | 80 | ||
81 | builder1.drop(); | 81 | builder1.drop(); |
82 | builder1.add(instruction1); | 82 | builder1.add(instruction1); |
83 | 83 | ||
84 | - final List<Instruction> instructions2 = builder1.build().instructions(); | 84 | + final List<Instruction> instructions2 = builder1.build().immediate(); |
85 | assertThat(instructions2, hasSize(11)); | 85 | assertThat(instructions2, hasSize(11)); |
86 | + | ||
87 | + builder1.deferred() | ||
88 | + .popVlan() | ||
89 | + .pushVlan() | ||
90 | + .setVlanId(VlanId.vlanId((short) 5)); | ||
91 | + | ||
92 | + final List<Instruction> instructions3 = builder1.build().immediate(); | ||
93 | + assertThat(instructions3, hasSize(11)); | ||
94 | + final List<Instruction> instructions4 = builder1.build().deferred(); | ||
95 | + assertThat(instructions4, hasSize(3)); | ||
86 | } | 96 | } |
87 | 97 | ||
88 | /** | 98 | /** | ... | ... |
... | @@ -93,18 +93,13 @@ public class IntentTestsMocks { | ... | @@ -93,18 +93,13 @@ public class IntentTestsMocks { |
93 | */ | 93 | */ |
94 | public static class MockTreatment implements TrafficTreatment { | 94 | public static class MockTreatment implements TrafficTreatment { |
95 | @Override | 95 | @Override |
96 | - public List<Instruction> instructions() { | ||
97 | - return new ArrayList<>(); | ||
98 | - } | ||
99 | - | ||
100 | - @Override | ||
101 | public List<Instruction> deferred() { | 96 | public List<Instruction> deferred() { |
102 | return null; | 97 | return null; |
103 | } | 98 | } |
104 | 99 | ||
105 | @Override | 100 | @Override |
106 | public List<Instruction> immediate() { | 101 | public List<Instruction> immediate() { |
107 | - return null; | 102 | + return new ArrayList<>(); |
108 | } | 103 | } |
109 | 104 | ||
110 | @Override | 105 | @Override | ... | ... |
... | @@ -36,12 +36,17 @@ public final class TrafficTreatmentCodec extends JsonCodec<TrafficTreatment> { | ... | @@ -36,12 +36,17 @@ public final class TrafficTreatmentCodec extends JsonCodec<TrafficTreatment> { |
36 | final ObjectNode result = context.mapper().createObjectNode(); | 36 | final ObjectNode result = context.mapper().createObjectNode(); |
37 | final ArrayNode jsonInstructions = result.putArray("instructions"); | 37 | final ArrayNode jsonInstructions = result.putArray("instructions"); |
38 | 38 | ||
39 | - if (treatment.instructions() != null) { | 39 | + final JsonCodec<Instruction> instructionCodec = |
40 | - final JsonCodec<Instruction> instructionCodec = | 40 | + context.codec(Instruction.class); |
41 | - context.codec(Instruction.class); | 41 | + |
42 | - for (final Instruction instruction : treatment.instructions()) { | 42 | + for (final Instruction instruction : treatment.immediate()) { |
43 | - jsonInstructions.add(instructionCodec.encode(instruction, context)); | 43 | + jsonInstructions.add(instructionCodec.encode(instruction, context)); |
44 | - } | 44 | + } |
45 | + | ||
46 | + final ArrayNode jsonDeferred = result.putArray("deferred"); | ||
47 | + | ||
48 | + for (final Instruction instruction : treatment.deferred()) { | ||
49 | + jsonDeferred.add(instructionCodec.encode(instruction, context)); | ||
45 | } | 50 | } |
46 | 51 | ||
47 | return result; | 52 | return result; | ... | ... |
... | @@ -370,7 +370,7 @@ public final class IntentJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> | ... | @@ -370,7 +370,7 @@ public final class IntentJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode> |
370 | // check treatment | 370 | // check treatment |
371 | final JsonNode jsonTreatment = jsonIntent.get("treatment"); | 371 | final JsonNode jsonTreatment = jsonIntent.get("treatment"); |
372 | final TrafficTreatment treatment = connectivityIntent.treatment(); | 372 | final TrafficTreatment treatment = connectivityIntent.treatment(); |
373 | - final List<Instruction> instructions = treatment.instructions(); | 373 | + final List<Instruction> instructions = treatment.immediate(); |
374 | final JsonNode jsonInstructions = jsonTreatment.get("instructions"); | 374 | final JsonNode jsonInstructions = jsonTreatment.get("instructions"); |
375 | if (jsonInstructions.size() != instructions.size()) { | 375 | if (jsonInstructions.size() != instructions.size()) { |
376 | description.appendText("size of instructions array is " | 376 | description.appendText("size of instructions array is " | ... | ... |
... | @@ -557,11 +557,6 @@ public class FlowRuleManagerTest { | ... | @@ -557,11 +557,6 @@ public class FlowRuleManagerTest { |
557 | } | 557 | } |
558 | 558 | ||
559 | @Override | 559 | @Override |
560 | - public List<Instruction> instructions() { | ||
561 | - return null; | ||
562 | - } | ||
563 | - | ||
564 | - @Override | ||
565 | public List<Instruction> deferred() { | 560 | public List<Instruction> deferred() { |
566 | return null; | 561 | return null; |
567 | } | 562 | } | ... | ... |
... | @@ -156,8 +156,8 @@ public class HostMonitorTest { | ... | @@ -156,8 +156,8 @@ public class HostMonitorTest { |
156 | OutboundPacket packet = packetService.packets.get(0); | 156 | OutboundPacket packet = packetService.packets.get(0); |
157 | 157 | ||
158 | // Check the output port is correct | 158 | // Check the output port is correct |
159 | - assertEquals(1, packet.treatment().instructions().size()); | 159 | + assertEquals(1, packet.treatment().immediate().size()); |
160 | - Instruction instruction = packet.treatment().instructions().get(0); | 160 | + Instruction instruction = packet.treatment().immediate().get(0); |
161 | assertTrue(instruction instanceof OutputInstruction); | 161 | assertTrue(instruction instanceof OutputInstruction); |
162 | OutputInstruction oi = (OutputInstruction) instruction; | 162 | OutputInstruction oi = (OutputInstruction) instruction; |
163 | assertEquals(portNum, oi.port()); | 163 | assertEquals(portNum, oi.port()); |
... | @@ -225,8 +225,8 @@ public class HostMonitorTest { | ... | @@ -225,8 +225,8 @@ public class HostMonitorTest { |
225 | OutboundPacket packet = packetService.packets.get(0); | 225 | OutboundPacket packet = packetService.packets.get(0); |
226 | 226 | ||
227 | // Check the output port is correct | 227 | // Check the output port is correct |
228 | - assertEquals(1, packet.treatment().instructions().size()); | 228 | + assertEquals(1, packet.treatment().immediate().size()); |
229 | - Instruction instruction = packet.treatment().instructions().get(0); | 229 | + Instruction instruction = packet.treatment().immediate().get(0); |
230 | assertTrue(instruction instanceof OutputInstruction); | 230 | assertTrue(instruction instanceof OutputInstruction); |
231 | OutputInstruction oi = (OutputInstruction) instruction; | 231 | OutputInstruction oi = (OutputInstruction) instruction; |
232 | assertEquals(portNum, oi.port()); | 232 | assertEquals(portNum, oi.port()); | ... | ... |
... | @@ -503,9 +503,9 @@ public class ProxyArpManagerTest { | ... | @@ -503,9 +503,9 @@ public class ProxyArpManagerTest { |
503 | private void verifyPacketOut(Ethernet expected, ConnectPoint outPort, | 503 | private void verifyPacketOut(Ethernet expected, ConnectPoint outPort, |
504 | OutboundPacket actual) { | 504 | OutboundPacket actual) { |
505 | assertArrayEquals(expected.serialize(), actual.data().array()); | 505 | assertArrayEquals(expected.serialize(), actual.data().array()); |
506 | - assertEquals(1, actual.treatment().instructions().size()); | 506 | + assertEquals(1, actual.treatment().immediate().size()); |
507 | assertEquals(outPort.deviceId(), actual.sendThrough()); | 507 | assertEquals(outPort.deviceId(), actual.sendThrough()); |
508 | - Instruction instruction = actual.treatment().instructions().get(0); | 508 | + Instruction instruction = actual.treatment().immediate().get(0); |
509 | assertTrue(instruction instanceof OutputInstruction); | 509 | assertTrue(instruction instanceof OutputInstruction); |
510 | assertEquals(outPort.port(), ((OutputInstruction) instruction).port()); | 510 | assertEquals(outPort.port(), ((OutputInstruction) instruction).port()); |
511 | } | 511 | } | ... | ... |
... | @@ -155,15 +155,7 @@ public class SimpleStatisticStore implements StatisticStore { | ... | @@ -155,15 +155,7 @@ public class SimpleStatisticStore implements StatisticStore { |
155 | private ConnectPoint buildConnectPoint(FlowRule rule) { | 155 | private ConnectPoint buildConnectPoint(FlowRule rule) { |
156 | PortNumber port = getOutput(rule); | 156 | PortNumber port = getOutput(rule); |
157 | 157 | ||
158 | - boolean hasGoto = rule.treatment().instructions() | ||
159 | - .stream() | ||
160 | - .anyMatch(i -> (i instanceof Instructions.GroupInstruction) | ||
161 | - || (i instanceof Instructions.TableTypeTransition)); | ||
162 | - | ||
163 | if (port == null) { | 158 | if (port == null) { |
164 | - if (!hasGoto) { | ||
165 | - log.debug("Rule {} has no output.", rule); | ||
166 | - } | ||
167 | return null; | 159 | return null; |
168 | } | 160 | } |
169 | ConnectPoint cp = new ConnectPoint(rule.deviceId(), port); | 161 | ConnectPoint cp = new ConnectPoint(rule.deviceId(), port); |
... | @@ -171,7 +163,7 @@ public class SimpleStatisticStore implements StatisticStore { | ... | @@ -171,7 +163,7 @@ public class SimpleStatisticStore implements StatisticStore { |
171 | } | 163 | } |
172 | 164 | ||
173 | private PortNumber getOutput(FlowRule rule) { | 165 | private PortNumber getOutput(FlowRule rule) { |
174 | - for (Instruction i : rule.treatment().instructions()) { | 166 | + for (Instruction i : rule.treatment().immediate()) { |
175 | if (i.type() == Instruction.Type.OUTPUT) { | 167 | if (i.type() == Instruction.Type.OUTPUT) { |
176 | Instructions.OutputInstruction out = (Instructions.OutputInstruction) i; | 168 | Instructions.OutputInstruction out = (Instructions.OutputInstruction) i; |
177 | return out.port(); | 169 | return out.port(); | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer10.java
... | @@ -138,7 +138,7 @@ public class FlowModBuilderVer10 extends FlowModBuilder { | ... | @@ -138,7 +138,7 @@ public class FlowModBuilderVer10 extends FlowModBuilder { |
138 | if (treatment == null) { | 138 | if (treatment == null) { |
139 | return acts; | 139 | return acts; |
140 | } | 140 | } |
141 | - for (Instruction i : treatment.instructions()) { | 141 | + for (Instruction i : treatment.immediate()) { |
142 | switch (i.type()) { | 142 | switch (i.type()) { |
143 | case DROP: | 143 | case DROP: |
144 | log.warn("Saw drop action; assigning drop action"); | 144 | log.warn("Saw drop action; assigning drop action"); | ... | ... |
providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilderVer13.java
... | @@ -186,24 +186,6 @@ public class FlowModBuilderVer13 extends FlowModBuilder { | ... | @@ -186,24 +186,6 @@ public class FlowModBuilderVer13 extends FlowModBuilder { |
186 | return fm; | 186 | return fm; |
187 | } | 187 | } |
188 | 188 | ||
189 | - | ||
190 | - private List<OFInstruction> buildInstructions() { | ||
191 | - List<OFInstruction> instructions = new LinkedList<>(); | ||
192 | - if (treatment == null) { | ||
193 | - return instructions; | ||
194 | - } | ||
195 | - for (Instruction i : treatment.instructions()) { | ||
196 | - switch (i.type()) { | ||
197 | - case TABLE: | ||
198 | - instructions.add(buildTableGoto(((Instructions.TableTypeTransition) i))); | ||
199 | - break; | ||
200 | - default: | ||
201 | - break; | ||
202 | - } | ||
203 | - } | ||
204 | - return instructions; | ||
205 | - } | ||
206 | - | ||
207 | private List<OFAction> buildActions(List<Instruction> treatments) { | 189 | private List<OFAction> buildActions(List<Instruction> treatments) { |
208 | List<OFAction> actions = new LinkedList<>(); | 190 | List<OFAction> actions = new LinkedList<>(); |
209 | boolean tableFound = false; | 191 | boolean tableFound = false; | ... | ... |
... | @@ -184,7 +184,7 @@ public final class GroupModBuilder { | ... | @@ -184,7 +184,7 @@ public final class GroupModBuilder { |
184 | return actions; | 184 | return actions; |
185 | } | 185 | } |
186 | 186 | ||
187 | - for (Instruction i : treatment.instructions()) { | 187 | + for (Instruction i : treatment.allInstructions()) { |
188 | switch (i.type()) { | 188 | switch (i.type()) { |
189 | case DROP: | 189 | case DROP: |
190 | log.warn("Saw drop action; assigning drop action"); | 190 | log.warn("Saw drop action; assigning drop action"); | ... | ... |
... | @@ -55,7 +55,7 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext { | ... | @@ -55,7 +55,7 @@ public class OpenFlowCorePacketContext extends DefaultPacketContext { |
55 | } | 55 | } |
56 | 56 | ||
57 | private void sendPacket(Ethernet eth) { | 57 | private void sendPacket(Ethernet eth) { |
58 | - List<Instruction> ins = treatmentBuilder().build().instructions(); | 58 | + List<Instruction> ins = treatmentBuilder().build().allInstructions(); |
59 | OFPort p = null; | 59 | OFPort p = null; |
60 | //TODO: support arbitrary list of treatments must be supported in ofPacketContext | 60 | //TODO: support arbitrary list of treatments must be supported in ofPacketContext |
61 | for (Instruction i : ins) { | 61 | for (Instruction i : ins) { | ... | ... |
... | @@ -113,7 +113,7 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr | ... | @@ -113,7 +113,7 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr |
113 | //Ethernet eth = new Ethernet(); | 113 | //Ethernet eth = new Ethernet(); |
114 | //eth.deserialize(packet.data().array(), 0, packet.data().array().length); | 114 | //eth.deserialize(packet.data().array(), 0, packet.data().array().length); |
115 | OFPortDesc p = null; | 115 | OFPortDesc p = null; |
116 | - for (Instruction inst : packet.treatment().instructions()) { | 116 | + for (Instruction inst : packet.treatment().allInstructions()) { |
117 | if (inst.type().equals(Instruction.Type.OUTPUT)) { | 117 | if (inst.type().equals(Instruction.Type.OUTPUT)) { |
118 | p = portDesc(((OutputInstruction) inst).port()); | 118 | p = portDesc(((OutputInstruction) inst).port()); |
119 | OFPacketOut po = packetOut(sw, packet.data().array(), p.getPortNo()); | 119 | OFPacketOut po = packetOut(sw, packet.data().array(), p.getPortNo()); | ... | ... |
... | @@ -298,12 +298,12 @@ public class FlowsResourceTest extends ResourceTest { | ... | @@ -298,12 +298,12 @@ public class FlowsResourceTest extends ResourceTest { |
298 | if (flow.treatment() != null) { | 298 | if (flow.treatment() != null) { |
299 | final JsonObject jsonTreatment = jsonFlow.get("treatment").asObject(); | 299 | final JsonObject jsonTreatment = jsonFlow.get("treatment").asObject(); |
300 | final JsonArray jsonInstructions = jsonTreatment.get("instructions").asArray(); | 300 | final JsonArray jsonInstructions = jsonTreatment.get("instructions").asArray(); |
301 | - if (flow.treatment().instructions().size() != jsonInstructions.size()) { | 301 | + if (flow.treatment().immediate().size() != jsonInstructions.size()) { |
302 | reason = "instructions array size of " + | 302 | reason = "instructions array size of " + |
303 | - Integer.toString(flow.treatment().instructions().size()); | 303 | + Integer.toString(flow.treatment().immediate().size()); |
304 | return false; | 304 | return false; |
305 | } | 305 | } |
306 | - for (final Instruction instruction : flow.treatment().instructions()) { | 306 | + for (final Instruction instruction : flow.treatment().immediate()) { |
307 | boolean instructionFound = false; | 307 | boolean instructionFound = false; |
308 | for (int instructionIndex = 0; instructionIndex < jsonInstructions.size(); instructionIndex++) { | 308 | for (int instructionIndex = 0; instructionIndex < jsonInstructions.size(); instructionIndex++) { |
309 | final String jsonType = | 309 | final String jsonType = | ... | ... |
... | @@ -534,7 +534,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { | ... | @@ -534,7 +534,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { |
534 | PortNumber out = link.src().port(); | 534 | PortNumber out = link.src().port(); |
535 | for (FlowEntry entry : entries) { | 535 | for (FlowEntry entry : entries) { |
536 | TrafficTreatment treatment = entry.treatment(); | 536 | TrafficTreatment treatment = entry.treatment(); |
537 | - for (Instruction instruction : treatment.instructions()) { | 537 | + for (Instruction instruction : treatment.allInstructions()) { |
538 | if (instruction.type() == Instruction.Type.OUTPUT && | 538 | if (instruction.type() == Instruction.Type.OUTPUT && |
539 | ((OutputInstruction) instruction).port().equals(out)) { | 539 | ((OutputInstruction) instruction).port().equals(out)) { |
540 | count++; | 540 | count++; | ... | ... |
... | @@ -528,7 +528,7 @@ public abstract class TopologyViewMessages { | ... | @@ -528,7 +528,7 @@ public abstract class TopologyViewMessages { |
528 | PortNumber out = link.src().port(); | 528 | PortNumber out = link.src().port(); |
529 | for (FlowEntry entry : entries) { | 529 | for (FlowEntry entry : entries) { |
530 | TrafficTreatment treatment = entry.treatment(); | 530 | TrafficTreatment treatment = entry.treatment(); |
531 | - for (Instruction instruction : treatment.instructions()) { | 531 | + for (Instruction instruction : treatment.allInstructions()) { |
532 | if (instruction.type() == Instruction.Type.OUTPUT && | 532 | if (instruction.type() == Instruction.Type.OUTPUT && |
533 | ((OutputInstruction) instruction).port().equals(out)) { | 533 | ((OutputInstruction) instruction).port().equals(out)) { |
534 | count++; | 534 | count++; | ... | ... |
-
Please register or login to post a comment