aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/adapters/ansible/roles/ext-network/tasks/main.yml1
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/files/onos.service20
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/files/setup_networks/log.py43
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/files/setup_networks/net_init20
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/files/setup_networks/setup_networks.py86
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/main.yml92
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml73
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml160
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml29
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/templates/keepalived.conf47
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/templates/my_configs.debian14
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/templates/network.cfg5
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/templates/org.apache.karaf.features.cfg49
-rwxr-xr-xdeploy/adapters/ansible/roles/onos_cluster/vars/main.yml6
-rw-r--r--deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py9
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_post_install_network_config9
-rwxr-xr-xdeploy/compass_conf/package_metadata/openstack.conf62
-rwxr-xr-xdeploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl1
-rw-r--r--deploy/conf/hardware_environment/huawei-pod1/network_openo.yml21
-rw-r--r--deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml10
-rw-r--r--deploy/conf/hardware_environment/huawei-pod2/network_openo.yml21
-rw-r--r--deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml10
-rw-r--r--deploy/conf/hardware_environment/intel-pod8/network_openo.yml19
-rw-r--r--deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml8
-rw-r--r--deploy/conf/vm_environment/huawei-virtual1/network_openo.yml19
-rw-r--r--deploy/conf/vm_environment/huawei-virtual2/network_openo.yml19
-rw-r--r--deploy/conf/vm_environment/huawei-virtual3/network_openo.yml19
-rw-r--r--deploy/conf/vm_environment/huawei-virtual4/network_openo.yml19
-rw-r--r--deploy/conf/vm_environment/huawei-virtual7/network_openo.yml19
-rw-r--r--deploy/conf/vm_environment/os-nosdn-openo-ha.yml8
-rwxr-xr-xdeploy/launch.sh4
-rw-r--r--deploy/opera_adapter.py84
32 files changed, 735 insertions, 271 deletions
diff --git a/deploy/adapters/ansible/roles/ext-network/tasks/main.yml b/deploy/adapters/ansible/roles/ext-network/tasks/main.yml
index b73bb0a9..eb95f636 100644
--- a/deploy/adapters/ansible/roles/ext-network/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/ext-network/tasks/main.yml
@@ -39,7 +39,6 @@
cloud: opnfv
name: "{{ public_net_info.network }}"
provider_network_type: "{{ public_net_info.type }}"
- provider_physical_network: "{{ public_net_info.provider_network }}"
provider_segmentation_id: "{{ public_net_info.segment_id }}"
shared: false
external: "yes"
diff --git a/deploy/adapters/ansible/roles/onos_cluster/files/onos.service b/deploy/adapters/ansible/roles/onos_cluster/files/onos.service
new file mode 100755
index 00000000..2f4e8dd4
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/files/onos.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=ONOS
+After=
+
+
+[Service]
+User=root
+Group=root
+Type=simple
+WorkingDirectory=/opt/onos/apache-karaf-3.0.5
+PermissionsStartOnly=true
+ExecStartPre=
+ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -server -Xms128M -Xmx512M -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dcom.sun.management.jmxremote -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/onos/apache-karaf-3.0.5/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/onos/apache-karaf-3.0.5/lib/ext -Dkaraf.instances=/opt/onos/apache-karaf-3.0.5/instances -Dkaraf.home=/opt/onos/apache-karaf-3.0.5 -Dkaraf.base=/opt/onos/apache-karaf-3.0.5 -Dkaraf.data=/opt/onos/apache-karaf-3.0.5/data -Dkaraf.etc=/opt/onos/apache-karaf-3.0.5/etc -Djava.io.tmpdir=/opt/onos/apache-karaf-3.0.5/data/tmp -Djava.util.logging.config.file=/opt/onos/apache-karaf-3.0.5/etc/java.util.logging.properties -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true -classpath /opt/onos/apache-karaf-3.0.5/lib/karaf-jaas-boot.jar:/opt/onos/apache-karaf-3.0.5/lib/karaf-org.osgi.core.jar:/opt/onos/apache-karaf-3.0.5/lib/karaf.jar org.apache.karaf.main.Main
+Restart=on-failure
+LimitNOFILE=65535
+TimeoutStopSec=15
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/log.py b/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/log.py
new file mode 100755
index 00000000..a22ff0fe
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/log.py
@@ -0,0 +1,43 @@
+import logging
+import os
+loggers = {}
+log_dir = "/var/log/setup_network"
+try:
+ os.makedirs(log_dir)
+except:
+ pass
+
+
+def getLogger(name):
+ if name in loggers:
+ return loggers[name]
+
+ logger = logging.getLogger(name)
+ logger.setLevel(logging.DEBUG)
+
+ # create file handler which logs even debug messages
+ log_file = "%s/%s.log" % (log_dir, name)
+ try:
+ os.remove(log_file)
+ except:
+ pass
+
+ fh = logging.FileHandler(log_file)
+ fh.setLevel(logging.DEBUG)
+
+ # create console handler with a higher log level
+ ch = logging.StreamHandler()
+ ch.setLevel(logging.ERROR)
+
+ # create formatter and add it to the handlers
+ formatter = logging.Formatter(
+ "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
+ ch.setFormatter(formatter)
+ fh.setFormatter(formatter)
+
+ # add the handlers to logger
+ logger.addHandler(ch)
+ logger.addHandler(fh)
+
+ loggers[name] = logger
+ return logger
diff --git a/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/net_init b/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/net_init
new file mode 100755
index 00000000..c27a8bf8
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/net_init
@@ -0,0 +1,20 @@
+#!/bin/bash
+## BEGIN INIT INFO
+# Provides: anamon.init
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 4 6
+# Required-Start: $network
+# Short-Description: Starts the cobbler anamon boot notification program
+# Description: anamon runs the first time a machine is booted after
+# installation.
+## END INIT INFO
+
+#
+# anamon.init: Starts the cobbler post-install boot notification program
+#
+# chkconfig: 35 0 6
+#
+# description: anamon runs the first time a machine is booted after
+# installation.
+#
+python /opt/setup_networks/setup_networks.py
diff --git a/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/setup_networks.py
new file mode 100755
index 00000000..a25d7ea9
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/files/setup_networks/setup_networks.py
@@ -0,0 +1,86 @@
+import yaml
+import netaddr
+import os
+import log as logging
+
+LOG = logging.getLogger("net-init")
+config_path = os.path.join(os.path.dirname(__file__), "network.cfg")
+
+
+def setup_bondings(bond_mappings):
+ print bond_mappings
+
+
+def add_vlan_link(interface, ifname, vlan_id):
+ LOG.info("add_vlan_link enter")
+ cmd = "ip link add link %s name %s type vlan id %s; " % (
+ ifname, interface, vlan_id)
+ cmd += "ip link set %s up; ip link set %s up" % (interface, ifname)
+ LOG.info("add_vlan_link: cmd=%s" % cmd)
+ os.system(cmd)
+
+
+def add_ovs_port(ovs_br, ifname, uplink, vlan_id=None):
+ LOG.info("add_ovs_port enter")
+ cmd = "ovs-vsctl --may-exist add-port %s %s" % (ovs_br, ifname)
+ if vlan_id:
+ cmd += " tag=%s" % vlan_id
+ cmd += " -- set Interface %s type=internal;" % ifname
+ cmd += "ip link set dev %s address `ip link show %s |awk \
+ '/link\/ether/{print $2}'`;" \
+ % (ifname, uplink)
+ cmd += "ip link set %s up;" % ifname
+ LOG.info("add_ovs_port: cmd=%s" % cmd)
+ os.system(cmd)
+
+
+def setup_intfs(sys_intf_mappings, uplink_map):
+ LOG.info("setup_intfs enter")
+ for intf_name, intf_info in sys_intf_mappings.items():
+ if intf_info["type"] == "vlan":
+ add_vlan_link(
+ intf_name,
+ intf_info["interface"],
+ intf_info["vlan_tag"])
+ elif intf_info["type"] == "ovs":
+ add_ovs_port(
+ intf_info["interface"],
+ intf_name,
+ uplink_map[intf_info["interface"]],
+ vlan_id=intf_info.get("vlan_tag"))
+ else:
+ pass
+
+
+def setup_ips(ip_settings, sys_intf_mappings):
+ LOG.info("setup_ips enter")
+ for intf_info in ip_settings.values():
+ network = netaddr.IPNetwork(intf_info["cidr"])
+ if sys_intf_mappings[intf_info["name"]]["type"] == "ovs":
+ intf_name = intf_info["name"]
+ else:
+ intf_name = intf_info["alias"]
+ cmd = "ip addr add %s/%s brd %s dev %s;" \
+ % (intf_info["ip"], intf_info["netmask"], str(network.broadcast), intf_name) # noqa: E501
+ if "gw" in intf_info:
+ cmd += "route del default;"
+ cmd += "ip route add default via %s dev %s" % (
+ intf_info["gw"], intf_name)
+ LOG.info("setup_ips: cmd=%s" % cmd)
+ os.system(cmd)
+
+
+def main(config):
+ uplink_map = {}
+ setup_bondings(config["bond_mappings"])
+ for provider_net in config["provider_net_mappings"]:
+ uplink_map[provider_net['name']] = provider_net['interface']
+
+ setup_intfs(config["sys_intf_mappings"], uplink_map)
+ setup_ips(config["ip_settings"], config["sys_intf_mappings"])
+
+if __name__ == "__main__":
+ os.system(
+ "service openvswitch-switch status|| service openvswitch-switch start")
+ config = yaml.load(open(config_path))
+ main(config)
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
index 37f689f6..b86b149e 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/main.yml
@@ -9,15 +9,20 @@
---
- include_vars: "{{ ansible_os_family }}.yml"
-- name: remove neutron-plugin-openvswitch-agent auto start
+- name: install onos related packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: "{{ packages | union(packages_noarch) }}"
+ when: groups['onos']|length !=0
+
+- name: remove neutron-openvswitch-agent auto start
shell: >
- update-rc.d neutron-plugin-openvswitch-agent remove;
- sed -i /neutron-plugin-openvswitch-agent/d /opt/service
+ update-rc.d neutron-openvswitch-agent remove;
+ sed -i /neutron-openvswitch-agent/d /opt/service
when: groups['onos']|length !=0
ignore_errors: "True"
- name: shut down and disable Neutron's agent services
- service: name=neutron-plugin-openvswitch-agent state=stopped
+ service: name=neutron-openvswitch-agent state=stopped
when: groups['onos']|length !=0
ignore_errors: "True"
@@ -35,16 +40,85 @@
- name: Stop the Open vSwitch service and clear existing OVSDB
shell: >
- ovs-vsctl del-br br-int ;
- ovs-vsctl del-br br-tun ;
- ovs-vsctl del-manager ;
- ip link delete onos_port1 type veth peer name onos_port2;
+ service openvswitch-switch stop ;
+ rm -rf /var/log/openvswitch/* ;
+ rm -rf /etc/openvswitch/conf.db ;
+ service openvswitch-switch start ;
when: groups['onos']|length !=0
ignore_errors: "True"
+##################################################################
+########### Recover External network #################
+##################################################################
+
+- name: add ovs bridge
+ openvswitch_bridge: bridge={{ item["name"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and groups['onos']|length !=0
+
+- name: add ovs uplink
+ openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and groups['onos']|length !=0
+
+- name: add ovs uplink
+ shell: ip link set {{ item["interface"] }} up
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and groups['onos']|length !=0
+
+- name: ensure script dir exist
+ shell: mkdir -p /opt/setup_networks
+ when: groups['onos']|length !=0
+
+- name: copy scripts
+ copy: src={{ item }} dest=/opt/setup_networks
+ with_items:
+ - setup_networks/log.py
+ - setup_networks/setup_networks.py
+ when: groups['onos']|length !=0
+
+- name: copy boot scripts
+ copy: src={{ item }} dest=/etc/init.d/ mode=0755
+ with_items:
+ - setup_networks/net_init
+ when: groups['onos']|length !=0
+
+- name: copy config files
+ template: src=network.cfg dest=/opt/setup_networks
+ when: groups['onos']|length !=0
+
+- name: make sure python lib exist
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - python-yaml
+ - python-netaddr
+ when: groups['onos']|length !=0
+
+- name: run scripts
+ shell: python /opt/setup_networks/setup_networks.py
+ when: groups['onos']|length !=0
+
+- name: add to boot scripts
+ service: name=net_init enabled=yes
+ when: groups['onos']|length !=0
+##################################################################
+
+- name: restart keepalived to recover external IP
+ shell: service keepalived restart
+ when: inventory_hostname in groups['onos']
+ ignore_errors: "True"
+
+- name: upgrade pbr
+ shell: |
+ pip install pbr --upgrade
+
- name: Install ONOS Cluster on Controller
include: onos_controller.yml
- when: inventory_hostname in groups['onos']
+ when: inventory_hostname in groups['onos'] and onos_sfc == "Disable"
+
+- name: Install ONOS Cluster on Controller
+ include: onos_sfc_controller.yml
+ when: inventory_hostname in groups['onos'] and onos_sfc == "Enable"
- name: Config ONOS Cluster
include: openvswitch.yml
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
index 1f7a0e76..87396bf0 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_controller.yml
@@ -17,35 +17,24 @@
url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"
dest: /opt/
-- name: upload onos sfc driver package
- get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_sfc_driver }}"
- dest: /opt/
-
- name: unarchive onos driver package
command: su -s /bin/sh -c "tar xvf /opt/networking-onos.tar -C /opt/"
-- name: upload onos sfc driver package
- command: su -s /bin/sh -c "tar xvf /opt/networking-sfc.tar -C /opt/"
-
- name: install onos driver
command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh"
-- name: install onos sfc driver
- command: su -s /bin/sh -c "/opt/networking-sfc/install_driver.sh"
-
-- name: install onos required packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
- with_items: packages
-
- name: download oracle-jdk8 package file
get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_pkg_name }}"
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ jdk8_pkg_name }}"
dest: /opt/{{ jdk8_pkg_name }}
+- name: install onos required packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: "{{ packages }}"
+
- name: download oracle-jdk8 script file
get_url:
- url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ jdk8_script_name }}"
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ jdk8_script_name }}"
dest: /opt/
- name: unarchive onos driver package
@@ -98,25 +87,35 @@
su -s /bin/sh -c "tar xzf /opt/{{ onos_pkg_name }} -C {{ onos_home }} \
--strip-components 1 --no-overwrite-dir -k --skip-old-files" onos
+- name: copy onos.service
+ copy:
+ src: "{{ onos_service_file.src }}"
+ dest: "{{ onos_service_file.dst }}"
+ mode: 0755
+
- name: configure onos service
shell: >
echo 'export ONOS_OPTS=debug' > {{ onos_home }}/options;
echo 'export ONOS_USER=root' >> {{ onos_home }}/options;
mkdir {{ onos_home }}/var;
mkdir {{ onos_home }}/config;
- sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' \
- {{ onos_home }}/init/onos.conf;
- cp -rf {{ onos_home }}/init/onos.conf /etc/init/;
- cp -rf {{ onos_home }}/init/onos.conf /etc/init.d/;
-- name: configure onos boot feature
- shell: >
- sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' \
- {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg;
+- name: create karaf config
+ template:
+ src: org.apache.karaf.features.cfg
+ dest: "{{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg"
+ owner: onos
+ group: onos
+ mode: 0775
- name: wait for config time
shell: "sleep 10"
+- name: chown onos directory and files
+ shell: >
+ chown -R onos:onos "{{ onos_home }}";
+ chown onos:onos "{{ onos_service_file.dst }}";
+
- name: start onos service
service: name=onos state=started enabled=yes
@@ -129,15 +128,28 @@
- name: Configure Neutron1
shell: >
- crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \
- networking_sfc.services.sfc.plugin.SfcPlugin, \
- networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin, onos_router;
+ crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins onos_router;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 \
mechanism_drivers onos_ml2;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 \
tenant_network_types vxlan;
crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan
+- name: configure metadata
+ shell: |
+ crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \
+ enable_isolated_metadata "True";
+
+- name: force metadata
+ shell: |
+ crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \
+ force_metadata "True";
+
+- name: configure vsctl for dhcp agent
+ shell: |
+ crudini --set /etc/neutron/dhcp_agent.ini OVS \
+ ovsdb_interface vsctl;
+
- name: Create ML2 Configuration File
template:
src: ml2_conf.sh
@@ -155,8 +167,9 @@
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" \
neutron;
- su -s /bin/sh -c "neutron-db-manage --subproject networking-sfc \
- upgrade head" neutron;
+
+- name: Restart neutron-dhcp-agent
+ service: name=neutron-dhcp-agent state=restarted
- name: Restart neutron-server
service: name=neutron-server state=restarted
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml
new file mode 100755
index 00000000..26679373
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/onos_sfc_controller.yml
@@ -0,0 +1,160 @@
+##############################################################################
+# Copyright (c) 2016 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: get image http server
+ shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf
+ register: http_server
+
+- name: download onos driver packages
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_driver }}"
+ dest: /opt/
+
+- name: download onos sfc driver package
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_sfc_driver }}"
+ dest: /opt/
+
+- name: unarchive onos driver package
+ command: su -s /bin/sh -c "tar xvf /opt/networking-onos.tar -C /opt/"
+
+- name: unarchive onos sfc driver package
+ command: su -s /bin/sh -c "tar xvf /opt/networking-sfc.tar -C /opt/"
+
+- name: install onos driver
+ command: su -s /bin/sh -c "/opt/networking-onos/install_driver.sh"
+
+- name: install onos sfc driver
+ command: su -s /bin/sh -c "/opt/networking-sfc/install_driver.sh"
+
+- name: install onos required packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: packages
+
+- name: download oracle-jdk8 package file
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ jdk8_pkg_name }}"
+ dest: /opt/{{ jdk8_pkg_name }}
+
+- name: download oracle-jdk8 script file
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/java/{{ jdk8_script_name }}"
+ dest: /opt/
+
+- name: unarchive onos driver package
+ command: su -s /bin/sh -c "tar xvf /opt/install_jdk8.tar -C /opt/"
+
+- name: install install_jdk8 package
+ command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh"
+
+- name: create JAVA_HOME environment variable
+ shell: >
+ export J2SDKDIR=/usr/lib/jvm/java-8-oracle;
+ export J2REDIR=/usr/lib/jvm/java-8-oracle/jre;
+ export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin;
+ export PATH=$PATH:/usr/lib/jvm/java-8-oracle/db/bin;
+ export PATH=$PATH:/usr/lib/jvm/java-8-oracle/jre/bin;
+ export JAVA_HOME=/usr/lib/jvm/java-8-oracle;
+ export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db;
+
+- name: create onos group
+ group: name=onos system=yes state=present
+
+- name: create onos user
+ user:
+ name: onos
+ group: onos
+ home: "{{ onos_home }}"
+ createhome: "yes"
+ system: "yes"
+ shell: "/bin/false"
+
+- name: download onos package
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ onos_pkg_name }}"
+ dest: /opt/{{ onos_pkg_name }}
+
+- name: create new jar repository
+ command: su -s /bin/sh -c "mkdir ~/.m2"
+ ignore_errors: "True"
+
+- name: download jar repository
+ get_url:
+ url: "http://{{ http_server.stdout_lines[0] }}/packages/onos/{{ repository }}"
+ dest: ~/.m2/
+
+- name: extract jar repository
+ command: su -s /bin/sh -c "tar xvf ~/.m2/repository.tar -C ~/.m2/"
+
+- name: extract onos package
+ command: |
+ su -s /bin/sh -c "tar xzf /opt/{{ onos_pkg_name }} -C {{ onos_home }} \
+ --strip-components 1 --no-overwrite-dir -k --skip-old-files" onos
+
+- name: configure onos service
+ shell: >
+ echo 'export ONOS_OPTS=debug' > {{ onos_home }}/options;
+ echo 'export ONOS_USER=root' >> {{ onos_home }}/options;
+ mkdir {{ onos_home }}/var;
+ mkdir {{ onos_home }}/config;
+ sed -i '/pre-stop/i\env JAVA_HOME=/usr/lib/jvm/java-8-oracle' {{ onos_home }}/init/onos.conf;
+ cp -rf {{ onos_home }}/init/onos.conf /etc/init/;
+ cp -rf {{ onos_home }}/init/onos.conf /etc/init.d/;
+
+- name: configure onos boot feature
+ shell: >
+ sed -i '/^featuresBoot=/c\featuresBoot={{ onos_boot_features }}' \
+ {{ onos_home }}/{{ karaf_dist }}/etc/org.apache.karaf.features.cfg;
+
+- name: wait for config time
+ shell: "sleep 10"
+
+- name: start onos service
+ service: name=onos state=started enabled=yes
+
+- name: wait for onos start time
+ shell: "sleep 200"
+
+- name: add onos auto start
+ shell: >
+ echo "onos">>/opt/service
+
+#########################################################################################
+################################ ONOS connect with OpenStack #######################
+#########################################################################################
+- name: Configure Neutron1
+ shell: >
+ crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \
+ networking_sfc.services.sfc.plugin.SfcPlugin, \
+ networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin,onos_router;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers onos_ml2;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan;
+ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers vxlan
+
+- name: Create ML2 Configuration File
+ template:
+ src: ml2_conf.sh
+ dest: "/opt/ml2_conf.sh"
+ mode: 0777
+
+- name: Configure Neutron2
+ command: su -s /bin/sh -c "/opt/ml2_conf.sh;"
+
+- name: Configure Neutron3
+ shell: >
+ mysql -e "drop database if exists neutron_ml2;";
+ mysql -e "create database neutron_ml2 character set utf8;";
+ mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';";
+ su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
+ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron;
+ su -s /bin/sh -c "neutron-db-manage --subproject networking-sfc upgrade head" neutron;
+
+- name: Restart neutron-server
+ service: name=neutron-server state=restarted
diff --git a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
index 4dfa6d45..7541d108 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/tasks/openvswitch.yml
@@ -1,11 +1,11 @@
-##############################################################################
+###############################################################################
# Copyright (c) 2016 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: set veth port
@@ -15,24 +15,31 @@
ifconfig onos_port2 up;
ignore_errors: "True"
-- name: add openflow-base feature
+- name: set veth to ovs
+ shell: >
+ export externamMac=`ifconfig eth1 | grep -Eo '\<[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'`;
+ ifconfig onos_port2 hw ether $externamMac;
+ ovs-vsctl add-port br-prv onos_port1;
+ ignore_errors: "True"
+
+- name: add onos optical model feature
command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow-base'";
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-optical-model'";
when: inventory_hostname in groups['onos']
-- name: add openflow feature
+- name: add openflow-base feature
command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-openflow'";
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-providers-openflow-base'";
when: inventory_hostname in groups['onos']
-- name: add ovsdatabase feature
+- name: add openflow feature
command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdatabase'";
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-providers-openflow-message'";
when: inventory_hostname in groups['onos']
- name: add ovsdb-base feature
command: |
- su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-ovsdb-base'";
+ su -s /bin/sh -c "/opt/onos/bin/onos 'feature:install onos-providers-ovsdb-base'";
when: inventory_hostname in groups['onos']
- name: add onos driver ovsdb feature
@@ -43,13 +50,13 @@
- name: add ovsdb provider host feature
command: |
su -s /bin/sh -c \
- "/opt/onos/bin/onos 'feature:install onos-ovsdb-provider-host'";
+ "/opt/onos/bin/onos 'feature:install onos-providers-ovsdb-host'";
when: inventory_hostname in groups['onos']
- name: add vtn feature
command: |
su -s /bin/sh -c \
- "/opt/onos/bin/onos 'feature:install onos-app-vtn-onosfw'";
+ "/opt/onos/bin/onos 'feature:install onos-apps-vtn'";
when: inventory_hostname in groups['onos']
- name: set public eth card start
diff --git a/deploy/adapters/ansible/roles/onos_cluster/templates/keepalived.conf b/deploy/adapters/ansible/roles/onos_cluster/templates/keepalived.conf
new file mode 100755
index 00000000..4ccf1c43
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/templates/keepalived.conf
@@ -0,0 +1,47 @@
+global_defs {
+ router_id {{ inventory_hostname }}
+}
+
+vrrp_sync_group VG1 {
+ group {
+ internal_vip
+ public_vip
+ }
+}
+
+vrrp_instance internal_vip {
+ interface {{ internal_vip.interface }}
+ virtual_router_id {{ vrouter_id_internal }}
+ state BACKUP
+ nopreempt
+ advert_int 1
+ priority {{ 50 + (host_index[inventory_hostname] * 50) }}
+
+ authentication {
+ auth_type PASS
+ auth_pass 1234
+ }
+
+ virtual_ipaddress {
+ {{ internal_vip.ip }}/{{ internal_vip.netmask }} dev {{ internal_vip.interface }}
+ }
+}
+
+vrrp_instance public_vip {
+ interface br-ex
+ virtual_router_id {{ vrouter_id_public }}
+ state BACKUP
+ nopreempt
+ advert_int 1
+ priority {{ 50 + (host_index[inventory_hostname] * 50) }}
+
+ authentication {
+ auth_type PASS
+ auth_pass 4321
+ }
+
+ virtual_ipaddress {
+ {{ network_cfg.public_vip.ip }}/{{ network_cfg.public_vip.netmask }} dev br-ex
+ }
+
+}
diff --git a/deploy/adapters/ansible/roles/onos_cluster/templates/my_configs.debian b/deploy/adapters/ansible/roles/onos_cluster/templates/my_configs.debian
new file mode 100755
index 00000000..5ab1519b
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/templates/my_configs.debian
@@ -0,0 +1,14 @@
+{%- for alias, intf in host_ip_settings.items() %}
+
+auto {{ alias }}
+iface {{ alias }} inet static
+ address {{ intf["ip"] }}
+ netmask {{ intf["netmask"] }}
+{% if "gw" in intf %}
+ gateway {{ intf["gw"] }}
+{% endif %}
+{% if intf["name"] == alias %}
+ pre-up ip link set {{ sys_intf_mappings[alias]["interface"] }} up
+ pre-up ip link add link {{ sys_intf_mappings[alias]["interface"] }} name {{ alias }} type vlan id {{ sys_intf_mappings[alias]["vlan_tag"] }}
+{% endif %}
+{% endfor %}
diff --git a/deploy/adapters/ansible/roles/onos_cluster/templates/network.cfg b/deploy/adapters/ansible/roles/onos_cluster/templates/network.cfg
new file mode 100755
index 00000000..cf271ad6
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/templates/network.cfg
@@ -0,0 +1,5 @@
+bond_mappings: {{ network_cfg["bond_mappings"] | to_json }}
+ip_settings: {{ ip_settings[inventory_hostname] | to_json }}
+sys_intf_mappings: {{ sys_intf_mappings | to_json }}
+provider_net_mappings: {{ network_cfg["provider_net_mappings"] | to_json }}
+
diff --git a/deploy/adapters/ansible/roles/onos_cluster/templates/org.apache.karaf.features.cfg b/deploy/adapters/ansible/roles/onos_cluster/templates/org.apache.karaf.features.cfg
new file mode 100755
index 00000000..321f0ab8
--- /dev/null
+++ b/deploy/adapters/ansible/roles/onos_cluster/templates/org.apache.karaf.features.cfg
@@ -0,0 +1,49 @@
+################################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+################################################################################
+
+#
+# Defines if the startlvl should be respected during feature startup. The default value is true. The default
+# behavior for 2.x is false (!) for this property
+#
+# Be aware that this property is deprecated and will be removed in Karaf 4.0. So, if you need to
+# set this to false, please use this only as a temporary solution!
+#
+#respectStartLvlDuringFeatureStartup=true
+
+
+#
+# Defines if the startlvl should be respected during feature uninstall. The default value is true.
+# If true, means stop bundles respecting the descend order of start level in a certain feature.
+#
+#respectStartLvlDuringFeatureUninstall=true
+
+#
+# Comma separated list of features repositories to register by default
+#
+featuresRepositories=mvn:org.apache.karaf.features/standard/3.0.5/xml/features,mvn:org.onosproject/onos-features/1.8.4/xml/features
+
+#
+# Comma separated list of features to install at startup
+#
+featuresBoot=config,standard,region,package,kar,ssh,management,webconsole,onos-api,onos-core,onos-incubator,onos-cli,onos-rest,onos-gui
+
+#
+# Defines if the boot features are started in asynchronous mode (in a dedicated thread)
+#
+featuresBootAsynchronous=false
diff --git a/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml b/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml
index 9389ed6b..eaf4ed53 100755
--- a/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml
+++ b/deploy/adapters/ansible/roles/onos_cluster/vars/main.yml
@@ -7,7 +7,8 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-onos_pkg_name: onos-1.6.0.tar.gz
+packages_noarch: []
+onos_pkg_name: onos-1.8.4.tar.gz
onos_home: /opt/onos/
karaf_dist: apache-karaf-3.0.5
jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz
@@ -15,6 +16,9 @@ jdk8_script_name: install_jdk8.tar
onos_driver: networking-onos.tar
onos_sfc_driver: networking-sfc.tar
repository: repository.tar
+onos_service_file:
+ src: onos.service
+ dst: /lib/systemd/system/onos.service
onos_boot_features:
- config
- standard
diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
index ab13e088..64c0469e 100644
--- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
@@ -10,6 +10,8 @@
import yaml
import netaddr
import os
+import platform
+import re
import log as logging
LOG = logging.getLogger("net-init")
@@ -88,6 +90,11 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
if __name__ == "__main__":
- os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa
+ if re.search('Ubuntu', platform.platform()):
+ os.system("service openvswitch-switch start")
+ elif re.search('redhat|centos', platform.platform()):
+ os.system("service openvswitch start")
+ else:
+ os.system("echo 'ERROR: no service named openvswitch'")
config = yaml.load(open(config_path))
main(config)
diff --git a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config
index 7d4dcb9d..f15b6be2 100644
--- a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config
+++ b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config
@@ -50,14 +50,7 @@ echo "physical interfaces: \${physical_interfaces}" >> /tmp/network_log
# map physical interface to mac address
mac_names=""
for physical_interface in \${physical_interfaces}; do
- set \$(ip link show \${physical_interface})
-#if $osversion == "trusty"
- mac=\$(echo \$@ | cut -d' ' -f17)
-#elif $osversion == "xenial"
- mac=\$(echo \$@ | cut -d' ' -f17)
-#else
- mac=\$(echo \$@ | cut -d' ' -f13)
-#end if
+ mac=\$(ip link show \${physical_interface} | awk 'match(\$0,/link\/ether/) {print \$2}')
mac_name=\$(echo \${mac} |tr 'a-z' 'A-Z' | tr ':' '_')
if [ -z "\${mac_name}" ]; then
mac_names="\${mac_name}"
diff --git a/deploy/compass_conf/package_metadata/openstack.conf b/deploy/compass_conf/package_metadata/openstack.conf
index 555f007c..b07efd4e 100755
--- a/deploy/compass_conf/package_metadata/openstack.conf
+++ b/deploy/compass_conf/package_metadata/openstack.conf
@@ -250,79 +250,29 @@ METADATA = {
'is_required': False
},
- 'openo_vm_ip': {
+ 'openo_ip': {
'_self': {
- 'mapping_to': 'openo_vm_ip',
+ 'mapping_to': 'openo_ip',
'is_required': False,
'field': 'general',
}
},
- 'openo_vm_mask': {
+ 'openo_docker_gw': {
'_self': {
- 'mapping_to': 'openo_vm_mask',
+ 'mapping_to': 'openo_docker_gw',
'is_required': False,
'field': 'general',
}
},
- 'openo_external_gw': {
+ 'openo_docker_cidr': {
'_self': {
- 'mapping_to': 'openo_external_gw',
- 'is_required': False,
- 'field': 'general',
- }
- },
- 'openo_external_cidr': {
- '_self': {
- 'mapping_to': 'openo_external_cidr',
- 'is_required': False,
- 'field': 'general',
- }
- }
- },
-
- 'openo_docker_net': {
- '_self': {
- 'mapping_to': 'openo_docker_net',
- 'is_required': False
- },
-
- 'docker_ip_start': {
- '_self': {
- 'mapping_to': 'docker_ip_start',
- 'is_required': False,
- 'field': 'general',
- }
- },
- 'docker_ip_end': {
- '_self': {
- 'mapping_to': 'docker_ip_end',
+ 'mapping_to': 'openo_docker_cidr',
'is_required': False,
'field': 'general',
}
}
},
- 'juju_net': {
- '_self': {
- 'mapping_to': 'juju_net',
- 'is_required': False
- },
-
- 'juju_net_cidr': {
- '_self': {
- 'mapping_to': 'juju_net_cidr',
- 'is_required': False,
- 'field': 'general',
- }
- },
- 'juju_net_gw': {
- '_self': {
- 'mapping_to': 'juju_net_gw',
- 'is_required': False,
- 'field': 'general',
- }
- }
- },
'public_net_info': {
'_self': {
diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl
index b56a0b15..ac82a981 100755
--- a/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl
+++ b/deploy/compass_conf/templates/ansible_installer/openstack_newton/vars/HA-ansible-multinodes.tmpl
@@ -33,6 +33,7 @@ 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')
ip_settings: $ip_settings
network_cfg: $network_cfg
sys_intf_mappings: $sys_intf_mappings
diff --git a/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml b/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml
index 80b80fc6..6fc5bc45 100644
--- a/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml
+++ b/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+# 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
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.10.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.10.0/24"
floating_ip_start: "192.168.10.100"
floating_ip_end: "192.168.10.200"
-
-openo_net:
- openo_vm_ip: "192.168.10.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.10.1"
- openo_external_cidr: "192.168.10.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.10.51"
- docker_ip_end: "192.168.10.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml b/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml
index 6eb50a29..0d403bc2 100644
--- a/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml
+++ b/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+# 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
@@ -16,8 +16,12 @@ ipmiUser: root
ipmiVer: '2.0'
deploy_options:
- - orchestrator: open-o
- - application: clearwater
+ orchestrator:
+ type: open-o
+ version: 1.0.0
+
+ vnf:
+ type:
hosts:
- name: host1
diff --git a/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml b/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml
index 7f2d45d3..1bba2daa 100644
--- a/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml
+++ b/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+# 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
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.11.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.11.0/24"
floating_ip_start: "192.168.11.30"
floating_ip_end: "192.168.11.100"
-
-openo_net:
- openo_vm_ip: "192.168.11.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.11.1"
- openo_external_cidr: "192.168.11.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.11.51"
- docker_ip_end: "192.168.11.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml
index e1219ddc..a6dcccfb 100644
--- a/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml
+++ b/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+# 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
@@ -16,8 +16,12 @@ POWER_TOOL: ipmitool
ipmiVer: '2.0'
deploy_options:
- - orchestrator: open-o
- - application: clearwater
+ orchestrator:
+ type: open-o
+ version: 1.0.0
+
+ vnf:
+ type:
hosts:
- name: host1
diff --git a/deploy/conf/hardware_environment/intel-pod8/network_openo.yml b/deploy/conf/hardware_environment/intel-pod8/network_openo.yml
index 48c47f7d..12e40afb 100644
--- a/deploy/conf/hardware_environment/intel-pod8/network_openo.yml
+++ b/deploy/conf/hardware_environment/intel-pod8/network_openo.yml
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 10.8.15.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth4
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "10.8.15.0/24"
floating_ip_start: "10.8.15.100"
floating_ip_end: "10.8.15.200"
-
-openo_net:
- openo_vm_ip: "10.8.15.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "10.8.15.1"
- openo_external_cidr: "10.8.15.0/24"
-
-openo_docker_net:
- docker_ip_start: "10.8.15.51"
- docker_ip_end: "10.8.15.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml b/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml
index f70414cf..6d28a49e 100644
--- a/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml
+++ b/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml
@@ -17,8 +17,12 @@ ipmiPass: root
ipmiVer: '1.0'
deploy_options:
- - orchestrator: open-o
- - application: clearwater
+ orchestrator:
+ type: open-o
+ version: 1.0.0
+
+ vnf:
+ type:
hosts:
- name: host1
diff --git a/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml
index 980fee79..a31c2990 100644
--- a/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml
+++ b/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.107.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.107.0/24"
floating_ip_start: "192.168.107.101"
floating_ip_end: "192.168.107.199"
-
-openo_net:
- openo_vm_ip: "192.168.107.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.107.1"
- openo_external_cidr: "192.168.107.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.107.51"
- docker_ip_end: "192.168.107.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml
index da30e37a..98b3a83d 100644
--- a/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml
+++ b/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.106.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.106.0/24"
floating_ip_start: "192.168.106.101"
floating_ip_end: "192.168.106.199"
-
-openo_net:
- openo_vm_ip: "192.168.106.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.106.1"
- openo_external_cidr: "192.168.106.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.106.51"
- docker_ip_end: "192.168.106.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml
index 643dd249..fd2e2c0f 100644
--- a/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml
+++ b/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.101.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.101.0/24"
floating_ip_start: "192.168.101.101"
floating_ip_end: "192.168.101.199"
-
-openo_net:
- openo_vm_ip: "192.168.101.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.101.1"
- openo_external_cidr: "192.168.101.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.101.51"
- docker_ip_end: "192.168.101.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml
index 63536181..dfa1f177 100644
--- a/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml
+++ b/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.103.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.103.0/24"
floating_ip_start: "192.168.103.101"
floating_ip_end: "192.168.103.199"
-
-openo_net:
- openo_vm_ip: "192.168.103.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.103.1"
- openo_external_cidr: "192.168.103.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.103.51"
- docker_ip_end: "192.168.103.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml
index 2bf972e2..1567185e 100644
--- a/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml
+++ b/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml
@@ -83,6 +83,11 @@ public_vip:
netmask: "24"
interface: external
+openo_net:
+ openo_ip: 192.168.83.50
+ openo_docker_gw: 172.11.1.1
+ openo_docker_cidr: 172.11.1.0/24
+
onos_nic: eth2
public_net_info:
enable: "True"
@@ -98,17 +103,3 @@ public_net_info:
floating_ip_cidr: "192.168.83.0/24"
floating_ip_start: "192.168.83.101"
floating_ip_end: "192.168.83.199"
-
-openo_net:
- openo_vm_ip: "192.168.83.50"
- openo_vm_mask: "255.255.255.0"
- openo_external_gw: "192.168.83.250"
- openo_external_cidr: "192.168.83.0/24"
-
-openo_docker_net:
- docker_ip_start: "192.168.83.51"
- docker_ip_end: "192.168.83.90"
-
-juju_net:
- juju_net_cidr: "12.1.1.0/24"
- juju_net_gw: "12.1.1.1"
diff --git a/deploy/conf/vm_environment/os-nosdn-openo-ha.yml b/deploy/conf/vm_environment/os-nosdn-openo-ha.yml
index c26567f3..69784c5c 100644
--- a/deploy/conf/vm_environment/os-nosdn-openo-ha.yml
+++ b/deploy/conf/vm_environment/os-nosdn-openo-ha.yml
@@ -12,8 +12,12 @@ TYPE: virtual
FLAVOR: cluster
deploy_options:
- - orchestrator: open-o
- - application: clearwater
+ orchestrator:
+ type: open-o
+ version: 1.0.0
+
+ vnf:
+ type:
hosts:
- name: host1
diff --git a/deploy/launch.sh b/deploy/launch.sh
index aa476784..51b502f2 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -143,4 +143,8 @@ echo ""
if [[ ${DHA##*/} =~ "openo" ]]; then
python ${COMPASS_DIR}/deploy/opera_adapter.py $DHA $NETWORK
+ if [[ $? -ne 0 ]]; then
+ log_error 'opera launch failed'
+ exit 1
+ fi
fi
diff --git a/deploy/opera_adapter.py b/deploy/opera_adapter.py
index d040999f..f83638d7 100644
--- a/deploy/opera_adapter.py
+++ b/deploy/opera_adapter.py
@@ -8,11 +8,11 @@
##############################################################################
import os
-import yaml
import sys
+import yaml
+import re
import subprocess
import traceback
-import ipaddress
def load_file(file):
@@ -33,23 +33,38 @@ def dump_file(data, file):
return None
-def sync_openo_network_yml(network, net_config):
- """sync opera/conf/network.yml according to Network file"""
- for i in net_config["openo_net"].keys():
- net_config["openo_net"][i] = network["openo_net"][i]
+def sync_openo_config(openo_config, dha, network):
+ """sync opera/conf/open-o.yml according to DHA and Network file"""
+ deploy_opts = dha.get('deploy_options')
+ openo_net = network.get('openo_net')
+ if deploy_opts['orchestrator']['type'] != 'open-o':
+ print("orchestrator is not openo")
+ sys.exit(1)
+
+ openo_config['openo_version'] = deploy_opts['orchestrator']['version']
+ openo_config['vnf_type'] = deploy_opts['vnf']['type']
+ openo_config['openo_net']['openo_ip'] = openo_net['openo_ip']
+
+
+def sync_admin_openrc(network, admin_openrc_file):
+ ssh_opts = "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+ vip = network['public_vip']['ip']
+ cmd = 'sshpass -p"root" ssh %s root@%s "cat /opt/admin-openrc.sh"' \
+ % (ssh_opts, vip)
+ ssh = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ if ssh.stdout is None:
+ print("fetch openrc fail")
+ sys.exit(1)
- sorted_ips = sorted(net_config["openo_docker_net"].items(),
- key=lambda item: item[1])
- docker_ips = [i[0] for i in sorted_ips]
- docker_start_ip = unicode(network["openo_docker_net"]["docker_ip_start"],
- "utf-8")
- docker_start_ip = ipaddress.IPv4Address(docker_start_ip)
- for i in docker_ips:
- net_config["openo_docker_net"][i] = str(docker_start_ip)
- docker_start_ip += 1
+ rcdata = ssh.stdout.readlines()
+ with open(admin_openrc_file, 'w') as fd:
+ ip = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}")
+ for i in rcdata:
+ if 'OS_AUTH_URL' in i:
+ i = re.sub(ip, vip, i)
+ fd.write(i)
- for i in net_config["juju_net"].keys():
- net_config["juju_net"][i] = network["juju_net"][i]
+ fd.write('export OS_REGION_NAME=RegionOne')
if __name__ == "__main__":
@@ -58,12 +73,17 @@ if __name__ == "__main__":
sys.exit(1)
_, dha_file, network_file = sys.argv
+ compass_dir = os.getenv('COMPASS_DIR')
+
+ if not compass_dir:
+ print("env var COMPASS_DIR doesn't exist")
+ sys.exit(1)
if not os.path.exists(dha_file):
- print("DHA file doesn't exit")
+ print("DHA file doesn't exist")
sys.exit(1)
if not os.path.exists(network_file):
- print("NETWORK file doesn't exit")
+ print("NETWORK file doesn't exist")
sys.exit(1)
dha = load_file(dha_file)
@@ -76,27 +96,31 @@ if __name__ == "__main__":
print('format error in NETWORK: %s' % network_file)
sys.exit(1)
- if dha["deploy_options"][0]["orchestrator"] != "open-o":
- sys.exit(0)
-
- compass_dir = os.getenv('COMPASS_DIR')
work_dir = os.path.join(compass_dir, 'work')
opera_dir = os.path.join(work_dir, 'opera')
conf_dir = os.path.join(opera_dir, 'conf')
- net_config_file = os.path.join(conf_dir, 'network.yml')
+ openo_config_file = os.path.join(conf_dir, 'open-o.yml')
+ admin_openrc_file = os.path.join(conf_dir, 'admin-openrc.sh')
p1 = subprocess.Popen(
"git clone https://gerrit.opnfv.org/gerrit/opera",
cwd=work_dir, shell=True)
p1.communicate()
- if not os.path.exists(net_config_file):
- print('file opera/conf/network.yml not found')
+ if not os.path.exists(openo_config_file):
+ print('file opera/conf/open-o.yml not found')
+ sys.exit(1)
+ if not os.path.exists(admin_openrc_file):
+ print('file opera/conf/admin-openrc.sh not found')
sys.exit(1)
- net_config = load_file(net_config_file)
- sync_openo_network_yml(network, net_config)
- dump_file(net_config, net_config_file)
+ openo_config = load_file(openo_config_file)
+ sync_openo_config(openo_config, dha, network)
+ dump_file(openo_config, openo_config_file)
+ sync_admin_openrc(network, admin_openrc_file)
- p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True)
+ p2 = subprocess.Popen("sudo ./opera_launch.sh", cwd=opera_dir, shell=True)
p2.communicate()
+ if p2.returncode != 0:
+ print('./opera_launch.sh fail')
+ sys.exit(1)