Added with Accelleran vbbu's template

Change-Id: Ie78924c9ecd9f8c3fd8cdb84820b3d714077f086
diff --git a/mcord/cni-config/03-network-definition.yaml b/mcord/cni-config/03-network-definition.yaml
index 719dd79..df9bf5e 100644
--- a/mcord/cni-config/03-network-definition.yaml
+++ b/mcord/cni-config/03-network-definition.yaml
@@ -46,6 +46,24 @@
         "type": "centralip",
         "ipType": "cluster",
         "etcdURL": "http://node1:32379",
-        "network": "13.1.1.0/24"
+        "network": "13.0.0.0/24"
+    }
+}'
+---
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+  name: bbu-net
+  annotations:
+    k8s.v1.cni.cncf.io/resourceName: intel.com/sriov
+spec:
+  config: '{
+    "type": "sriov",
+    "name": "bbu-net",
+    "ipam": {
+        "type": "centralip",
+        "ipType": "cluster",
+        "etcdURL": "http://node1:32379",
+        "network": "116.0.0.0/24"
     }
 }'
diff --git a/mcord/mcord-control-plane/Chart.yaml b/mcord/mcord-control-plane/Chart.yaml
index 1dad508..edbb6c2 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.2
+version: 0.1.3
diff --git a/mcord/mcord-control-plane/templates/cp.yaml b/mcord/mcord-control-plane/templates/cp.yaml
index dab5aeb..563336f 100644
--- a/mcord/mcord-control-plane/templates/cp.yaml
+++ b/mcord/mcord-control-plane/templates/cp.yaml
@@ -66,15 +66,15 @@
         stdin: true
         command: [ "bash",  "-xc"]
         args:
-        - . /opt/ngic/config/cp_config.cfg;
+        - export HOSTIP=$(ip route get 1 | awk '{print $NF;exit}');
+          echo "$HOSTIP" > /opt/ngic/config/shared/SGW_S1U_IP;
+          . /opt/ngic/config/cp_config.cfg;
           sleep 20;
           ./ngic_controlplane $EAL_ARGS -- $APP_ARGS;
         tty: true
         env:
         - name: MME_S11_IP
           value: {{ .Values.mme_hostname }}
-        #- name: SGW_S1U_IP  # for now,this will be in our own pod
-        #  value: "5.5.5.5"
         - name: APN
           value: {{ .Values.ngic_cp.config.apn }}
         - name: IP_POOL_IP
diff --git a/mcord/mcord-control-plane/templates/hss.yaml b/mcord/mcord-control-plane/templates/hss.yaml
index 40b8f75..dd3fb88 100644
--- a/mcord/mcord-control-plane/templates/hss.yaml
+++ b/mcord/mcord-control-plane/templates/hss.yaml
@@ -52,25 +52,21 @@
         command: ["bash", "-xc"]
         args:
         - until nslookup {{ .Values.hssdb_hostname }}; do echo waiting for cassandra; sleep 2; done;
-          sleep 5;
+          sleep 10;
           cqlsh --file /scripts/oai_db.cql cassandra;
           /scripts/data_provisioning_users.sh 302720100000421 1122334456 apn1 6226194254742F2D67145153602F7C8D 1 cassandra {{ .Values.mme_hostname }} {{ .Values.mme_hostname }};
           cqlsh -e "use vhss; update users_imsi set opc='D6CAF10C337FD65AC31A18EBACBF5BF9' where imsi='302720100000421';" cassandra;
-          cqlsh -e "select imsi,key,opc,sqn from vhss.users_imsi;" cassandra;
-          /scripts/data_provisioning_mme.sh 1 19136246000 {{ .Values.mme_hostname }} {{ .Values.mme_hostname }} 1 cassandra;
+          /scripts/data_provisioning_mme.sh 1 19136246000 mme-0.{{ .Values.mme_hostname }}.{{ .Values.namespace }}.svc.cluster.local {{ .Values.mme_hostname }}.{{ .Values.namespace }}.svc.cluster.local 1 cassandra;
           /scripts/data_provisioning_mme.sh 1 19136246000 smsrouter.test3gpp.net test3gpp.net 0  cassandra;
       containers:
       - name: hss
         image: {{ .Values.hss.images.hss }}
         imagePullPolicy: Always
-        command: ["bash", "-xc"]
-        args:
-        - sleep 3600;
         env:
           - name: CASSANDRA_ADDR
-            value: cassandra
+            value: {{ .Values.hssdb_hostname }}
           - name: MME_ADDR
