summaryrefslogtreecommitdiffstats
path: root/utils/rubbos_dev_env_setup/mac_generator.sh
diff options
context:
space:
mode:
authorQiLiang <liangqi1@huawei.com>2015-12-17 14:09:28 +0000
committerQiLiang <liangqi1@huawei.com>2015-12-17 14:32:21 +0000
commit459ddd6e4bcd28b37b675eaba01501e17e50de39 (patch)
treefc4b9b22d3691b97ca0bf88c15ec6f9f562e2d63 /utils/rubbos_dev_env_setup/mac_generator.sh
parent833d16b53e59967db779b0eba37d4f7481cb94e9 (diff)
Add scripts to setup development env
Usage: apt-get install -y genisoimage \ libvirt-bin \ qemu-kvm service libvirt-bin restart cd bottlenecks/utils/rubbos_dev_env_setup ./deploy.sh The deploy.sh will create 9 vms (ip from 192.168.122.11 ~ 19): control,httpd,mysql,tomcat,client1,client2,client3,client4,benchmark TODO: add scripts to build initial disk.img JIRA:BOTTLENECK-24 Change-Id: I99b5bcae8b795cee80e8688aae18b69e46249548 Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'utils/rubbos_dev_env_setup/mac_generator.sh')
-rwxr-xr-xutils/rubbos_dev_env_setup/mac_generator.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/rubbos_dev_env_setup/mac_generator.sh b/utils/rubbos_dev_env_setup/mac_generator.sh
new file mode 100755
index 00000000..bc5f6c2e
--- /dev/null
+++ b/utils/rubbos_dev_env_setup/mac_generator.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# this is a modified copy from compass4nfv/deploy/mac_generator.sh
+
+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}
+