diff options
author | Narinder Gupta <narinder.gupta@canonical.com> | 2017-02-05 08:24:01 -0600 |
---|---|---|
committer | Narinder Gupta <narinder.gupta@canonical.com> | 2017-02-05 08:55:45 -0600 |
commit | fe8f6531947ae65939e977117f9b281fbe14bed3 (patch) | |
tree | f6a45dac9d3870bef73cc0cf46a39ab43f1a1323 | |
parent | edf35e6c820e613ae73999189ed7e4b98c3a4e7d (diff) |
cleanup task.
Change-Id: I287e80899225c611752117ab29f079de7ba25f58
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
-rwxr-xr-x | ci/01-bootstrap.sh | 4 | ||||
-rwxr-xr-x | ci/02-deploybundle.sh | 60 | ||||
-rwxr-xr-x | ci/03-maasdeploy.sh | 39 | ||||
-rwxr-xr-x | ci/clean.sh | 5 | ||||
-rw-r--r-- | ci/config_tpl/deployconfig.yaml | 32 | ||||
-rw-r--r-- | ci/config_tpl/juju2/deployconfig.yaml | 5 | ||||
-rw-r--r-- | ci/config_tpl/juju2/maas_tpl/deployment.yaml | 45 | ||||
-rw-r--r-- | ci/config_tpl/maas2/maas_tpl/deployment.yaml | 45 | ||||
-rwxr-xr-x | ci/deploy.sh | 59 | ||||
-rw-r--r-- | ci/genDeploymentConfig.py | 21 | ||||
-rw-r--r-- | ci/maas/custom/deployment.yaml | 155 | ||||
-rwxr-xr-x | ci/openstack.sh | 2 | ||||
-rw-r--r-- | labconfig/default/deployconfig.yaml | 35 | ||||
-rw-r--r-- | labconfig/default/labconfig.yaml | 2 |
14 files changed, 132 insertions, 377 deletions
diff --git a/ci/01-bootstrap.sh b/ci/01-bootstrap.sh index b02b83d3..88f87dd5 100755 --- a/ci/01-bootstrap.sh +++ b/ci/01-bootstrap.sh @@ -16,7 +16,7 @@ if [[ "$jujuver" < "2" ]]; then juju set-constraints tags= else - controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` - cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` + controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` + cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` juju bootstrap $controllername $cloudname --debug --to bootstrap.maas fi diff --git a/ci/02-deploybundle.sh b/ci/02-deploybundle.sh index b634ec8d..afd5c8e9 100755 --- a/ci/02-deploybundle.sh +++ b/ci/02-deploybundle.sh @@ -52,10 +52,10 @@ check_status() { echo "...... deployment finishing ......." } -#read the value from deployment.yaml +#read the value from deployconfig.yaml PROFILE=maas -MAAS_IP=$(grep " ip_address" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //') +MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //') API_SERVERMAAS="http://$MAAS_IP/MAAS/" if [ "$maasver" > "2" ]; then API_KEY=`sudo maas-region apikey --username=ubuntu || true` @@ -75,37 +75,35 @@ fi maas login $PROFILE $API_SERVERMAAS $API_KEY if [[ "$opnfvmodel" = "openstack" ]]; then - if [ -e ./deployment.yaml ]; then - if [ -e ./deployconfig.yaml ]; then - extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '` - datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'` - admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'` - cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` - osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` - fi + if [ -e ./deployconfig.yaml ]; then + extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '` + datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'` + admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'` + cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` + osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` + fi - if [ "$maasver" > "2" ]; then - workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` - else - workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` - fi - max=0 - for v in ${workmutiple[@]}; do - if (( $v > $max )); then max=$v; fi; - done - echo $max - - if [ "$max" -lt 4 ];then - workmutiple=1.1 - elif [ "$max" -lt 33 ]; then - workmutiple=0.25 - elif [ "$max" -lt 73 ]; then - workmutiple=0.1 - else - workmutiple=0.05 - fi - sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml + if [ "$maasver" > "2" ]; then + workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` + else + workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` + fi + max=0 + for v in ${workmutiple[@]}; do + if (( $v > $max )); then max=$v; fi; + done + echo $max + + if [ "$max" -lt 4 ];then + workmutiple=1.1 + elif [ "$max" -lt 33 ]; then + workmutiple=0.25 + elif [ "$max" -lt 73 ]; then + workmutiple=0.1 + else + workmutiple=0.05 fi + sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml fi case "$opnfvlab" in diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 5f973fd0..df47af6f 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -31,22 +31,17 @@ sudo pip install --upgrade pip # Config preparation # -# Get labconfig and generate deployment.yaml for MAAS and deployconfig.yaml +# Get labconfig and generate deployconfig.yaml case "$labname" in intelpod[569]|orangepod[12]|cengnpod[12] ) array=(${labname//pod/ }) cp ../labconfig/${array[0]}/pod${array[1]}/labconfig.yaml . - python genMAASConfig.py -l labconfig.yaml > deployment.yaml python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml ;; 'attvirpod1' ) cp ../labconfig/att/virpod1/labconfig.yaml . - python genMAASConfig.py -l labconfig.yaml > deployment.yaml python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml ;; - 'juniperpod1' ) - cp maas/juniper/pod1/deployment.yaml ./deployment.yaml - ;; 'custom') labfile=$2 if [ -e $labfile ]; then @@ -61,32 +56,29 @@ case "$labname" in if [ ! -e ./labconfig.yaml ]; then virtinstall=1 labname="default" - cp ../labconfig/default/deployment.yaml ./ cp ../labconfig/default/labconfig.yaml ./ cp ../labconfig/default/deployconfig.yaml ./ else - python genMAASConfig.py -l labconfig.yaml > deployment.yaml python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml - labname=`grep "maas_name" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //'` + labname=`grep "maas_name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` fi ;; * ) virtinstall=1 labname="default" - cp ../labconfig/default/deployment.yaml ./ cp ../labconfig/default/labconfig.yaml ./ - cp ../labconfig/default/deployconfig.yaml ./ + python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml ;; esac -MAAS_IP=$(grep " ip_address" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //') -MAAS_NAME=`grep "maas_name" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //'` +MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //') +MAAS_NAME=`grep "maas_name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` API_SERVER="http://$MAAS_IP/MAAS/api/2.0" API_SERVERMAAS="http://$MAAS_IP/MAAS/" PROFILE=ubuntu -MY_UPSTREAM_DNS=`grep "upstream_dns" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //'` +MY_UPSTREAM_DNS=`grep "upstream_dns" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` SSH_KEY=`cat ~/.ssh/id_rsa.pub` -MAIN_ARCHIVE=`grep "main_archive" deployment.yaml | cut -d ':' -f 2-3 | sed -e 's/ //'` +MAIN_ARCHIVE=`grep "main_archive" deployconfig.yaml | cut -d ':' -f 2-3 | sed -e 's/ //'` URL=https://images.maas.io/ephemeral-v2/daily/ KEYRING_FILE=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg SOURCE_ID=1 @@ -96,7 +88,7 @@ PRIMARY_RACK_CONTROLLER="$MAAS_IP" SUBNET_CIDR="192.168.122.0/24" VLAN_TAG="untagged" -# In the case of a virtual deployment get deployment.yaml and deployconfig.yaml +# In the case of a virtual deployment get deployconfig.yaml if [ "$virtinstall" -eq 1 ]; then MAAS_IP="192.168.122.1" API_SERVER="http://$MAAS_IP/MAAS/api/2.0" @@ -108,18 +100,13 @@ fi #create backup directory mkdir ~/joid_config/ || true -# Backup deployment.yaml and deployconfig.yaml in joid_config folder +# Backup deployconfig.yaml in joid_config folder if [ -e ./deployconfig.yaml ]; then cp ./deployconfig.yaml ~/joid_config/ cp ./labconfig.yaml ~/joid_config/ fi -if [ -e ./deployment.yaml ]; then - cp ./deployment.yaml ~/joid_config/ -fi - - # # Prepare local environment to avoid password asking # @@ -484,8 +471,8 @@ crnodevlanint() { addcredential() { API_KEY=`sudo maas-region apikey --username=ubuntu` - controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` - cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` + controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` + cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` echo "credentials:" > credential.yaml echo " $controllername:" >> credential.yaml @@ -497,8 +484,8 @@ addcredential() { } addcloud() { - controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` - cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` + controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` + cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` echo "clouds:" > maas-cloud.yaml echo " $cloudname:" >> maas-cloud.yaml diff --git a/ci/clean.sh b/ci/clean.sh index aa14fe76..68d4dd36 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -6,7 +6,6 @@ jujuver=`juju --version` if [[ "$jujuver" > "2" ]]; then if [ ! -d labconfig.yaml ]; then - cp ~/joid_config/deployment.yaml ./deployment.yaml || true cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true fi @@ -19,8 +18,8 @@ fi if [[ "$jujuver" > "2" ]]; then - controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` - cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` + controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` + cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` juju kill-controller $controllername --timeout 10s -y || true rm -rf precise rm -rf trusty diff --git a/ci/config_tpl/deployconfig.yaml b/ci/config_tpl/deployconfig.yaml index ead9ca15..8800f302 100644 --- a/ci/config_tpl/deployconfig.yaml +++ b/ci/config_tpl/deployconfig.yaml @@ -1,12 +1,18 @@ +opnfv-{{ lab.location }}{{ lab.racks[0].rack }}-maas: opnfv: {% set net_prefix = opnfv.spaces_dict.admin.cidr[:-4] %} admNetgway: {{ opnfv.spaces_dict.admin.gateway }} admNetwork: {{ net_prefix }}2 admin_password: openstack + ip_address: {{ os.brAdmIP }} + maas_name: {{ lab.location }}{{ lab.racks[0].rack }} + main_archive: http://archive.ubuntu.com/ubuntu + upstream_dns: {{ lab.racks[0].dns }} {% if opnfv.storage_dict.ceph is defined %} ceph-disk: {{ opnfv.storage_dict.ceph.disk }} {% endif %} {% if opnfv.spaces_dict.data is defined %} +{% set netdata_prefix = opnfv.spaces_dict.data.cidr[:-4] %} dataNetwork: {{ opnfv.spaces_dict.data.cidr }} {% endif %} domain: {{ lab.racks[0].osdomainname }} @@ -16,6 +22,7 @@ opnfv: interface-enable: {{ lab.racks[0].ifnamelist }} os-domain-name: {{ lab.racks[0].osdomainname }} {% if opnfv.spaces_dict.public is defined %} +{% set netpublic_prefix = opnfv.spaces_dict.public.cidr[:-4] %} publicNetwork: {{ opnfv.spaces_dict.public.cidr }} {% endif %} spaces: @@ -36,6 +43,29 @@ opnfv: {% endif %} units: {{ lab.racks[0].nodes|count }} vip: +{% if opnfv.spaces_dict.public is defined %} +{% if opnfv.spaces_dict.data is defined %} + ceilometer: {{ net_prefix }}24 {{ netdata_prefix }}24 {{ netpublic_prefix }}24 + cinder: {{ net_prefix }}29 {{ netdata_prefix }}29 {{ netpublic_prefix }}29 + dashboard: {{ net_prefix }}21 {{ netdata_prefix }}21 {{ netpublic_prefix }}21 + glance: {{ net_prefix }}22 {{ netdata_prefix }}22 {{ netpublic_prefix }}22 + heat: {{ net_prefix }}28 {{ netdata_prefix }}28 {{ netpublic_prefix }}28 + keystone: {{ net_prefix }}23 {{ netdata_prefix }}23 {{ netpublic_prefix }}23 + mysql: {{ net_prefix }}25 + neutron: {{ net_prefix }}27 {{ netdata_prefix }}27 {{ netpublic_prefix }}27 + nova: {{ net_prefix }}26 {{ netdata_prefix }}27 {{ netpublic_prefix }}26 +{% else %} + ceilometer: {{ net_prefix }}24 {{ netpublic_prefix }}24 + cinder: {{ net_prefix }}29 {{ netpublic_prefix }}29 + dashboard: {{ net_prefix }}21 {{ netpublic_prefix }}21 + glance: {{ net_prefix }}22 {{ netpublic_prefix }}22 + heat: {{ net_prefix }}28 {{ netpublic_prefix }}28 + keystone: {{ net_prefix }}23 {{ netpublic_prefix }}23 + mysql: {{ net_prefix }}25 + neutron: {{ net_prefix }}27 {{ netpublic_prefix }}27 + nova: {{ net_prefix }}26 {{ netpublic_prefix }}26 +{% endif %} +{% else %} ceilometer: {{ net_prefix }}24 cinder: {{ net_prefix }}29 dashboard: {{ net_prefix }}21 @@ -45,4 +75,4 @@ opnfv: mysql: {{ net_prefix }}25 neutron: {{ net_prefix }}27 nova: {{ net_prefix }}26 - rabbitmq: {{ net_prefix }}20 +{% endif %} diff --git a/ci/config_tpl/juju2/deployconfig.yaml b/ci/config_tpl/juju2/deployconfig.yaml index da98d022..8800f302 100644 --- a/ci/config_tpl/juju2/deployconfig.yaml +++ b/ci/config_tpl/juju2/deployconfig.yaml @@ -1,8 +1,13 @@ +opnfv-{{ lab.location }}{{ lab.racks[0].rack }}-maas: opnfv: {% set net_prefix = opnfv.spaces_dict.admin.cidr[:-4] %} admNetgway: {{ opnfv.spaces_dict.admin.gateway }} admNetwork: {{ net_prefix }}2 admin_password: openstack + ip_address: {{ os.brAdmIP }} + maas_name: {{ lab.location }}{{ lab.racks[0].rack }} + main_archive: http://archive.ubuntu.com/ubuntu + upstream_dns: {{ lab.racks[0].dns }} {% if opnfv.storage_dict.ceph is defined %} ceph-disk: {{ opnfv.storage_dict.ceph.disk }} {% endif %} diff --git a/ci/config_tpl/juju2/maas_tpl/deployment.yaml b/ci/config_tpl/juju2/maas_tpl/deployment.yaml deleted file mode 100644 index b8e84cc5..00000000 --- a/ci/config_tpl/juju2/maas_tpl/deployment.yaml +++ /dev/null @@ -1,45 +0,0 @@ -opnfv-{{ lab.location }}{{ lab.racks[0].rack }}-maas: - juju-bootstrap: -{% include 'juju-bootstrap.yaml' %} - maas: - apt_sources: - - ppa:maas/stable - - ppa:juju/stable - arch: amd64 - boot_source: - keyring_filename: /usr/share/keyrings/ubuntu-cloudimage-keyring.gpg - selections: - '1': - arches: amd64 - labels: release - os: ubuntu - release: xenial - subarches: '*' - url: http://maas.ubuntu.com/images/ephemeral-v2/releases/ - disk_size: 160G - interfaces: -{% for net in opnfv.spaces %} - - bridge={{ net.bridge }},model=virtio -{% endfor %} - ip_address: {{ os.brAdmIP }} - memory: 4096 - name: opnfv-{{ lab.location }}{{ lab.racks[0].rack }} - network_config: | -{% include 'maas-network_config.yaml' %} - node_group_ifaces: -{% include 'maas-node_group_ifaces.yaml' %} - nodes: -{% include 'maas-nodes.yaml' %} - password: ubuntu - pool: default - release: trusty - settings: - maas_name: {{ lab.location }}{{ lab.racks[0].rack }} - main_archive: http://archive.ubuntu.com/ubuntu - upstream_dns: {{ lab.racks[0].dns }} - user: ubuntu - vcpus: 4 - virsh: - rsa_priv_key: {{ os.home }}/.ssh/id_rsa - rsa_pub_key: {{ os.home }}/.ssh/id_rsa.pub - uri: qemu+ssh://{{ os.user }}@{{ os.brAdmIP }}/system diff --git a/ci/config_tpl/maas2/maas_tpl/deployment.yaml b/ci/config_tpl/maas2/maas_tpl/deployment.yaml deleted file mode 100644 index b8e84cc5..00000000 --- a/ci/config_tpl/maas2/maas_tpl/deployment.yaml +++ /dev/null @@ -1,45 +0,0 @@ -opnfv-{{ lab.location }}{{ lab.racks[0].rack }}-maas: - juju-bootstrap: -{% include 'juju-bootstrap.yaml' %} - maas: - apt_sources: - - ppa:maas/stable - - ppa:juju/stable - arch: amd64 - boot_source: - keyring_filename: /usr/share/keyrings/ubuntu-cloudimage-keyring.gpg - selections: - '1': - arches: amd64 - labels: release - os: ubuntu - release: xenial - subarches: '*' - url: http://maas.ubuntu.com/images/ephemeral-v2/releases/ - disk_size: 160G - interfaces: -{% for net in opnfv.spaces %} - - bridge={{ net.bridge }},model=virtio -{% endfor %} - ip_address: {{ os.brAdmIP }} - memory: 4096 - name: opnfv-{{ lab.location }}{{ lab.racks[0].rack }} - network_config: | -{% include 'maas-network_config.yaml' %} - node_group_ifaces: -{% include 'maas-node_group_ifaces.yaml' %} - nodes: -{% include 'maas-nodes.yaml' %} - password: ubuntu - pool: default - release: trusty - settings: - maas_name: {{ lab.location }}{{ lab.racks[0].rack }} - main_archive: http://archive.ubuntu.com/ubuntu - upstream_dns: {{ lab.racks[0].dns }} - user: ubuntu - vcpus: 4 - virsh: - rsa_priv_key: {{ os.home }}/.ssh/id_rsa - rsa_pub_key: {{ os.home }}/.ssh/id_rsa.pub - uri: qemu+ssh://{{ os.user }}@{{ os.brAdmIP }}/system diff --git a/ci/deploy.sh b/ci/deploy.sh index f92f5032..99be542d 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -74,7 +74,7 @@ done #by default maas creates two VMs in case of three more VM needed. createresource() { - maas_ip=`grep " ip_address" deployment.yaml | cut -d " " -f 10` + maas_ip=`grep " ip_address" deployconfig.yaml | cut -d " " -f 10` apikey=`grep maas-oauth: environments.yaml | cut -d "'" -f 2` maas login maas http://${maas_ip}/MAAS/api/1.0 ${apikey} @@ -105,37 +105,34 @@ createresource() { #copy the files and create extra resources needed for HA deployment # in case of default VM labs. deploy() { - if [ ! -f ./deployment.yaml ] && [ -e ~/.juju/deployment.yaml ]; then - cp ~/.juju/deployment.yaml ./deployment.yaml - elif [ ! -f ./deployment.yaml ] && [ -e ~/joid_config/deployment.yaml ]; then - cp ~/joid_config/deployment.yaml ./deployment.yaml - fi - - if [[ "$jujuver" > "2" ]]; then - if [ ! -f ./labconfig.yaml ] && [ -e ~/joid_config/labconfig.yaml ]; then - cp ~/joid_config/labconfig.yaml ./labconfig.yaml - fi - if [ ! -f ./deployconfig.yaml ] && [ -e ~/joid_config/deployconfig.yaml ]; then - cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml - fi - else - if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then - cp ~/.juju/environments.yaml ./environments.yaml - elif [ ! -f ./environments.yaml ] && [ -e ~/joid_config/environments.yaml ]; then - cp ~/joid_config/environments.yaml ./environments.yaml + if [[ "$jujuver" > "2" ]]; then + if [ ! -f ./labconfig.yaml ] && [ -e ~/joid_config/labconfig.yaml ]; then + cp ~/joid_config/labconfig.yaml ./labconfig.yaml + + if [ ! -f ./deployconfig.yaml ] && [ -e ~/joid_config/deployconfig.yaml ]; then + cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml + else + python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml + fi + else + echo " MAAS not deployed please deploy MAAS first." + fi + else + if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then + cp ~/.juju/environments.yaml ./environments.yaml + elif [ ! -f ./environments.yaml ] && [ -e ~/joid_config/environments.yaml ]; then + cp ~/joid_config/environments.yaml ./environments.yaml + fi + #copy the script which needs to get deployed as part of ofnfv release + echo "...... deploying now ......" + echo " " >> environments.yaml + echo " enable-os-refresh-update: false" >> environments.yaml + echo " enable-os-upgrade: false" >> environments.yaml + echo " admin-secret: admin" >> environments.yaml + echo " default-series: $opnfvdistro" >> environments.yaml + cp environments.yaml ~/.juju/ + cp environments.yaml ~/joid_config/ fi - #copy the script which needs to get deployed as part of ofnfv release - echo "...... deploying now ......" - echo " " >> environments.yaml - echo " enable-os-refresh-update: false" >> environments.yaml - echo " enable-os-upgrade: false" >> environments.yaml - echo " admin-secret: admin" >> environments.yaml - echo " default-series: $opnfvdistro" >> environments.yaml - cp environments.yaml ~/.juju/ - cp environments.yaml ~/joid_config/ - fi - - if [[ "$opnfvtype" = "ha" && "$opnfvlab" = "default" ]]; then createresource diff --git a/ci/genDeploymentConfig.py b/ci/genDeploymentConfig.py index eecdd2f2..0a21fffa 100644 --- a/ci/genDeploymentConfig.py +++ b/ci/genDeploymentConfig.py @@ -14,6 +14,9 @@ from distutils.version import LooseVersion, StrictVersion import os import yaml import subprocess +import socket +import fcntl +import struct # # Parse parameters @@ -59,6 +62,21 @@ def load_yaml(filepath): except yaml.YAMLError as exc: print(exc) + +def get_ip_address(ifname): + """Get local IP""" + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + return socket.inet_ntoa(fcntl.ioctl( + s.fileno(), + 0x8915, # SIOCGIFADDR + struct.pack('256s', bytes(ifname.encode('utf-8')[:15])) + )[20:24]) + + +# +# Config import +# + # # Config import # @@ -79,7 +97,8 @@ for storage in config['opnfv']['storage']: # Add some OS environment variables config['os'] = {'home': HOME, 'user': USER, - } + 'brAdmIP': get_ip_address(config['opnfv']['spaces_dict'] + ['admin']['bridge'])} # Prepare interface-enable, more easy to do it here ifnamelist = set() diff --git a/ci/maas/custom/deployment.yaml b/ci/maas/custom/deployment.yaml deleted file mode 100644 index 857237aa..00000000 --- a/ci/maas/custom/deployment.yaml +++ /dev/null @@ -1,155 +0,0 @@ -# This file defines the deployment for the MAAS environment which is to be -# deployed and automated. -demo-maas: - # Contains the virtual machine parameters for creating the Juju bootstrap - # node virtual machine - juju-bootstrap: - name: bootstrap - interfaces: ['bridge=virbr0,model=virtio'] - memory: 2048 - vcpus: 2 - arch: amd64 - pool: default - disk_size: 20G -# sticky_ip_address: -# requested_address: 192.168.122.25 - - maas: - # Defines the general setup for the MAAS environment, including the - # username and password for the host as well as the MAAS server. - user: ubuntu - password: ubuntu - - # Contains the virtual machine parameters for creating the MAAS virtual - # server. Here you can configure the name of the virsh domain, the - # parameters for how the network is attached. - name: opnfv-maas - interfaces: ['bridge=virbr0,model=virtio'] - memory: 4096 - vcpus: 2 - arch: amd64 - pool: default - disk_size: 60G - release: trusty - - # Apt http proxy setting(s) - apt_http_proxy: - - apt_sources: - - ppa:maas/stable - - ppa:juju/stable - - boot_source: - url: http://maas.ubuntu.com/images/ephemeral-v2/daily/ - keyring_filename: /usr/share/keyrings/ubuntu-cloudimage-keyring.gpg - exclusive: true - selections: - 1: - release: trusty - os: ubuntu - arches: amd64 - subarches: "*" - labels: daily - 2: - release: xenial - os: ubuntu - arches: amd64 - subarches: "*" - labels: daily - - # Virsh power settings - # Specifies the uri and keys to use for virsh power control of the - # juju virtual machine. If the uri is omitted, the value for the - # --remote is used. If no power settings are desired, then do not - # supply the virsh block. - virsh: - rsa_priv_key: /home/ubuntu/.ssh/id_rsa - rsa_pub_key: /home/ubuntu/.ssh/id_rsa.pub - uri: qemu+ssh://ubuntu@192.168.122.1/system - - # Defines the IP Address that the configuration script will use to - # to access the MAAS controller via SSH. - ip_address: 192.168.122.2 - - # This section allows the user to set a series of options on the - # MAAS server itself. The list of config options can be found in - # the upstream MAAS documentation: - # - http://maas.ubuntu.com/docs/api.html#maas-server - settings: - main_archive: http://us.archive.ubuntu.com/ubuntu - upstream_dns: 192.168.122.1 - maas_name: automaas - # kernel_opts: "console=tty0 console=ttyS1,115200n8" - ntp_server: ntp.ubuntu.com - - # This section is used to define the networking parameters for when - # the node first comes up. It is fed into the meta-data cloud-init - # configuration and is used to configure the networking piece of the - # service. The contents of this section are written directly to the - # /etc/network/interfaces file. - # - # Please note, this is slightly different than the - # node-group-interfaces section below. This will configure the - # machine's networking params, and the node-group-interfaces will - # configure the maas node-group interfaces which is used for - # controlling the dhcp, dns, etc. - network_config: | - auto lo - iface lo inet loopback - - auto eth0 - iface eth0 inet static - address 192.168.122.2 - netmask 255.255.255.0 - network 192.168.122.0 - broadcast 192.168.122.255 - gateway 192.168.122.1 - dns-nameservers 192.168.122.1 127.0.0.1 - - # See https://maas.ubuntu.com/docs/maascli.html#node-groups for - # description and full list of supported options. - # NOTE: interfaces are added using the node_group_interfaces section - # and only one node_group can be created by this bundle. - # Additional node groups can be added post deployment. - #node_group: - # # This is the cluster DNS name. - # name: maas - - # The node-group-interfaces section is used to configure the MAAS - # network interfaces. Basic configuration is supported, such as which - # device should be bound, the range of IP addresses, etc. - # Note: this may contain the special identifiers: - # ${maas_net} - the first 3 octets of the ipv4 address - # ${maas_ip} - the ip address of the MAAS controller - node_group_ifaces: - - device: eth0 - ip: 192.168.122.2 - subnet_mask: 255.255.255.0 - broadcast_ip: 192.168.122.255 - router_ip: 192.168.122.1 - static_range: - low: 192.168.122.101 - high: 192.168.122.200 - dynamic_range: - low: 192.168.122.25 - high: 192.168.122.100 - - # Physical nodes to be added to the MAAS cluster. Nodes will be - # configured, commissioned and put into the Ready state so - # they are ready to be deployed to. - #nodes: - # - name: node1 - # tags: api - # architecture: amd64/generic - # mac_addresses: - # - "38:63:bb:43:b8:9c" - # power: - # type: ipmi - # address: 10.0.1.1 - # user: maas - # pass: passw0rd - # driver: LAN_2_0 - # sticky_ip_address: - # mac_address: "38:63:bb:43:b8:9c" - # requested_address: 192.168.122.6 - diff --git a/ci/openstack.sh b/ci/openstack.sh index 1c40cf52..06e59c4f 100755 --- a/ci/openstack.sh +++ b/ci/openstack.sh @@ -180,7 +180,7 @@ if ([ "$opnfvlab" == "orangepod1" ] \ # The public network exists on MAAS, so we push the dns record to it # Recover maas ips and login to it - maas_ip=$(grep " ip_address" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //') + maas_ip=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //') maas_pubip=$(grep floating-ip-range ./labconfig.yaml |cut -d, -f4 |perl -pe 's!^(.*)\.\d+/\d+$!$1.5!') apikey=$(grep maas-oauth: environments.yaml | cut -d "'" -f 2) maas login maas http://${maas_ip}/MAAS/api/1.0 ${apikey} diff --git a/labconfig/default/deployconfig.yaml b/labconfig/default/deployconfig.yaml deleted file mode 100644 index 12f82162..00000000 --- a/labconfig/default/deployconfig.yaml +++ /dev/null @@ -1,35 +0,0 @@ -opnfv: - admNetgway: 192.168.122.1 - admNetwork: 192.168.122.2 - admin_password: openstack - ceph-disk: /srv - dataNetwork: '' - domain: None - ext-port: eth1 - ext_port: eth1 - floating-ip-range: 192.168.122.30,192.168.122.49,192.168.122.1,192.168.122.0/24 - interface-enable: eth1 - os-domain-name: None - publicNetwork: '' - spaces: - - bridge: brAdm - cidr: 192.168.122.0/24 - gateway: 192.168.122.1 - type: admin - vlan: null - storage: - - disk: /srv - type: ceph - storageNetwork: '' - units: 3 - vip: - ceilometer: 192.168.122.24 - cinder: 192.168.122.29 - dashboard: 192.168.122.21 - glance: 192.168.122.22 - heat: 192.168.122.28 - keystone: 192.168.122.23 - mysql: 192.168.122.25 - neutron: 192.168.122.27 - nova: 192.168.122.26 - rabbitmq: 192.168.122.20 diff --git a/labconfig/default/labconfig.yaml b/labconfig/default/labconfig.yaml index 1e981d88..d59cab21 100644 --- a/labconfig/default/labconfig.yaml +++ b/labconfig/default/labconfig.yaml @@ -41,7 +41,7 @@ opnfv: cidr: 192.168.122.0/24 gateway: 192.168.122.1 vlan: - - type: public + - type: floating bridge: brPublic cidr: 192.168.122.0/24 gateway: 192.168.122.1 |