configurable PPPoE flow per service

Change-Id: I71905b183faf700dd087f5bb001f502af27117ee
diff --git a/api/src/main/java/org/opencord/sadis/UniTagInformation.java b/api/src/main/java/org/opencord/sadis/UniTagInformation.java
index 12bbaae..0e5c438 100644
--- a/api/src/main/java/org/opencord/sadis/UniTagInformation.java
+++ b/api/src/main/java/org/opencord/sadis/UniTagInformation.java
@@ -76,6 +76,9 @@
     @JsonProperty(value = "isIgmpRequired")
     private boolean isIgmpRequired;
 
+    @JsonProperty(value = "isPppoeRequired")
+    private boolean isPppoeRequired;
+
     public UniTagInformation() {
 
     }
@@ -90,7 +93,7 @@
                               final String downstreamOltBandwidthProfile,
                               final String serviceName, final boolean enableMacLearning,
                               final String configuredMacAddress, final boolean isDhcpRequired,
-                              final boolean isIgmpRequired) {
+                              final boolean isIgmpRequired, final boolean isPppoeRequired) {
         this.uniTagMatch = uniTagMatch;
         this.ponCTag = ponCTag;
         this.ponSTag = ponSTag;
@@ -108,6 +111,7 @@
         this.configuredMacAddress = configuredMacAddress;
         this.isDhcpRequired = isDhcpRequired;
         this.isIgmpRequired = isIgmpRequired;
+        this.isPppoeRequired = isPppoeRequired;
     }
     //CHECKSTYLE:ON
 
@@ -179,6 +183,10 @@
         return isIgmpRequired;
     }
 
+    public final boolean getIsPppoeRequired() {
+        return isPppoeRequired;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) {
@@ -226,6 +234,9 @@
         if (isIgmpRequired != that.isIgmpRequired) {
             return false;
         }
+        if (isPppoeRequired != that.isPppoeRequired) {
+            return false;
+        }
         if (upstreamBandwidthProfile != null ? !upstreamBandwidthProfile.equals(that.upstreamBandwidthProfile) :
                 that.upstreamBandwidthProfile != null) {
             return false;
@@ -266,6 +277,7 @@
         result = 31 * result + (configuredMacAddress != null ? configuredMacAddress.hashCode() : 0);
         result = 31 * result + (isDhcpRequired ? 1 : 0);
         result = 31 * result + (isIgmpRequired ? 1 : 0);
+        result = 31 * result + (isPppoeRequired ? 1 : 0);
         return result;
     }
 
@@ -289,6 +301,7 @@
         sb.append(", configuredMacAddress='").append(configuredMacAddress).append('\'');
         sb.append(", isDhcpRequired=").append(isDhcpRequired);
         sb.append(", isIgmpRequired=").append(isIgmpRequired);
+        sb.append(", isPppoeRequired=").append(isPppoeRequired);
         sb.append('}');
         return sb.toString();
     }
@@ -312,6 +325,7 @@
         private String configuredMacAddress;
         private boolean isDhcpRequired;
         private boolean isIgmpRequired;
+        private boolean isPppoeRequired;
 
         public final Builder setUniTagMatch(final VlanId uniTagMatch) {
             this.uniTagMatch = uniTagMatch;
@@ -398,14 +412,19 @@
             return this;
         }
 
+        public final Builder setIsPppoeRequired(final boolean isPppoeRequired) {
+            this.isPppoeRequired = isPppoeRequired;
+            return this;
+        }
+
         public final UniTagInformation build() {
             return new UniTagInformation(this.uniTagMatch, this.ponCTag,
                     this.ponSTag, this.usPonCTagPriority, this.usPonSTagPriority,
                     this.dsPonCTagPriority, this.dsPonSTagPriority, this.technologyProfileId,
                     this.upstreamBandwidthProfile, this.downstreamBandwidthProfile,
                     this.upstreamOltBandwidthProfile, this.downstreamOltBandwidthProfile,
-                    this.serviceName, this.enableMacLearning,
-                    this.configuredMacAddress, this.isDhcpRequired, this.isIgmpRequired);
+                    this.serviceName, this.enableMacLearning, this.configuredMacAddress,
+                    this.isDhcpRequired, this.isIgmpRequired, this.isPppoeRequired);
         }
     }
 }
