blob: b7f6cb040ea3b8569291d887041634d85a4de29c [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001#!/bin/bash
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002
Jeremy Ronquillo223db002020-06-05 10:28:22 -07003# Copyright 2019-present Open Networking Foundation
4#
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07005# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07006
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -05007APPLICATION=$1
Jeremy Ronquillo223db002020-06-05 10:28:22 -07008set -xe
9
Jeremy Ronquillo223db002020-06-05 10:28:22 -070010mkdir -p /opt/cp/config
11cd /opt/cp/config
Hyunsun Moon1fc24472021-03-14 19:10:11 -050012cp /etc/cp/config/{*.cfg,*.json,*.conf} .
Jeremy Ronquillo223db002020-06-05 10:28:22 -070013
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -050014case $APPLICATION in
15 "ngic_controlplane")
16 echo "Starting ngic controlplane app"
17 if [ ! -d "/dev/hugepages" ]; then
18 MEMORY="--no-huge -m $((MEM_LIMIT-1024))"
19 fi
20 CORES="-c $(taskset -p $$ | awk '{print $NF}')"
21 EAL_ARGS="${CORES} ${MEMORY} --no-pci"
22 cat /opt/cp/config/subscriber_mapping.json
23 {{- if .Values.config.coreDump.enabled }}
24 cp /bin/ngic_controlplane /tmp/coredump/
25 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070026
Ajay Lotan Thakurc3cd6192020-10-12 20:12:38 -050027 ngic_controlplane $EAL_ARGS -- -f /etc/cp/config/
28 ;;
29
30 "gx-app")
31 echo "Starting gx-app"
32 SPGWC_IDENTITY={{ tuple "spgwc" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }};
33 DIAMETER_HOST=$(echo $SPGWC_IDENTITY| cut -d'.' -f1)
34 DIAMETER_REALM={{ tuple "spgwc" "realm" . | include "omec-control-plane.diameter_endpoint" | quote }};
35 chmod +x /bin/make_certs.sh
36 cp /bin/make_certs.sh /opt/cp/config
37 /bin/make_certs.sh $DIAMETER_HOST $DIAMETER_REALM
38 {{- if .Values.config.coreDump.enabled }}
39 cp /bin/gx_app /tmp/coredump/
40 {{- end }}
41 cd /opt/cp/
42 gx_app
43 ;;
44
45 *)
46 echo "invalid app $APPLICATION"
47 ;;
48esac