Merge pull request #25 from teone/feature/latest-onos-apps

Changing the Sadis config to comply with the latest ONOS Apps
diff --git a/README.md b/README.md
index e569414..ec1a4f8 100644
--- a/README.md
+++ b/README.md
@@ -74,6 +74,9 @@
 | `WITH_BBSIM`                    | no                           | Should the BBSIM POD be deployed?                                                   |
 | `WITH_ONOS`                     | yes                          | Should `ONOS` service be deployed?                                                  |
 | `WITH_RADIUS`                   | no                           | Should `freeradius` service be deployed?                                            |
+| `WITH_EAPOL`                    | no                           | Configure the OLT app to push EAPOL flows                                           |
+| `WITH_DHCP`                     | no                           | Configure the OLT app to push DCHP flows                                            |
+| `WITH_IGMP`                     | no                           | Configure the OLT app to push IGMP flows                                            |
 | `WITH_TIMINGS`                  | no                           | Outputs duration of various steps of the install                                    |
 | `WITH_CHAOS`                    | no                           | Starts kube-monkey to introduce chaos                                               |
 | `CONFIG_SADIS`                  | no                           | Configure SADIS entries into ONOS, if WITH_ONOS set (see SADIS Configuration        |    
diff --git a/full-values.yaml b/full-values.yaml
index d83e596..865f158 100644
--- a/full-values.yaml
+++ b/full-values.yaml
@@ -91,8 +91,8 @@
 
 # Customization for BBSIM
 kafka_broker: 'voltha-kafka.voltha.svc.cluster.local:9092'
-pon_ports: 1
-onus_per_pon_port: 1
+pon: 1
+onu: 1
 auth: true
 dhcp: true
 
diff --git a/onos-files/olt-onos-olt-settings.json b/onos-files/olt-onos-olt-settings.json
deleted file mode 100644
index f70077d..0000000
--- a/onos-files/olt-onos-olt-settings.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "enableDhcpOnProvisioning" : true,
- "defaultVlan" : 65535
-}
diff --git a/onos-files/onos-sadis-sample.json b/onos-files/onos-sadis-sample.json
index 9ca3b21..565ed62 100644
--- a/onos-files/onos-sadis-sample.json
+++ b/onos-files/onos-sadis-sample.json
@@ -16,47 +16,59 @@
       },
       {
         "id": "BBSM00000001-1",
-        "cTag": 900,
-        "sTag": 900,
         "nasPortId": "BBSM00000001-1",
         "circuitId": "BBSM00000001-1",
-        "remoteId": "BBSIMOLT000",
-        "technologyProfileId": 64,
-        "upstreamBandwidthProfile": "Default",
-        "downstreamBandwidthProfile": "Default"
+        "remoteId": "BBSM00000001-1",
+        "uniTagList": [{
+          "ponCTag": 900,
+          "ponSTag": 900,
+          "technologyProfileId": 64,
+          "downstreamBandwidthProfile": "Default",
+          "upstreamBandwidthProfile": "Default",
+          "isDhcpRequired": true
+        }]
       },
       {
         "id": "BBSM00000002-1",
-        "cTag": 901,
-        "sTag": 900,
         "nasPortId": "BBSM00000002-1",
         "circuitId": "BBSM00000002-1",
-        "remoteId": "BBSIMOLT000",
-        "technologyProfileId": 64,
-        "upstreamBandwidthProfile": "Default",
-        "downstreamBandwidthProfile": "Default"
+        "remoteId": "BBSM00000002-1",
+        "uniTagList": [{
+          "ponCTag": 901,
+          "ponSTag": 900,
+          "technologyProfileId": 64,
+          "downstreamBandwidthProfile": "Default",
+          "upstreamBandwidthProfile": "Default",
+          "isDhcpRequired": true
+        }]
       },
       {
         "id": "BBSM00000101-1",
-        "cTag": 902,
-        "sTag": 900,
         "nasPortId": "BBSM00000101-1",
         "circuitId": "BBSM00000101-1",
-        "remoteId": "BBSIMOLT000",
-        "technologyProfileId": 64,
-        "upstreamBandwidthProfile": "Default",
-        "downstreamBandwidthProfile": "Default"
+        "remoteId": "BBSM00000101-1",
+        "uniTagList": [{
+          "ponCTag": 902,
+          "ponSTag": 900,
+          "technologyProfileId": 64,
+          "downstreamBandwidthProfile": "Default",
+          "upstreamBandwidthProfile": "Default",
+          "isDhcpRequired": true
+        }]
       },
       {
-        "id": "BBSM00000102-1",
-        "cTag": 903,
-        "sTag": 900,
-        "nasPortId": "BBSM00000102-1",
-        "circuitId": "BBSM00000102-1",
-        "remoteId": "BBSIMOLT000",
-        "technologyProfileId": 64,
-        "upstreamBandwidthProfile": "Default",
-        "downstreamBandwidthProfile": "Default"
+        "id": "BBSM00000201-1",
+        "nasPortId": "BBSM00000201-1",
+        "circuitId": "BBSM00000201-1",
+        "remoteId": "BBSM00000201-1",
+        "uniTagList": [{
+          "ponCTag": 903,
+          "ponSTag": 900,
+          "technologyProfileId": 64,
+          "downstreamBandwidthProfile": "Default",
+          "upstreamBandwidthProfile": "Default",
+          "isDhcpRequired": true
+        }]
       }
     ]
   },
