Implement M-CORD Services in Multi-cluster's configuration

Change-Id: Ie7b6cf0c4d010edd75efd4049bc8ac8fbb41cfc4
diff --git a/mcord/mcord-bbu/Chart.yaml b/mcord/mcord-bbu/Chart.yaml
index 63845f3..300ab4e 100644
--- a/mcord/mcord-bbu/Chart.yaml
+++ b/mcord/mcord-bbu/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: A Helm chart for MCORD BBU Services
 name: mcord-bbu
-version: 0.1.4
+version: 0.2.0
diff --git a/mcord/mcord-bbu/templates/accelleran.yaml b/mcord/mcord-bbu/templates/accelleran.yaml
index dbf2655..efe88d8 100644
--- a/mcord/mcord-bbu/templates/accelleran.yaml
+++ b/mcord/mcord-bbu/templates/accelleran.yaml
@@ -26,7 +26,7 @@
   ports:
     - name: s1ap
       port: {{ .Values.accelleran.ports.s1ap }}
-      protocol: TCP
+      protocol: SCTP
 ---
 apiVersion: v1
 kind: Service
@@ -34,12 +34,12 @@
   name: accelleran-external
 spec:
   selector:
-    app: accelleran-external
+    app: accelleran
   type: NodePort
   ports:
     - port: {{ .Values.accelleran.ports.s1ap }}
       nodePort: {{ .Values.accelleran.ports.s1ap_external }}
-      protocol: TCP
+      protocol: SCTP
 ---
 apiVersion: apps/v1
 kind: StatefulSet
@@ -62,6 +62,8 @@
           { "name": "bbu-net", "interface": "vbbu-net", "namespace": "default" }
         ]'
     spec:
+      nodeSelector:
+        kubernetes.io/hostname: "node2"
       initContainers:
       - name: init-iptables
         image: {{ .Values.accelleran.images.init }}
@@ -124,8 +126,11 @@
         stdin: true
         tty: true
         command: ["sh", "-c"]
+        # Configure BBU SCTP source port to `s1ap_external`, MME endpoint port to `mme_port` and configure BBU to use
         args:
-        - sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('eth0');";
+        - sqlite3 /mnt/app/datastore.db "update cellS1apConfig set enbSctpPort={{ .Values.accelleran.ports.s1ap_external }};";
+          sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway set S1SigLinkPort={{ .Values.mme_port }};";
+          sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('eth0');";
           sqlite3 /mnt/app/datastore.db "update logging set severity=7 where id=25;"
           sleep 10;
           /l3/l3start;
diff --git a/mcord/mcord-bbu/values.yaml b/mcord/mcord-bbu/values.yaml
index cba38e5..97340e9 100644
--- a/mcord/mcord-bbu/values.yaml
+++ b/mcord/mcord-bbu/values.yaml
@@ -19,7 +19,10 @@
 # Declare variables to be passed into your templates.
 
 accelleran_hostname: "accelleran"
-mme_hostname: "mme"
+
+# MME is on REMOTE's node2
+mme_hostname: "10.90.0.152"
+mme_port: 31412
 
 accelleran:
   images:
@@ -29,7 +32,7 @@
     bbu: "node1:30500/accelleran/vran-l3-fdd:onf-dns"
   ports:
     s1ap: 36412
-    s1ap_external: 30412
+    s1ap_external: 31412
   replicas: 1
   nats_service_name: "nats-cluster"
   inst_id: "enb_key"
diff --git a/mcord/mcord-control-plane/Chart.yaml b/mcord/mcord-control-plane/Chart.yaml
index 265448d..fb66e4f 100644
--- a/mcord/mcord-control-plane/Chart.yaml
+++ b/mcord/mcord-control-plane/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: A Helm chart for MCORD Control Plane Services
 name: mcord-control-plane
-version: 0.1.9
+version: 0.2.0
diff --git a/mcord/mcord-control-plane/templates/cassandra.yaml b/mcord/mcord-control-plane/templates/cassandra.yaml
index 9f85e03..312233b 100644
--- a/mcord/mcord-control-plane/templates/cassandra.yaml
+++ b/mcord/mcord-control-plane/templates/cassandra.yaml
@@ -44,7 +44,9 @@
     metadata:
       labels:
         app: cassandra
