compass-install/ci/mac_generator.sh
Jerry Zhao 1a109ea8a7 add vagrantfile for compass-install
compass can be installed on libvirt backed vagrant box.
easier to manage to lifecycle.
add test option to inject pxeboot mac to compass db.

Change-Id: I779e3d6860d54dee4bd1687fc473e5c38c30e6ca
2015-03-25 08:14:05 +00:00

24 lines
506 B
Bash
Executable File

#!/bin/bash
function mac_address_part() {
hex_number=$(printf '%02x' $RANDOM)
number_length=${#hex_number}
number_start=$(expr $number_length - 2)
echo ${hex_number:$number_start:2}
}
function mac_address() {
echo "00:00:$(mac_address_part):$(mac_address_part):$(mac_address_part):$(mac_address_part)"
}
machines=''
for i in `seq $1`; do
mac=$(mac_address)
if [[ -z $machines ]]; then
machines="${mac}"
else
machines="${machines}, ${mac}"
fi
done
echo ${machines}