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
diff --git a/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java b/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java
index 2be1e82..7407258 100644
--- a/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java
+++ b/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java
@@ -205,8 +205,8 @@
 
         @Override
         public void run() {
-            TrafficSelector selector = DefaultTrafficSelector.builder().build();
-            TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+            TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+            TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
             List<Constraint> constraint = Lists.newArrayList();
             List<Host> hosts = Lists.newArrayList(hostService.getHosts());
             while (!hosts.isEmpty()) {
@@ -405,8 +405,8 @@
             private final Host src;
             private final Host dst;
 
-            private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
-            private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+            private final TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+            private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
             private final List<Constraint> constraint = Lists.newArrayList();
             private final HostToHostIntent intent;
 
diff --git a/apps/ifwd/src/main/java/org/onosproject/ifwd/IntentReactiveForwarding.java b/apps/ifwd/src/main/java/org/onosproject/ifwd/IntentReactiveForwarding.java
index 2e7634c..4b1d85a 100644
--- a/apps/ifwd/src/main/java/org/onosproject/ifwd/IntentReactiveForwarding.java
+++ b/apps/ifwd/src/main/java/org/onosproject/ifwd/IntentReactiveForwarding.java
@@ -157,8 +157,8 @@
 
     // Install a rule forwarding the packet to the specified port.
     private void setUpConnectivity(PacketContext context, HostId srcId, HostId dstId) {
-        TrafficSelector selector = DefaultTrafficSelector.builder().build();
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         HostToHostIntent intent = new HostToHostIntent(appId, srcId, dstId,
                                                        selector, treatment);
diff --git a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
index 5f2fc0f..8613101 100644
--- a/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
+++ b/apps/intent-perf/src/main/java/org/onosproject/intentperf/IntentPerfInstaller.java
@@ -203,7 +203,7 @@
             //FIXME we currently ignore the path length and always use the same device
             TrafficSelector selector = DefaultTrafficSelector.builder()
                     .matchEthDst(MacAddress.valueOf(count)).build();
-            TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+            TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
             ConnectPoint ingress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(1));
             ConnectPoint egress = new ConnectPoint(ingressDevice.id(), PortNumber.portNumber(2));
 
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
index fd99c6a..c9f9606 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
@@ -166,8 +166,7 @@
             return intents;
         }
 
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder()
-                .build();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         TrafficSelector selector;
 
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
index bc0972f..7ec843b 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
+++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
@@ -108,7 +108,7 @@
             new ConnectPoint(deviceId2, PortNumber.portNumber(1));
 
     private final TrafficTreatment noTreatment =
-            DefaultTrafficTreatment.builder().build();
+            DefaultTrafficTreatment.emptyTreatment();
 
     @Before
     public void setUp() throws Exception {
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
index eb5161b..4fcf131 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
@@ -50,8 +50,8 @@
         HostId oneId = HostId.hostId(one);
         HostId twoId = HostId.hostId(two);
 
-        TrafficSelector selector = DefaultTrafficSelector.builder().build();
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
         List<Constraint> constraints = buildConstraints();
 
         HostToHostIntent intent = new HostToHostIntent(appId(), key(),
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
index 5185d65..8ac8186 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
@@ -68,7 +68,7 @@
         }
 
         TrafficSelector selector = buildTrafficSelector();
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
         List<Constraint> constraints = buildConstraints();
 
         SinglePointToMultiPointIntent intent =
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java
index 1d067b6..109f669 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java
@@ -120,7 +120,7 @@
     private List<Intent> generateIntents(ConnectPoint ingress, ConnectPoint egress) {
         TrafficSelector.Builder selectorBldr = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4);
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         List<Intent> intents = Lists.newArrayList();
         for (int i = 0; i < count; i++) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
index 8a488a8..d140f97 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
@@ -129,7 +129,7 @@
     private List<Intent> generateIntents(ConnectPoint ingress, ConnectPoint egress) {
         TrafficSelector.Builder selectorBldr = DefaultTrafficSelector.builder()
                 .matchEthType(Ethernet.TYPE_IPV4);
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         List<Intent> intents = Lists.newArrayList();
         for (int i = 0; i < count; i++) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java
index b8f25fc..5eb592a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java
@@ -67,8 +67,8 @@
     }
 
     private Collection<Intent> generateIntents() {
-        TrafficSelector selector = DefaultTrafficSelector.builder().build();
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         List<Host> hosts = Lists.newArrayList(hostService.getHosts());
         List<Intent> fullMesh = Lists.newArrayList();
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
index d67e63a..5675d2e 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
@@ -15,23 +15,23 @@
  */
 package org.onosproject.net.flow;
 
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableSet;
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onlab.packet.MplsLabel;
+import org.onlab.packet.VlanId;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.criteria.Criteria;
+import org.onosproject.net.flow.criteria.Criterion;
+
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.criteria.Criteria;
-import org.onosproject.net.flow.criteria.Criterion;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.Ip6Address;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.MplsLabel;
-import org.onlab.packet.VlanId;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-
 /**
  * Default traffic selector implementation.
  */
@@ -39,6 +39,9 @@
 
     private final Set<Criterion> criteria;
 
+    private static final TrafficSelector EMPTY
+            = new DefaultTrafficSelector(Collections.emptySet());
+
     /**
      * Creates a new traffic selector with the specified criteria.
      *
@@ -98,6 +101,15 @@
     }
 
     /**
+     * Returns an empty traffic selector.
+     *
+     * @return empty traffic selector
+     */
+    public static TrafficSelector emptySelector() {
+        return EMPTY;
+    }
+
+    /**
      * Returns a new traffic selector builder primed to produce entities
      * patterned after the supplied selector.
      *
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index 499e9e7..7249ac0 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -27,6 +27,7 @@
 import org.onosproject.net.flow.instructions.Instruction;
 import org.onosproject.net.flow.instructions.Instructions;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 
@@ -41,6 +42,9 @@
 
     private final boolean hasClear;
 
+    private static final DefaultTrafficTreatment EMPTY
+            = new DefaultTrafficTreatment(Collections.emptyList());
+
     /**
      * Creates a new traffic treatment from the specified list of instructions.
      *
@@ -99,6 +103,15 @@
     }
 
     /**
+     * Returns an empty traffic treatment.
+     *
+     * @return empty traffic treatment
+     */
+    public static TrafficTreatment emptyTreatment() {
+        return EMPTY;
+    }
+
+    /**
      * Returns a new traffic treatment builder primed to produce entities
      * patterned after the supplied treatment.
      *
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index db634ff..5f62442 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -273,12 +273,14 @@
 
         /**
          * Builds an immutable traffic treatment descriptor.
+         * <p>
+         * If the treatment is empty when build() is called, it will add a default
+         * drop rule automatically. For a treatment that is actually empty, use
+         * {@link org.onosproject.net.flow.DefaultTrafficTreatment#emptyTreatment}.
+         * </p>
          *
          * @return traffic treatment
          */
         TrafficTreatment build();
-
-
     }
-
 }
diff --git a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
index 8add596..d47594a 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
@@ -50,8 +50,8 @@
      */
     public HostToHostIntent(ApplicationId appId, HostId one, HostId two) {
         this(appId, one, two,
-             DefaultTrafficSelector.builder().build(),
-             DefaultTrafficTreatment.builder().build(),
+             DefaultTrafficSelector.emptySelector(),
+             DefaultTrafficTreatment.emptyTreatment(),
              ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL)));
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java b/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
index 707ee6c..b6d0246 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
@@ -51,8 +51,8 @@
      */
     public TwoWayP2PIntent(ApplicationId appId, ConnectPoint one, ConnectPoint two) {
         this(appId, one, two,
-             DefaultTrafficSelector.builder().build(),
-             DefaultTrafficTreatment.builder().build(),
+             DefaultTrafficSelector.emptySelector(),
+             DefaultTrafficTreatment.emptyTreatment(),
              ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL)));
     }
 
diff --git a/core/api/src/test/java/org/onosproject/net/intent/ConnectivityIntentTest.java b/core/api/src/test/java/org/onosproject/net/intent/ConnectivityIntentTest.java
index 8628b30..d6b2882 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/ConnectivityIntentTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/ConnectivityIntentTest.java
@@ -35,8 +35,8 @@
     public static final ApplicationId APPID = new TestApplicationId("foo");
 
     public static final IntentId IID = new IntentId(123);
-    public static final TrafficSelector MATCH = DefaultTrafficSelector.builder().build();
-    public static final TrafficTreatment NOP = DefaultTrafficTreatment.builder().build();
+    public static final TrafficSelector MATCH = DefaultTrafficSelector.emptySelector();
+    public static final TrafficTreatment NOP = DefaultTrafficTreatment.emptyTreatment();
 
     public static final ConnectPoint P1 = new ConnectPoint(DeviceId.deviceId("111"), PortNumber.portNumber(0x1));
     public static final ConnectPoint P2 = new ConnectPoint(DeviceId.deviceId("222"), PortNumber.portNumber(0x2));
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
index 8ce4858..11a6e6e 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
@@ -63,8 +63,8 @@
 
     private final ApplicationId appId = new TestApplicationId("test");
     private final ProviderId pid = new ProviderId("of", "test");
-    private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
-    private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+    private final TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+    private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
     private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1));
     private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2));
     private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallCoordinatingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallCoordinatingTest.java
index ffb3a70..cad6768 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallCoordinatingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallCoordinatingTest.java
@@ -64,8 +64,8 @@
 
     private final ApplicationId appId = new TestApplicationId("test");
     private final ProviderId pid = new ProviderId("of", "test");
