Newer
Older
#!/bin/sh
## Note: This script does not clean up network elements already existing in the storage. Running it repeatedly will
## create a garbage storage.
GOSDNC_PATH="./artifacts/gosdnc"
GOSDNC_START=false
GOSDN_ADDRESS="172.100.0.5:55055"
ADMINPW="TestPassword"
OPENCONFIG_PLUGIN="d1c269a2-6482-4010-b0d8-679dff73153b"
## Adjust this if timer is to short.
## Check for provided flags.
while getopts s: flag
do
case "${flag}" in
s) GOSDNC_START=${OPTARG};;
esac
done
## Sleep is needed to give gosdn some time to start correctly.
sleep $SLEEP_TIMER
echo 'Logging in via gosdnc and setting up gnmi-targets in controller...'
## Call login and create entries for all the network elements.
## Could be a bit more automated in the future, but fine for now.
$GOSDNC_PATH login --controller $GOSDN_ADDRESS --u admin --p $ADMINPW
$GOSDNC_PATH mne create --address 172.100.0.11:7030 --name gnmi-target-switch0 --password admin --plugin-id $OPENCONFIG_PLUGIN --tls --username admin
$GOSDNC_PATH mne create --address 172.100.0.12:7030 --name gnmi-target-switch1 --password admin --plugin-id $OPENCONFIG_PLUGIN --tls --username admin
## Start gosdnc in prompt mode if GOSDNC_START=true
if $GOSDNC_START; then
$GOSDNC_PATH prompt
fi