EdgeView Client Script
When the EdgeView is started on the EVE device, the controller may install a script for client to run EdgeView commands on user's laptop. The script has the filename like 'run.{device-name}.1659561808.edgeview.sh' in which 'device-name' is the string for the name of the device enabled with EdgeView session, and the digits are the timestamp in UNIX seconds when the EdgeView started.
The user can locate the script in a directory and run for example:
./run.{device-name}.1659561808.edgeview.sh -inst 1 route
The main part of the EdgeView client script:
docker run -it --rm -e EDGEVIEW_CLIENT=1 -h=$(hostname) -p <port mapping> -v /tmp/download:/download lfedge/eve-edgeview -token <jwt-token> "$@"
The volume '-v' setting assumes the local laptop has a directory '/tmp/downlad' to be used for files uploading from device to the laptop. This volume option is needed for EdgeView commands 'cp', 'log/copy-logfiles' and 'techsupport'. The '-p' option defines the docker TCP port to laptop host mapping in a range. In the single instance case, it is in the range of 9001-9005.
The 'jwt-token' is a string generated by the controller when the EdgeView is started.
Docker Port Mapping
On a Mac laptop, it does not support docker run in network in host mode, the port mapping for TCP must be explicitly defined, such as:
docker run -it --rm -e EDGEVIEW_CLIENT=1 -h=$(hostname) -p 9001-9005:9001-9005 -v /tmp/download:/download lfedge/eve-edgeview -token <jwt-token> "$@"
Although in EdgeView multiple instances, a user may run two EdgeView sessions on the same laptop for instance 1 and instance 2. Using explicit range will collide for the ports on laptop. Here is the general script to set the part mapping range base on user's instance number input:
for var in "$@"
do
if [ ! -z "$gotinst" ]; then
instid=$var
break
fi
if [ "$var" = "-inst" ]; then
gotinst=1
fi
done
portstart=9001
portend=9005
if [ ! -z "$instid" ]; then
if [ "$instid" -lt 1 ] || [ "$instid" -gt 5 ]; then
echo "inst needs to be in the range 1-5"
exit
fi
newid=$(($instid - 1))
multi=$(($newid * 5))
portstart=$((9001 + $multi))
portend=$((9005 + $multi))
fi
PORTMAP="-p $portstart-$portend:$portstart-$portend"
docker run -it --rm -e EDGEVIEW_CLIENT=1 -h=$(hostname) $PORTMAP -v /tmp/
download:/download lfedge/eve-edgeview -token <jwt-token> "$@"
Window OS
For running the EdgeView client script, the Window OS needs to have docker desktop installed. The script works unchanged if the WSL version is 2.