diff --git a/voltha b/voltha
index 19474bf..52ee03b 100755
--- a/voltha
+++ b/voltha
@@ -70,6 +70,9 @@
 WITH_TIMINGS=${WITH_TIMINGS:-no}
 WITH_BBSIM=${WITH_BBSIM:-no}
 WITH_RADIUS=${WITH_RADIUS:-no}
+WITH_EAPOL=${WITH_EAPOL:-yes}
+WITH_DHCP=${WITH_DHCP:-yes}
+WITH_IGMP=${WITH_IGMP:-no}
 WITH_ONOS=${WITH_ONOS:-yes}
 WITH_CHAOS=${WITH_CHAOS:-no}
 WITH_ADAPTERS=${WITH_ADAPTERS:-yes}
@@ -133,6 +136,9 @@
     WITH_TIMINGS \
     WITH_BBSIM \
     WITH_RADIUS \
+    WITH_EAPOL \
+    WITH_DHCP \
+    WITH_IGMP \
     WITH_ONOS \
     WITH_CHAOS \
     WITH_ADAPTERS \
@@ -371,13 +377,19 @@
 fi
 
 push_onos_config() {
-    local MSG=$1
-    local RESOURCE=$2
-    local DATA=$3
+    local TYPE=$1
+    local MSG=$2
+    local RESOURCE=$3
+    local DATA=$4
 
     bspin - "$MSG $GEAR"
     while true; do
-        (set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/$RESOURCE --data @$DATA >>$LOG 2>&1) >>$LOG 2>&1
+        if [ $TYPE == "file" ]; then
+          (set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/$RESOURCE --data @$DATA >>$LOG 2>&1) >>$LOG 2>&1
+        fi
+        if [ $TYPE == "json" ]; then
+          (set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/$RESOURCE --data $DATA >>$LOG 2>&1) >>$LOG 2>&1
+        fi
         if [ $? -eq 0 ]; then
             break
         fi
@@ -1063,7 +1075,7 @@
     port_forward default onos-ssh $ONOS_SSH_PORT 8101
     espin - $VERIFIED
     bspin - "Verify or download ONOS configuration support files $DOWNLOAD"
-    ONOS_FILES="olt-onos-enableExtraneousRules.json  olt-onos-olt-settings.json onos-aaa.json \
+    ONOS_FILES="olt-onos-enableExtraneousRules.json onos-aaa.json \
         onos-dhcpl2relay.json onos-kafka.json onos-sadis-sample.json"
     (set -x; mkdir -p ./onos-files  >>$LOG 2>&1) >>$LOG 2>&1
     ERR_OUT=$(mktemp)
@@ -1096,18 +1108,27 @@
     fi
 
     check_onos_app_active org.opencord.kafka
-    push_onos_config "Push ONOS Kafka Configuration" "network/configuration/apps/org.opencord.kafka" "onos-files/onos-kafka.json"
+    push_onos_config "file" "Push ONOS Kafka Configuration" "network/configuration/apps/org.opencord.kafka" "onos-files/onos-kafka.json"
     check_onos_app_active org.opencord.dhcpl2relay
-    push_onos_config "Push ONOS DHCP L2 Relay Configuration" "network/configuration/apps/org.opencord.dhcpl2relay" "onos-files/onos-dhcpl2relay.json"
+    push_onos_config "file" "Push ONOS DHCP L2 Relay Configuration" "network/configuration/apps/org.opencord.dhcpl2relay" "onos-files/onos-dhcpl2relay.json"
     check_onos_app_active org.opencord.olt
-    push_onos_config "Enable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.Olt" "onos-files/olt-onos-olt-settings.json"
-    push_onos_config "Enabling extraneous rules for ONOS" "configuration/org.onosproject.net.flow.impl.FlowRuleManager" "onos-files/olt-onos-enableExtraneousRules.json"
+    # FIXME use WITH_DHCP and WITH_EAPOL flags to configre OLT App
+    if [ $WITH_EAPOL == "yes" ]; then
+      push_onos_config "json" "Enable VOLTHA ONOS EAPOL provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableEapol":true}'
+    fi
+    if [ $WITH_DHCP == "yes" ]; then
+      push_onos_config "json" "Enable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableDhcpOnProvisioning":true,"enableDhcpV4":true}'
+    fi
+    if [ $WITH_IGMP == "yes" ]; then
+      push_onos_config "json" "Enable VOLTHA ONOS IGMP provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableIgmpOnProvisioning":true}'
+    fi
+    push_onos_config "file" "Enabling extraneous rules for ONOS" "configuration/org.onosproject.net.flow.impl.FlowRuleManager" "onos-files/olt-onos-enableExtraneousRules.json"
     if [ -f onos-files/onos-sadis.json ]; then
-        push_onos_config "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "onos-files/onos-sadis.json"
+        push_onos_config "file" "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "onos-files/onos-sadis.json"
     elif [ "$CONFIG_SADIS" == "yes" ]; then
         SADIS_CFG=onos-files/onos-sadis-sample.json
         check_onos_app_active org.opencord.sadis
-        push_onos_config "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "$SADIS_CFG"
+        push_onos_config "file" "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "$SADIS_CFG"
     fi
 fi
 if [ "$WITH_TIMINGS" == "yes" ]; then