From 1edb67f913276eec2dad1adae80a3ac3d9a5356c Mon Sep 17 00:00:00 2001 From: chigang Date: Wed, 26 Jul 2017 17:19:30 +0800 Subject: Add moonv4 into Compass4nfv JIRA:- To deploy moon master, export MOON_CFG env like below compass deploy: export MOON_CFG="master:flag=Disable,slave:flag=Enable,slave:name=slave1,slave:master_ip=master_ip" To deploy moon slave, export MOON_CFG env like below compass deploy: export MOON_CFG="master:flag=Enable,slave:flag=Disable,slave:name=slave1,slave:master_ip=master_ip" Change-Id: I21c0186a029c508d390c69112b43510d9c5b9c5c Signed-off-by: chigang --- .../ansible/openstack/HA-ansible-multinodes.yml | 5 ++ deploy/client.py | 38 +++++++++++---- deploy/compass_conf/flavor/openstack_ocata.conf | 2 +- .../package_installer/ansible-ocata.conf | 2 +- .../compass_conf/package_metadata/openstack.conf | 55 ++++++++++++++++++---- .../compass_conf/role/openstack_ocata_ansible.conf | 10 ++++ .../vars/HA-ansible-multinodes.tmpl | 7 ++- deploy/conf/base.conf | 1 + .../huawei-pod1/os-odl_l2-moon-ha.yml | 5 +- deploy/conf/vm_environment/os-odl_l2-moon-ha.yml | 5 +- deploy/deploy_host.sh | 3 +- 11 files changed, 105 insertions(+), 28 deletions(-) (limited to 'deploy') diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index 3691a921..40c70ac3 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -35,3 +35,8 @@ - setup-openvswitch - setup-opendaylight - post-openstack + +- hosts: moon + remote_user: root + roles: + - moon diff --git a/deploy/client.py b/deploy/client.py index 366ae418..5eab212d 100644 --- a/deploy/client.py +++ b/deploy/client.py @@ -250,9 +250,9 @@ opts = [ cfg.StrOpt('odl_l3_agent', help='odl l3 agent enable flag', default='Disable'), - cfg.StrOpt('moon', - help='moon enable flag', - default='Disable'), + cfg.StrOpt('moon_cfg', + help='moon config', + default='master:flag=Disable,slave:flag=Disable,slave:name=slave1,slave:master_ip=master_ip'), # noqa cfg.StrOpt('onos_sfc', help='onos_sfc enable flag', default='Disable'), @@ -728,6 +728,30 @@ class CompassClient(object): 'password': password } + moon_cfgs = [ + cfg + for cfg in CONF.moon_cfg.split(',') + if cfg + ] + LOG.info( + 'moon configure: %s', moon_cfgs + ) + moon_cfg = {} + for cfg in moon_cfgs: + if ':' not in cfg: + raise Exception( + 'there is no : in cfg %s' % cfg # noqa + ) + role, conf_pair = cfg.split(':', 1) + if '=' not in conf_pair: + raise Exception( + 'there is no = in %s configure pair' % conf_pair + ) + key, value = conf_pair.split('=', 1) + moon_cfg[role] = {} if role not in moon_cfg else moon_cfg[role] + moon_cfg[role][key] = value + package_config["moon_cfg"] = moon_cfg + package_config["security"] = {"service_credentials": service_credential_cfg, # noqa "console_credentials": console_credential_cfg} # noqa @@ -761,12 +785,8 @@ class CompassClient(object): package_config['enable_secgroup'] = (CONF.enable_secgroup == "true") package_config['enable_fwaas'] = (CONF.enable_fwaas == "true") package_config['enable_vpnaas'] = (CONF.enable_vpnaas == "true") - package_config[ - 'odl_l3_agent'] = "Enable" if CONF.odl_l3_agent == "Enable" else "Disable" # noqa - package_config[ - 'moon'] = "Enable" if CONF.moon == "Enable" else "Disable" - package_config[ - 'onos_sfc'] = "Enable" if CONF.onos_sfc == "Enable" else "Disable" + package_config['odl_l3_agent'] = "Enable" if CONF.odl_l3_agent == "Enable" else "Disable" # noqa + package_config['onos_sfc'] = "Enable" if CONF.onos_sfc == "Enable" else "Disable" # noqa package_config['plugins'] = [] if CONF.plugins: for item in CONF.plugins.split(','): diff --git a/deploy/compass_conf/flavor/openstack_ocata.conf b/deploy/compass_conf/flavor/openstack_ocata.conf index c532ac6c..1179afae 100755 --- a/deploy/compass_conf/flavor/openstack_ocata.conf +++ b/deploy/compass_conf/flavor/openstack_ocata.conf @@ -25,7 +25,7 @@ FLAVORS = [{ 'display_name': 'HA-ansible-multinodes-ocata', 'template': 'HA-ansible-multinodes.tmpl', 'roles': [ - 'controller', 'compute', 'ha', 'odl', 'onos', 'opencontrail', 'ceph', 'ceph-adm', 'ceph-mon', 'ceph-osd', 'sec-patch', 'ceph-osd-node' + 'controller', 'compute', 'ha', 'odl', 'onos', 'opencontrail', 'ceph', 'ceph-adm', 'ceph-mon', 'ceph-osd', 'ceph-osd-node', 'moon' ], }] diff --git a/deploy/compass_conf/package_installer/ansible-ocata.conf b/deploy/compass_conf/package_installer/ansible-ocata.conf index 0286b4eb..1df2153b 100755 --- a/deploy/compass_conf/package_installer/ansible-ocata.conf +++ b/deploy/compass_conf/package_installer/ansible-ocata.conf @@ -7,7 +7,7 @@ SETTINGS = { 'playbook_file': 'site.yml', 'inventory_file': 'inventory.py', 'inventory_json_file': 'inventory.json', - 'inventory_group': ['controller', 'compute', 'ha', 'odl', 'onos', 'opencontrail', 'ceph_adm', 'ceph_mon', 'ceph_osd'], + 'inventory_group': ['controller', 'compute', 'ha', 'odl', 'onos', 'opencontrail', 'ceph_adm', 'ceph_mon', 'ceph_osd', 'moon'], 'group_variable': 'all', 'etc_hosts_path': 'roles/pre-openstack/templates/hosts', 'runner_dirs': ['roles','openstack_ocata/templates','openstack_ocata/roles'] diff --git a/deploy/compass_conf/package_metadata/openstack.conf b/deploy/compass_conf/package_metadata/openstack.conf index cfe66356..f045868e 100755 --- a/deploy/compass_conf/package_metadata/openstack.conf +++ b/deploy/compass_conf/package_metadata/openstack.conf @@ -113,14 +113,6 @@ METADATA = { 'default_value': 'Disable' } }, - 'moon': { - '_self': { - 'mapping_to': 'moon', - 'field': 'anytype', - 'is_required':False, - 'default_value': 'Disable' - } - }, 'plugins': { '_self': { 'mapping_to': 'plugins', @@ -471,5 +463,50 @@ METADATA = { } } }, - + 'moon_cfg': { + '_self': { + 'required_in_whole_config': False, + 'mapping_to': 'moon_cfg' + }, + 'master': { + '_self': { + 'required_in_whole_config': False, + 'mapping_to': 'master' + }, + 'flag': { + '_self': { + 'is_required': False, + 'field': 'general', + 'mapping_to': 'flag' + } + }, + }, + 'slave': { + '_self': { + 'required_in_whole_config': False, + 'mapping_to': 'slave' + }, + 'flag': { + '_self': { + 'is_required': False, + 'field': 'general', + 'mapping_to': 'flag' + } + }, + 'name': { + '_self': { + 'is_required': False, + 'field': 'general', + 'mapping_to': 'name' + } + }, + 'master_ip': { + '_self': { + 'is_required': False, + 'field': 'general', + 'mapping_to': 'master_ip' + } + }, + } + } } diff --git a/deploy/compass_conf/role/openstack_ocata_ansible.conf b/deploy/compass_conf/role/openstack_ocata_ansible.conf index dfe426d0..bfb54173 100755 --- a/deploy/compass_conf/role/openstack_ocata_ansible.conf +++ b/deploy/compass_conf/role/openstack_ocata_ansible.conf @@ -112,4 +112,14 @@ ROLES = [{ 'display': 'sec-patch node', 'description': 'Security Patch Node', 'optional': True +}, { + 'role': 'none', + 'display': 'none node', + 'description': 'Only install OS Node', + 'optional': True +}, { + 'role': 'moon', + 'display': 'moon master or slave node', + 'description': "Moon master/slave Node", + 'optional': True }] diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl index b7b6b91e..e62e58d5 100755 --- a/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl @@ -56,7 +56,6 @@ enable_secgroup: $getVar('enable_secgroup', True) enable_fwaas: $getVar('enable_fwaas', True) enable_vpnaas: $getVar('enable_vpnaas', True) odl_l3_agent: $getVar('odl_l3_agent', 'Disable') -moon: $getVar('moon', 'Disable') ha_network: $getVar('ha_network', 'Disable') onos_nic: $getVar('onos_nic', 'eth2') onos_sfc: $getVar('onos_sfc', 'Disable') @@ -240,3 +239,9 @@ odl_base_features: ['config', 'standard', 'region', 'package', 'kar', 'ssh', 'ma odl_extra_features: ['odl-l2switch-switch', 'odl-ovsdb-plugin', 'odl-ovsdb-openstack', 'odl-ovsdb-northbound','odl-dlux-core', 'odl-restconf-all', 'odl-mdsal-clustering', 'odl-openflowplugin-flow-services', 'odl-netconf-connector', 'odl-netconf-connector-ssh', 'jolokia-osgi'] odl_features: "{{ odl_base_features + odl_extra_features }}" odl_api_port: 8080 + +#set moon_cfg = $getVar('moon_cfg', {}) +moon_master: $moon_cfg.master.flag +moon_slave: $moon_cfg.slave.flag +moon_slave_name: $moon_cfg.slave.name +moon_master_ip: $moon_cfg.slave.master_ip diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf index b474e282..bdbea459 100644 --- a/deploy/conf/base.conf +++ b/deploy/conf/base.conf @@ -68,3 +68,4 @@ export OS_CONFIG_FILENAME="" export SERVICE_CREDENTIALS="image:service=service,compute:service=service,dashboard:service=service,identity:service=service,image:service=service,metering:service=service,network:service=service,rabbitmq:service=service,volume:service=service,mysql:service=service,heat:heat=heat_db_secret,alarming:aodh=aodh_db_secret,policy:congress=service" export CONSOLE_CREDENTIALS="admin:console=console,demo:console=console,compute:console=console,dashboard:console=console,identity:console=console,image:console=console,metering:console=console,network:console=console,object-store:console=console,volume:console=console,heat:heat=heat_secret,alarming:aodh=aodh_secret,policy:congress=console" export PACKAGE_CONFIG_FILENAME="" +export MOON_CFG=${MOON_CFG:-"master:flag=Disable,slave:flag=Disable,slave:name=slave1,slave:master_ip=master_ip"} diff --git a/deploy/conf/hardware_environment/huawei-pod1/os-odl_l2-moon-ha.yml b/deploy/conf/hardware_environment/huawei-pod1/os-odl_l2-moon-ha.yml index dca3228b..d2447c1d 100644 --- a/deploy/conf/hardware_environment/huawei-pod1/os-odl_l2-moon-ha.yml +++ b/deploy/conf/hardware_environment/huawei-pod1/os-odl_l2-moon-ha.yml @@ -15,9 +15,9 @@ POWER_TOOL: ipmitool ipmiUser: root ipmiVer: '2.0' -moon: "Enable" plugins: - opendaylight: "Enable" + - moon: "Enable" hosts: - name: host1 @@ -74,5 +74,4 @@ hosts: ipmiIp: 172.16.130.31 ipmiPass: Opnfv@pod1 roles: - - compute - - ceph-osd + - moon diff --git a/deploy/conf/vm_environment/os-odl_l2-moon-ha.yml b/deploy/conf/vm_environment/os-odl_l2-moon-ha.yml index 759055d6..5a02cbf7 100644 --- a/deploy/conf/vm_environment/os-odl_l2-moon-ha.yml +++ b/deploy/conf/vm_environment/os-odl_l2-moon-ha.yml @@ -11,9 +11,9 @@ TYPE: virtual FLAVOR: cluster -moon: "Enable" plugins: - opendaylight: "Enable" + - moon: "Enable" hosts: - name: host1 @@ -45,5 +45,4 @@ hosts: - name: host5 roles: - - compute - - ceph-osd + - moon diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh index 1556651f..aa90dca6 100755 --- a/deploy/deploy_host.sh +++ b/deploy/deploy_host.sh @@ -47,7 +47,8 @@ function deploy_host(){ --deployment_timeout="${DEPLOYMENT_TIMEOUT}" --${POLL_SWITCHES_FLAG} --dashboard_url="${DASHBOARD_URL}" \ --cluster_vip="${VIP}" --network_cfg="$NETWORK" --neutron_cfg="$NEUTRON" \ --enable_secgroup="${ENABLE_SECGROUP}" --enable_fwaas="${ENABLE_FWAAS}" --expansion="${EXPANSION}" \ - --rsa_file="$rsa_file" --enable_vpnaas="${ENABLE_VPNAAS}" --odl_l3_agent="${odl_l3_agent}" --moon="${moon}" --onos_sfc="${onos_sfc}" --plugins="$plugins" + --rsa_file="$rsa_file" --enable_vpnaas="${ENABLE_VPNAAS}" --odl_l3_agent="${odl_l3_agent}" \ + --moon_cfg="${MOON_CFG}" --onos_sfc="${onos_sfc}" --plugins="$plugins" RET=$? sleep $((AYNC_TIMEOUT+5)) -- cgit 1.2.3-korg