-            value: {{ .Values.mme_hostname }}
+            value: mme-0.{{ .Values.mme_hostname }}.{{ .Values.namespace }}.svc.cluster.local
         #command: [ "sleep", "3600"]
         resources:
           limits:
diff --git a/mcord/mcord-control-plane/templates/mme.yaml b/mcord/mcord-control-plane/templates/mme.yaml
index 476265a..ad28806 100644
--- a/mcord/mcord-control-plane/templates/mme.yaml
+++ b/mcord/mcord-control-plane/templates/mme.yaml
@@ -80,11 +80,11 @@
           - name: ENB_S1AP_PORT
             value: "{{ .Values.mme.ports.s1ap }}"   #ng4t uses 32767
           - name: CONNECT_PEER
-            value: {{ .Values.hss_hostname }}
+            value: hss-0.{{ .Values.hss_hostname }}.{{ .Values.namespace }}.svc.cluster.local
           - name: VAR_HSS_REALM
-            value: {{ .Values.hss_hostname }}
+            value: {{ .Values.hss_hostname }}.{{ .Values.namespace }}.svc.cluster.local
           - name: HSS_S6A_IP
-            value: {{ .Values.hss_hostname }}
+            value: hss-0.{{ .Values.hss_hostname }}.{{ .Values.namespace }}.svc.cluster.local
           - name: HSS_PORT
             value: "{{ .Values.mme.ports.s6a }}"
         stdin: true
diff --git a/mcord/mcord-data-plane/Chart.yaml b/mcord/mcord-data-plane/Chart.yaml
index aabcbdd..85a41d9 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.1.2
+version: 0.1.3
diff --git a/mcord/mcord-data-plane/templates/accelleran.yaml b/mcord/mcord-data-plane/templates/accelleran.yaml
new file mode 100644
index 0000000..eb9f5d5
--- /dev/null
+++ b/mcord/mcord-data-plane/templates/accelleran.yaml
@@ -0,0 +1,141 @@
+---
+# Copyright 2018-present Open Networking Foundation
+# Copyright 2018 Intel Corporation
+#
+# 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.
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: accelleran
+spec:
+  selector:
+    app: accelleran
+  clusterIP: None
+  ports:
+    - name: s1ap
+      port: {{ .Values.accelleran.ports.s1ap }}
+      protocol: TCP
+
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: accelleran
+  labels:
+    app: accelleran
+spec:
+  replicas: {{ .Values.accelleran.replicas }}
+  selector:
+    matchLabels:
+      app: accelleran
+  serviceName: "accelleran"
+  template:
+    metadata:
+      labels:
+        app: accelleran
+      annotations:
+        k8s.v1.cni.cncf.io/networks: '[
+          { "name": "bbu-net", "interface": "vbbu-net", "namespace": "default" }
+        ]'
+    spec:
+      initContainers:
+      - name: init-iptables
+        image: {{ .Values.accelleran.images.init }}
+        command: [ "sh", "-c"]
+        args:
+        - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
+        securityContext:
+          capabilities:
+            add:
+            - NET_ADMIN
+      terminationGracePeriodSeconds: 1
+      containers:
+      - name: nats
+        image: {{ .Values.accelleran.images.nats }}
+        imagePullPolicy: IfNotPresent
+        stdin: true
+        tty: true
+        env:
+        - name: NATS_SERVICE_NAME
+          value: {{ .Values.accelleran.nats_service_name }}
+        command: [ "sh", "-c"]
+        args:
+        - gnatsd -DV -c /etc/gnatsd.conf;
+        resources:
+          limits:
+            cpu: {{ .Values.accelleran.resources.cpu }}
+            memory: {{ .Values.accelleran.resources.mem }}
+            intel.com/sriov: '2'
+        securityContext:
+          capabilities:
+            add:
+            - NET_ADMIN
+            - IPC_LOCK
+      - name: redis
+        image: {{ .Values.accelleran.images.redis }}
+        imagePullPolicy: IfNotPresent
+        stdin: true
+        tty: true
+        command: ["sh", "-c"]
+        args:
+        # FIXME: Redis can't support with dns resolution, can't set hostname at here.
+        - (sleep 5; redis-cli -h localhost -p 6379 set NATS_SERVICE_URL "nat://{{ .Values.accelleran_hostname }}:4222";) &
+          /usr/local/bin/redis-server
+        resources:
+          limits:
+            cpu: {{ .Values.accelleran.resources.cpu }}
+            memory: {{ .Values.accelleran.resources.mem }}
+            intel.com/sriov: '2'
+        securityContext:
+          capabilities:
+            add:
+            - NET_ADMIN
+            - IPC_LOCK
+      - name: bbu
+        image: {{ .Values.accelleran.images.bbu }}
+        imagePullPolicy: IfNotPresent
+        env:
+          - name: HOST_IP
+            value: {{ .Values.accelleran_hostname }}
+        stdin: true
+        tty: true
+        command: ["sh", "-c"]
+        args:
+        - sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway_S1SigLinkServerListList set S1SigLinkServerList='{{ .Values.accelleran_hostname }}';";
+          sleep 10;
+          /l3/l3start;
+        volumeMounts:
+        - name: bbu-config
+          mountPath: /mnt/app/bootstrap.txt
+          subPath: bootstrap.txt
+        resources:
+          limits:
+            cpu: {{ .Values.accelleran.resources.cpu }}
+            memory: {{ .Values.accelleran.resources.mem }}
+            intel.com/sriov: '2'
+        securityContext:
+          capabilities:
+            add:
+            - NET_ADMIN
+            - IPC_LOCK
+            - SYS_NICE
+      volumes:
+        - name: bbu-config
+          configMap:
+            name: l3-config
+            items:
+              - key: bootstrap.txt
+                path: bootstrap.txt
+
diff --git a/mcord/mcord-data-plane/templates/cm.yaml b/mcord/mcord-data-plane/templates/cm.yaml
index b84ccf3..5686236 100644
--- a/mcord/mcord-data-plane/templates/cm.yaml
+++ b/mcord/mcord-data-plane/templates/cm.yaml
@@ -436,4 +436,13 @@
     PROTOCOL = 17
     LOCAL_LOW_LIMIT_PORT = 17000
     LOCAL_HIGH_LIMIT_PORT = 17010
