ha/service-mgmt/sm-db-1.0.0/scripts/sm-db-populate.script
Dean Troyer 17c909ec83 StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:26 -07:00

48 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
DATABASE=sm.db.v1
HEARTBEAT_DATABASE=sm.hb.db.v1
CSV_DIR=./
sm-db-build
mv sm.db.main ${DATABASE}
mv sm.db.hb ${HEARTBEAT_DATABASE}
echo -e "Populate SERVICE_DOMAINS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDomains.csv SERVICE_DOMAINS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_DOMAIN_INTERFACES_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDomainInterfaces.csv SERVICE_DOMAIN_INTERFACES_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_DOMAIN_MEMBERS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDomainMembers.csv SERVICE_DOMAIN_MEMBERS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_GROUPS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceGroups.csv SERVICE_GROUPS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_GROUP_MEMBERS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceGroupMembers.csv SERVICE_GROUP_MEMBERS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICES_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/Services.csv SERVICES_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_INSTANCES_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceInstances.csv SERVICE_INSTANCES_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_DEPENDENCY_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceDependency.csv SERVICE_DEPENDENCY_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_ACTIONS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceActions.csv SERVICE_ACTIONS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_ACTION_RESULTS_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceActionResults.csv SERVICE_ACTION_RESULTS_V1 \n" | /usr/bin/sqlite3 ${DATABASE}
echo -e "Populate SERVICE_HEARTBEAT_V1"
/bin/echo -e ".separator | \n.import ${CSV_DIR}/ServiceHeartbeat.csv SERVICE_HEARTBEAT_V1 \n" | /usr/bin/sqlite3 ${HEARTBEAT_DATABASE}