summaryrefslogtreecommitdiffstats
path: root/compass/deploy/mac_generator.sh
diff options
context:
space:
mode:
authorJerry Zhao <zhaoxinyu@huawei.com>2015-04-11 08:21:10 +0800
committerJerry Zhao <zhaoxinyu@huawei.com>2015-04-20 20:46:01 +0800
commit77bf95508534a744c4b6e7b5635ec1e8eb294098 (patch)
tree38ed362a6a88b7bc7e010a6614f0de6146a5920a /compass/deploy/mac_generator.sh
parente1d29739ccbc6efc20f400636a211dae0e75bff4 (diff)
first commit of deploy.sh for compass
with deploy.sh in this patch, a compass vagrant box will be spawned along with 5 libvirt vms. compass api will be called to install ubuntu 14.04 on those libvirt vms. in a patch later, openstack will be configured to be installed. JIRA: BGS-28 Change-Id: Ie5f8442331081289a1a81a8e3295c881b0504c3c Signed-off-by: Jerry Zhao <zhaoxinyu@huawei.com>
Diffstat (limited to 'compass/deploy/mac_generator.sh')
-rwxr-xr-xcompass/deploy/mac_generator.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/compass/deploy/mac_generator.sh b/compass/deploy/mac_generator.sh
new file mode 100755
index 0000000..ca898cb
--- /dev/null
+++ b/compass/deploy/mac_generator.sh
@@ -0,0 +1,23 @@
+#!/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}