diff options
-rwxr-xr-x | ci/03-maasdeploy.sh | 43 | ||||
-rw-r--r-- | labconfig/huawei/pod12/labconfig.yaml | 133 |
2 files changed, 166 insertions, 10 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index b7e684f5..2c7a16a8 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -164,14 +164,15 @@ fi mkdir ~/joid_config/ || true mkdir ~/.juju/ || true -sudo mkdir -p ~/maas || true -sudo chown maas:maas ~/maas -if [ ! -e ~/maas/.ssh/id_rsa ]; then - sudo -u maas ssh-keygen -N '' -f ~/maas/.ssh/id_rsa -y +if [ ! -e ~maas/.ssh/id_rsa ]; then + sudo -u maas mkdir ~maas/.ssh/ + sudo -u maas touch ~maas/.ssh/id_rsa + sudo -u maas chmod 600 ~maas/.ssh/id_rsa + sudo -u maas ssh-keygen -t rsa -f ~maas/.ssh/id_rsa -q -N "" -y fi # Ensure virsh can connect without ssh auth -sudo cat ~/maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys +sudo cat ~maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys sudo cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys # @@ -188,7 +189,7 @@ installmaas(){ configuremaas(){ sudo maas createadmin --username=ubuntu --email=ubuntu@ubuntu.com --password=ubuntu API_KEY=`sudo maas-region apikey --username=ubuntu` - maas login $PROFILE $API_SERVER $API_KEY + maas login $PROFILE $API_SERVERMAAS $API_KEY maas $PROFILE maas set-config name='main_archive' value=$MAIN_ARCHIVE maas $PROFILE maas set-config name=upstream_dns value=$MY_UPSTREAM_DNS maas $PROFILE maas set-config name='maas_name' value=$MAAS_NAME @@ -220,12 +221,16 @@ enablesubnetanddhcp(){ IP_STATIC_RANGE_LOW="192.168.122.1" IP_STATIC_RANGE_HIGH="192.168.122.49" + + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + maas $PROFILE ipranges create type=reserved \ start_ip=$IP_STATIC_RANGE_LOW end_ip=$IP_STATIC_RANGE_HIGH \ comment='This is a reserved range' IP_DYNAMIC_RANGE_LOW="192.168.122.50" - IP_DYNAMIC_RANGE_HIGH="192.168.122.240" + IP_DYNAMIC_RANGE_HIGH="192.168.122.150" maas $PROFILE ipranges create type=dynamic \ start_ip=$IP_DYNAMIC_RANGE_LOW end_ip=$IP_DYNAMIC_RANGE_HIGH \ comment='This is a reserved dynamic range' @@ -284,6 +289,9 @@ addnodes(){ power_parameters_power_address='qemu+ssh://'$USER'@192.168.122.1/system' \ architecture='amd64/generic' power_parameters_power_id='bootstrap' | grep system_id | cut -d '"' -f 4 ` + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + maas $PROFILE tag update-nodes bootstrap add=$bootstrapid } @@ -331,6 +339,9 @@ if [ "$virtinstall" -eq 1 ]; then sudo virsh -c qemu:///system define --file node2-compute sudo virsh -c qemu:///system define --file node5-compute + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + controlnodeid=`maas $PROFILE machines create autodetect_nodegroup='yes' name='node1-control' tags='control' hostname='node1-control' power_type='virsh' mac_addresses=$node1controlmac power_parameters_power_address='qemu+ssh://'$USER'@192.168.122.1/system' architecture='amd64/generic' power_parameters_power_id='node1-control' | grep system_id | cut -d '"' -f 4 ` maas $PROFILE tag update-nodes control add=$controlnodeid @@ -350,7 +361,10 @@ fi #Below function will mark the interfaces in Auto mode to enbled by MAAS enableautomode() { - listofnodes=`maas maas nodes list | grep system_id | cut -d '"' -f 4` + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + + listofnodes=`maas maas nodes read | grep system_id | cut -d '"' -f 4` for nodes in $listofnodes do maas maas interface link-subnet $nodes $1 mode=$2 subnet=$3 @@ -360,10 +374,13 @@ enableautomode() { #Below function will mark the interfaces in Auto mode to enbled by MAAS # using hostname of the node added into MAAS enableautomodebyname() { + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + if [ ! -z "$4" ]; then for i in `seq 1 7`; do - nodes=`maas maas nodes list | grep system_id | cut -d '"' -f 4` + nodes=`maas maas nodes read | grep system_id | cut -d '"' -f 4` if [ ! -z "$nodes" ]; then maas maas interface link-subnet $nodes $1 mode=$2 subnet=$3 fi @@ -374,6 +391,9 @@ enableautomodebyname() { #Below function will create vlan and update interface with the new vlan # will return the vlan id created crvlanupdsubnet() { + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + newvlanid=`maas maas vlans create $2 name=$3 vid=$4 | grep resource | cut -d '/' -f 6 ` maas maas subnet update $5 vlan=$newvlanid eval "$1"="'$newvlanid'" @@ -381,7 +401,10 @@ crvlanupdsubnet() { #Below function will create interface with new vlan and bind to physical interface crnodevlanint() { - listofnodes=`maas maas nodes list | grep system_id | cut -d '"' -f 4` + API_KEY=`sudo maas-region apikey --username=ubuntu` + maas login $PROFILE $API_SERVERMAAS $API_KEY + + listofnodes=`maas maas nodes read | grep system_id | cut -d '"' -f 4` for nodes in $listofnodes do diff --git a/labconfig/huawei/pod12/labconfig.yaml b/labconfig/huawei/pod12/labconfig.yaml new file mode 100644 index 00000000..0102e547 --- /dev/null +++ b/labconfig/huawei/pod12/labconfig.yaml @@ -0,0 +1,133 @@ +lab: + location: huawei + racks: + - rack: pod12 + nodes: + - name: rack-12-m1 + architecture: x86_64 + roles: [network,control] + nics: + - ifname: eth1 + spaces: [admin] + mac: ["88:cf:98:83:31:d8"] + - ifname: eth4 + spaces: [data] + mac: ["88:cf:98:e9:9a:99"] + - ifname: eth5 + spaces: [public] + mac: ["88:cf:98:e9:9a:9a"] + power: + type: ipmi + address: 192.168.120.19 + user: root + pass: Huawei12#$ + - name: rack-12-m2 + architecture: x86_64 + roles: [compute,control,storage] + nics: + - ifname: eth1 + spaces: [admin] + mac: ["88:cf:98:61:66:0b"] + - ifname: eth4 + spaces: [data] + mac: ["88:cf:98:e9:9a:c3"] + - ifname: eth5 + spaces: [public] + mac: ["88:cf:98:e9:9a:c4"] + power: + type: ipmi + address: 192.168.120.20 + user: root + pass: Huawei12#$ + - name: rack-12-m3 + architecture: x86_64 + roles: [compute,control,storage] + nics: + - ifname: eth1 + spaces: [admin] + mac: ["88:cf:98:61:66:d9"] + - ifname: eth4 + spaces: [data] + mac: ["88:cf:98:e9:9a:9b"] + - ifname: eth5 + spaces: [public] + mac: ["88:cf:98:e9:9a:9c"] + power: + type: ipmi + address: 192.168.120.21 + user: root + pass: Huawei12#$ + - name: rack-12-m4 + architecture: x86_64 + roles: [compute,storage] + nics: + - ifname: eth1 + spaces: [admin] + mac: ["88:cf:98:83:30:b4"] + - ifname: eth4 + spaces: [data] + mac: ["88:cf:98:e9:9a:9b"] + - ifname: eth5 + spaces: [public] + mac: ["88:cf:98:e9:9a:9c"] + power: + type: ipmi + address: 192.168.120.22 + user: root + pass: Huawei12#$ + - name: rack-12-m5 + architecture: x86_64 + roles: [compute,storage] + nics: + - ifname: eth1 + spaces: [admin] + mac: ["88:cf:98:83:31:db"] + - ifname: eth4 + spaces: [data] + mac: ["88:cf:98:e9:9a:a5"] + - ifname: eth5 + spaces: [public] + mac: ["88:cf:98:e9:9a:a6"] + power: + type: ipmi + address: 192.168.120.23 + user: root + pass: Huawei12#$ + floating-ip-range: 10.6.15.7,10.6.15.250,10.6.15.1,10.6.15.0/24 + ext-port: "eth5" + dns: 8.8.8.8 + public-api-ip: + osdomainname: +opnfv: + release: d + distro: xenial + type: nonha + openstack: newton + sdncontroller: + - type: nosdn + storage: + - type: ceph + disk: /dev/sdb + feature: odl_l2 + spaces: + - type: admin + bridge: brAdm + cidr: 10.6.1.0/24 + gateway: 10.6.1.1 + vlan: + - type: data + bridge: brData + cidr: 10.6.12.0/24 + gateway: + vlan: 31 + - type: public + bridge: brPublic + cidr: 10.6.15.0/24 + gateway: + vlan: 31 + - type: external + bridge: brExt + cidr: + gateway: 192.168.30.250 + ipaddress: 192.168.30.2 + vlan: |