blob: 200c63ed10a6897bc194121a8d7cf831eaab108f [file] [log] [blame]
Tomás Villaseca4f962b72019-12-27 14:15:21 -03001#!/bin/bash
2# Copyright 2019 Whitestack LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17. ./util.bash --source-only
18
19VNFD="vnfd-catalog"
20NSD="nsd-catalog"
21
22> search_results.txt
23> statistics.txt
24echo "(pattern),(version),RO,devops,NBI,POL,LCM" &> statistics.txt
25
26MODULES=("RO" "devops" "NBI" "POL" "LCM")
27
28grep -r --exclude=*.txt $VNFD . &>> search_results.txt
29grep -r --exclude=*.txt $NSD . &>> search_results.txt
30
31generateStatistics(){ #1: $VNFD or $NSD, 2: commit tag
32 STATISTICS="$1,$2"
33 for i in "${MODULES[@]}"
34 do
35 STATISTICS="$STATISTICS,$(grep -F ./$i/ search_results.txt | grep $1 | wc -l)"
36 done
37 echo $STATISTICS &>>statistics.txt
38}
39
40generateStatistics $VNFD "latest"
41generateStatistics $NSD "latest"
42
43COLOR='\033[0;31m'
44echo -e "${COLOR}-- Number of ocurrences of a pattern in each module for a specific version --"
45
46printTable ',' "$(cat statistics.txt)" true