-
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: l3-config
+data:
+  bootstrap.txt: |
+    redis.hostname:{{ .Values.accelleran_hostname }}
+    redis.port:6379
+    instance.filter:{{ .Values.accelleran.inst_id }}
diff --git a/mcord/mcord-data-plane/templates/dp.yaml b/mcord/mcord-data-plane/templates/dp.yaml
index 000dca3..4bdf14f 100644
--- a/mcord/mcord-data-plane/templates/dp.yaml
+++ b/mcord/mcord-data-plane/templates/dp.yaml
@@ -80,8 +80,8 @@
               divisor: 1Mi
         command: [ "bash",  "-xc"]
         args:
-        - ifconfig -a;
-          ifconfig lo down;
+        - ifconfig lo down;
+          ifconfig -a;
           . /opt/ngic/config/dp_config.cfg;
           ./ngic_dataplane $EAL_ARGS -- $APP_ARGS
         volumeMounts:
@@ -101,7 +101,9 @@
         {{- end}}
         resources:
           limits:
+            {{- if .Values.ngic_dp.config.hugepage_enabled}}
             hugepages-1Gi: {{ .Values.ngic_dp.resources.hugepage }}
+            {{- end}}
             cpu: {{ .Values.ngic_dp.resources.cpu }}
             memory: {{ .Values.ngic_dp.resources.mem }}
             intel.com/sriov: '2'
@@ -118,7 +120,7 @@
         - name: config-volume
           configMap:
             name: ngicdp-config
-        {{- if .Values.ngic_dp.config.hugepage_enabled }}
+        {{- if .Values.ngic_dp.config.hugepage_enabled}}
         - name: hugepage
           emptyDir:
             medium: HugePages
diff --git a/mcord/mcord-data-plane/values.yaml b/mcord/mcord-data-plane/values.yaml
index 1b546dc..f0d527f 100644
--- a/mcord/mcord-data-plane/values.yaml
+++ b/mcord/mcord-data-plane/values.yaml
@@ -18,8 +18,10 @@
 # This is a YAML-formatted file.
 # Declare variables to be passed into your templates.
 
+redis_hostname: "redis"
 controlplane_hostname: "ngic-cp"
 controlplane_port: 21
+accelleran_hostname: "accelleran"
 
 ngic_dp:
   images:
@@ -38,4 +40,19 @@
     dpdk_enabled: false
     hugepage_enabled: true
 
+accelleran:
+  images:
+    init: "ngick8stesting/c3po-mmeinit"
+    nats: "10.90.0.131:30500/ngick8stesting/vbbu-nats:20190121"
+    redis: "10.90.0.131:30500/ngick8stesting/vbbu-redis:20190121"
+    bbu: "10.90.0.131:30500/accelleran/vran-l3-fdd:onf-dns"
+  ports:
+    s1ap: 36412
+  replicas: 1
+  nats_service_name: "nats-cluster"
+  inst_id: "enb_key"
+  resources:
+    cpu: 3
+    mem: "1Gi"
+
 namespace: epc