COMAC-109 Add support of openmme

The old mme is enabled by default.
To use openmme, set mme.type to openmme.

Change-Id: Id1029236af82f8f1abde7d25cee8cc70adfb8691
diff --git a/mcord-release/mcord-services/Chart.yaml b/mcord-release/mcord-services/Chart.yaml
index 57fffe3..e5db2a8 100644
--- a/mcord-release/mcord-services/Chart.yaml
+++ b/mcord-release/mcord-services/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: M-CORD services with OMEC inside
 name: mcord-services
-version: 0.1.3
+version: 0.1.4
diff --git a/mcord-release/mcord-services/templates/_helpers.tpl b/mcord-release/mcord-services/templates/_helpers.tpl
index 5e5718b..ac27abf 100644
--- a/mcord-release/mcord-services/templates/_helpers.tpl
+++ b/mcord-release/mcord-services/templates/_helpers.tpl
@@ -58,3 +58,21 @@
 {{- $wtf := $context.Template.Name | replace $last $name -}}
 {{ include $wtf $context }}
 {{- end -}}
+
+{{/*
+Return identity, realm, and hostname of the first pod of the given statefulset.
+*/}}
+{{- define "mcord-services.endpoint_lookup" -}}
+{{- $service := index . 0 -}}
+{{- $type := index . 1 -}}
+{{- $context := index . 2 -}}
+{{- $serviceContext := index $context.Values $service -}}
+{{- $serviceName := $serviceContext.name -}}
+{{- if eq $type "identity" -}}
+{{- printf "%s-0.%s.%s.svc.%s" $serviceName $serviceName $context.Release.Namespace "cluster.local" -}}
+{{- else if eq $type "realm" -}}
+{{- printf "%s.%s.svc.%s" $serviceName $context.Release.Namespace "cluster.local" -}}
+{{- else if eq $type "host" -}}
+{{- printf "%s-0" $serviceName -}}
+{{- end -}}
+{{- end -}}
diff --git a/mcord-release/mcord-services/templates/bin/_mme-init.sh.tpl b/mcord-release/mcord-services/templates/bin/_mme-init.sh.tpl
new file mode 100644
index 0000000..b96bf90
--- /dev/null
+++ b/mcord-release/mcord-services/templates/bin/_mme-init.sh.tpl
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+cp /opt/mme/config/config.json /opt/mme/config/shared/config.json
+cd /opt/mme/config/shared
+
+# Set local IP address for s1ap and s11 networks to the config
+jq --arg MME_LOCAL_IP "$MME_LOCAL_IP" '.mme.ip_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
+jq --arg MME_LOCAL_IP "$MME_LOCAL_IP" '.s1ap.s1ap_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
+jq --arg MME_LOCAL_IP "$MME_LOCAL_IP" '.s11.egtp_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
+
+# Set SPGW-C address to the config
+SPGWC_POD={{ tuple "spgwc" "identity" . | include "mcord-services.endpoint_lookup" | quote }}
+SPGWC_ADDR=$(dig +short $SPGWC_POD)
+jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.sgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json
+jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.pgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json
+
+# Add additional redundant keys - should be fixed in openmme
+HSS_TYPE=$(jq -r '.s6a.host_type' config.json)
+HSS_HOST=$(jq -r '.s6a.host' config.json)
+jq --arg HSS_TYPE "$HSS_TYPE" '.s6a.hss_type=$HSS_TYPE' config.json > config.tmp && mv config.tmp config.json
+jq --arg HSS_HOST "$HSS_HOST" '.s6a.host_name=$HSS_HOST' config.json > config.tmp && mv config.tmp config.json
+
+# Copy the final configs for each applications
+cp /opt/mme/config/shared/config.json /opt/mme/config/shared/mme.json
+cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s11.json
+cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s1ap.json
+cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s6a.json
+cp /opt/mme/config/s6a_fd.conf /opt/mme/config/shared/s6a_fd.conf
+
+# Generate certs
+MME_IDENTITY={{ tuple "mme" "identity" . | include "mcord-services.endpoint_lookup" | quote }};
+DIAMETER_HOST=$(echo $MME_IDENTITY | cut -d'.' -f1)
+DIAMETER_REALM={{ tuple "mme" "realm" . | include "mcord-services.endpoint_lookup" | quote }};
+
+cp /openmme/target/conf/make_certs.sh /opt/mme/config/shared/make_certs.sh
+cd /opt/mme/config/shared
+./make_certs.sh $DIAMETER_HOST $DIAMETER_REALM
diff --git a/mcord-release/mcord-services/templates/bin/_mme-run.sh.tpl b/mcord-release/mcord-services/templates/bin/_mme-run.sh.tpl
new file mode 100644
index 0000000..6b7718b
--- /dev/null
+++ b/mcord-release/mcord-services/templates/bin/_mme-run.sh.tpl
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+APPLICATION=$1
+
+# copy config files to openmme target directly
+cp /opt/mme/config/shared/* /openmme/target/conf/
+
+cd /openmme/target
+export LD_LIBRARY_PATH=/usr/local/lib:./lib
+
+case $APPLICATION in
+    "mme-app")
+      echo "Starting mme-app"
+      echo "conf/mme.json"
+      cat conf/mme.json
+      ./bin/mme-app
+      ;;
+    "s1ap-app")
+      echo "Starting s1ap-app"
+      echo "conf/s1ap.json"
+      cat conf/s1ap.json
+      ./bin/s1ap-app
+      ;;
+    "s6a-app")
+      echo "Starting s6a-app"
+      echo "conf/s6a.json"
+      cat conf/s6a.json
+      echo "conf/s6a_fd.conf"
+      cat conf/s6a_fd.conf
+      ./bin/s6a-app
+      ;;
+    "s11-app")
+      echo "Starting s11-app"
+      echo "conf/s11.json"
+      cat conf/s11.json
+      ./bin/s11-app
+      ;;
+    *)
+      echo "invalid app $APPLICATION"
+      ;;
+esac
diff --git a/mcord-release/mcord-services/templates/configmap-mme.yaml b/mcord-release/mcord-services/templates/configmap-mme.yaml
new file mode 100644
index 0000000..37163a0
--- /dev/null
+++ b/mcord-release/mcord-services/templates/configmap-mme.yaml
@@ -0,0 +1,115 @@
+---
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if eq .Values.mme.type "openmme" }}
+
+{{- if empty .Values.mme.conf.s6a.host -}}
+{{- $_ := tuple "hss" "identity" . | include "mcord-services.endpoint_lookup" | set .Values.mme.conf.s6a "host" -}}
+{{- end }}
+{{- if empty .Values.mme.conf.s6a.realm -}}
+{{- $_ := tuple "hss" "realm" . | include "mcord-services.endpoint_lookup" | set .Values.mme.conf.s6a "realm" -}}
+{{- end }}
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Values.mme.name }}
+data:
+  config.json: {{ toJson .Values.mme.conf | quote }}
+  s6a_fd.conf: |
+    # -------- Test configuration ---------
+    AppServThreads = 40;
+    SCTP_streams = 3;
+    NoRelay;
+    No_IPv6;
+
+    # Identity = "<diameter_host>.<diameter_realm>";
+    Identity = {{ tuple "mme" "identity" . | include "mcord-services.endpoint_lookup" | quote }};
+    Realm = {{ tuple "mme" "realm" . | include "mcord-services.endpoint_lookup" | quote }};
+    # Port = 3868;
+    # SecPort = 3869;
+
+    ConnectPeer = {{ tuple "hss" "identity" . | include "mcord-services.endpoint_lookup" | quote }} { No_TLS; port = 3868; };
+
+    # TLS_Cred = "<diameter_host>.cert.pem", "<diameter_host>.key.pem";
+    TLS_Cred = "conf/{{ tuple "mme" "host" . | include "mcord-services.endpoint_lookup" }}.cert.pem",
+               "conf/{{ tuple "mme" "host" . | include "mcord-services.endpoint_lookup" }}.key.pem";
+    TLS_CA = "conf/cacert.pem";
+
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_3gpp2_avps.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_CreditControl.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_base_rfc6733.fdx";
+    ###
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_draftload_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_etsi283034_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4004_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4006bis_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4072_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc4590_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5447_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5580_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5777_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc5778_avps.fdx";
+    ###
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc6734_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc6942_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7155_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7683_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_rfc7944_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29061_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29128_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29154_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29173_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29212_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29214_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29215_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29217_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29229_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29272_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29273_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29329_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29336_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29337_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29338_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29343_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29344_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29345_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29368_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts29468_avps.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_ts32299_avps.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_CxDx.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Gx.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_NAS.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Rf.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Ro.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Rx.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_S6as6d.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_S6c.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_S6mS6n.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_S6t.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_S9.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_SGd.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_SLh.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Sd.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Sh.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_T4.fdx";
+    LoadExtension = "/usr/local/lib/freeDiameter/dict_T6aT6bT7.fdx";
+    #LoadExtension = "/usr/local/lib/freeDiameter/dict_Tsp.fdx";
+  mme-init.sh: |
+{{ tuple "bin/_mme-init.sh.tpl" . | include "mcord-services.template" | indent 4 }}
+  mme-run.sh : |
+{{ tuple "bin/_mme-run.sh.tpl" . | include "mcord-services.template" | indent 4 }}
+{{- end }}
diff --git a/mcord-release/mcord-services/templates/hss.yaml b/mcord-release/mcord-services/templates/hss.yaml
index bc62dd2..a2478f8 100644
--- a/mcord-release/mcord-services/templates/hss.yaml
+++ b/mcord-release/mcord-services/templates/hss.yaml
@@ -248,9 +248,9 @@
         - name: HSSDB_ADDR
           value: {{ .Values.hssdb.name }}
         - name: MME_HOST
-          value: mme-0
+          value: {{ tuple "mme" "host" . | include "mcord-services.endpoint_lookup" | quote }}
         - name: MME_REALM
-          value: {{ .Values.mme.name }}.{{ .Values.global.namespace }}.{{ .Values.global.fqdn }}
+          value: {{ tuple "mme" "realm" . | include "mcord-services.endpoint_lookup" | quote }}
       containers:
       - name: hss
         image: {{ .Values.hss.image }}
@@ -261,7 +261,7 @@
         - name: HSSDB_ADDR
           value: {{ .Values.hssdb.name | quote }}
         - name: MME_IDENTITY
-          value: {{ .Values.mme.name }}.{{ .Values.global.namespace }}.{{ .Values.global.fqdn }}
+          value: {{ tuple "mme" "identity" . | include "mcord-services.endpoint_lookup" | quote }}
         command: ["bash", "-c", "/opt/c3po/hss/launch.sh; sleep 3600"]
         resources:
           limits:
diff --git a/mcord-release/mcord-services/templates/mme.yaml b/mcord-release/mcord-services/templates/mme.yaml
index c6e6adb..06f47be 100644
--- a/mcord-release/mcord-services/templates/mme.yaml
+++ b/mcord-release/mcord-services/templates/mme.yaml
@@ -13,6 +13,8 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
+{{- if eq .Values.mme.type "c3po" }}
 ---
 apiVersion: v1
 kind: ConfigMap
@@ -291,3 +293,4 @@
         configMap:
           name: {{ .Values.mme.name }}
           defaultMode: 420
+{{- end }}
diff --git a/mcord-release/mcord-services/templates/service-mme.yaml b/mcord-release/mcord-services/templates/service-mme.yaml
new file mode 100644
index 0000000..fbcd602
--- /dev/null
+++ b/mcord-release/mcord-services/templates/service-mme.yaml
@@ -0,0 +1,50 @@
+---
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if eq .Values.mme.type "openmme" }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Values.mme.name }}
+spec:
+  selector:
+    app: {{ .Values.mme.name }}
+  clusterIP: None
+  ports:
+  - name: s11
+    port: {{ .Values.mme.conf.s11.egtp_default_port }}
+    protocol: UDP
+  - name: s1ap
+    port: {{ .Values.mme.conf.s1ap.sctp_port }}
+    protocol: SCTP
+  - name: s6a
+    port: 3868
+    protocol: TCP
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Values.mme.name }}-external
+spec:
+  selector:
+    app: {{ .Values.mme.name }}
+  type: NodePort
+  ports:
+    - name: s1ap
+      port: {{ .Values.mme.conf.s1ap.sctp_port }}
+      nodePort: {{ .Values.mme.conf.s1ap.sctp_port_external }}
+      protocol: SCTP
+{{- end }}
diff --git a/mcord-release/mcord-services/templates/spgwc.yaml b/mcord-release/mcord-services/templates/spgwc.yaml
index c965922..3d83b33 100644
--- a/mcord-release/mcord-services/templates/spgwc.yaml
+++ b/mcord-release/mcord-services/templates/spgwc.yaml
@@ -492,7 +492,7 @@
         - name: DP_ADDR
           value: spgwu-0.{{ .Values.spgwu.name }}.{{ .Values.global.namespace }}.{{ .Values.global.fqdn }}
         - name: MME_S11_IP
-          value: mme-0.{{ .Values.mme.name }}.{{ .Values.global.namespace }}.{{ .Values.global.fqdn }}
+          value: {{ tuple "mme" "identity" . | include "mcord-services.endpoint_lookup" | quote }}
         - name: APN
           value: apn1
         - name: IP_POOL_IP
diff --git a/mcord-release/mcord-services/templates/statefulset-mme.yaml b/mcord-release/mcord-services/templates/statefulset-mme.yaml
new file mode 100644
index 0000000..f2ece70
--- /dev/null
+++ b/mcord-release/mcord-services/templates/statefulset-mme.yaml
@@ -0,0 +1,198 @@
+---
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{- if eq .Values.mme.type "openmme" }}
+
+{{- $releaseName := .Release.Name }}
+{{- $namespace := .Values.global.namespace }}
+{{- $name := .Values.mme.name }}
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: {{ $releaseName }}-{{ $name }}
+  namespace: {{ $namespace }}
+---
+kind: Role
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: {{ $releaseName }}-{{ $name }}
+  namespace: {{ $namespace }}
+rules:
+  - apiGroups:
+      - ""
+      - extensions
+      - batch
+      - apps
+    verbs:
+      - get
+      - list
+    resources:
+      - daemonsets
+      - jobs
+      - pods
+      - services
+      - endpoints
+---
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: {{ $releaseName }}-{{ $name }}
+  namespace: {{ $namespace }}
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: Role
+  name: {{ $releaseName }}-{{ $name }}
+subjects:
+- kind: ServiceAccount
+  name: {{ $releaseName }}-{{ $name }}
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: {{ $name }}
+  namespace: {{ $namespace }}
+  labels:
+    app: {{ $name }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: {{ $name }}
+  serviceName: {{ $name | quote }}
+  template:
+    metadata:
+      labels:
+        app: {{ $name }}
+    spec:
+      serviceAccountName: {{ $releaseName }}-{{ $name }}
+      initContainers:
+      - name: mme-dep-check
+        image: {{ .Values.mme.images.tags.dep_check | quote }}
+        imagePullPolicy: {{ .Values.mme.images.pullPolicy }}
+        securityContext:
+          allowPrivilegeEscalation: false
+          readOnlyRootFilesystem: false
+          runAsUser: 0
+        env:
+          - name: POD_NAME
+            valueFrom:
+              fieldRef:
+                apiVersion: v1
+                fieldPath: metadata.name
+          - name: NAMESPACE
+            valueFrom:
+              fieldRef:
+                apiVersion: v1
+                fieldPath: metadata.namespace
+          - name: PATH
+            value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+          - name: COMMAND
+            value: "echo done"
+          - name: DEPENDENCY_POD_JSON
+            value: '[{"labels": {"app": {{ .Values.spgwc.name | quote }}}, "requireSameNode": false}, {"labels": {"app": {{ .Values.hss.name | quote }}}, "requireSameNode": false}]'
+          # add dependency job for make_certs.sh
+        command:
+          - kubernetes-entrypoint
+        volumeMounts:
+          []
+      - name: mme-init
+        image: {{ .Values.mme.images.tags.mme | quote }}
+        imagePullPolicy: {{ .Values.mme.images.pullPolicy }}
+        command: ["/opt/mme/scripts/mme-init.sh"]
+        env:
+        - name: MME_LOCAL_IP
+          valueFrom:
+            fieldRef:
+              fieldPath: status.podIP
+        volumeMounts:
+        - name: scripts
+          mountPath: /opt/mme/scripts/mme-init.sh
+          subPath: mme-init.sh
+        - name: configs
+          mountPath: /opt/mme/config
+        - name: shared-data
+          mountPath: /opt/mme/config/shared
+      containers:
+      - name: mme-app
+        image: {{ .Values.mme.images.tags.mme | quote }}
+        imagePullPolicy: {{ .Values.mme.images.pullPolicy }}
+        command: ["bash", "-xc"]
+        args:
+        - /opt/mme/scripts/mme-run.sh mme-app
+        volumeMounts:
+        - name: scripts
+          mountPath: /opt/mme/scripts/mme-run.sh
+          subPath: mme-run.sh
+        - name: shared-data
+          mountPath: /opt/mme/config/shared
+        - name: shared-app
+          mountPath: /tmp
+      - name: s1ap-app
+        image: {{ .Values.mme.images.tags.mme | quote }}
+        imagePullPolicy: {{ .Values.mme.images.pullPolicy }}
+        command: ["bash", "-xc"]
+        args:
+        - /opt/mme/scripts/mme-run.sh s1ap-app
+        volumeMounts:
+        - name: scripts
+          mountPath: /opt/mme/scripts/mme-run.sh
+          subPath: mme-run.sh
+        - name: shared-data
+          mountPath: /opt/mme/config/shared
+        - name: shared-app
+          mountPath: /tmp
+      - name: s6a-app
+        image: {{ .Values.mme.images.tags.mme | quote }}
+        imagePullPolicy: {{ .Values.mme.images.pullPolicy }}
+        command: ["bash", "-xc"]
+        args:
+        - /opt/mme/scripts/mme-run.sh s6a-app
+        volumeMounts:
+        - name: scripts
+          mountPath: /opt/mme/scripts/mme-run.sh
+          subPath: mme-run.sh
+        - name: shared-data
+          mountPath: /opt/mme/config/shared
+        - name: shared-app
+          mountPath: /tmp
+      - name: s11-app
+        image: {{ .Values.mme.images.tags.mme | quote }}
+        imagePullPolicy: {{ .Values.mme.images.pullPolicy }}
+        command: ["bash", "-xc"]
+        args:
+        - /opt/mme/scripts/mme-run.sh s11-app
+        volumeMounts:
+        - name: scripts
+          mountPath: /opt/mme/scripts/mme-run.sh
+          subPath: mme-run.sh
+        - name: shared-data
+          mountPath: /opt/mme/config/shared
+        - name: shared-app
+          mountPath: /tmp
+      volumes:
+      - name: scripts
+        configMap:
+          name: {{ $name }}
+          defaultMode: 493
+      - name: configs
+        configMap:
+          name: {{ $name }}
+          defaultMode: 420
+      - name: shared-data
+        emptyDir: {}
+      - name: shared-app
+        emptyDir: {}
+{{- end }}
diff --git a/mcord-release/mcord-services/templates/statefulset-spgwu.yaml b/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
index da94a73..40bf94a 100644
--- a/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
+++ b/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
@@ -32,8 +32,8 @@
         app: {{ .Values.spgwu.name }}
       annotations:
         k8s.v1.cni.cncf.io/networks: '[
-                { "name": "s1u-net", "interface": "s1u-net" },
-                { "name": "sgi-net", "interface": "sgi-net" }
+                { "name": "s1u-net", "interface": "s1u-net", "interfaceRequest": "s1u-net" },
+                { "name": "sgi-net", "interface": "sgi-net", "interfaceRequest": "sgi-net" }
         ]'
     spec:
 {{- if .Values.network.sriov.enabled }}
diff --git a/mcord-release/mcord-services/values.yaml b/mcord-release/mcord-services/values.yaml
index f2516d4..dc4342f 100644
--- a/mcord-release/mcord-services/values.yaml
+++ b/mcord-release/mcord-services/values.yaml
@@ -41,11 +41,47 @@
   memory: 1Gi
 
 mme:
-  name: mme
   initimage: ngick8stesting/c3po-mmeinit
   image: ngick8stesting/c3po-mme:5e2eaf6
   cpu: 3
   memory: 1Gi
+  # Provide which mme will be used.
+  # Possible options are c3po and openmme but note that c3po mme will be deprecated soon.
+  type: c3po
+  name: mme
+  images:
+    tags:
+      dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
+      mme: omecproject/openmme:0.1.0-dev
+    pullPolicy: IfNotPresent
+  resources:
+    cpu: 3
+    memory: 1Gi
+  conf:
+    # Leave hostnames and addressses null unless using external spgw and hss.
+    mme:
+      name: vmmestandalone
+      group_id: 1
+      code: 1
+      mcc:
+        dig1: 2
+        dig2: 0
+        dig3: 8
+      mnc:
+        dig1: 0
+        dig2: 1
+        dig3: -1
+    s1ap:
+      sctp_port: 36412
+      sctp_port_external: 36412
+    s11:
+      egtp_default_port: 2123
+      sgw_addr: null
+      pgw_addr: null
+    s6a:
+      host_type: freediameter
+      host: null
+      realm: null
 
 spgwc:
   name: spgwc