Refactor SR and OFDPA pipeliner

populateRouterMacVlanFilters -> populateVlanMacFilters
hostFwdObjBuilder -> bridgingFwdObjBuilder
getForwardingObjectiveBuilder -> routingFwdObjBuilder
refactor pipeline initialization

Change-Id: I94932cde5155706571085ff41cb4ef63e2a39844
diff --git a/src/main/java/org/onosproject/segmentrouting/CordConfigHandler.java b/src/main/java/org/onosproject/segmentrouting/CordConfigHandler.java
index 618c0f0..34f5d1e 100644
--- a/src/main/java/org/onosproject/segmentrouting/CordConfigHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/CordConfigHandler.java
@@ -124,7 +124,7 @@
             // Add olt to the subnet of agent
             log.info("push subnet for olt {}", agentSubnet);
             srManager.deviceConfiguration.addSubnet(connectPoint, agentSubnet);
-            srManager.routingRulePopulator.populateRouterMacVlanFilters(connectPoint.deviceId());
+            srManager.routingRulePopulator.populateVlanMacFilters(connectPoint.deviceId());
 
             // Add host information for olt
             log.info("push host info for olt {}", macAddress);
@@ -175,7 +175,7 @@
             // Remove olt to the subnet of agent
             log.info("delete subnet for olt {}", agentSubnet);
             srManager.deviceConfiguration.removeSubnet(connectPoint, agentSubnet);
-            srManager.routingRulePopulator.populateRouterMacVlanFilters(connectPoint.deviceId());
+            srManager.routingRulePopulator.populateVlanMacFilters(connectPoint.deviceId());
         });
     }
 
diff --git a/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java b/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
index bee1150..1873530 100644
--- a/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/DefaultRoutingHandler.java
@@ -643,14 +643,14 @@
      * @param deviceId Switch ID to set the rules
      */
     public void populatePortAddressingRules(DeviceId deviceId) {
-        rulePopulator.populateRouterIpPunts(deviceId);
+        rulePopulator.populateIpPunts(deviceId);
         rulePopulator.populateArpNdpPunts(deviceId);
 
         // Although device is added, sometimes device store does not have the
         // ports for this device yet. It results in missing filtering rules in the
         // switch. We will attempt it a few times. If it still does not work,
         // user can manually repopulate using CLI command sr-reroute-network
-        PortFilterInfo firstRun = rulePopulator.populateRouterMacVlanFilters(deviceId);
+        PortFilterInfo firstRun = rulePopulator.populateVlanMacFilters(deviceId);
         if (firstRun == null) {
             firstRun = new PortFilterInfo(0, 0, 0);
         }
@@ -829,7 +829,7 @@
         @Override
         public void run() {
             log.info("RETRY FILTER ATTEMPT {} ** dev:{}", ++counter, devId);
-            PortFilterInfo thisRun = rulePopulator.populateRouterMacVlanFilters(devId);
+            PortFilterInfo thisRun = rulePopulator.populateVlanMacFilters(devId);
             boolean sameResult = prevRun.equals(thisRun);
             log.debug("dev:{} prevRun:{} thisRun:{} sameResult:{}", devId, prevRun,
                       thisRun, sameResult);
diff --git a/src/main/java/org/onosproject/segmentrouting/HostHandler.java b/src/main/java/org/onosproject/segmentrouting/HostHandler.java
index b229793..45dd4e9 100644
--- a/src/main/java/org/onosproject/segmentrouting/HostHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/HostHandler.java
@@ -93,7 +93,7 @@
             log.debug("Populate L2 table entry for host {} at {}:{}",
                     mac, deviceId, port);
             ForwardingObjective.Builder fob =
-                    hostFwdObjBuilder(deviceId, mac, vlanId, port);
+                    bridgingFwdObjBuilder(deviceId, mac, vlanId, port);
             if (fob == null) {
                 log.warn("Fail to create fwd obj for host {}/{}. Abort.", mac, vlanId);
                 return;
@@ -130,7 +130,7 @@
         if (accepted(host)) {
             // Revoke bridging table entry
             ForwardingObjective.Builder fob =
-                    hostFwdObjBuilder(deviceId, mac, vlanId, port);
+                    bridgingFwdObjBuilder(deviceId, mac, vlanId, port);
             if (fob == null) {
                 log.warn("Fail to create fwd obj for host {}/{}. Abort.", mac, vlanId);
                 return;
@@ -168,7 +168,7 @@
         if (accepted(event.prevSubject())) {
             // Revoke previous bridging table entry
             ForwardingObjective.Builder prevFob =
-                    hostFwdObjBuilder(prevDeviceId, mac, vlanId, prevPort);
+                    bridgingFwdObjBuilder(prevDeviceId, mac, vlanId, prevPort);
             if (prevFob == null) {
                 log.warn("Fail to create fwd obj for host {}/{}. Abort.", mac, vlanId);
                 return;
@@ -191,7 +191,7 @@
         if (accepted(event.subject())) {
             // Populate new bridging table entry
             ForwardingObjective.Builder newFob =
-                    hostFwdObjBuilder(newDeviceId, mac, vlanId, newPort);
+                    bridgingFwdObjBuilder(newDeviceId, mac, vlanId, newPort);
             if (newFob == null) {
                 log.warn("Fail to create fwd obj for host {}/{}. Abort.", mac, vlanId);
                 return;
@@ -249,7 +249,10 @@
     }
 
     /**
-     * Generates the forwarding objective builder for the host rules.
+     * Generates a forwarding objective builder for bridging rules.
+     * <p>
+     * The forwarding objective bridges packets destined to a given MAC to
+     * given port on given device.
      *
      * @param deviceId Device that host attaches to
      * @param mac MAC address of the host
@@ -257,7 +260,7 @@
      * @param outport Port that host attaches to
      * @return Forwarding objective builder
      */
-    private ForwardingObjective.Builder hostFwdObjBuilder(
+    private ForwardingObjective.Builder bridgingFwdObjBuilder(
             DeviceId deviceId, MacAddress mac, VlanId vlanId,
             PortNumber outport) {
         VlanId untaggedVlan = srManager.getUntaggedVlanId(new ConnectPoint(deviceId, outport));
diff --git a/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index 54e43d5..dae8a71 100644
--- a/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -123,7 +123,7 @@
                 prefix, deviceId, outPort);
         ForwardingObjective.Builder fwdBuilder;
         try {
-            fwdBuilder = getForwardingObjectiveBuilder(
+            fwdBuilder = routingFwdObjBuilder(
                     deviceId, prefix, hostMac, outPort);
         } catch (DeviceConfigNotFoundException e) {
             log.warn(e.getMessage() + " Aborting populateIpRuleForHost.");
@@ -156,7 +156,7 @@
                 prefix, deviceId, outPort);
         ForwardingObjective.Builder fwdBuilder;
         try {
-            fwdBuilder = getForwardingObjectiveBuilder(
+            fwdBuilder = routingFwdObjBuilder(
                     deviceId, prefix, hostMac, outPort);
         } catch (DeviceConfigNotFoundException e) {
             log.warn(e.getMessage() + " Aborting revokeIpRuleForHost.");
@@ -175,8 +175,10 @@
     }
 
     /**
-     * Returns a forwarding objective that points packets destined to a
-     * given prefix to given port on given device with given destination MAC.
+     * Returns a forwarding objective builder for routing rules.
+     * <p>
+     * The forwarding objective routes packets destined to a given prefix to
+     * given port on given device with given destination MAC.
      *
      * @param deviceId device ID
      * @param prefix prefix that need to be routed
@@ -185,7 +187,7 @@
      * @return forwarding objective builder
      * @throws DeviceConfigNotFoundException if given device is not configured
      */
-    private ForwardingObjective.Builder getForwardingObjectiveBuilder(
+    private ForwardingObjective.Builder routingFwdObjBuilder(
             DeviceId deviceId, IpPrefix prefix,
             MacAddress hostMac, PortNumber outPort)
             throws DeviceConfigNotFoundException {
@@ -599,7 +601,7 @@
      * @param deviceId  the switch dpid for the router
      * @return PortFilterInfo information about the processed ports
      */
-    public PortFilterInfo populateRouterMacVlanFilters(DeviceId deviceId) {
+    public PortFilterInfo populateVlanMacFilters(DeviceId deviceId) {
         log.debug("Installing per-port filtering objective for untagged "
                 + "packets in device {}", deviceId);
 
@@ -709,14 +711,14 @@
      *
      * @param deviceId the switch dpid for the router
      */
-    public void populateRouterIpPunts(DeviceId deviceId) {
+    public void populateIpPunts(DeviceId deviceId) {
         Ip4Address routerIpv4;
         Ip6Address routerIpv6;
         try {
             routerIpv4 = config.getRouterIpv4(deviceId);
             routerIpv6 = config.getRouterIpv6(deviceId);
         } catch (DeviceConfigNotFoundException e) {
-            log.warn(e.getMessage() + " Aborting populateRouterIpPunts.");
+            log.warn(e.getMessage() + " Aborting populateIpPunts.");
             return;
         }