Change pdp sim java version
[policy/models.git] / models-sim / policy-models-sim-pdp / src / main / package / docker / pdp-sim.sh
1 #!/bin/bash
2 #
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2019-2020 Nordix Foundation.
5 #  Modifications copyright (C) 2020 Bell Canada. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # SPDX-License-Identifier: Apache-2.0
20 # ============LICENSE_END=========================================================
21 #
22
23 if [ -z "$PDP_SIM_HOME" ]
24 then
25         PDP_SIM_HOME=/opt/app/policy/pdp-sim
26 fi
27
28 JAVA_HOME=/usr/lib/jvm/java-17-openjdk
29 KEYSTORE="${PDP_SIM_HOME}/etc/ssl/policy-keystore"
30 KEYSTORE_PASSWD="Pol1cy_0nap"
31 TRUSTSTORE="${PDP_SIM_HOME}/etc/ssl/policy-truststore"
32 TRUSTSTORE_PASSWD="Pol1cy_0nap"
33
34 if [ "$#" -eq 1 ]
35 then
36     CONFIG_FILE=$1
37 else
38     CONFIG_FILE=${CONFIG_FILE}
39 fi
40
41 if [ -z "$CONFIG_FILE" ]
42 then
43     CONFIG_FILE="$PDP_SIM_HOME/etc/config/OnapPfConfig.json"
44 fi
45
46 echo "PDP simulator configuration file:" $CONFIG_FILE
47
48 $JAVA_HOME/bin/java \
49     -cp "$PDP_SIM_HOME/etc:$PDP_SIM_HOME/lib/*" \
50     -Djavax.net.ssl.keyStore="$KEYSTORE" \
51     -Djavax.net.ssl.keyStorePassword="$KEYSTORE_PASSWD" \
52     -Djavax.net.ssl.trustStore="$TRUSTSTORE" \
53     -Djavax.net.ssl.trustStorePassword="$TRUSTSTORE_PASSWD" \
54     org.onap.policy.models.sim.pdp.PdpSimulatorMain \
55     -c $CONFIG_FILE