Change to bootstrap non-sequencial IMSI users

Change-Id: I15c5222688a572ed21afcb4ec98e48345093a1e9
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index c5aebe5..e86fc86 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: OMEC control plane services
 name: omec-control-plane
-version: 0.1.4
+version: 0.1.5
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 096a434..be1f7a8 100644
--- a/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
+++ b/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
@@ -23,30 +23,26 @@
     apn=$3
     key=$4
     opc=$5
-    no_of_users=$6
+    sqn=$6
     cassandra_ip=$7
     mmeidentity=$8
     mmerealm=$9
 
-    for (( i=1; i<=$no_of_users; 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', 96, '{\"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\":\"apn1\",\"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 to vhss.users_imsi!\n"
-           exit 1
-        fi
+    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\":\"apn1\",\"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');"
-        if [ $? -ne 0 ];then
-           echo -e "oops! Something went wrong adding to vhss.msisdn_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
 
-        imsi=`expr $imsi + 1`;
-        msisdn=`expr $msisdn + 1`
-    done
+    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 "The provisioning is successful\n"
+    echo -e "Added $imsi\n"
 }
 
 function provision_mme() {
@@ -69,24 +65,31 @@
        exit 1
     fi
 
-    echo -e "The mme identity provisioning is successfull\n"
+    echo -e "Added mme $id\n"
 }
 
-provision_users \
-    {{ .Values.config.hss.bootstrap.users.imsi }} \
-    {{ .Values.config.hss.bootstrap.users.msisdn }} \
-    {{ .Values.config.hss.bootstrap.users.apn }} \
-    {{ .Values.config.hss.bootstrap.users.key }} \
-    {{ .Values.config.hss.bootstrap.users.opc }} \
-    {{ .Values.config.hss.bootstrap.users.numbers }} \
-    {{ .Values.config.hss.hssdb }} \
-    {{ tuple "mme" "identity" . | include "omec-control-plane.endpoint_lookup" }} \
-    {{ tuple "mme" "reaml" . | include "omec-control-plane.endpoint_lookup" }}
+mme_identity={{ tuple "mme" "identity" . | include "omec-control-plane.endpoint_lookup" }}
+mme_realm={{ tuple "mme" "realm" . | include "omec-control-plane.endpoint_lookup" }}
 
+{{- range .Values.config.hss.bootstrap.users }}
+provision_users \
+    {{ .imsi }} \
+    {{ .msisdn }} \
+    {{ .apn }} \
+    {{ .key }} \
+    {{ .opc }} \
+    {{ .sqn }} \
+    {{ $.Values.config.hss.hssdb }} \
+    $mme_identity \
+    $mme_realm
+{{- end }}
+
+{{- range .Values.config.hss.bootstrap.mmes }}
 provision_mme \
-    {{ .Values.config.hss.bootstrap.mme.id }} \
-    {{ .Values.config.hss.bootstrap.mme.isdn }} \
-    {{ tuple "mme" "identity" . | include "omec-control-plane.endpoint_lookup" }} \
-    {{ tuple "mme" "realm" . | include "omec-control-plane.endpoint_lookup" }} \
-    {{ .Values.config.hss.bootstrap.mme.unreachability }} \
-    {{ .Values.config.hss.hssdb }}
+    {{ .id }} \
+    {{ .isdn }} \
+    $mme_identity \
+    $mme_realm \
+    {{ .unreachability }} \
+    {{ $.Values.config.hss.hssdb }}
+{{- end }}
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index f4071d7..7f6da5d 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -102,16 +102,22 @@
     bootstrap:
       enabled: true
       users:
-        imsi: "208014567891200"
-        msisdn: "1122334455"
-        apn: apn1
-        key: "465b5ce8b199b49faa5f0a2ee238a6bc"
-        opc: "d4416644f6154936193433dd20a0ace0"
-        numbers: 2
-      mme:
-        id: 1
-        isdn: "19136246000"
-        unreachability: 1
+        - imsi: "208014567891200"
+          msisdn: "1122334455"
+          apn: apn1
+          key: "465b5ce8b199b49faa5f0a2ee238a6bc"
+          opc: "d4416644f6154936193433dd20a0ace0"
+          sqn: 96
+        - imsi: "208014567891201"
+          msisdn: "1122334455"
+          apn: apn1
+          key: "465b5ce8b199b49faa5f0a2ee238a6bc"
+          opc: "d4416644f6154936193433dd20a0ace0"
+          sqn: 96
+      mmes:
+        - id: 1
+          isdn: "19136246000"
+          unreachability: 1
     # See https://github.com/omec-project/c3po for details of config options
     cfgFiles:
       hss.json: