forked from hellt/vrnetlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vrnetlab.sh
53 lines (45 loc) · 1.11 KB
/
vrnetlab.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
vr_mgmt_ip() {
VROUTER=$1
VR_ADDRESS=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $VROUTER)
echo $VR_ADDRESS
}
vrssh() {
VROUTER=$1
USER=$2
VR_ADDRESS=$(vr_mgmt_ip $VROUTER)
if [ -z "$USER" ] ; then
if [ -x $(command -v sshpass) ]; then
sshpass -p VR-netlab9 ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l vrnetlab
else
ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l vrnetlab
fi
else
ssh -oStrictHostKeyChecking=no $VR_ADDRESS -l $USER
fi
}
vrsftp() {
VROUTER=$1
USER=$2
VR_ADDRESS=$(vr_mgmt_ip $VROUTER)
if [ -z "$USER" ] ; then
if [ -x $(command -v sshpass) ]; then
sshpass -p VR-netlab9 sftp vrnetlab@$VR_ADDRESS
else
sftp vrnetlab@$VR_ADDRESS
fi
else
sftp $USER@$VR_ADDRESS
fi
}
vrcons() {
VROUTER=$1
telnet $(vr_mgmt_ip $VROUTER) 5000
}
vrbridge() {
VR1=$1
VP1=$2
VR2=$3
VP2=$4
docker run -d --name "bridge-${VR1}-${VP1}-${VR2}-${VP2}" --link $VR1 --link $VR2 vr-xcon --p2p "${VR1}/${VP1}--${VR2}/${VP2}"
}