2 ###############################################################################
3 # Copyright 2017 Huawei Technologies Co., Ltd.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 ###############################################################################
17 SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
20 sdnctl_num_tables=$(docker exec -i sdnc_db_container mysql -s -D sdnctl -u sdnctl -pgamma <<<'show tables;' 2>/dev/null | grep -v ERROR | wc -l)
22 appcctl_num_tables=$(docker exec -i sdnc_db_container mysql -s -D appcctl -u appcctl -pappcctl <<<'show tables;' 2>/dev/null | grep -v ERROR | wc -l)
26 docker exec -i sdnc_db_container mysql -s -D sdnctl -u sdnctl -pgamma <<<"show tables" 2>/dev/null | ( while read table_name; do
27 export $table_name="$(docker exec -i sdnc_db_container mysql -s -D sdnctl -u sdnctl -pgamma <<<"select count(*) from $table_name" 2>/dev/null)"
30 if [ "$sdnctl_num_tables" -ge "1" ]; then
31 echo "There are $sdnctl_num_tables tables in the sdnctl database. "
33 echo "Database sdnctl is not available."
37 if [ "$appcctl_num_tables" -ge "1" ]; then
38 echo "There is $appcctl_num_tables table in the appcctl database. "
40 echo "Database appcctl is not available."
44 #if [ "$NODE_TYPES" -eq "0" ]; then
45 # echo "There is no data in table NODE_TYPES. "
49 #if [ "$SVC_LOGIC" -eq "0" ] ; then
50 # echo "There is no data in table SVC_LOGIC. "
54 #if [ "$VNF_DG_MAPPING" -eq "0" ]; then
55 # echo "There is no data in table VNF_DG_MAPPING. "
59 echo "Expected table data is present."
62 if [ "$?" -eq "1" ]; then