New changes in gnb deployments

1. Support for singleInterface or multiInterface deployment
2. Routes are added only in case of singleInterface=false.
   Routes are taken through networkTopo config.
3. ability to change defaultAs IP address.

Change-Id: I7581a6555d7c90e479f18d84b477d13864cd211a
diff --git a/5g-ran-sim/Chart.yaml b/5g-ran-sim/Chart.yaml
index 890728d..9b5eea9 100644
--- a/5g-ran-sim/Chart.yaml
+++ b/5g-ran-sim/Chart.yaml
@@ -8,4 +8,4 @@
 name: 5g-ran-sim
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.4.12
+version: 0.4.13
diff --git a/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl b/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl
index 130d18a..bc5db92 100644
--- a/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl
+++ b/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl
@@ -13,7 +13,13 @@
 cd /gnbsim
 cat ./config/gnb.conf
 cat /etc/hosts
-ip route add 192.168.252.0/24 via 192.168.251.1
+
+{{- if not .Values.config.gnbsim.singleInterface }}
+{{- range .Values.config.gnbsim.networkTopo }}
+ip route add {{ .upfAddr }} via {{ .upfGw }}
+{{- end }}
+
 # Disabling checksum offloading to hardware
 ethtool -K enb tx off
+{{- end }}
 sleep infinity
diff --git a/5g-ran-sim/templates/configmap-gnbsim.yaml b/5g-ran-sim/templates/configmap-gnbsim.yaml
index 8d6b841..32daa76 100644
--- a/5g-ran-sim/templates/configmap-gnbsim.yaml
+++ b/5g-ran-sim/templates/configmap-gnbsim.yaml
@@ -5,6 +5,18 @@
 */}}
 
 {{- if .Values.config.gnbsim.deploy }}
+{{- if not .Values.config.useExistingConfigMap }}
+{{- $config := index .Values.config "gnbsim" }}
+{{- $gnbconf := index .Values.config.gnbsim.yamlCfgFiles "gnb.conf" }}
+{{- $configuration := index $gnbconf "configuration" }}
+
+{{- if not (hasKey $configuration "singleInterface") -}}
+{{- $_ := .Values.config.gnbsim.singleInterface | set $configuration "singleInterface" -}}
+{{- end }}
+{{- $_ := .Values.config.gnbsim.networkTopo | set $configuration "networkTopo" -}}
+{{- end }}
+
+
 ---
 apiVersion: v1
 kind: ConfigMap
diff --git a/5g-ran-sim/templates/statefulset-gnbsim.yaml b/5g-ran-sim/templates/statefulset-gnbsim.yaml
index 7c2827d..88a0146 100644
--- a/5g-ran-sim/templates/statefulset-gnbsim.yaml
+++ b/5g-ran-sim/templates/statefulset-gnbsim.yaml
@@ -23,6 +23,7 @@
     metadata:
       labels:
 {{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 8 }}
+{{- if not .Values.config.gnbsim.singleInterface }}
       annotations:
         k8s.v1.cni.cncf.io/networks: '[
            { 
@@ -35,6 +36,7 @@
 {{- end }}
            }
          ]'
+{{- end }}
     spec:
     {{- if .Values.nodeSelectors.enabled }}
       nodeSelector:
diff --git a/5g-ran-sim/values.yaml b/5g-ran-sim/values.yaml
index 2b4e5e1..4b43345 100644
--- a/5g-ran-sim/values.yaml
+++ b/5g-ran-sim/values.yaml
@@ -6,7 +6,7 @@
   repository: "" #default docker hub
   tags:
     init: omecproject/pod-init:1.0.0
-    gnbsim: omecproject/5gc-gnbsim:main-832a5a6
+    gnbsim: omecproject/5gc-gnbsim:main-6e34bd2
   pullPolicy: IfNotPresent
 
 nodeSelectors:
@@ -26,6 +26,7 @@
       memory: 1Gi
 
 config:
+  useExistingConfigMap: false
   clusterDomain: cluster.local
   coreDump:
     enabled: false
@@ -37,7 +38,7 @@
     ipam: static
     cniPlugin: simpleovs #need override value
     gnb:
-      ip: 192.168.251.5/24
+      ip: 192.168.251.5/24 #user plane IP at gnb if 2 separate interface provided
     profile:
       enable: true
       port: 5000
@@ -46,12 +47,17 @@
       nodePort:
         enabled: false
         port: 30071
+    singleInterface: false
+    networkTopo:
+      - upfAddr: "192.168.252.3/32"
+        upfGw: "192.168.251.1"
     yamlCfgFiles:
       gnb.conf:
         info:
           version: 1.0.0
           description: gNodeB sim initial configuration
         configuration:
+          #singleInterface: #this will be added thorugh configmap script
           gnbs: # pool of gNodeBs
             gnb1:
               n2IpAddr: # gNB N2 interface IP address used to connect to AMF 
@@ -87,6 +93,7 @@
               gnbName: gnb1 # gNB to be used for this profile
               startImsi: 208930100007487 #First IMSI. Subsequent values will be used if ueCount is mo    re than 1
               ueCount: 5 # Number of UEs for for which the profile will be executed
+              defaultAs: "192.168.250.1"
               plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
                 mcc: 208 # Mobile Country Code (3 digits string, digit: 0~9)
                 mnc: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9)