diff --git a/net/common.sh b/net/common.sh index 128f8c6ab..cbf2146c6 100644 --- a/net/common.sh +++ b/net/common.sh @@ -54,6 +54,7 @@ loadConfigFile() { [[ -n $leaderRotation ]] || usage "Config file invalid, leaderRotation unspecified: $configFile" [[ ${#fullnodeIpList[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpList unspecified: $configFile" [[ ${#fullnodeIpListPrivate[@]} -gt 0 ]] || usage "Config file invalid, fullnodeIpListPrivate unspecified: $configFile" + [[ ${#fullnodeIpList[@]} -eq ${#fullnodeIpListPrivate[@]} ]] || usage "Config file invalid, fullnodeIpList/fullnodeIpListPrivate length mismatch: $configFile" if $publicNetwork; then entrypointIp=${fullnodeIpList[0]} diff --git a/net/gce.sh b/net/gce.sh index 55c65f39c..cfd0f6d69 100755 --- a/net/gce.sh +++ b/net/gce.sh @@ -59,6 +59,7 @@ Manage testnet instances create - create a new testnet (implies 'config') config - configure the testnet and write a config file describing it delete - delete the testnet + info - display information about the currently configured testnet common options: -p [prefix] - Optional common prefix for instance names to avoid @@ -85,6 +86,9 @@ Manage testnet instances delete-specific options: none + info-specific options: + none + EOF exit $exitcode } @@ -93,7 +97,8 @@ EOF command=$1 [[ -n $command ]] || usage shift -[[ $command = create || $command = config || $command = delete ]] || usage "Invalid command: $command" +[[ $command = create || $command = config || $command = info || $command = delete ]] || + usage "Invalid command: $command" while getopts "h?p:Pn:c:z:gG:a:d:b" opt; do case $opt in @@ -466,6 +471,31 @@ EOF config) prepareInstancesAndWriteConfigFile ;; +info) + loadConfigFile + printNode() { + declare nodeType=$1 + declare ip=$2 + declare ipPrivate=$3 + printf " %-16s | %-15s | %-15s\n" "$nodeType" "$ip" "$ipPrivate" + } + + printNode "Node Type" "Public IP" "Private IP" + echo "-------------------+-----------------+-----------------" + nodeType=bootstrap-leader + for i in $(seq 0 $(( ${#fullnodeIpList[@]} - 1)) ); do + ipAddress=${fullnodeIpList[$i]} + ipAddressPrivate=${fullnodeIpListPrivate[$i]} + printNode $nodeType "$ipAddress" "$ipAddressPrivate" + nodeType=fullnode + done + + for i in $(seq 0 $(( ${#clientIpList[@]} - 1)) ); do + ipAddress=${clientIpList[$i]} + ipAddressPrivate=${clientIpListPrivate[$i]} + printNode bench-tps "$ipAddress" "$ipAddressPrivate" + done + ;; *) usage "Unknown command: $command" esac