Removing old name references
[appc.git] / appc-directed-graph / dg-loader / provider / src / main / resources / scripts / dg_load_activate.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # ONAP : APPC
6 # ================================================================================
7 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
8 # ================================================================================
9 # Copyright (C) 2017 Amdocs
10 # =============================================================================
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
14
15 #      http://www.apache.org/licenses/LICENSE-2.0
16
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22
23 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 # ============LICENSE_END=========================================================
25 ###
26
27
28 ###
29 ### Convert XML DGs to JSON DGs using dg-loader, then load/activate them in the MySQL DB. ###
30 ###
31
32 export APPC_HOME=${APPC_HOME:-/opt/onap/appc}
33
34 # SVCLOGIC_DIR env variable points to /opt/onap/appc/svclogic
35 export SVCLOGIC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
36
37 #Path to the dg-loader jar file
38 export DG_LOADER=${APPC_HOME}/data/dg-loader-provider-jar-with-dependencies.jar
39
40 # Check if the JSON Directory exists under the env. variable defined
41 export DG_JSON_DIR=${SVCLOGIC_DIR}/graphs/appc/json/dg-loader-dgs
42 echo "Processing DG JSON directory : ${DG_JSON_DIR}"
43 if [ ! -d "$DG_JSON_DIR" ] 
44 then
45     echo "DG-Loader JSON Directory is Missing"
46 exit 1
47 fi
48
49
50 cd ${DG_JSON_DIR}
51 mkdir -p ${DG_JSON_DIR}/converted-xml
52
53 # Generate XML DGs from JSON DGs
54 $JAVA_HOME/bin/java -cp ${DG_LOADER} org.onap.sdnc.dg.loader.DGXMLGenerator ${DG_JSON_DIR} ${DG_JSON_DIR}/converted-xml
55
56 # Load converted XML DGs to the SVC_LOGIC DB in the MySQL Docker Container
57 $JAVA_HOME/bin/java -cp ${DG_LOADER} org.onap.sdnc.dg.loader.DGXMLLoad ${DG_JSON_DIR}/converted-xml ${APPC_HOME}/data/properties/dblib.properties
58
59 # Activate converted XML DGs to the SVC_LOGIC DB in the MySQL Docker Container
60 $JAVA_HOME/bin/java -cp ${DG_LOADER} org.onap.sdnc.dg.loader.DGXMLActivate ${DG_JSON_DIR}/dg_activate.txt ${APPC_HOME}/data/properties/dblib.properties
61
62 exit 0