2 ##############################################################################
3 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
12 ## This script is used in 'create_libvirt_vm.sh'
13 function mac_address_part() {
14 hex_number=$(printf '%02x' $RANDOM)
15 number_length=${#hex_number}
16 number_start=$(expr $number_length - 2)
17 echo ${hex_number:$number_start:2}
20 function mac_address() {
21 echo "00:00:$(mac_address_part):$(mac_address_part):$(mac_address_part):$(mac_address_part)"
28 if [[ -z $machines ]]; then
31 machines="${machines} ${mac}"