51
50
sudo apt-get install software-properties-common -y
52
51
sudo apt-add-repository ppa:juju/stable -y
53
52
sudo apt-add-repository ppa:maas/stable -y
54
if [ "bionic" == "$opnfvdistro" ]; then
55
echo "no cloud archive needed"
57
sudo apt-add-repository cloud-archive:pike -y
53
sudo apt-add-repository cloud-archive:pike -y
60
54
if [ "aarch64" == "$NODE_ARCTYPE" ]; then
61
if [ "bionic" == "$opnfvdistro" ]; then
62
echo "no repository needed"
64
sudo add-apt-repository ppa:ubuntu-cloud-archive/pike-staging -y
55
sudo add-apt-repository ppa:ubuntu-cloud-archive/pike-staging -y
67
57
sudo apt-get update -y || true
68
58
#sudo apt-get dist-upgrade -y
70
if [ "bionic" == "$opnfvdistro" ]; then
71
sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \
72
maas maas-region-controller juju python-pip python-psutil python-openstackclient \
73
python-congressclient gsutil pastebinit python-jinja2 sshpass \
74
openssh-server vlan ipmitool jq expect snap -y --allow-unauthenticated
75
sudo snap install charm
77
sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \
60
sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvirt-bin \
78
61
maas maas-region-controller juju python-pip python-psutil python-openstackclient \
79
62
python-congressclient gsutil charm-tools pastebinit python-jinja2 sshpass \
80
openssh-server vlan ipmitool jq expect snap -y --allow-unauthenticated
63
openssh-server vlan ipmitool jq expect snap -y
83
65
if [ "aarch64" == "$NODE_ARCTYPE" ]; then
84
sudo apt-get install qemu qemu-efi qemu-system-aarch64 -y --allow-unauthenticated
66
sudo apt-get install qemu qemu-efi qemu-system-aarch64 -y
87
69
sudo -H pip install --upgrade pip
90
73
# Config preparation
268
251
maas $PROFILE tags create name=$tag || true
271
#below tag would be used to enable huge pages for DPDK and SRIOV enablement in Ubuntu kernel via MAAS
272
maas $PROFILE tags create name='opnfv-dpdk' comment='OPNFV DPDK enablement' \
273
kernel_opts='hugepagesz=2M hugepages=1024 hugepagesz=1G hugepages=20 default_hugepagesz=1G intel_iommu=on' || true
275
254
#create the required spaces.
276
255
maas $PROFILE space update 0 name=default || true
277
256
for space in admin-api internal-api public-api \
317
296
NET_VLAN_ID=$(maas $PROFILE vlans read $NET_FABRIC_ID | jq -r ".[] | select(.vid==\"$SPACE_VLAN\")".id)
318
297
NET_VLAN_VID=$(maas $PROFILE vlans read $NET_FABRIC_ID | jq -r ".[] | select(.vid==\"$SPACE_VLAN\")".vid)
319
298
if ([ $SPACE_GWAY ] && [ "$SPACE_GWAY" != "null" ]); then
320
maas $PROFILE subnet update $SPACE_CIDR gateway_ip=$SPACE_GWAY || true
299
maas $PROFILE subnet update $SPACE_CIDR gateway_ip=$SPACE_GWAY
322
301
if ([ $NET_VLAN_VID ] && [ $NET_VLAN_VID == "0" ]); then
327
306
NET_VLAN_ID=$(maas $PROFILE vlans create $NET_FABRIC_ID vid=$SPACE_VLAN | jq --raw-output ".id")
328
307
if ([ $NET_VLAN_ID ] && [ $NET_VLAN_ID != "null" ]); then
329
maas $PROFILE subnet update $SPACE_CIDR vlan=$NET_VLAN_ID || true
308
maas $PROFILE subnet update $SPACE_CIDR vlan=$NET_VLAN_ID
330
309
NET_FABRIC_VID=$SPACE_VLAN
338
317
if ([ $SPACE_VLAN ] && [ "$SPACE_VLAN" != "null" ]); then
339
318
NET_VLAN_ID=$(maas $PROFILE vlans create $FABRIC_ID vid=$SPACE_VLAN | jq --raw-output ".id")
340
319
if ([ $SPACE_GWAY ] && [ "$SPACE_GWAY" != "null" ]); then
341
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid=$VID_ID gateway_ip=$SPACE_GWAY || true
320
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid=$VID_ID gateway_ip=$SPACE_GWAY
343
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid=$VID_ID || true
322
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid=$VID_ID
345
324
NET_FABRIC_VID=$VLAN_ID
347
326
if ([ $SPACE_GWAY ] && [ "$SPACE_GWAY" != "null" ]); then
348
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid="0" gateway_ip=$SPACE_GWAY || true
327
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid="0" gateway_ip=$SPACE_GWAY
350
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid="0" || true
329
maas $PROFILE subnets create fabric=$FABRIC_ID cidr=$SPACE_CIDR vid="0"
353
332
NET_FABRIC_NAME=$(maas $PROFILE subnets read | jq -r ".[] | select(.cidr==\"$SPACE_CIDR\")".vlan.fabric)
368
347
NET_FABRIC_ID=$(maas $PROFILE fabric read $NET_FABRIC_NAME | jq -r ".id")
369
348
if ([ $NET_FABRIC_ID ] && [ $NET_FABRIC_ID != "null" ]); then
370
349
if ([ $JUJU_VLAN_VID ] && [ $JUJU_VLAN_VID != "null" ]); then
371
maas $PROFILE vlan update $NET_FABRIC_ID $JUJU_VLAN_VID space=$JUJU_SPACE_ID || true
350
maas $PROFILE vlan update $NET_FABRIC_ID $JUJU_VLAN_VID space=$JUJU_SPACE_ID
374
353
if ([ $type == "admin" ]); then
390
369
PRIMARY_RACK_CONTROLLER=$(maas $PROFILE rack-controllers read | jq -r '.[0].system_id')
391
370
maas $PROFILE vlan update $NET_FABRIC_ID $NET_FABRIC_VID dhcp_on=True primary_rack=$PRIMARY_RACK_CONTROLLER || true
393
elif ([ $type == "public" ] || [ $type == "osapi" ]); then
394
# If we have a network, we create reserve IPS for public IP range
395
if ([ $NET_FABRIC_ID ]); then
397
SUBNET_PREFIX=${SPACE_CIDR::-5}
398
IP_RES_RANGE_LOW="$SUBNET_PREFIX.1"
399
IP_RES_RANGE_HIGH="$SUBNET_PREFIX.39"
400
maas $PROFILE ipranges create type=reserved \
401
start_ip=$IP_RES_RANGE_LOW end_ip=$IP_RES_RANGE_HIGH \
402
comment='This is a reserved range' || true
405
if ([ $NET_FABRIC_ID ]); then
407
SUBNET_PREFIX=${SPACE_CIDR::-5}
408
IP_RES_RANGE_LOW="$SUBNET_PREFIX.1"
409
IP_RES_RANGE_HIGH="$SUBNET_PREFIX.5"
410
maas $PROFILE ipranges create type=reserved \
411
start_ip=$IP_RES_RANGE_LOW end_ip=$IP_RES_RANGE_HIGH \
412
comment='This is a reserved range' || true
590
548
setupspacenetwork
592
sudo sed -i 's/localhost/'$MAAS_IP'/g' /etc/maas/rackd.conf
593
sudo service maas-rackd restart
594
sudo service maas-regiond restart
550
#just make sure rack controller has been synced and import only
551
# just whether images have been imported or not.
552
#sudo ./maas-reconfigure-region.sh $MAAS_IP
598
555
# Let's add the nodes now. Currently works only for virtual deployment.