Static address allocation support by PDN GW

Passing arg to spgwc. Also adding individual IMSI
for which we need static address allocation

Change-Id: Id8164f64524ab0fe96b859dd540680536b951ad9
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index 82fabd0..1cc0cba 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -19,4 +19,4 @@
 name: omec-control-plane
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.1.25
+version: 0.1.26
diff --git a/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl b/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
index cfdda81..ebbddf2 100644
--- a/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
+++ b/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
@@ -52,6 +52,25 @@
     done
 }
 
+function provision_staticusers() {
+    imsi=${1}
+    msisdn=${2}
+    apn=${3}
+    key=${4}
+    opc=${5}
+    sqn=${6}
+    cassandra_ip=${7}
+    mmeidentity=${8}
+    mmerealm=${9}
+    staticAddr=${10}
+
+    echo "IMSI=$imsi MSISDN=$msisdn"
+    cqlsh $cassandra_ip -e "INSERT INTO vhss.users_imsi (imsi, msisdn, access_restriction, key, opc, mmehost, mmeidentity_idmmeidentity, mmerealm, rand, sqn, subscription_data) VALUES ('$imsi', $msisdn, 41, '$key', '$opc','$mmeidentity', 3, '$mmerealm', '2683b376d1056746de3b254012908e0e', $sqn, '{\"Subscription-Data\":{\"Access-Restriction-Data\":41,\"Subscriber-Status\":0,\"Network-Access-Mode\":2,\"Regional-Subscription-Zone-Code\":[\"0x0123\",\"0x4567\",\"0x89AB\",\"0xCDEF\",\"0x1234\",\"0x5678\",\"0x9ABC\",\"0xDEF0\",\"0x2345\",\"0x6789\"],\"MSISDN\":\"0x$msisdn\",\"AMBR\":{\"Max-Requested-Bandwidth-UL\":50000000,\"Max-Requested-Bandwidth-DL\":100000000},\"APN-Configuration-Profile\":{\"Context-Identifier\":0,\"All-APN-Configurations-Included-Indicator\":0,\"APN-Configuration\":{\"Context-Identifier\":0,\"PDN-Type\":0,\"Served-Party-IP-Address\":[\"$staticAddr\"],\"Service-Selection\":\"$apn\",\"EPS-Subscribed-QoS-Profile\":{\"QoS-Class-Identifier\":9,\"Allocation-Retention-Priority\":{\"Priority-Level\":15,\"Pre-emption-Capability\":0,\"Pre-emption-Vulnerability\":0}},\"AMBR\":{\"Max-Requested-Bandwidth-UL\":50000000,\"Max-Requested-Bandwidth-DL\":100000000},\"PDN-GW-Allocation-Type\":0,\"MIP6-Agent-Info\":{\"MIP-Home-Agent-Address\":[\"172.26.17.183\"]}}},\"Subscribed-Periodic-RAU-TAU-Timer\":0}}');"
+
+    cqlsh $cassandra_ip -e "INSERT INTO vhss.msisdn_imsi (msisdn, imsi) VALUES ($msisdn, '$imsi');"
+    echo -e "Added $imsi\n"
+}
+
 function provision_mme() {
     id=$1
     isdn=$2
@@ -92,6 +111,20 @@
     $mme_realm
 {{- end }}
 
+{{- range .Values.config.hss.bootstrap.staticusers }}
+provision_staticusers \
+    {{ .imsi }} \
+    {{ .msisdn }} \
+    {{ $.Values.config.hss.bootstrap.apn }} \
+    {{ $.Values.config.hss.bootstrap.key }} \
+    {{ $.Values.config.hss.bootstrap.opc }} \
+    {{ $.Values.config.hss.bootstrap.sqn }} \
+    {{ $.Values.config.hss.hssdb }} \
+    $mme_identity \
+    $mme_realm \
+    {{ .staticAddr }} 
+{{- end }}
+
 {{- range .Values.config.hss.bootstrap.mmes }}
 provision_mme \
     {{ .id }} \
diff --git a/omec/omec-control-plane/templates/configmap-spgwc.yaml b/omec/omec-control-plane/templates/configmap-spgwc.yaml
index 12515da..bc71b34 100644
--- a/omec/omec-control-plane/templates/configmap-spgwc.yaml
+++ b/omec/omec-control-plane/templates/configmap-spgwc.yaml
@@ -38,7 +38,7 @@
     CONFIG_UPDATE_FOLDER="-f /etc/cp/config/"
     APP_ARGS="${MGMT_INFO} ${APN_INFO} ${MISC} ${SPGW_CFG} ${CONFIG_UPDATE_FOLDER}"
 {{- else }}
-    APP_ARGS="${MGMT_INFO} ${APN_INFO} ${MISC} ${SPGW_CFG}"
+    APP_ARGS="${MGMT_INFO} ${APN_INFO} ${MISC} ${SPGW_CFG} "
 {{- end }}
   interface.cfg: |
     [0]
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index 10c7777..68dfea5 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -114,6 +114,10 @@
         - imsiStart: "208014567891200"
           msisdnStart: "1122334455"
           count: 10
+      staticusers:
+        - imsi: "208014567891201"
+          msisdn: "1122334455"
+          staticAddr: 0.0.0.0
       mmes:
         - id: 1
           isdn: "19136246000"
@@ -236,6 +240,9 @@
           phoneType: "iPhone11-Pro"
   spgwc:
     apn: internet
+    #This  ue Static pool is used only multi upf is not enabled. In case of multi-upf use app_config.cfg to provide static pool per DP
+    #ueStaticPool: 10.250.255.0/24
+    ueStaticPool: None
     ueIpPool:
       ip: 10.250.0.0
       mask: 255.255.0.0