summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml5
-rw-r--r--deploy/client.py38
-rwxr-xr-xdeploy/compass_conf/flavor/openstack_ocata.conf2
-rwxr-xr-xdeploy/compass_conf/package_installer/ansible-ocata.conf2
-rwxr-xr-xdeploy/compass_conf/package_metadata/openstack.conf55
-rwxr-xr-xdeploy/compass_conf/role/openstack_ocata_ansible.conf10
-rwxr-xr-xdeploy/compass_conf/templates/ansible_installer/openstack_ocata/vars/HA-ansible-multinodes.tmpl7
-rw-r--r--deploy/conf/base.conf1
-rw-r--r--deploy/conf/hardware_environment/huawei-pod1/os-odl_l2-moon-ha.yml5
-rw-r--r--deploy/conf/vm_environment/os-odl_l2-moon-ha.yml5
-rwxr-xr-xdeploy/deploy_host.sh3
-rw-r--r--plugins/moon/plugins.desc55
-rw-r--r--plugins/moon/roles/moon/tasks/main.yml11
-rw-r--r--plugins/moon/roles/moon/tasks/moon.yml204
14 files changed, 375 insertions, 28 deletions
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 38b11edb..1fdc5d5e 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')
@@ -247,3 +246,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))
diff --git a/plugins/moon/plugins.desc b/plugins/moon/plugins.desc
new file mode 100644
index 00000000..2d0e56f6
--- /dev/null
+++ b/plugins/moon/plugins.desc
@@ -0,0 +1,55 @@
+# ##############################################################
+# This is an example for add a plugin into Compass4nfv
+# It illustrates how feature components can be integrated into Compass4nfv
+# together with scenarios.
+#
+#
+# More details can be found in the development document.
+# ##############################################################
+---
+plugin:
+ # plugin name,it is also as the switch to enable/disable plugin in scenario
+ # files
+ name: moon
+
+ description: plugin introduce and description
+ maintainers:
+ - ruan.he@orange.com
+
+ # true: this plugin is deployed separately on a new node
+ # false: this plugin is deployed on controller or compute node
+ independent_hosts: true
+
+ # artifact: packege download url for this plugin
+ artifacts:
+ url:
+
+ # global_vars:
+ # define the parameters required by the plugin
+ # and its value will be defined and passed by compass4nfv
+ global_vars:
+ - xxx: yyy
+ - ntp_server: "pool.ntp.org"
+
+ # orchestration
+ # A plugin can have mutiple components, each component may need to be
+ # installed on different inventory or have its own configuration.
+ # due to Compass4nfv currently only supports ansible, so each component
+ # of the installation and configuration script need to be use ansible.
+ # cm : congfiguration management tool : only ansible support
+ # role: each component corresponds to ansible script that locates in the same
+ # directory as plugin.desc.
+ # phrase: pre_openstack -- the component is installed after the OS
+ # provisioning, before the OpenStack deployment.
+ # phrase: post_openstack -- the component is installed before the OpenStack
+ # deployment.
+ # inventory: if the phrase is pre_openstack, inventory can be controller and
+ # compute. if the phrase is post_openstack, inventory can be get from the file
+ # openstack-ansible.inventory
+ orchestration:
+ cm: ansible
+ roles:
+ - role: moon
+ phrase: post_openstack
+ inventory:
+ - moon
diff --git a/plugins/moon/roles/moon/tasks/main.yml b/plugins/moon/roles/moon/tasks/main.yml
new file mode 100644
index 00000000..91283129
--- /dev/null
+++ b/plugins/moon/roles/moon/tasks/main.yml
@@ -0,0 +1,11 @@
+##############################################################################
+# Copyright (c) 2016-2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+---
+- include: moon.yml
+ when: moon is defined and moon == "Enable" and ansible_os_family == "Debian"
diff --git a/plugins/moon/roles/moon/tasks/moon.yml b/plugins/moon/roles/moon/tasks/moon.yml
new file mode 100644
index 00000000..4edc4579
--- /dev/null
+++ b/plugins/moon/roles/moon/tasks/moon.yml
@@ -0,0 +1,204 @@
+#############################################################################
+# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+---
+- name: rm pip.conf
+ file:
+ path: /root/.pip/pip.conf
+ state: absent
+
+- name: check docker.list stat
+ stat:
+ path: /etc/apt/sources.list.d/docker.list
+ register: stat_result
+
+# [WARNING]: Consider using get_url or uri module rather than running wget
+- name: install docker
+ remote_user: root
+ shell: wget -qO- https://get.docker.com/ | sh
+ when: stat_result.stat.exists == False
+
+- name: remove conflict packages
+ remote_user: root
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
+ with_items:
+ - python3-pkg-resources
+
+- name: install dependent packages
+ remote_user: root
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - git
+ - python3-dev
+ - python3-pip
+ - python3-venv
+ - python3-setuptools
+
+- name: make ubuntu dir
+ file:
+ path: /home/ubuntu
+ state: directory
+ mode: 0755
+
+- name: check moon code dir exists
+ stat:
+ path: /home/ubuntu/moon
+ register: stat_result
+
+- name: fetch moon source code
+ shell: git clone https://git.opnfv.org/moon /home/ubuntu/moon
+ when: stat_result.stat.exists == False
+
+- name: create moon etc conf
+ remote_user: root
+ file:
+ src: /home/ubuntu/moon/moonv4/moon_orchestrator/conf
+ dest: /etc/moon
+ state: link
+
+- name: configure moon.conf
+ lineinfile:
+ dest: /etc/moon/moon.conf
+ regexp: '{{ item.regexp }}'
+ line: '{{ item.line }}'
+ with_items:
+ - regexp: '^dist_dir=.*'
+ line: 'dist_dir=/home/ubuntu/moon/moonv4/moon_orchestrator/dist'
+ - regexp: '^password=.*'
+ line: 'password={{ ADMIN_PASS }}'
+
+- name: configure moon.conf for moon slave
+ lineinfile:
+ dest: /etc/moon/moon.conf
+ regexp: '{{ item.regexp }}'
+ line: '{{ item.line }}'
+ with_items:
+ - regexp: '^slave_name=.*'
+ line: 'slave_name={{ moon_slave_name }}'
+ - regexp: '^master_url=.*'
+ line: 'master_url=rabbit://moon:p4sswOrd1@{{ moon_master_ip }}/moon'
+ - regexp: '^master_login.*'
+ line: 'master_login=moon'
+ - regexp: '^master_password=.*'
+ line: 'master_password=p4sswOrd1'
+ when: moon_slave == "Enable"
+
+- name: list container netwroks
+ shell: docker network ls --format \{\{.Name\}\}
+ register: result
+
+- name: dump template generated file content
+ debug:
+ msg: "{{ result.stdout }}"
+
+- name: create moon network
+ shell: docker network create -d bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 moon
+ when: result.stdout.find("moon") == -1
+
+- name: list containers
+ shell: docker ps --format \{\{.Names\}\}
+ register: result
+
+- name: start rabbitmq
+ shell: |
+ docker run -dti \
+ --net=moon \
+ --hostname messenger \
+ --name messenger \
+ --link messenger:messenger \
+ -e RABBITMQ_DEFAULT_USER=moon \
+ -e RABBITMQ_DEFAULT_PASS=p4sswOrd1 \
+ -e RABBITMQ_NODENAME=rabbit@messenger \
+ -e RABBITMQ_DEFAULT_VHOST=moon \
+ -p 5671:5671 \
+ -p 5672:5672 \
+ rabbitmq:3-management
+ when: result.stdout.find("messenger") == -1
+
+- name: dump template generated file content
+ debug:
+ msg: "{{ result.stdout }}"
+
+- name: start mysql
+ shell: docker run -dti \
+ --net=moon \
+ --hostname db \
+ --name db \
+ -e MYSQL_ROOT_PASSWORD=p4sswOrd1 \
+ -e MYSQL_DATABASE=moon \
+ -e MYSQL_USER=moon \
+ -e MYSQL_PASSWORD=p4sswOrd1 \
+ -p 3306:3306 \
+ mysql:latest
+ when: result.stdout.find("db") == -1
+
+- name: set messenger and db hosts name
+ remote_user: root
+ lineinfile:
+ dest: /etc/hosts
+ regexp: 'messenger'
+ line: '127.0.0.1 messenger db'
+
+- name: set keystone hosts name
+ remote_user: root
+ lineinfile:
+ dest: /etc/hosts
+ regexp: 'keystone'
+ line: '{{ internal_vip.ip }} keystone'
+
+- name: update pip
+ remote_user: root
+ shell: pip3 install pip --upgrade
+
+- name: run moon build_all.sh
+ shell: |
+ export MOON_HOME=/home/ubuntu/moon/moonv4;
+ cd ${MOON_HOME}/bin;
+ source build_all.sh;
+ args:
+ executable: /bin/bash
+
+- name: modify moon start.sh
+ lineinfile:
+ dest: /home/ubuntu/moon/moonv4/bin/start.sh
+ state: absent
+ regexp: "{{ item }}"
+ with_items:
+ - "^sleep 20s"
+ - "^.*starting Keystone container.*"
+ - "^docker run .*keystone.*"
+
+- name: run moon start.sh
+ shell: |
+ export MOON_HOME=/home/ubuntu/moon/moonv4;
+ cd ${MOON_HOME}/moon_orchestrator;
+ if [ ! -d tests/venv ]; then
+ pyvenv tests/venv;
+ source tests/venv/bin/activate;
+ pip3 install -r requirements.txt --upgrade;
+ pip3 install dist/moon_db-0.1.0.tar.gz --upgrade;
+ pip3 install dist/moon_utilities-0.1.0.tar.gz --upgrade;
+ pip3 install . --upgrade;
+ cd ../moon_db/;
+ pip3 install -r requirements.txt --upgrade;
+ else
+ source tests/venv/bin/activate;
+ fi
+ killall -9 /home/ubuntu/moon/moonv4/moon_orchestrator/tests/venv/bin/python3.5
+ sleep 3
+ ( ( nohup ../bin/start.sh > /tmp/start.log 2>&1 ) & );
+ args:
+ executable: /bin/bash
+
+- name: fetch template generated file content
+ shell: whoami
+ register: template_gen_out
+
+- name: dump template generated file content
+ debug:
+ msg: "{{ template_gen_out.stdout }}"