forked from lamw/vmware-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenablePromForVDS.sh
More file actions
executable file
·33 lines (28 loc) · 973 Bytes
/
enablePromForVDS.sh
File metadata and controls
executable file
·33 lines (28 loc) · 973 Bytes
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
#!/bin/bash
# Author: William Lam
# Website: www.williamlam.com
# Product: VMware vCloud Director
# Description: Shell script to enable promiscuous & forged transmit mode for VDS in VCNS
# Reference: http://www.williamlam.com/2013/05/how-to-enable-nested-esxi-using-vxlan.html
if [ $# -ne 3 ] ;then
echo -e "\nUsage: $0 VCNS_IP VDS_MOREF VDS_MTU"
echo -e "\n $0 172.30.0.196 dvs-13 9000\n"
exit 1
fi
VCNS_IP=$1
VDS_MOREF=$2
VDS_MTU=$3
VCNS_USERNAME=admin
VCNS_PASSWORD=default
VCNS_INPUT_FILE=/tmp/enable-vds-prom
cat > ${VCNS_INPUT_FILE} << __PREPARE_VDS__
<vdsContext>
<switch>
<objectId>${VDS_MOREF}</objectId>
</switch>
<mtu>${VDS_MTU}</mtu>
<promiscuousMode>true</promiscuousMode>
</vdsContext>
__PREPARE_VDS__
echo "Preparing VDS ${VDS_MOREF} with MTU ${VDS_MTU} on VCNS ${VCNS_IP} ..."
curl -i -k -H "Content-Type: application/xml" -u "${VCNS_USERNAME}:${VCNS_PASSWORD}" -d @${VCNS_INPUT_FILE} -X POST "https://${VCNS_IP}/api/2.0/vdn/switches"