Configure DataPlane S11 IP and S1U IP via ENV

Change-Id: I33839d7249f55bb55b18b72e38e453e02c37c111
diff --git a/mcord/mcord-control-plane/Chart.yaml b/mcord/mcord-control-plane/Chart.yaml
index 8fc59be..21b43e0 100644
--- a/mcord/mcord-control-plane/Chart.yaml
+++ b/mcord/mcord-control-plane/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: A Helm chart for MCORD Control Plane Services
 name: mcord-control-plane
-version: 0.1.6
+version: 0.1.7
diff --git a/mcord/mcord-control-plane/templates/cm.yaml b/mcord/mcord-control-plane/templates/cm.yaml
index 45ea93d..1122b7c 100644
--- a/mcord/mcord-control-plane/templates/cm.yaml
+++ b/mcord/mcord-control-plane/templates/cm.yaml
@@ -72,14 +72,6 @@
         MEMORY="--no-huge -m $((MEM_LIMIT-1024))"
     fi
 
-    SGW_S1U_IP=$(netstat -ie | grep -A1 s1u-net | tail -1 | awk '{print $2}' | tr -d addr:)
-    SHARED_DIR="/opt/ngic/config/shared"
-    if [ -d ${SHARED_DIR} ]; then
-        while [ ! -f ${SHARED_DIR}/SGW_S1U_IP ]; do echo "Waiting for SGW_S1U_IP"; sleep 2; done
-        SGW_S1U_IP=$(cat ${SHARED_DIR}/SGW_S1U_IP)
-    fi
-
-    SGW_S11_IP=$(hostname)
     MGMT_INFO="-s ${SGW_S11_IP} -m ${MME_S11_IP} -w ${SGW_S1U_IP}"
     APN_INFO="-i ${IP_POOL_IP} -p ${IP_POOL_MASK} -a ${APN}"
     SPGW_CFG="-d 03 -l 2 -r 7.7.7.7 -g 6.6.6.6 -v 4.4.4.4  -u 5.5.5.5"
@@ -133,7 +125,7 @@
     APP_ARGS="${S1U} ${SGI} ${WORKERS} ${MISC} ${SPGW_CFG}"
   interface.cfg: |
     [0]
-    dp_comm_ip = {{ .Values.spgwu_hostname }}
+    dp_comm_ip = {{ .Values.spgwu_s11_ip }}
     dp_comm_port = {{ .Values.spgwu_port }}
     cp_comm_ip = 127.0.0.1
     cp_comm_port = 21
diff --git a/mcord/mcord-control-plane/templates/cp.yaml b/mcord/mcord-control-plane/templates/cp.yaml
index c6dee13..eef9a4c 100644
--- a/mcord/mcord-control-plane/templates/cp.yaml
+++ b/mcord/mcord-control-plane/templates/cp.yaml
@@ -66,15 +66,17 @@
         stdin: true
         command: [ "bash",  "-xc" ]
         args:
-        - export DP_S1U_IP="{{ .Values.spgwu_s1u_ip }}";
-          echo "$DP_S1U_IP" > /opt/ngic/config/shared/SGW_S1U_IP;
-          . /opt/ngic/config/cp_config.cfg;
+        - . /opt/ngic/config/cp_config.cfg;
           sleep 20;
           ./ngic_controlplane $EAL_ARGS -- $APP_ARGS;
         tty: true
         env:
         - name: MME_S11_IP
           value: {{ .Values.mme_hostname }}
+        - name: SGW_S11_IP
+          values: {{ .Values.spgwu_s11_ip }}
+        - name: SGW_S1U_IP
+          value: {{ .Values.spgwu_s1u_ip }}
         - name: APN
           value: {{ .Values.ngic_cp.config.apn }}
         - name: IP_POOL_IP
diff --git a/mcord/mcord-control-plane/values.yaml b/mcord/mcord-control-plane/values.yaml
index 5f37dc9..51833ed 100644
--- a/mcord/mcord-control-plane/values.yaml
+++ b/mcord/mcord-control-plane/values.yaml
@@ -23,7 +23,7 @@
 mme_hostname: "mme"
 spgwc_hostname: "ngic-cp"
 # If the control plane is installed in a separate cluster, this value needs to be overridden
-spgwu_hostname: "ngic-dp"
+spgwu_s11_ip: "ngic-dp"
 # The spgwu_s1u_ip changes everytime, you can get it with this command:
 # ngic_sriov=$(kubectl exec -n epc ngic-dp-0 ifconfig s1u-net | grep 'inet addr' | cut -d: -f2 | awk '{print $1}')
 # and use it in the chart with --set spgwu_s1u_ip=$ngic_sriov