AETHER-17 Add support of BESS upf to comac-in-a-box

Also converged various configs under config.spgwu

Change-Id: I4f3383bb280494326a417ec6172427f806829f71
diff --git a/omec/omec-user-plane/templates/config/_spgwu.json.tpl b/omec/omec-user-plane/templates/config/_spgwu.json.tpl
index ba36cc7..e667a86 100644
--- a/omec/omec-user-plane/templates/config/_spgwu.json.tpl
+++ b/omec/omec-user-plane/templates/config/_spgwu.json.tpl
@@ -1,6 +1,7 @@
 {
-  "ue_cidr": {{ .Values.networks.ue.subnet | quote }},
-  "enb_cidr": {{ .Values.networks.enb.subnet | quote }},
+  "mode": {{ .Values.config.spgwu.mode | quote }},
+  "ue_cidr": {{ .Values.config.spgwu.ue.subnet | quote }},
+  "enb_cidr": {{ .Values.config.spgwu.enb.subnet | quote }},
   "s1u": {
     "ifname": {{ .Values.config.spgwu.s1u.device | quote }}
   },
diff --git a/omec/omec-user-plane/templates/networks.yaml b/omec/omec-user-plane/templates/networks.yaml
index 40ca04b..d9bd41a 100644
--- a/omec/omec-user-plane/templates/networks.yaml
+++ b/omec/omec-user-plane/templates/networks.yaml
@@ -9,15 +9,15 @@
 kind: NetworkAttachmentDefinition
 metadata:
   name: s1u-net
-{{- if $.Values.networks.sriov.enabled }}
+{{- if $.Values.config.spgwu.sriov.enabled }}
   annotations:
     k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_s1u_net
 {{- end }}
 spec:
   config: '{
-    "type": {{ .Values.networks.cniPlugin | quote }},
+    "type": {{ .Values.config.spgwu.cniPlugin | quote }},
     "ipam": {
-        "type": {{ .Values.networks.ipam | quote }}
+        "type": {{ .Values.config.spgwu.ipam | quote }}
     }
   }'
 ---
@@ -25,14 +25,14 @@
 kind: NetworkAttachmentDefinition
 metadata:
   name: sgi-net
-{{- if $.Values.networks.sriov.enabled }}
+{{- if $.Values.config.spgwu.sriov.enabled }}
   annotations:
     k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_sgi_net
 {{- end }}
 spec:
   config: '{
-    "type": {{ .Values.networks.cniPlugin | quote }},
+    "type": {{ .Values.config.spgwu.cniPlugin | quote }},
     "ipam": {
-        "type": {{ .Values.networks.ipam | quote }}
+        "type": {{ .Values.config.spgwu.ipam | quote }}
     }
   }'
diff --git a/omec/omec-user-plane/templates/service-spgwu.yaml b/omec/omec-user-plane/templates/service-spgwu.yaml
index efa09ba..ddb2967 100644
--- a/omec/omec-user-plane/templates/service-spgwu.yaml
+++ b/omec/omec-user-plane/templates/service-spgwu.yaml
@@ -34,4 +34,4 @@
   - name: bess-web
     protocol: TCP
     port: 8000
-    nodePort: {{ .Values.config.bess.web.nodePort }}
+    nodePort: {{ .Values.config.spgwu.bess.web.nodePort }}
diff --git a/omec/omec-user-plane/templates/statefulset-spgwu.yaml b/omec/omec-user-plane/templates/statefulset-spgwu.yaml
index 57fc312..963f27a 100644
--- a/omec/omec-user-plane/templates/statefulset-spgwu.yaml
+++ b/omec/omec-user-plane/templates/statefulset-spgwu.yaml
@@ -46,8 +46,9 @@
         imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
         command: ["sh", "-xec"]
         args:
-        - ip route add {{ .Values.networks.enb.subnet }} via {{ .Values.networks.s1u.gateway }};
-          ip route add default via {{ .Values.networks.sgi.gateway }} metric 110;
+        - ip route replace {{ .Values.config.spgwu.enb.subnet }} via {{ .Values.config.spgwu.s1u.gateway }};
+          ip route replace default via {{ .Values.config.spgwu.sgi.gateway }} metric 110;
+          iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP;
         securityContext:
           capabilities:
             add:
@@ -66,7 +67,13 @@
             - NET_ADMIN
         stdin: true
         tty: true
-        command: ["/bin/bash", "-xc", "bessd -f -grpc-url=0.0.0.0:10514;"]
+        command: ["/bin/bash", "-xc"]
+        args:
+        {{- if .Values.config.spgwu.hugepage.enabled }}
+          - bessd -f -grpc-url=0.0.0.0:10514
+        {{- else }}
+          - bessd -m 0 -f -grpc-url=0.0.0.0:10514
+        {{- end }}
         lifecycle:
           postStart:
             exec:
@@ -81,7 +88,10 @@
           {{- if .Values.resources.enabled }}
 {{ toYaml .Values.resources.bess.requests | indent 12 }}
           {{- end }}
-          {{- if .Values.networks.sriov.enabled }}
+          {{- if .Values.config.spgwu.hugepage.enabled }}
+            hugepages-1Gi: 2Gi
+          {{- end }}
+          {{- if .Values.config.spgwu.sriov.enabled }}
             intel.com/sriov_vfio_s1u_net: 1
             intel.com/sriov_vfio_sgi_net: 1
           {{- end }}
@@ -89,7 +99,10 @@
           {{- if .Values.resources.enabled }}
 {{ toYaml .Values.resources.bess.limits | indent 12 }}
           {{- end }}
-          {{- if .Values.networks.sriov.enabled }}
+          {{- if .Values.config.spgwu.hugepage.enabled }}
+            hugepages-1Gi: 2Gi
+          {{- end }}
+          {{- if .Values.config.spgwu.sriov.enabled }}
             intel.com/sriov_vfio_s1u_net: 1
             intel.com/sriov_vfio_sgi_net: 1
           {{- end }}
@@ -97,8 +110,10 @@
           - name: CONF_FILE
             value: /etc/bess/conf/spgwu.json
         volumeMounts:
+        {{- if .Values.config.spgwu.hugepage.enabled }}
           - name: hugepages
             mountPath: /dev/hugepages
+        {{- end }}
           - name: configs
             mountPath: /etc/bess/conf
         {{- if .Values.config.coreDump.enabled }}
@@ -161,9 +176,11 @@
         configMap:
           name: spgwu
           defaultMode: 493
+    {{- if .Values.config.spgwu.hugepage.enabled }}
       - name: hugepages
         emptyDir:
           medium: HugePages
+    {{- end }}
     {{- if .Values.config.coreDump.enabled }}
       - name: host-rootfs
         hostPath: