Adding emptyTreatment() and emptySelector()
Note: There was a change that adds a DROP action to a traffic treatment if there are no other actions present. To get a traffic treatment without the drop rule, use emptyTreatment() Change-Id: I1f23ed5e1fa7519eb94fcafa85facbad815d5e9c
Showing
25 changed files
with
83 additions
and
57 deletions
... | @@ -205,8 +205,8 @@ public class DemoInstaller implements DemoAPI { | ... | @@ -205,8 +205,8 @@ public class DemoInstaller implements DemoAPI { |
205 | 205 | ||
206 | @Override | 206 | @Override |
207 | public void run() { | 207 | public void run() { |
208 | - TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 208 | + TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
209 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 209 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
210 | List<Constraint> constraint = Lists.newArrayList(); | 210 | List<Constraint> constraint = Lists.newArrayList(); |
211 | List<Host> hosts = Lists.newArrayList(hostService.getHosts()); | 211 | List<Host> hosts = Lists.newArrayList(hostService.getHosts()); |
212 | while (!hosts.isEmpty()) { | 212 | while (!hosts.isEmpty()) { |
... | @@ -405,8 +405,8 @@ public class DemoInstaller implements DemoAPI { | ... | @@ -405,8 +405,8 @@ public class DemoInstaller implements DemoAPI { |
405 | private final Host src; | 405 | private final Host src; |
406 | private final Host dst; | 406 | private final Host dst; |
407 | 407 | ||
408 | - private final TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 408 | + private final TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
409 | - private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 409 | + private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
410 | private final List<Constraint> constraint = Lists.newArrayList(); | 410 | private final List<Constraint> constraint = Lists.newArrayList(); |
411 | private final HostToHostIntent intent; | 411 | private final HostToHostIntent intent; |
412 | 412 | ... | ... |
... | @@ -157,8 +157,8 @@ public class IntentReactiveForwarding { | ... | @@ -157,8 +157,8 @@ public class IntentReactiveForwarding { |
157 | 157 | ||
158 | // Install a rule forwarding the packet to the specified port. | 158 | // Install a rule forwarding the packet to the specified port. |
159 | private void setUpConnectivity(PacketContext context, HostId srcId, HostId dstId) { | 159 | private void setUpConnectivity(PacketContext context, HostId srcId, HostId dstId) { |
160 | - TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 160 | + TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
161 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 161 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
162 | 162 | ||
163 | HostToHostIntent intent = new HostToHostIntent(appId, srcId, dstId, | 163 | HostToHostIntent intent = new HostToHostIntent(appId, srcId, dstId, |
164 | selector, treatment); | 164 | selector, treatment); | ... | ... |
... | @@ -203,7 +203,7 @@ public class IntentPerfInstaller { | ... | @@ -203,7 +203,7 @@ public class IntentPerfInstaller { |
203 | //FIXME we currently ignore the path length and always use the same device | 203 | //FIXME we currently ignore the path length and always use the same device |
204 | TrafficSelector selector = DefaultTrafficSelector.builder() | 204 | TrafficSelector selector = DefaultTrafficSelector.builder() |
205 | .matchEthDst(MacAddress.valueOf(count)).build(); | 205 | .matchEthDst(MacAddress.valueOf(count)).build(); |
206 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 206 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
207 | ConnectPoint ingress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(1)); | 207 | ConnectPoint ingress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(1)); |
208 | ConnectPoint egress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(2)); | 208 | ConnectPoint egress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(2)); |
209 | 209 | ... | ... |
... | @@ -166,8 +166,7 @@ public class PeerConnectivityManager { | ... | @@ -166,8 +166,7 @@ public class PeerConnectivityManager { |
166 | return intents; | 166 | return intents; |
167 | } | 167 | } |
168 | 168 | ||
169 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder() | 169 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
170 | - .build(); | ||
171 | 170 | ||
172 | TrafficSelector selector; | 171 | TrafficSelector selector; |
173 | 172 | ... | ... |
... | @@ -108,7 +108,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { | ... | @@ -108,7 +108,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { |
108 | new ConnectPoint(deviceId2, PortNumber.portNumber(1)); | 108 | new ConnectPoint(deviceId2, PortNumber.portNumber(1)); |
109 | 109 | ||
110 | private final TrafficTreatment noTreatment = | 110 | private final TrafficTreatment noTreatment = |
111 | - DefaultTrafficTreatment.builder().build(); | 111 | + DefaultTrafficTreatment.emptyTreatment(); |
112 | 112 | ||
113 | @Before | 113 | @Before |
114 | public void setUp() throws Exception { | 114 | public void setUp() throws Exception { | ... | ... |
... | @@ -50,8 +50,8 @@ public class AddHostToHostIntentCommand extends ConnectivityIntentCommand { | ... | @@ -50,8 +50,8 @@ public class AddHostToHostIntentCommand extends ConnectivityIntentCommand { |
50 | HostId oneId = HostId.hostId(one); | 50 | HostId oneId = HostId.hostId(one); |
51 | HostId twoId = HostId.hostId(two); | 51 | HostId twoId = HostId.hostId(two); |
52 | 52 | ||
53 | - TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 53 | + TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
54 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 54 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
55 | List<Constraint> constraints = buildConstraints(); | 55 | List<Constraint> constraints = buildConstraints(); |
56 | 56 | ||
57 | HostToHostIntent intent = new HostToHostIntent(appId(), key(), | 57 | HostToHostIntent intent = new HostToHostIntent(appId(), key(), | ... | ... |
... | @@ -68,7 +68,7 @@ public class AddSinglePointToMultiPointIntentCommand extends ConnectivityIntentC | ... | @@ -68,7 +68,7 @@ public class AddSinglePointToMultiPointIntentCommand extends ConnectivityIntentC |
68 | } | 68 | } |
69 | 69 | ||
70 | TrafficSelector selector = buildTrafficSelector(); | 70 | TrafficSelector selector = buildTrafficSelector(); |
71 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 71 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
72 | List<Constraint> constraints = buildConstraints(); | 72 | List<Constraint> constraints = buildConstraints(); |
73 | 73 | ||
74 | SinglePointToMultiPointIntent intent = | 74 | SinglePointToMultiPointIntent intent = | ... | ... |
... | @@ -120,7 +120,7 @@ public class IntentCycleCommand extends AbstractShellCommand | ... | @@ -120,7 +120,7 @@ public class IntentCycleCommand extends AbstractShellCommand |
120 | private List<Intent> generateIntents(ConnectPoint ingress, ConnectPoint egress) { | 120 | private List<Intent> generateIntents(ConnectPoint ingress, ConnectPoint egress) { |
121 | TrafficSelector.Builder selectorBldr = DefaultTrafficSelector.builder() | 121 | TrafficSelector.Builder selectorBldr = DefaultTrafficSelector.builder() |
122 | .matchEthType(Ethernet.TYPE_IPV4); | 122 | .matchEthType(Ethernet.TYPE_IPV4); |
123 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 123 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
124 | 124 | ||
125 | List<Intent> intents = Lists.newArrayList(); | 125 | List<Intent> intents = Lists.newArrayList(); |
126 | for (int i = 0; i < count; i++) { | 126 | for (int i = 0; i < count; i++) { | ... | ... |
... | @@ -129,7 +129,7 @@ public class IntentPushTestCommand extends AbstractShellCommand | ... | @@ -129,7 +129,7 @@ public class IntentPushTestCommand extends AbstractShellCommand |
129 | private List<Intent> generateIntents(ConnectPoint ingress, ConnectPoint egress) { | 129 | private List<Intent> generateIntents(ConnectPoint ingress, ConnectPoint egress) { |
130 | TrafficSelector.Builder selectorBldr = DefaultTrafficSelector.builder() | 130 | TrafficSelector.Builder selectorBldr = DefaultTrafficSelector.builder() |
131 | .matchEthType(Ethernet.TYPE_IPV4); | 131 | .matchEthType(Ethernet.TYPE_IPV4); |
132 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 132 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
133 | 133 | ||
134 | List<Intent> intents = Lists.newArrayList(); | 134 | List<Intent> intents = Lists.newArrayList(); |
135 | for (int i = 0; i < count; i++) { | 135 | for (int i = 0; i < count; i++) { | ... | ... |
... | @@ -67,8 +67,8 @@ public class RandomIntentCommand extends AbstractShellCommand { | ... | @@ -67,8 +67,8 @@ public class RandomIntentCommand extends AbstractShellCommand { |
67 | } | 67 | } |
68 | 68 | ||
69 | private Collection<Intent> generateIntents() { | 69 | private Collection<Intent> generateIntents() { |
70 | - TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 70 | + TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
71 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 71 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
72 | 72 | ||
73 | List<Host> hosts = Lists.newArrayList(hostService.getHosts()); | 73 | List<Host> hosts = Lists.newArrayList(hostService.getHosts()); |
74 | List<Intent> fullMesh = Lists.newArrayList(); | 74 | List<Intent> fullMesh = Lists.newArrayList(); | ... | ... |
... | @@ -15,22 +15,22 @@ | ... | @@ -15,22 +15,22 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow; | 16 | package org.onosproject.net.flow; |
17 | 17 | ||
18 | -import java.util.HashMap; | 18 | +import com.google.common.base.MoreObjects; |
19 | -import java.util.Map; | 19 | +import com.google.common.collect.ImmutableSet; |
20 | -import java.util.Objects; | ||
21 | -import java.util.Set; | ||
22 | - | ||
23 | -import org.onosproject.net.PortNumber; | ||
24 | -import org.onosproject.net.flow.criteria.Criteria; | ||
25 | -import org.onosproject.net.flow.criteria.Criterion; | ||
26 | -import org.onlab.packet.IpPrefix; | ||
27 | import org.onlab.packet.Ip6Address; | 20 | import org.onlab.packet.Ip6Address; |
21 | +import org.onlab.packet.IpPrefix; | ||
28 | import org.onlab.packet.MacAddress; | 22 | import org.onlab.packet.MacAddress; |
29 | import org.onlab.packet.MplsLabel; | 23 | import org.onlab.packet.MplsLabel; |
30 | import org.onlab.packet.VlanId; | 24 | import org.onlab.packet.VlanId; |
25 | +import org.onosproject.net.PortNumber; | ||
26 | +import org.onosproject.net.flow.criteria.Criteria; | ||
27 | +import org.onosproject.net.flow.criteria.Criterion; | ||
31 | 28 | ||
32 | -import com.google.common.base.MoreObjects; | 29 | +import java.util.Collections; |
33 | -import com.google.common.collect.ImmutableSet; | 30 | +import java.util.HashMap; |
31 | +import java.util.Map; | ||
32 | +import java.util.Objects; | ||
33 | +import java.util.Set; | ||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Default traffic selector implementation. | 36 | * Default traffic selector implementation. |
... | @@ -39,6 +39,9 @@ public final class DefaultTrafficSelector implements TrafficSelector { | ... | @@ -39,6 +39,9 @@ public final class DefaultTrafficSelector implements TrafficSelector { |
39 | 39 | ||
40 | private final Set<Criterion> criteria; | 40 | private final Set<Criterion> criteria; |
41 | 41 | ||
42 | + private static final TrafficSelector EMPTY | ||
43 | + = new DefaultTrafficSelector(Collections.emptySet()); | ||
44 | + | ||
42 | /** | 45 | /** |
43 | * Creates a new traffic selector with the specified criteria. | 46 | * Creates a new traffic selector with the specified criteria. |
44 | * | 47 | * |
... | @@ -98,6 +101,15 @@ public final class DefaultTrafficSelector implements TrafficSelector { | ... | @@ -98,6 +101,15 @@ public final class DefaultTrafficSelector implements TrafficSelector { |
98 | } | 101 | } |
99 | 102 | ||
100 | /** | 103 | /** |
104 | + * Returns an empty traffic selector. | ||
105 | + * | ||
106 | + * @return empty traffic selector | ||
107 | + */ | ||
108 | + public static TrafficSelector emptySelector() { | ||
109 | + return EMPTY; | ||
110 | + } | ||
111 | + | ||
112 | + /** | ||
101 | * Returns a new traffic selector builder primed to produce entities | 113 | * Returns a new traffic selector builder primed to produce entities |
102 | * patterned after the supplied selector. | 114 | * patterned after the supplied selector. |
103 | * | 115 | * | ... | ... |
... | @@ -27,6 +27,7 @@ import org.onosproject.net.PortNumber; | ... | @@ -27,6 +27,7 @@ import org.onosproject.net.PortNumber; |
27 | import org.onosproject.net.flow.instructions.Instruction; | 27 | import org.onosproject.net.flow.instructions.Instruction; |
28 | import org.onosproject.net.flow.instructions.Instructions; | 28 | import org.onosproject.net.flow.instructions.Instructions; |
29 | 29 | ||
30 | +import java.util.Collections; | ||
30 | import java.util.List; | 31 | import java.util.List; |
31 | import java.util.Objects; | 32 | import java.util.Objects; |
32 | 33 | ||
... | @@ -41,6 +42,9 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -41,6 +42,9 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
41 | 42 | ||
42 | private final boolean hasClear; | 43 | private final boolean hasClear; |
43 | 44 | ||
45 | + private static final DefaultTrafficTreatment EMPTY | ||
46 | + = new DefaultTrafficTreatment(Collections.emptyList()); | ||
47 | + | ||
44 | /** | 48 | /** |
45 | * Creates a new traffic treatment from the specified list of instructions. | 49 | * Creates a new traffic treatment from the specified list of instructions. |
46 | * | 50 | * |
... | @@ -99,6 +103,15 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { | ... | @@ -99,6 +103,15 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { |
99 | } | 103 | } |
100 | 104 | ||
101 | /** | 105 | /** |
106 | + * Returns an empty traffic treatment. | ||
107 | + * | ||
108 | + * @return empty traffic treatment | ||
109 | + */ | ||
110 | + public static TrafficTreatment emptyTreatment() { | ||
111 | + return EMPTY; | ||
112 | + } | ||
113 | + | ||
114 | + /** | ||
102 | * Returns a new traffic treatment builder primed to produce entities | 115 | * Returns a new traffic treatment builder primed to produce entities |
103 | * patterned after the supplied treatment. | 116 | * patterned after the supplied treatment. |
104 | * | 117 | * | ... | ... |
... | @@ -273,12 +273,14 @@ public interface TrafficTreatment { | ... | @@ -273,12 +273,14 @@ public interface TrafficTreatment { |
273 | 273 | ||
274 | /** | 274 | /** |
275 | * Builds an immutable traffic treatment descriptor. | 275 | * Builds an immutable traffic treatment descriptor. |
276 | + * <p> | ||
277 | + * If the treatment is empty when build() is called, it will add a default | ||
278 | + * drop rule automatically. For a treatment that is actually empty, use | ||
279 | + * {@link org.onosproject.net.flow.DefaultTrafficTreatment#emptyTreatment}. | ||
280 | + * </p> | ||
276 | * | 281 | * |
277 | * @return traffic treatment | 282 | * @return traffic treatment |
278 | */ | 283 | */ |
279 | TrafficTreatment build(); | 284 | TrafficTreatment build(); |
280 | - | ||
281 | - | ||
282 | } | 285 | } |
283 | - | ||
284 | } | 286 | } | ... | ... |
... | @@ -50,8 +50,8 @@ public final class HostToHostIntent extends ConnectivityIntent { | ... | @@ -50,8 +50,8 @@ public final class HostToHostIntent extends ConnectivityIntent { |
50 | */ | 50 | */ |
51 | public HostToHostIntent(ApplicationId appId, HostId one, HostId two) { | 51 | public HostToHostIntent(ApplicationId appId, HostId one, HostId two) { |
52 | this(appId, one, two, | 52 | this(appId, one, two, |
53 | - DefaultTrafficSelector.builder().build(), | 53 | + DefaultTrafficSelector.emptySelector(), |
54 | - DefaultTrafficTreatment.builder().build(), | 54 | + DefaultTrafficTreatment.emptyTreatment(), |
55 | ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL))); | 55 | ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL))); |
56 | } | 56 | } |
57 | 57 | ... | ... |
... | @@ -51,8 +51,8 @@ public final class TwoWayP2PIntent extends ConnectivityIntent { | ... | @@ -51,8 +51,8 @@ public final class TwoWayP2PIntent extends ConnectivityIntent { |
51 | */ | 51 | */ |
52 | public TwoWayP2PIntent(ApplicationId appId, ConnectPoint one, ConnectPoint two) { | 52 | public TwoWayP2PIntent(ApplicationId appId, ConnectPoint one, ConnectPoint two) { |
53 | this(appId, one, two, | 53 | this(appId, one, two, |
54 | - DefaultTrafficSelector.builder().build(), | 54 | + DefaultTrafficSelector.emptySelector(), |
55 | - DefaultTrafficTreatment.builder().build(), | 55 | + DefaultTrafficTreatment.emptyTreatment(), |
56 | ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL))); | 56 | ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL))); |
57 | } | 57 | } |
58 | 58 | ... | ... |
... | @@ -35,8 +35,8 @@ public abstract class ConnectivityIntentTest extends IntentTest { | ... | @@ -35,8 +35,8 @@ public abstract class ConnectivityIntentTest extends IntentTest { |
35 | public static final ApplicationId APPID = new TestApplicationId("foo"); | 35 | public static final ApplicationId APPID = new TestApplicationId("foo"); |
36 | 36 | ||
37 | public static final IntentId IID = new IntentId(123); | 37 | public static final IntentId IID = new IntentId(123); |
38 | - public static final TrafficSelector MATCH = DefaultTrafficSelector.builder().build(); | 38 | + public static final TrafficSelector MATCH = DefaultTrafficSelector.emptySelector(); |
39 | - public static final TrafficTreatment NOP = DefaultTrafficTreatment.builder().build(); | 39 | + public static final TrafficTreatment NOP = DefaultTrafficTreatment.emptyTreatment(); |
40 | 40 | ||
41 | public static final ConnectPoint P1 = new ConnectPoint(DeviceId.deviceId("111"), PortNumber.portNumber(0x1)); | 41 | public static final ConnectPoint P1 = new ConnectPoint(DeviceId.deviceId("111"), PortNumber.portNumber(0x1)); |
42 | public static final ConnectPoint P2 = new ConnectPoint(DeviceId.deviceId("222"), PortNumber.portNumber(0x2)); | 42 | public static final ConnectPoint P2 = new ConnectPoint(DeviceId.deviceId("222"), PortNumber.portNumber(0x2)); | ... | ... |
... | @@ -63,8 +63,8 @@ public class CompilingTest { | ... | @@ -63,8 +63,8 @@ public class CompilingTest { |
63 | 63 | ||
64 | private final ApplicationId appId = new TestApplicationId("test"); | 64 | private final ApplicationId appId = new TestApplicationId("test"); |
65 | private final ProviderId pid = new ProviderId("of", "test"); | 65 | private final ProviderId pid = new ProviderId("of", "test"); |
66 | - private final TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 66 | + private final TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
67 | - private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 67 | + private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
68 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); | 68 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); |
69 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); | 69 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); |
70 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | 70 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | ... | ... |
... | @@ -64,8 +64,8 @@ public class InstallCoordinatingTest { | ... | @@ -64,8 +64,8 @@ public class InstallCoordinatingTest { |
64 | 64 | ||
65 | private final ApplicationId appId = new TestApplicationId("test"); | 65 | private final ApplicationId appId = new TestApplicationId("test"); |
66 | private final ProviderId pid = new ProviderId("of", "test"); | 66 | private final ProviderId pid = new ProviderId("of", "test"); |
67 | - private final TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 67 | + private final TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
68 | - private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 68 | + private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
69 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); | 69 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); |
70 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); | 70 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); |
71 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | 71 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | ... | ... |
... | @@ -64,8 +64,8 @@ public class InstallingTest { | ... | @@ -64,8 +64,8 @@ public class InstallingTest { |
64 | 64 | ||
65 | private final ApplicationId appId = new TestApplicationId("test"); | 65 | private final ApplicationId appId = new TestApplicationId("test"); |
66 | private final ProviderId pid = new ProviderId("of", "test"); | 66 | private final ProviderId pid = new ProviderId("of", "test"); |
67 | - private final TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 67 | + private final TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
68 | - private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 68 | + private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
69 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); | 69 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); |
70 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); | 70 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); |
71 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | 71 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | ... | ... |
... | @@ -65,8 +65,8 @@ public class WithdrawCoordinatingTest { | ... | @@ -65,8 +65,8 @@ public class WithdrawCoordinatingTest { |
65 | 65 | ||
66 | private final ApplicationId appId = new TestApplicationId("test"); | 66 | private final ApplicationId appId = new TestApplicationId("test"); |
67 | private final ProviderId pid = new ProviderId("of", "test"); | 67 | private final ProviderId pid = new ProviderId("of", "test"); |
68 | - private final TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 68 | + private final TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
69 | - private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 69 | + private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
70 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); | 70 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); |
71 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); | 71 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); |
72 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | 72 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | ... | ... |
... | @@ -63,8 +63,8 @@ public class WithdrawingTest { | ... | @@ -63,8 +63,8 @@ public class WithdrawingTest { |
63 | 63 | ||
64 | private final ApplicationId appId = new TestApplicationId("test"); | 64 | private final ApplicationId appId = new TestApplicationId("test"); |
65 | private final ProviderId pid = new ProviderId("of", "test"); | 65 | private final ProviderId pid = new ProviderId("of", "test"); |
66 | - private final TrafficSelector selector = DefaultTrafficSelector.builder().build(); | 66 | + private final TrafficSelector selector = DefaultTrafficSelector.emptySelector(); |
67 | - private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 67 | + private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
68 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); | 68 | private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1)); |
69 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); | 69 | private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2)); |
70 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | 70 | private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1)); | ... | ... |
... | @@ -205,8 +205,8 @@ public class KryoSerializerTest { | ... | @@ -205,8 +205,8 @@ public class KryoSerializerTest { |
205 | @Test | 205 | @Test |
206 | public void testFlowRuleBatchEntry() { | 206 | public void testFlowRuleBatchEntry() { |
207 | final FlowRule rule1 = | 207 | final FlowRule rule1 = |
208 | - new DefaultFlowRule(DID1, DefaultTrafficSelector.builder().build(), | 208 | + new DefaultFlowRule(DID1, DefaultTrafficSelector.emptySelector(), |
209 | - DefaultTrafficTreatment.builder().build(), 0, 0, 0, true); | 209 | + DefaultTrafficTreatment.emptyTreatment(), 0, 0, 0, true); |
210 | final FlowRuleBatchEntry entry1 = | 210 | final FlowRuleBatchEntry entry1 = |
211 | new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule1); | 211 | new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule1); |
212 | final FlowRuleBatchEntry entry2 = | 212 | final FlowRuleBatchEntry entry2 = | ... | ... |
... | @@ -67,9 +67,9 @@ public class IntentCodecTest extends AbstractIntentTest { | ... | @@ -67,9 +67,9 @@ public class IntentCodecTest extends AbstractIntentTest { |
67 | private final HostId id2 = hid("12:34:56:78:92:ab/1"); | 67 | private final HostId id2 = hid("12:34:56:78:92:ab/1"); |
68 | private final ApplicationId appId = new DefaultApplicationId(3, "test"); | 68 | private final ApplicationId appId = new DefaultApplicationId(3, "test"); |
69 | final TrafficSelector emptySelector = | 69 | final TrafficSelector emptySelector = |
70 | - DefaultTrafficSelector.builder().build(); | 70 | + DefaultTrafficSelector.emptySelector(); |
71 | final TrafficTreatment emptyTreatment = | 71 | final TrafficTreatment emptyTreatment = |
72 | - DefaultTrafficTreatment.builder().build(); | 72 | + DefaultTrafficTreatment.emptyTreatment(); |
73 | private final CodecContext context = new MockCodecContext(); | 73 | private final CodecContext context = new MockCodecContext(); |
74 | 74 | ||
75 | /** | 75 | /** | ... | ... |
... | @@ -312,8 +312,8 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { | ... | @@ -312,8 +312,8 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { |
312 | 312 | ||
313 | HostToHostIntent intent = | 313 | HostToHostIntent intent = |
314 | new HostToHostIntent(appId, one, two, | 314 | new HostToHostIntent(appId, one, two, |
315 | - DefaultTrafficSelector.builder().build(), | 315 | + DefaultTrafficSelector.emptySelector(), |
316 | - DefaultTrafficTreatment.builder().build()); | 316 | + DefaultTrafficTreatment.emptyTreatment()); |
317 | 317 | ||
318 | intentService.submit(intent); | 318 | intentService.submit(intent); |
319 | startMonitoringIntent(event, intent); | 319 | startMonitoringIntent(event, intent); |
... | @@ -333,7 +333,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { | ... | @@ -333,7 +333,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { |
333 | // FIXME: clearly, this is not enough | 333 | // FIXME: clearly, this is not enough |
334 | TrafficSelector selector = DefaultTrafficSelector.builder() | 334 | TrafficSelector selector = DefaultTrafficSelector.builder() |
335 | .matchEthDst(dstHost.mac()).build(); | 335 | .matchEthDst(dstHost.mac()).build(); |
336 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 336 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
337 | 337 | ||
338 | MultiPointToSinglePointIntent intent = | 338 | MultiPointToSinglePointIntent intent = |
339 | new MultiPointToSinglePointIntent(appId, selector, treatment, | 339 | new MultiPointToSinglePointIntent(appId, selector, treatment, | ... | ... |
... | @@ -350,8 +350,8 @@ public class TopologyViewWebSocket | ... | @@ -350,8 +350,8 @@ public class TopologyViewWebSocket |
350 | 350 | ||
351 | HostToHostIntent intent = | 351 | HostToHostIntent intent = |
352 | new HostToHostIntent(appId, one, two, | 352 | new HostToHostIntent(appId, one, two, |
353 | - DefaultTrafficSelector.builder().build(), | 353 | + DefaultTrafficSelector.emptySelector(), |
354 | - DefaultTrafficTreatment.builder().build()); | 354 | + DefaultTrafficTreatment.emptyTreatment()); |
355 | 355 | ||
356 | intentService.submit(intent); | 356 | intentService.submit(intent); |
357 | startMonitoringIntent(event, intent); | 357 | startMonitoringIntent(event, intent); |
... | @@ -371,7 +371,7 @@ public class TopologyViewWebSocket | ... | @@ -371,7 +371,7 @@ public class TopologyViewWebSocket |
371 | // FIXME: clearly, this is not enough | 371 | // FIXME: clearly, this is not enough |
372 | TrafficSelector selector = DefaultTrafficSelector.builder() | 372 | TrafficSelector selector = DefaultTrafficSelector.builder() |
373 | .matchEthDst(dstHost.mac()).build(); | 373 | .matchEthDst(dstHost.mac()).build(); |
374 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder().build(); | 374 | + TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment(); |
375 | 375 | ||
376 | MultiPointToSinglePointIntent intent = | 376 | MultiPointToSinglePointIntent intent = |
377 | new MultiPointToSinglePointIntent(appId, selector, treatment, | 377 | new MultiPointToSinglePointIntent(appId, selector, treatment, | ... | ... |
-
Please register or login to post a comment