-    spec:
+    spec:    
+      nodeSelector:
+       kubernetes.io/hostname: "node3"
       terminationGracePeriodSeconds: 1
       containers:
       - name: cassandra
diff --git a/mcord/mcord-control-plane/templates/cp.yaml b/mcord/mcord-control-plane/templates/cp.yaml
index 35fbe20..2197347 100644
--- a/mcord/mcord-control-plane/templates/cp.yaml
+++ b/mcord/mcord-control-plane/templates/cp.yaml
@@ -31,6 +31,20 @@
     port: {{ .Values.ngic_cp.ports.sx }}
     protocol: UDP
 ---
+apiVersion: v1
+kind: Service
+metadata:
+  name: ngic-cp-external
+spec:
+  selector:
+    app: ngic-cp
+  type: NodePort
+  ports:
+    - name: sx
+      port: {{ .Values.ngic_cp.ports.sx }}
+      nodePort: {{ .Values.ngic_cp.ports.sx_external }}
+      protocol: UDP
+---
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
@@ -48,6 +62,8 @@
       labels:
         app: ngic-cp
     spec:
+      nodeSelector:
+        kubernetes.io/hostname: "node2"
       initContainers:
       - name: init-iptables
         image: {{ .Values.ngic_cp.images.init }}
diff --git a/mcord/mcord-control-plane/templates/hss.yaml b/mcord/mcord-control-plane/templates/hss.yaml
index 69dd53a..7a04bcb 100644
--- a/mcord/mcord-control-plane/templates/hss.yaml
+++ b/mcord/mcord-control-plane/templates/hss.yaml
@@ -45,6 +45,8 @@
       labels:
         app: hss
     spec:
+      nodeSelector:
+        kubernetes.io/hostname: "node3"
       terminationGracePeriodSeconds: 1
       initContainers:
       - name: init-db
diff --git a/mcord/mcord-control-plane/templates/mme.yaml b/mcord/mcord-control-plane/templates/mme.yaml
index d6946de..89e7309 100644
--- a/mcord/mcord-control-plane/templates/mme.yaml
+++ b/mcord/mcord-control-plane/templates/mme.yaml
@@ -24,15 +24,9 @@
     app: mme
   clusterIP: None
   ports:
-  - name: s11
-    port: {{ .Values.mme.ports.s11 }}
-    protocol: UDP
   - name: s1ap
     port: {{ .Values.mme.ports.s1ap }}
     protocol: SCTP
-  - name: s6a
-    port: {{ .Values.mme.ports.s6a }}
-    protocol: TCP
 ---
 apiVersion: v1
 kind: Service
@@ -40,21 +34,13 @@
   name: mme-external
 spec:
   selector:
-    app: mme-external
+    app: mme
   type: NodePort
   ports:
-    - name: s11
-      port: {{ .Values.mme.ports.s11 }}
-      nodePort: {{ .Values.mme.ports.s11_external }}
-      protocol: TCP
     - name: s1ap
       port: {{ .Values.mme.ports.s1ap }}
       nodePort: {{ .Values.mme.ports.s1ap_external }}
-      protocol: TCP
-    - name: s6a
-      port: {{ .Values.mme.ports.s6a }}
-      nodePort: {{ .Values.mme.ports.s6a_external }}
-      protocol: TCP
+      protocol: SCTP
 ---
 apiVersion: apps/v1
 kind: StatefulSet
@@ -73,6 +59,8 @@
       labels:
         app: mme
     spec:
+      nodeSelector:
+        kubernetes.io/hostname: "node2"
       terminationGracePeriodSeconds: 1
       initContainers:
       - name: init-mme
@@ -100,7 +88,7 @@
           - name: ENB_S1AP_IP
             value: {{ .Values.accelleran_hostname }}
           - name: ENB_S1AP_PORT