diff --git a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java
index 958d8d7..5923204 100644
--- a/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java
+++ b/app/src/main/java/org/opencord/sadis/impl/SubscriberAndDeviceInformationConfig.java
@@ -78,6 +78,7 @@
  *                  "configuredDacAddress"          : string,
  *                  "isDhcpRequired"                : string,
  *                  "isIgmpRequired"                : string,
+ *                  "isPppoeRequired"                : string,
  *                  "serviceName"                   : string
  *                 }
  *              ]
@@ -108,6 +109,7 @@
     private static final String SERVICE_NAME = "serviceName";
     private static final String IS_DHCP_REQ = "isDhcpRequired";
     private static final String IS_IGMP_REQ = "isIgmpRequired";
+    private static final String IS_PPPOE_REQ = "isPppoeRequired";
     private static final String MAC_ADDRESS = "configuredMacAddress";
 
     public List<SubscriberAndDeviceInformation> getEntries() {
@@ -190,6 +192,7 @@
                         node.get(SERVICE_NAME).asText())
                 .setIsDhcpRequired(node.get(IS_DHCP_REQ) != null && node.get(IS_DHCP_REQ).asBoolean())
                 .setIsIgmpRequired(node.get(IS_IGMP_REQ) != null && node.get(IS_IGMP_REQ).asBoolean())
+                .setIsPppoeRequired(node.get(IS_PPPOE_REQ) != null && node.get(IS_PPPOE_REQ).asBoolean())
                 .setConfiguredMacAddress(node.get(MAC_ADDRESS) == null ? MacAddress.NONE.toString() :
                         node.get(MAC_ADDRESS).asText())
                 .build();
diff --git a/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java b/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java
index 9afbdcc..09060bb 100644
--- a/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java
+++ b/app/src/main/java/org/opencord/sadis/impl/UniTagInformationCodec.java
@@ -45,6 +45,7 @@
     private static final String MAC = "configuredMacAddress";
     private static final String DHCP_REQ = "isDhcpRequired";
     private static final String IGMP_REQ = "isIgmpRequired";
+    private static final String PPPOE_REQ = "isPppoeRequired";
     private static final int NO_PCP = -1;
     private static final int NO_TP = -1;
     private static final String EMPTY_BP = "";
@@ -53,6 +54,7 @@
     private static final String EMPTY_MAC = "";
     private static final boolean DEFAULT_DHCP_REQ = false;
     private static final boolean DEFAULT_IGMP_REQ = false;
+    private static final boolean DEFAULT_PPPOE_REQ = false;
 
     @Override
     public ObjectNode encode(UniTagInformation entry, CodecContext context) {
@@ -73,7 +75,8 @@
                 .put(MAC_LEARN, entry.getEnableMacLearning())
                 .put(MAC, entry.getConfiguredMacAddress())
                 .put(DHCP_REQ, entry.getIsDhcpRequired())
-                .put(IGMP_REQ, entry.getIsIgmpRequired());
+                .put(IGMP_REQ, entry.getIsIgmpRequired())
+                .put(PPPOE_REQ, entry.getIsPppoeRequired());
     }
 
     @Override
@@ -117,7 +120,9 @@
                 .setIsDhcpRequired(json.get(DHCP_REQ) == null ? DEFAULT_DHCP_REQ :
                         json.get(DHCP_REQ).asBoolean())
                 .setIsIgmpRequired(json.get(IGMP_REQ) == null ? DEFAULT_IGMP_REQ :
-                        json.get(IGMP_REQ).asBoolean());
+                        json.get(IGMP_REQ).asBoolean())
+                .setIsPppoeRequired(json.get(PPPOE_REQ) == null ? DEFAULT_PPPOE_REQ :
+                        json.get(PPPOE_REQ).asBoolean());
         log.info("Codec UniTagInformation Codec builder returning {}", tagInfoBuilder.build());
         return tagInfoBuilder.build();
     }