Introduce a CLI object

Instead of writing the CLI calls to stderr as INFO loglines, now add
them to a list of messages by prune/create/sync.

Always close the VPP connection after finishing, by adding a destructor
to the VPPApi class.

At the end of each phase, print out what was gathered to stdout. Later,
I will make this more advanced (output to file, output directly to a
pipe of a running vppctl binary, etc).
This commit is contained in:
Pim van Pelt
2022-03-29 14:04:53 +00:00
parent 7c8f36d1fe
commit f70bff400f
3 changed files with 150 additions and 78 deletions

View File

@ -2,23 +2,20 @@
for i in hippo[0-9]*.yaml; do
echo "Clearing: Moving to hippo-empty.yaml"
./vppcfg -c hippo-empty.yaml 2>&1
./vppcfg -c hippo-empty.yaml 2>&1 | egrep ': [0-9]+> ' | cut -f2- -d'>' > /tmp/vppcfg-exec-empty
./vppcfg -c hippo-empty.yaml > /tmp/vppcfg-exec-empty
[ -s /tmp/vppcfg-exec-empty ] && vppctl exec /tmp/vppcfg-exec-empty
for j in hippo[0-9]*.yaml; do
echo " - Moving to $i .. "
./vppcfg -c $i 2>&1
./vppcfg -c $i 2>&1 | egrep ': [0-9]+> ' | cut -f2- -d'>' > /tmp/vppcfg-exec_$i
./vppcfg -c $i > /tmp/vppcfg-exec_$i
[ -s /tmp/vppcfg-exec_$i ] && vppctl exec /tmp/vppcfg-exec_$i
echo " - Moving from $i to $j"
./vppcfg -c $j 2>&1
./vppcfg -c $j 2>&1 | egrep ': [0-9]+> ' | cut -f2- -d'>' > /tmp/vppcfg-exec_${i}_${j}
./vppcfg -c $j > /tmp/vppcfg-exec_${i}_${j}
[ -s /tmp/vppcfg-exec_${i}_${j} ] && vppctl exec /tmp/vppcfg-exec_${i}_${j}
echo " - Checking that from $j to $j is empty"
./vppcfg -c $j 2>&1 | egrep ': [0-9]+> ' | cut -f2- -d'>' > /tmp/vppcfg-exec_${j}_${j}_null
./vppcfg -c $j > /tmp/vppcfg-exec_${j}_${j}_null
done
done