-            value: "{{ .Values.mme.ports.s1ap }}"   #ng4t uses 32767
+            value: "{{ .Values.accelleran_port }}"   #ng4t uses 32767
           - name: CONNECT_PEER
             value: hss-0.{{ .Values.hss_hostname }}.{{ .Values.namespace }}.svc.cluster.local
           - name: VAR_HSS_REALM
diff --git a/mcord/mcord-control-plane/values.yaml b/mcord/mcord-control-plane/values.yaml
index 7a89b90..930cfcd 100644
--- a/mcord/mcord-control-plane/values.yaml
+++ b/mcord/mcord-control-plane/values.yaml
@@ -23,13 +23,16 @@
 mme_hostname: "mme"
 spgwc_hostname: "ngic-cp"
 # If the control plane is installed in a separate cluster, this value needs to be overridden
-spgwu_s11_ip: "ngic-dp"
+# DP installed on LOCAL node3
+spgwu_s11_ip: "10.90.0.133"
 # The spgwu_s1u_ip changes everytime, you can get it with this command:
 # ngic_sriov=$(kubectl exec -n epc ngic-dp-0 ifconfig s1u-net | grep 'inet addr' | cut -d: -f2 | awk '{print $1}')
 # and use it in the chart with --set spgwu_s1u_ip=$ngic_sriov
 spgwu_s1u_ip: "119.0.0.45"
-spgwu_port: 20
-accelleran_hostname: "10.233.75.23"
+spgwu_port: 31310
+# BBU is allocated on LOCAL's node2, use node2's IP
+accelleran_hostname: "10.90.0.132"
+accelleran_port: 31412
 
 hss:
   # TODO: init UE's IMEI to DB?
@@ -46,15 +49,13 @@
 
 mme:
   images:
-    init: "node1:30500/ngick8stesting/c3po-mmeinit"
+    init: "ngick8stesting/c3po-mmeinit"
     mme: "ngick8stesting/c3po-mme:mwca-mme-debug"
   ports:
     s11: 2123
     s1ap: 36412
     s6a: 3868
-    s11_external: 32123
     s1ap_external: 31412
-    s6a_external: 30868
   replicas: 1
   enb_s1ap_ip: "119.0.0.10"
   resources:
@@ -69,6 +70,7 @@
   ports:
     s11: 2123
     sx: 21
+    sx_external: 31311
   config:
     apn: "apn1"
     ue_ip_pool: "16.0.0.0"
diff --git a/mcord/mcord-data-plane/Chart.yaml b/mcord/mcord-data-plane/Chart.yaml
index e65b958..55af2f7 100644
--- a/mcord/mcord-data-plane/Chart.yaml
+++ b/mcord/mcord-data-plane/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: A Helm chart for MCORD Data Plane Services
 name: mcord-data-plane
-version: 0.2.3
+version: 0.3.0
diff --git a/mcord/mcord-data-plane/templates/dp.yaml b/mcord/mcord-data-plane/templates/dp.yaml
index 71bcd47..4038394 100644
--- a/mcord/mcord-data-plane/templates/dp.yaml
+++ b/mcord/mcord-data-plane/templates/dp.yaml
@@ -49,6 +49,7 @@
     app: ngic-dp
 spec:
   replicas: {{ .Values.ngic_dp.replicas }}
+
   selector:
     matchLabels:
       app: ngic-dp
@@ -63,6 +64,8 @@
             { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" }
         ]'
     spec:
+      nodeSelector:
+        kubernetes.io/hostname: "node3"
       initContainers:
       - name: init-iptables
         image: {{ .Values.ngic_dp.images.init }}
diff --git a/mcord/mcord-data-plane/values.yaml b/mcord/mcord-data-plane/values.yaml
index c0d7a29..3fcdcb0 100644
--- a/mcord/mcord-data-plane/values.yaml
+++ b/mcord/mcord-data-plane/values.yaml
@@ -21,8 +21,9 @@
 redis_hostname: "redis"
 accelleran_hostname: "accelleran"
 mme_hostname: "mme"
-controlplane_hostname: "ngic-cp"
-controlplane_port: 21
+# CP is on REMOTE node2
+controlplane_hostname: "10.90.0.132"
+controlplane_port: 31311
 
 ngic_dp:
   images: