[EDGEPOD-202] Add users to HSSDB as a group

Change-Id: Iec6dc9b085ef5a26aeb156878953d34eb8a22ae5
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index 3c09b9e..34d8f43 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.23
+version: 0.1.24
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 1cec0e4..cfdda81 100644
--- a/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
+++ b/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
@@ -18,31 +18,38 @@
 set -ex
 
 function provision_users() {
-    imsi=$1
-    msisdn=$2
-    apn=$3
-    key=$4
-    opc=$5
-    sqn=$6
-    cassandra_ip=$7
-    mmeidentity=$8
-    mmerealm=$9
+    count=${1}
+    imsi=${2}
+    msisdn=${3}
+    apn=${4}
+    key=${5}
+    opc=${6}
+    sqn=${7}
+    cassandra_ip=${8}
+    mmeidentity=${9}
+    mmerealm=${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\":[\"10.0.0.1\",\"10.0.0.2\"],\"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}}');"
+    for (( i=1; i<=$count; i++ ))
+    do
+        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\":[\"0.0.0.0\"],\"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}}');"
 
-    if [ $? -ne 0 ];then
-       echo -e "oops! Something went wrong adding $imsi to vhss.users_imsi!\n"
-       exit 1
-    fi
+        if [ $? -ne 0 ];then
+           echo -e "oops! Something went wrong adding $imsi to vhss.users_imsi!\n"
+           exit 1
+        fi
 
-    cqlsh $cassandra_ip -e "INSERT INTO vhss.msisdn_imsi (msisdn, imsi) VALUES ($msisdn, '$imsi');"
-    if [ $? -ne 0 ];then
-       echo -e "oops! Something went wrong adding $imsi to vhss.msisdn_imsi!\n"
-       exit 1
-    fi
+        cqlsh $cassandra_ip -e "INSERT INTO vhss.msisdn_imsi (msisdn, imsi) VALUES ($msisdn, '$imsi');"
+        if [ $? -ne 0 ];then
+           echo -e "oops! Something went wrong adding $imsi to vhss.msisdn_imsi!\n"
+           exit 1
+        fi
 
-    echo -e "Added $imsi\n"
+        echo -e "Added $imsi\n"
+
+        imsi=`expr $imsi + 1`;
+        msisdn=`expr $msisdn + 1`
+    done
 }
 
 function provision_mme() {
@@ -73,12 +80,13 @@
 
 {{- range .Values.config.hss.bootstrap.users }}
 provision_users \
-    {{ .imsi }} \
-    {{ .msisdn }} \
-    {{ .apn }} \
-    {{ .key }} \
-    {{ .opc }} \
-    {{ .sqn }} \
+    {{ .count }} \
+    {{ .imsiStart }} \
+    {{ .msisdnStart }} \
+    {{ $.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
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index 02d9c2e..10c7777 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -106,19 +106,14 @@
       #ipSec:
     bootstrap:
       enabled: true
+      apn: internet
+      key: "465b5ce8b199b49faa5f0a2ee238a6bc"
+      opc: "d4416644f6154936193433dd20a0ace0"
+      sqn: 96
       users:
-        - imsi: "208014567891200"
-          msisdn: "1122334455"
-          apn: apn1
-          key: "465b5ce8b199b49faa5f0a2ee238a6bc"
-          opc: "d4416644f6154936193433dd20a0ace0"
-          sqn: 96
-        - imsi: "208014567891201"
-          msisdn: "1122334455"
-          apn: apn1
-          key: "465b5ce8b199b49faa5f0a2ee238a6bc"
-          opc: "d4416644f6154936193433dd20a0ace0"
-          sqn: 96
+        - imsiStart: "208014567891200"
+          msisdnStart: "1122334455"
+          count: 10
       mmes:
         - id: 1
           isdn: "19136246000"
@@ -235,33 +230,12 @@
           tac: 17
           edgeName: edge-onf-menlo
         phoneTypes:
-        - imsi: 315010999912342
+        - imsi: 208014567891200
           phoneType: "Pixel-4"
-        - imsi: 315010999912343
-          phoneType: "iPhone11-Pro-Max"
-        - imsi: 315010999912345
-          phoneType: "iPhone11"
-        - imsi: 315010999912346
-          phoneType: "Sercomm-Dongle"
-        - imsi: 315010999912347
-          phoneType: "Sercomm-Camera"
-        - imsi: 315010999912348
-          phoneType: "Sercomm-Dongle"
-        - imsi: 315010999912349
+        - imsi: 208014567891201
           phoneType: "iPhone11-Pro"
-        - imsi: 315010999912350
-          phoneType: "iPhone11-Pro"
-        - imsi: 315010999912352
-          phoneType: "iPhone11"
-        - imsi: 315010999912353
-          phoneType: "iPhone11-Pro-Max"
-        - imsi: 315010999912354
-          phoneType: "iPhone11"
-        - imsi: 315010999912355
-          phoneType: "Pixel-4"
-
   spgwc:
-    apn: apn1
+    apn: internet
     ueIpPool:
       ip: 10.250.0.0
       mask: 255.255.0.0