-    private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
-    private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+    private final TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+    private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
     private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1));
     private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2));
     private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallingTest.java
index 656d940..89c797c 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/InstallingTest.java
@@ -64,8 +64,8 @@
 
     private final ApplicationId appId = new TestApplicationId("test");
     private final ProviderId pid = new ProviderId("of", "test");
-    private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
-    private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+    private final TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+    private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
     private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1));
     private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2));
     private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinatingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinatingTest.java
index 7140b05..f5dbf58 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinatingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawCoordinatingTest.java
@@ -65,8 +65,8 @@
 
     private final ApplicationId appId = new TestApplicationId("test");
     private final ProviderId pid = new ProviderId("of", "test");
-    private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
-    private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+    private final TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+    private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
     private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1));
     private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2));
     private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawingTest.java
index 9484f63..1861ae5 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/WithdrawingTest.java
@@ -63,8 +63,8 @@
 
     private final ApplicationId appId = new TestApplicationId("test");
     private final ProviderId pid = new ProviderId("of", "test");
-    private final TrafficSelector selector = DefaultTrafficSelector.builder().build();
-    private final TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+    private final TrafficSelector selector = DefaultTrafficSelector.emptySelector();
+    private final TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
     private final ConnectPoint cp1 = new ConnectPoint(deviceId("1"), portNumber(1));
     private final ConnectPoint cp2 = new ConnectPoint(deviceId("1"), portNumber(2));
     private final ConnectPoint cp3 = new ConnectPoint(deviceId("2"), portNumber(1));
diff --git a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
index d32119c..86feb99 100644
--- a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
+++ b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
@@ -205,8 +205,8 @@
     @Test
     public void testFlowRuleBatchEntry() {
         final FlowRule rule1 =
-                new DefaultFlowRule(DID1, DefaultTrafficSelector.builder().build(),
-                        DefaultTrafficTreatment.builder().build(), 0, 0, 0, true);
+                new DefaultFlowRule(DID1, DefaultTrafficSelector.emptySelector(),
+                        DefaultTrafficTreatment.emptyTreatment(), 0, 0, 0, true);
         final FlowRuleBatchEntry entry1 =
                 new FlowRuleBatchEntry(FlowRuleBatchEntry.FlowRuleOperation.ADD, rule1);
         final FlowRuleBatchEntry entry2 =
diff --git a/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java b/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
index 919d25d..e4a1373 100644
--- a/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
+++ b/web/api/src/test/java/org/onosproject/codec/impl/IntentCodecTest.java
@@ -67,9 +67,9 @@
     private final HostId id2 = hid("12:34:56:78:92:ab/1");
     private final ApplicationId appId = new DefaultApplicationId(3, "test");
     final TrafficSelector emptySelector =
-            DefaultTrafficSelector.builder().build();
+            DefaultTrafficSelector.emptySelector();
     final TrafficTreatment emptyTreatment =
-            DefaultTrafficTreatment.builder().build();
+            DefaultTrafficTreatment.emptyTreatment();
     private final CodecContext context = new MockCodecContext();
 
     /**
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
index 29505b7..c27772f 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
@@ -312,8 +312,8 @@
 
         HostToHostIntent intent =
                 new HostToHostIntent(appId, one, two,
-                                     DefaultTrafficSelector.builder().build(),
-                                     DefaultTrafficTreatment.builder().build());
+                                     DefaultTrafficSelector.emptySelector(),
+                                     DefaultTrafficTreatment.emptyTreatment());
 
         intentService.submit(intent);
         startMonitoringIntent(event, intent);
@@ -333,7 +333,7 @@
         // FIXME: clearly, this is not enough
         TrafficSelector selector = DefaultTrafficSelector.builder()
                 .matchEthDst(dstHost.mac()).build();
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         MultiPointToSinglePointIntent intent =
                 new MultiPointToSinglePointIntent(appId, selector, treatment,
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewWebSocket.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewWebSocket.java
index 24e8b82..9ef1329 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewWebSocket.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewWebSocket.java
@@ -350,8 +350,8 @@
 
         HostToHostIntent intent =
                 new HostToHostIntent(appId, one, two,
-                                     DefaultTrafficSelector.builder().build(),
-                                     DefaultTrafficTreatment.builder().build());
+                                     DefaultTrafficSelector.emptySelector(),
+                                     DefaultTrafficTreatment.emptyTreatment());
 
         intentService.submit(intent);
         startMonitoringIntent(event, intent);
@@ -371,7 +371,7 @@
         // FIXME: clearly, this is not enough
         TrafficSelector selector = DefaultTrafficSelector.builder()
                 .matchEthDst(dstHost.mac()).build();
-        TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+        TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
 
         MultiPointToSinglePointIntent intent =
                 new MultiPointToSinglePointIntent(appId, selector, treatment,