Last active
September 8, 2016 15:38
-
-
Save swamibluedata/7a13040750ee1534b0cb9df5da01f73d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For 2.4 bundle launch few extra parameters have to be provided. Following set of commands can be run to | |
# convert yavlab floating ip to those 5 parameters. Adjust FLOAT_RANGE. | |
YAVLAB_DEF_GW="10.32.0.1" | |
PUBLIC_IF="eth0" | |
FLOAT_RANGE="10.35.237.0/24" | |
inet_aton() { | |
local a b c d | |
{ IFS=. read a b c d; } <<< $1 | |
echo $(((((((a << 8) | b) << 8) | c) << 8) | d)) | |
} | |
inet_ntoa() { | |
local ui32=$1; shift | |
local ip n | |
for n in 1 2 3 4; do | |
ip=$((ui32 & 0xff))${ip:+.}$ip | |
ui32=$((ui32 >> 8)) | |
done | |
echo $ip | |
} | |
# Assuming FLOAT_RANGE is from jenkins | |
RANGE=(${FLOAT_RANGE//// }) | |
NET_IP=${RANGE[0]} | |
MASK=${RANGE[1]} | |
NETMASK_INT=$((0xffffffff << (32 - $MASK))) | |
NET_IP_INT=$(($(inet_aton $NET_IP) & $NETMASK_INT)) | |
INT_IP_INT=$((NET_IP_INT + 1)) | |
START_IP_INT=$((NET_IP_INT + 2)) | |
END_IP_INT=$(((NET_IP_INT | ~$NETMASK_INT) - 1)) | |
INT_IP=$(inet_ntoa $INT_IP_INT) | |
START_IP=$(inet_ntoa $START_IP_INT) | |
END_IP=$(inet_ntoa $END_IP_INT) | |
# Invoke the bundle with the above parameters | |
$BUNDLE \ | |
--int-gateway-ip $INT_IP \ | |
--floating-ip-start $START_IP \ | |
--floating-ip-end $END_IP \ | |
--floating-ip-mask $MASK \ | |
--floating-ip-extif $PUBLIC_IF \ | |
--floating-ip-nexthop $YAVLAB_DEF_GW \ | |
-s | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment