From 3bc3a8828c3ceefedd08e1767ae6e3bf2df9ac22 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Wed, 23 Aug 2017 15:05:02 +0800 Subject: Support multiple physnet mapping JIRA: COMPASS-559 1. support multiple mapping in provider_net_mappings of network.yml and create corresponding ovs bridges 2. support seperate config in sys_intf_mappings of network.yml 3. remove linux bridges in compute nodes for ovs port binding convenience 4. support openstack vlan tenant network 5. modify odl and odl_sfc roles to use configurable provider mapping 6. remove some hard coding Change-Id: Ib57484ce60d029f89c647fd5baf2c7af37c85d0b Signed-off-by: Harry Huang --- .../ansible/openstack/HA-ansible-multinodes.yml | 42 ++++++++- .../roles/config-compute/templates/compute.j2 | 24 ++--- .../config-controller/templates/controller.j2 | 24 ++--- .../ansible/roles/config-osa/files/fetch-files.yml | 28 ------ .../config-osa/files/os-flavor/tasks/main.yml | 17 ---- .../roles/config-osa/files/os-flavor/vars/main.yml | 45 --------- .../ansible/roles/config-osa/files/setup-ovs.yml | 64 ------------- .../ansible/roles/config-osa/tasks/main.yml | 25 ----- .../config-osa/templates/create-flavor.yml.j2 | 15 --- .../config-osa/templates/create-network.yml.j2 | 41 -------- .../templates/openstack_user_config.yml.j2 | 58 +++++++----- .../config-osa/templates/user_variables.yml.j2 | 18 +++- .../ansible/roles/post-openstack/tasks/main.yml | 72 ++++++++------ .../ansible/roles/post-osa/handlers/main.yml | 11 +++ .../adapters/ansible/roles/post-osa/tasks/main.yml | 12 +++ .../ansible/roles/post-osa/templates/compute.j2 | 62 ++++++++++++ .../ansible/roles/process-openrc/tasks/main.yml | 26 +++++ .../roles/setup-openvswitch/handlers/main.yml | 12 +++ .../roles/setup-openvswitch/tasks/compute.yml | 65 +++++++++++++ .../roles/setup-openvswitch/tasks/controller.yml | 49 ++++++++++ .../ansible/roles/setup-openvswitch/tasks/main.yml | 22 +++-- .../ansible/roles/setup-openvswitch/vars/main.yml | 12 +++ .../compass_conf/package_metadata/openstack.conf | 26 ++--- .../vars/HA-ansible-multinodes.tmpl | 59 +++++++++--- .../hardware_environment/huawei-pod1/network.yml | 12 ++- .../vm_environment/huawei-virtual1/network.yml | 12 ++- .../vm_environment/huawei-virtual2/network.yml | 12 ++- .../vm_environment/huawei-virtual8/network.yml | 12 ++- .../vm_environment/huawei-virtual9/network.yml | 12 ++- deploy/conf/vm_environment/network.yml | 12 ++- plugins/moon/roles/moon/templates/compute.j2 | 25 +++-- .../roles/odl_cluster/files/opendaylight.service | 20 ---- .../roles/odl_cluster/handlers/main.yml | 11 --- .../roles/odl_cluster/tasks/control-agents-1.yml | 39 -------- .../roles/odl_cluster/tasks/control-agents-2.yml | 87 ----------------- .../roles/odl_cluster/tasks/control-agents-3.yml | 42 --------- .../roles/odl_cluster/tasks/control-db-1.yml | 8 -- .../roles/odl_cluster/tasks/control-hosts-1.yml | 100 -------------------- .../roles/odl_cluster/tasks/control-hosts-2.yml | 23 ----- .../roles/odl_cluster/tasks/control-repos-1.yml | 17 ---- .../roles/odl_cluster/tasks/control-servers-1.yml | 15 --- .../roles/odl_cluster/tasks/control-servers-2.yml | 34 ------- .../roles/odl_cluster/tasks/control-servers-3.yml | 19 ---- .../odl_cluster/roles/odl_cluster/tasks/main.yml | 39 -------- .../roles/odl_cluster/tasks/odl-post.yml | 34 ------- .../roles/odl_cluster/templates/acl_conf.sh | 12 --- .../roles/odl_cluster/templates/custom.properties | 105 --------------------- .../roles/odl_cluster/templates/ml2_conf.sh | 14 --- .../templates/org.apache.karaf.features.cfg | 54 ----------- .../odl_cluster/roles/odl_cluster/vars/Debian.yml | 21 ----- .../odl_cluster/roles/odl_cluster/vars/RedHat.yml | 19 ---- .../odl_cluster/roles/odl_cluster/vars/main.yml | 60 ------------ .../roles/setup-odl/files/opendaylight.service | 20 ++++ .../odl_cluster/roles/setup-odl/handlers/main.yml | 11 +++ .../roles/setup-odl/tasks/control-agents-1.yml | 39 ++++++++ .../roles/setup-odl/tasks/control-agents-2.yml | 100 ++++++++++++++++++++ .../roles/setup-odl/tasks/control-agents-3.yml | 69 ++++++++++++++ .../roles/setup-odl/tasks/control-db-1.yml | 8 ++ .../roles/setup-odl/tasks/control-hosts-1.yml | 100 ++++++++++++++++++++ .../roles/setup-odl/tasks/control-hosts-2.yml | 23 +++++ .../roles/setup-odl/tasks/control-repos-1.yml | 17 ++++ .../roles/setup-odl/tasks/control-servers-1.yml | 15 +++ .../roles/setup-odl/tasks/control-servers-2.yml | 36 +++++++ .../roles/setup-odl/tasks/control-servers-3.yml | 19 ++++ plugins/odl_cluster/roles/setup-odl/tasks/main.yml | 4 + .../roles/setup-odl/tasks/odl-cluster.yml | 46 +++++++++ .../odl_cluster/roles/setup-odl/tasks/odl-post.yml | 34 +++++++ .../odl_cluster/roles/setup-odl/tasks/odl-pre.yml | 46 +++++++++ .../roles/setup-odl/templates/acl_conf.sh | 12 +++ .../roles/setup-odl/templates/custom.properties | 105 +++++++++++++++++++++ .../roles/setup-odl/templates/ml2_conf.sh | 14 +++ .../templates/org.apache.karaf.features.cfg | 54 +++++++++++ .../odl_cluster/roles/setup-odl/vars/Debian.yml | 21 +++++ .../odl_cluster/roles/setup-odl/vars/RedHat.yml | 19 ++++ plugins/odl_cluster/roles/setup-odl/vars/main.yml | 62 ++++++++++++ .../roles/setup-opendaylight/tasks/main.yml | 25 ----- .../setup-opendaylight/templates/setup-odl.yml.j2 | 12 --- .../odl_cluster_sfc/files/opendaylight.service | 20 ---- .../odl_sfc/roles/odl_cluster_sfc/files/sfc.conf | 9 -- .../roles/odl_cluster_sfc/handlers/main.yml | 11 --- .../odl_cluster_sfc/tasks/control-agents-1.yml | 39 -------- .../odl_cluster_sfc/tasks/control-agents-2.yml | 87 ----------------- .../odl_cluster_sfc/tasks/control-agents-3.yml | 42 --------- .../roles/odl_cluster_sfc/tasks/control-db-1.yml | 8 -- .../odl_cluster_sfc/tasks/control-hosts-1.yml | 100 -------------------- .../odl_cluster_sfc/tasks/control-hosts-2.yml | 23 ----- .../odl_cluster_sfc/tasks/control-repos-1.yml | 27 ------ .../odl_cluster_sfc/tasks/control-servers-1.yml | 22 ----- .../odl_cluster_sfc/tasks/control-servers-2.yml | 49 ---------- .../odl_cluster_sfc/tasks/control-servers-3.yml | 28 ------ .../odl_cluster_sfc/tasks/control-utility-1.yml | 7 -- .../odl_sfc/roles/odl_cluster_sfc/tasks/main.yml | 44 --------- .../roles/odl_cluster_sfc/tasks/odl-post.yml | 34 ------- .../roles/odl_cluster_sfc/templates/acl_conf.sh | 12 --- .../odl_cluster_sfc/templates/custom.properties | 105 --------------------- .../roles/odl_cluster_sfc/templates/ml2_conf.sh | 14 --- .../templates/org.apache.karaf.features.cfg | 54 ----------- .../odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml | 21 ----- .../odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml | 19 ---- .../odl_sfc/roles/odl_cluster_sfc/vars/main.yml | 65 ------------- .../roles/setup-odl-sfc/files/opendaylight.service | 20 ++++ plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf | 9 ++ .../odl_sfc/roles/setup-odl-sfc/handlers/main.yml | 11 +++ .../roles/setup-odl-sfc/tasks/control-agents-1.yml | 39 ++++++++ .../roles/setup-odl-sfc/tasks/control-agents-2.yml | 100 ++++++++++++++++++++ .../roles/setup-odl-sfc/tasks/control-agents-3.yml | 69 ++++++++++++++ .../roles/setup-odl-sfc/tasks/control-db-1.yml | 8 ++ .../roles/setup-odl-sfc/tasks/control-hosts-1.yml | 100 ++++++++++++++++++++ .../roles/setup-odl-sfc/tasks/control-hosts-2.yml | 23 +++++ .../roles/setup-odl-sfc/tasks/control-repos-1.yml | 27 ++++++ .../setup-odl-sfc/tasks/control-servers-1.yml | 22 +++++ .../setup-odl-sfc/tasks/control-servers-2.yml | 51 ++++++++++ .../setup-odl-sfc/tasks/control-servers-3.yml | 28 ++++++ .../setup-odl-sfc/tasks/control-utility-1.yml | 7 ++ plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml | 4 + .../roles/setup-odl-sfc/tasks/odl-cluster.yml | 51 ++++++++++ .../odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml | 34 +++++++ .../odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml | 46 +++++++++ .../roles/setup-odl-sfc/templates/acl_conf.sh | 12 +++ .../setup-odl-sfc/templates/custom.properties | 105 +++++++++++++++++++++ .../roles/setup-odl-sfc/templates/ml2_conf.sh | 14 +++ .../templates/org.apache.karaf.features.cfg | 54 +++++++++++ .../odl_sfc/roles/setup-odl-sfc/vars/Debian.yml | 21 +++++ .../odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml | 19 ++++ plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml | 65 +++++++++++++ .../odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 | 13 --- .../odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml | 20 +--- 127 files changed, 2362 insertions(+), 2060 deletions(-) delete mode 100644 deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml delete mode 100644 deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml delete mode 100644 deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml delete mode 100644 deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml delete mode 100644 deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 delete mode 100644 deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 create mode 100755 deploy/adapters/ansible/roles/post-osa/handlers/main.yml create mode 100644 deploy/adapters/ansible/roles/post-osa/tasks/main.yml create mode 100755 deploy/adapters/ansible/roles/post-osa/templates/compute.j2 create mode 100644 deploy/adapters/ansible/roles/process-openrc/tasks/main.yml create mode 100644 deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml create mode 100644 deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml create mode 100644 deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml create mode 100644 deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service delete mode 100755 plugins/odl_cluster/roles/odl_cluster/handlers/main.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/main.yml delete mode 100644 plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml delete mode 100755 plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh delete mode 100755 plugins/odl_cluster/roles/odl_cluster/templates/custom.properties delete mode 100755 plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh delete mode 100755 plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg delete mode 100755 plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml delete mode 100755 plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml delete mode 100755 plugins/odl_cluster/roles/odl_cluster/vars/main.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/files/opendaylight.service create mode 100755 plugins/odl_cluster/roles/setup-odl/handlers/main.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/main.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh create mode 100755 plugins/odl_cluster/roles/setup-odl/templates/custom.properties create mode 100755 plugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh create mode 100755 plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg create mode 100755 plugins/odl_cluster/roles/setup-odl/vars/Debian.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/vars/RedHat.yml create mode 100755 plugins/odl_cluster/roles/setup-odl/vars/main.yml delete mode 100644 plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml delete mode 100644 plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh delete mode 100755 plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml delete mode 100644 plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml create mode 100755 plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml delete mode 100644 plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 diff --git a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml index f253afcc..741c5bf1 100644 --- a/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml +++ b/deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml @@ -1,11 +1,11 @@ -# ############################################################################# +############################################################################## # 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 -# ############################################################################# +############################################################################## --- - hosts: all remote_user: root @@ -38,11 +38,47 @@ - setup-infrastructure - setup-openstack - sync-inventory + +- hosts: compute + remote_user: root + roles: + - post-osa + +- hosts: neutron_openvswitch_agent + remote_user: root + roles: - setup-openvswitch + +- hosts: localhost + remote_user: root + roles: - setup-sfc - - setup-opendaylight + tags: + - sfc + +- hosts: + - localhost + - neutron_all + - galera_container + - network_hosts + - repo_container + - utility + remote_user: root + roles: + - setup-odl + tags: + - odl + +- hosts: utility_all[0] + remote_user: root + roles: - post-openstack +- hosts: localhost + remote_user: root + roles: + - process-openrc + - hosts: moon remote_user: root roles: diff --git a/deploy/adapters/ansible/roles/config-compute/templates/compute.j2 b/deploy/adapters/ansible/roles/config-compute/templates/compute.j2 index c53708ec..b23550f9 100644 --- a/deploy/adapters/ansible/roles/config-compute/templates/compute.j2 +++ b/deploy/adapters/ansible/roles/config-compute/templates/compute.j2 @@ -10,35 +10,35 @@ auto eth0 iface eth0 inet manual # external interface -{% set intf_external = sys_intf_mappings["external"]["interface"] %} -{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %} -{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %} +{% set intf_external = compu_sys_mappings["external"]["interface"] %} +{% if compu_sys_mappings["external"]["vlan_tag"] | int %} +{% set intf_external = intf_external + '.' + compu_sys_mappings["external"]["vlan_tag"]|string %} {% endif %} auto {{ intf_external }} iface {{ intf_external }} inet manual -{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %} +{% if compu_sys_mappings["external"]["vlan_tag"] | int %} vlan-raw-device {{ intf_external }} {% endif %} # tenant interface -{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %} -{% if sys_intf_mappings["tenant"]["interface"] != "None" %} -{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %} +{% set intf_tenant = compu_sys_mappings["tenant"]["interface"] %} +{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %} +{% set intf_tenant = intf_tenant + '.' + compu_sys_mappings["tenant"]["vlan_tag"]|string %} {% endif %} auto {{ intf_tenant }} iface {{ intf_tenant }} inet manual -{% if sys_intf_mappings["tenant"]["interface"] != "None" %} +{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %} vlan-raw-device {{ intf_tenant }} {% endif %} # storage interface -{% set intf_storage = sys_intf_mappings["storage"]["interface"] %} -{% if sys_intf_mappings["storage"]["interface"] != "None" %} -{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %} +{% set intf_storage = compu_sys_mappings["storage"]["interface"] %} +{% if compu_sys_mappings["storage"]["vlan_tag"] | int %} +{% set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %} {% endif %} auto {{ intf_storage }} iface {{ intf_storage }} inet manual -{% if sys_intf_mappings["storage"]["interface"] != "None" %} +{% if compu_sys_mappings["storage"]["vlan_tag"] | int %} vlan-raw-device {{ intf_storage }} {% endif %} diff --git a/deploy/adapters/ansible/roles/config-controller/templates/controller.j2 b/deploy/adapters/ansible/roles/config-controller/templates/controller.j2 index 2aeb9a04..4e444eca 100755 --- a/deploy/adapters/ansible/roles/config-controller/templates/controller.j2 +++ b/deploy/adapters/ansible/roles/config-controller/templates/controller.j2 @@ -10,35 +10,35 @@ auto eth0 iface eth0 inet manual # external interface -{% set intf_external = sys_intf_mappings["external"]["interface"] %} -{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %} -{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %} +{% set intf_external = contr_sys_mappings["external"]["interface"] %} +{% if contr_sys_mappings["external"]["vlan_tag"] | int %} +{% set intf_external = intf_external + '.' + contr_sys_mappings["external"]["vlan_tag"]|string %} {% endif %} auto {{ intf_external }} iface {{ intf_external }} inet manual -{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %} +{% if contr_sys_mappings["external"]["vlan_tag"] | int %} vlan-raw-device {{ intf_external }} {% endif %} # tenant interface -{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %} -{% if sys_intf_mappings["tenant"]["interface"] != "None" %} -{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %} +{% set intf_tenant = contr_sys_mappings["tenant"]["interface"] %} +{% if contr_sys_mappings["tenant"]["vlan_tag"] | int %} +{% set intf_tenant = intf_tenant + '.' + contr_sys_mappings["tenant"]["vlan_tag"]|string %} {% endif %} auto {{ intf_tenant }} iface {{ intf_tenant }} inet manual -{% if sys_intf_mappings["tenant"]["interface"] != "None" %} +{% if contr_sys_mappings["tenant"]["vlan_tag"] | int %} vlan-raw-device {{ intf_tenant }} {% endif %} # storage interface -{% set intf_storage = sys_intf_mappings["storage"]["interface"] %} -{% if sys_intf_mappings["storage"]["interface"] != "None" %} -{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %} +{% set intf_storage = contr_sys_mappings["storage"]["interface"] %} +{% if contr_sys_mappings["storage"]["vlan_tag"] | int %} +{% set intf_storage = intf_storage + '.' + contr_sys_mappings["storage"]["vlan_tag"]|string %} {% endif %} auto {{ intf_storage }} iface {{ intf_storage }} inet manual -{% if sys_intf_mappings["storage"]["interface"] != "None" %} +{% if contr_sys_mappings["storage"]["vlan_tag"] | int %} vlan-raw-device {{ intf_storage }} {% endif %} diff --git a/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml b/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml deleted file mode 100644 index 346ef2fd..00000000 --- a/deploy/adapters/ansible/roles/config-osa/files/fetch-files.yml +++ /dev/null @@ -1,28 +0,0 @@ -# ############################################################################# -# 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: Fetch openrc - hosts: utility_all[0] - max_fail_percentage: 20 - user: root - tasks: - - fetch: - src: /root/openrc - dest: /opt/openrc - flat: "yes" - -- name: Fetch haproxy.cert - hosts: haproxy_hosts[0] - max_fail_percentage: 20 - user: root - tasks: - - fetch: - src: /etc/ssl/certs/haproxy.cert - dest: /opt/os_cacert - flat: "yes" diff --git a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml deleted file mode 100644 index 03b57120..00000000 --- a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/tasks/main.yml +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################## -# 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: create openstack flavors - shell: | - . /root/openrc; - openstack flavor create {{ item.name }} \ - --id {{ item.id }} --ram {{ item.ram }} \ - --disk {{ item.disk }} --vcpus {{ item.vcpus }} || true - with_items: "{{ flavors }}" diff --git a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml b/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml deleted file mode 100644 index d9c36d42..00000000 --- a/deploy/adapters/ansible/roles/config-osa/files/os-flavor/vars/main.yml +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- -flavors: - - id: 0 - name: m1.nano - vcpus: 1 - ram: 64 - disk: 1 - - - id: 1 - name: m1.tiny - vcpus: 1 - ram: 512 - disk: 1 - - - id: 2 - name: m1.small - vcpus: 1 - ram: 2048 - disk: 20 - - - id: 3 - name: m1.medium - vcpus: 2 - ram: 4096 - disk: 40 - - - id: 4 - name: m1.large - vcpus: 4 - ram: 8192 - disk: 80 - - - id: 5 - name: m1.xlarge - vcpus: 8 - ram: 16384 - disk: 160 diff --git a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml b/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml deleted file mode 100644 index ed631036..00000000 --- a/deploy/adapters/ansible/roles/config-osa/files/setup-ovs.yml +++ /dev/null @@ -1,64 +0,0 @@ -# ############################################################################# -# 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: Installation and setup of Neutron - hosts: neutron_openvswitch_agent - gather_facts: "{{ gather_facts | default(True) }}" - max_fail_percentage: 20 - user: root - tasks: - - name: stop neutron-openvswitch-agent - service: - name: neutron-openvswitch-agent - state: stopped - - # yamllint disable rule:line-length - - name: change the openvswitch_agent.ini - lineinfile: - dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini - insertafter: '^bridge_mappings' - line: "local_ip = {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }}" - when: - - inventory_hostname not in groups['nova_compute'] - - - name: change the openvswitch_agent.ini - lineinfile: - dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini - state: absent - regexp: '^bridge_mappings' - notify: - - Restart neutron-openvswitch-agent - when: - - inventory_hostname in groups['nova_compute'] - # yamllint enable rule:line-length - - - name: Setup br-provider - openvswitch_bridge: - bridge: br-provider - state: present - notify: - - Restart neutron-openvswitch-agent - when: - - inventory_hostname not in groups['nova_compute'] - - - name: Add port to br-provider - openvswitch_port: - bridge: br-provider - port: "eth12" - state: present - notify: - - Restart neutron-openvswitch-agent - when: - - inventory_hostname not in groups['nova_compute'] - - handlers: - - name: Restart neutron-openvswitch-agent - service: - name: neutron-openvswitch-agent - state: restarted diff --git a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml index 2cb79a94..139b426f 100755 --- a/deploy/adapters/ansible/roles/config-osa/tasks/main.yml +++ b/deploy/adapters/ansible/roles/config-osa/tasks/main.yml @@ -224,31 +224,6 @@ src: ansible.cfg dest: /opt/openstack-ansible/playbooks/ -- name: copy setup-ovs.yml - copy: - src: setup-ovs.yml - dest: /opt/openstack-ansible/playbooks - -- name: copy flavor roles - copy: - src: os-flavor - dest: /etc/ansible/roles/ - -- name: generate create-network.yml - template: - src: create-network.yml.j2 - dest: /opt/openstack-ansible/playbooks/create-network.yml - -- name: generate create-flavor.yml - template: - src: create-flavor.yml.j2 - dest: /opt/openstack-ansible/playbooks/create-flavor.yml - -- name: copy fetch-files.yml - copy: - src: fetch-files.yml - dest: /opt/openstack-ansible/playbooks/fetch-files.yml - - name: copy user_ceph.yml copy: src: user_ceph.yml diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 deleted file mode 100644 index b33cd414..00000000 --- a/deploy/adapters/ansible/roles/config-osa/templates/create-flavor.yml.j2 +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################## -# 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: Create flavor - hosts: utility_container[0] - max_fail_percentage: 20 - user: root - roles: - - os-flavor diff --git a/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 deleted file mode 100644 index 301bf9da..00000000 --- a/deploy/adapters/ansible/roles/config-osa/templates/create-network.yml.j2 +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# 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: Create external network - hosts: utility_container[0] - max_fail_percentage: 20 - user: root - tasks: - - name: create external net - shell: | - . /root/openrc; - openstack network create --external \ - --provider-physical-network {{ public_net_info.provider_network }} \ - --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }}; - when: {{ public_net_info.enable }} == True - and "{{ public_net_info.type }}" == "flat" - - - name: create external net - shell: | - . /root/openrc; - openstack network create --external \ - --network-segment {{ public_net_info.segment_id }} \ - --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }}; - when: {{public_net_info.enable}} == True - and "{{ public_net_info.type }}" != "flat" - - - name: create external subnet - shell: | - . /root/openrc; - openstack subnet create --network "{{ public_net_info.network }}" \ - --allocation-pool \ - start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }} \ - --gateway "{{ public_net_info.external_gw }}" \ - --subnet-range "{{ public_net_info.floating_ip_cidr }}" \ - "{{ public_net_info.subnet }}" diff --git a/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 index d69674f2..cadf5308 100644 --- a/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 +++ b/deploy/adapters/ansible/roles/config-osa/templates/openstack_user_config.yml.j2 @@ -15,7 +15,23 @@ used_ips: {% endif %} {% endfor %} - "{{ internal_vip.ip }}" + - "{{ public_vip.ip }}" +{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} +{% set neutron_agent = "neutron_linuxbridge_agent" %} +{% else %} +{% set neutron_agent = "neutron_openvswitch_agent" %} +{% endif %} +{% set provider_net_mappings = network_cfg["provider_net_mappings"] %} +{% set public_net_info = network_cfg["public_net_info"] %} +{% set ext_physnet = public_net_info["provider_network"] %} +{% set ext_type = public_net_info["type"] %} +{% set ext_intf = [] %} +{% for item in provider_net_mappings %} +{% if item["network"] == ext_physnet %} +{% set _ = ext_intf.append(item["interface"]) %} +{% endif %} +{% endfor %} global_overrides: internal_lb_vip_address: {{ internal_vip.ip }} external_lb_vip_address: {{ public_vip.ip }} @@ -33,46 +49,40 @@ global_overrides: - hosts is_container_address: true is_ssh_address: true +{% if tenant_net_info["type"] == "vxlan" %} - network: container_bridge: "br-tenant" container_type: "veth" - container_interface: "eth10" + container_interface: "eth2" ip_from_q: "tunnel" type: "vxlan" - range: "1:1000" + range: "{{ tenant_net_info["range"] }}" net_name: "vxlan" group_binds: -{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} - - neutron_linuxbridge_agent -{% else %} - - neutron_openvswitch_agent + - {{ neutron_agent }} {% endif %} - network: container_bridge: "br-external" container_type: "veth" - container_interface: "eth12" - host_bind_override: "eth12" - type: "flat" - net_name: "{{ public_net_info.provider_network }}" + container_interface: "{{ ext_intf[0] }}" + host_bind_override: "{{ ext_intf[0] }}" + type: "{{ ext_type }}" + net_name: "{{ ext_physnet }}" group_binds: -{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} - - neutron_linuxbridge_agent -{% else %} - - neutron_openvswitch_agent -{% endif %} + - {{ neutron_agent }} +{% for item in provider_net_mappings %} +{% if item["network"] != ext_physnet and "controller" in item["role"] %} - network: - container_bridge: "br-external" + container_bridge: "br-tenant" container_type: "veth" - container_interface: "eth11" - type: "vlan" - range: "1:1" - net_name: "vlan" + container_interface: "{{ item["interface"] }}" + host_bind_override: "{{ item["interface"] }}" + type: "flat" + net_name: "{{ item["network"] }}" group_binds: -{% if "linuxbridge" == NEUTRON_MECHANISM_DRIVERS[0] %} - - neutron_linuxbridge_agent -{% else %} - - neutron_openvswitch_agent + - {{ neutron_agent }} {% endif %} +{% endfor %} - network: container_bridge: "br-storage" container_type: "veth" diff --git a/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 b/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 index a6cefd71..e43aa22c 100644 --- a/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 +++ b/deploy/adapters/ansible/roles/config-osa/templates/user_variables.yml.j2 @@ -41,11 +41,21 @@ openstack_host_specific_kernel_modules: neutron_plugin_type: ml2.ovs -neutron_ml2_drivers_type: "local,flat,vlan,vxlan" +neutron_ml2_drivers_type: "local,flat,{{ tenant_net_info['type'] }}" neutron_provider_networks: network_flat_networks: "*" - network_types: "vxlan" - network_vxlan_ranges: "1:1000" - network_mappings: "physnet:br-provider" + network_types: "{{ tenant_net_info['type'] }}" +{% if tenant_net_info["type"] == "vxlan" %} + network_vxlan_ranges: "{{ tenant_net_info['range'] }}" +{% endif %} +{% if tenant_net_info["type"] == "vlan" %} + network_vlan_ranges: "{{tenant_net_info['provider_network']}}:{{tenant_net_info['range']}}" +{% endif %} +{% set controller_mappings = [] %} +{% for key, value in contr_prv_mappings.iteritems() %} +{% set mapping = key + ":" + value["bridge"] %} +{% set _ = controller_mappings.append(mapping) %} +{% endfor %} + network_mappings: "{{ ','.join(controller_mappings) }}" {% endif %} diff --git a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml index 6a8299d6..4e2da1e0 100644 --- a/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml +++ b/deploy/adapters/ansible/roles/post-openstack/tasks/main.yml @@ -1,4 +1,4 @@ -############################################################################## +############################################################################# # Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. # # All rights reserved. This program and the accompanying materials @@ -7,35 +7,53 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- -- name: create network - shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \ - cd /opt/openstack-ansible/playbooks; \ - openstack-ansible create-network.yml > /dev/null" +- name: create external net + shell: | + . /root/openrc; + openstack network create --external \ + --provider-physical-network {{ public_net_info.provider_network }} \ + --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }}; + when: + - public_net_info.enable == "True" + - public_net_info.type == "flat" -- name: create flavor - shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \ - cd /opt/openstack-ansible/playbooks; \ - openstack-ansible create-flavor.yml > /dev/null" +- name: create external net + shell: | + . /root/openrc; + openstack network create --external \ + --network-segment {{ public_net_info.segment_id }} \ + --provider-physical-network {{ public_net_info.provider_network }} \ + --provider-network-type {{ public_net_info.type }} {{ public_net_info.network }}; + when: + - public_net_info.enable == "True" + - public_net_info.type == "vlan" -- name: run ansible yml to fetch openrc - shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \ - cd /opt/openstack-ansible/playbooks; \ - openstack-ansible fetch-files.yml > /dev/null" +- name: create external subnet + shell: | + . /root/openrc; + openstack subnet create --network "{{ public_net_info.network }}" \ + --allocation-pool \ + start={{ public_net_info.floating_ip_start }},end={{ public_net_info.floating_ip_end }} \ + --gateway "{{ public_net_info.external_gw }}" \ + --subnet-range "{{ public_net_info.floating_ip_cidr }}" \ + "{{ public_net_info.subnet }}" -- name: replace http with https in openrc - replace: - dest: /opt/openrc - regexp: "http://" - replace: "https://" +- name: create openstack flavors + shell: | + . /root/openrc; + openstack flavor create {{ item.name }} \ + --id {{ item.id }} --ram {{ item.ram }} \ + --disk {{ item.disk }} --vcpus {{ item.vcpus }} || true + with_items: "{{ flavors }}" -- name: replace internalURL with publicURL in openrc - replace: +- name: fetch openrc + fetch: + src: /root/openrc dest: /opt/openrc - regexp: "{{ internal_vip['ip'] }}" - replace: "{{ public_vip['ip'] }}" + flat: "yes" -- name: change the endpoint type - replace: - dest: /opt/openrc - regexp: "internalURL" - replace: "publicURL" +- name: fetch haproxy.cert + fetch: + src: /etc/ssl/certs/haproxy.cert + dest: /opt/os_cacert + flat: "yes" diff --git a/deploy/adapters/ansible/roles/post-osa/handlers/main.yml b/deploy/adapters/ansible/roles/post-osa/handlers/main.yml new file mode 100755 index 00000000..3d979e6a --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/handlers/main.yml @@ -0,0 +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: restart network service + shell: "/sbin/ifconfig eth0 0 &&/sbin/ifdown -a && \ + /sbin/ifup --ignore-errors -a" diff --git a/deploy/adapters/ansible/roles/post-osa/tasks/main.yml b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml new file mode 100644 index 00000000..cf157d74 --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: remove bridge ubuntu + template: + src: compute.j2 + dest: /etc/network/interfaces + notify: + - restart network service + when: ansible_distribution == 'Ubuntu' + +# TODO +# - name: remove bridge centos +# when: ansible_distribution == 'CentOS' diff --git a/deploy/adapters/ansible/roles/post-osa/templates/compute.j2 b/deploy/adapters/ansible/roles/post-osa/templates/compute.j2 new file mode 100755 index 00000000..9e45fa90 --- /dev/null +++ b/deploy/adapters/ansible/roles/post-osa/templates/compute.j2 @@ -0,0 +1,62 @@ +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +# The loopback network interface +auto lo +iface lo inet loopback + +# Physical interface +auto eth0 +iface eth0 inet static + address {{ ip_settings[inventory_hostname]["mgmt"]["ip"] }} + netmask 255.255.255.0 + pre-up ifconfig br-mgmt down || true + pre-up brctl delbr br-mgmt || true + +# external interface +{% set intf_external = compu_sys_mappings["external"]["interface"] %} +{% if compu_sys_mappings["external"]["vlan_tag"] | int %} +{% set intf_external = intf_external + '.' + compu_sys_mappings["external"]["vlan_tag"]|string %} +{% endif %} +auto {{ intf_external }} +iface {{ intf_external }} inet static +{% if compu_sys_mappings["external"]["vlan_tag"] | int %} + vlan-raw-device {{ intf_external }} +{% endif %} + address {{ ip_settings[inventory_hostname]["external"]["ip"] }} + netmask 255.255.255.0 + gateway {{ ip_settings[inventory_hostname]["external"]["gw"] }} + pre-up ip link del br-vlan-veth || true + pre-up ifconfig br-external down || true + pre-up brctl delbr br-external || true + +# tenant interface +{% set intf_tenant = compu_sys_mappings["tenant"]["interface"] %} +{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %} +{% set intf_tenant = intf_tenant + '.' + compu_sys_mappings["tenant"]["vlan_tag"]|string %} +{% endif %} +auto {{ intf_tenant }} +iface {{ intf_tenant }} inet static +{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %} + vlan-raw-device {{ intf_tenant }} +{% endif %} + address {{ ip_settings[inventory_hostname]["tenant"]["ip"] }} + netmask 255.255.255.0 + pre-up ifconfig br-tenant down || true + pre-up brctl delbr br-tenant || true + +# storage interface +{% set intf_storage = compu_sys_mappings["storage"]["interface"] %} +{% if compu_sys_mappings["storage"]["vlan_tag"] | int %} +{% set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %} +{% endif %} +auto {{ intf_storage }} +iface {{ intf_storage }} inet static +{% if compu_sys_mappings["storage"]["vlan_tag"] | int %} + vlan-raw-device {{ intf_storage }} +{% endif %} + address {{ ip_settings[inventory_hostname]["storage"]["ip"] }} + netmask 255.255.255.0 + pre-up ifconfig br-storage down || true + pre-up brctl delbr br-storage || true + diff --git a/deploy/adapters/ansible/roles/process-openrc/tasks/main.yml b/deploy/adapters/ansible/roles/process-openrc/tasks/main.yml new file mode 100644 index 00000000..aed68b88 --- /dev/null +++ b/deploy/adapters/ansible/roles/process-openrc/tasks/main.yml @@ -0,0 +1,26 @@ +############################################################################## +# 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: replace http with https in openrc + replace: + dest: /opt/openrc + regexp: "http://" + replace: "https://" + +- name: replace internalURL with publicURL in openrc + replace: + dest: /opt/openrc + regexp: "{{ internal_vip['ip'] }}" + replace: "{{ public_vip['ip'] }}" + +- name: change the endpoint type + replace: + dest: /opt/openrc + regexp: "internalURL" + replace: "publicURL" diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml b/deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml new file mode 100644 index 00000000..fb7814b7 --- /dev/null +++ b/deploy/adapters/ansible/roles/setup-openvswitch/handlers/main.yml @@ -0,0 +1,12 @@ +############################################################################ +# 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: restart neutron-openvswitch-agent + service: + name: neutron-openvswitch-agent + state: restarted diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml new file mode 100644 index 00000000..62edd34b --- /dev/null +++ b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/compute.yml @@ -0,0 +1,65 @@ +############################################################################# +# 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: stop neutron-openvswitch-agent + service: + name: neutron-openvswitch-agent + state: stopped + +- name: remove tunnel_types when vlan + lineinfile: + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + state: absent + regexp: '^tunnel_types' + when: + - tenant_net_info["type"] == "vlan" + notify: + - restart neutron-openvswitch-agent + +- name: fix mapping in compute + shell: | + {% set compute_mappings = [] %} + {% for key, value in compu_prv_mappings.iteritems() %} + {% set mapping = key + ":" + value["bridge"] %} + {% set _ = compute_mappings.append(mapping) %} + {% endfor %} + {% if compute_mappings | length != 0 %} + sed -i "s/^\(bridge_mappings\).*/\1 = {{ ','.join(compute_mappings) }}/g" \ + /etc/neutron/plugins/ml2/openvswitch_agent.ini + {% else %} + sed -i "/bridge_mappings/d" /etc/neutron/plugins/ml2/openvswitch_agent.ini + {% endif %} + notify: + - restart neutron-openvswitch-agent + +- name: create compute bridges + openvswitch_bridge: + bridge: "{{ item['name'] }}" + state: present + with_items: + - "{{ provider_net_mappings }}" + when: + - compute in item["role"] + notify: + - restart neutron-openvswitch-agent + +- name: create compute bridge ports + openvswitch_port: + bridge: "{{ item['name'] }}" + port: "{{ item['interface'] }}" + state: present + with_items: + - "{{ provider_net_mappings }}" + when: + - compute in item["role"] + +- name: stop neutron-openvswitch-agent + service: + name: neutron-openvswitch-agent + state: started diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml new file mode 100644 index 00000000..258a39e2 --- /dev/null +++ b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/controller.yml @@ -0,0 +1,49 @@ +############################################################################# +# 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: stop neutron-openvswitch-agent + service: + name: neutron-openvswitch-agent + state: stopped + +- name: remove tunnel_types when vlan + lineinfile: + dest: /etc/neutron/plugins/ml2/openvswitch_agent.ini + state: absent + regexp: '^tunnel_types' + when: + - tenant_net_info["type"] == "vlan" + notify: + - restart neutron-openvswitch-agent + +- name: create controller bridges + openvswitch_bridge: + bridge: "{{ item['name'] }}" + state: present + with_items: + - "{{ provider_net_mappings }}" + when: + - controller in item["role"] + notify: + - restart neutron-openvswitch-agent + +- name: create controller bridge ports + openvswitch_port: + bridge: "{{ item['name'] }}" + port: "{{ item['interface'] }}" + state: present + with_items: + - "{{ provider_net_mappings }}" + when: + - controller in item["role"] + +- name: stop neutron-openvswitch-agent + service: + name: neutron-openvswitch-agent + state: started diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml index a424f974..87e508ca 100644 --- a/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-openvswitch/tasks/main.yml @@ -1,16 +1,18 @@ -############################################################################## -# 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 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## +############################################################################# --- -- name: setup openvswitch - shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \ - cd /opt/openstack-ansible/playbooks; \ - openstack-ansible setup-ovs.yml \ - | tee -a /var/log/osa/ovs.log > /dev/null" - when: NEUTRON_MECHANISM_DRIVERS[0] == "openvswitch" or - NEUTRON_MECHANISM_DRIVERS[0] == "opendaylight" +- include: controller.yml + when: + - inventory_hostname not in groups['nova_compute'] + - NEUTRON_MECHANISM_DRIVERS[0] == "openvswitch" or "opendaylight" + +- include: compute.yml + when: + - inventory_hostname in groups['nova_compute'] + - NEUTRON_MECHANISM_DRIVERS[0] == "openvswitch" or "opendaylight" diff --git a/deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml b/deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml new file mode 100644 index 00000000..69ce5ee9 --- /dev/null +++ b/deploy/adapters/ansible/roles/setup-openvswitch/vars/main.yml @@ -0,0 +1,12 @@ +############################################################################## +## 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 +############################################################################## +--- +controller: "controller" + +compute: "compute" diff --git a/deploy/compass_conf/package_metadata/openstack.conf b/deploy/compass_conf/package_metadata/openstack.conf index 9f079f9e..6027cb1a 100755 --- a/deploy/compass_conf/package_metadata/openstack.conf +++ b/deploy/compass_conf/package_metadata/openstack.conf @@ -268,36 +268,36 @@ METADATA = { } }, - 'openo_net': { + 'tenant_net_info': { '_self': { - 'mapping_to': 'openo_net', - 'is_required': False + 'mapping_to': 'tenant_net_info', + 'is_required': True }, - 'openo_ip': { + 'type': { '_self': { - 'mapping_to': 'openo_ip', - 'is_required': False, + 'mapping_to': 'type', + 'is_required': True, 'field': 'general', + 'options': ['vxlan', 'vlan'], } }, - 'openo_docker_gw': { + 'range': { '_self': { - 'mapping_to': 'openo_docker_gw', - 'is_required': False, + 'mapping_to': 'range', + 'is_required': True, 'field': 'general', } }, - 'openo_docker_cidr': { + 'provider_network': { '_self': { - 'mapping_to': 'openo_docker_cidr', - 'is_required': False, + 'mapping_to': 'provider_network', + 'is_required': True, 'field': 'general', } } }, - 'public_net_info': { '_self': { 'mapping_to': 'public_net_info' 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 704c23fb..527f480a 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 @@ -3,13 +3,18 @@ #set network_cfg = $getVar('network_cfg', {}) #set ntp_server = $getVar('ntp_server', "") #set ceph_disk = $getVar('ceph_disk',"") -#set $sys_intf_mappings= {} -#for $intf_info in $network_cfg.sys_intf_mappings -#set $sys_intf_mappings[$intf_info["name"]] = $intf_info -#end for - #set controllers = $getVar('controller', []) #set computes = $getVar('compute', []) +#set $contr_sys_mappings= {} +#set $compu_sys_mappings= {} +#for $intf_info in $network_cfg.sys_intf_mappings +#if "controller" in $intf_info["role"] +#set $contr_sys_mappings[$intf_info["name"]] = $intf_info +#end if +#if "compute" in $intf_info["role"] +#set $compu_sys_mappings[$intf_info["name"]] = $intf_info +#end if +#end for #set ip_settings={} #for k,v in $getVar('ip_settings', {}).items() @@ -35,6 +40,18 @@ #end if #end for +#set provider_net_mappings = $network_cfg["provider_net_mappings"] +#set contr_prv_mappings = {} +#set compu_prv_mappings = {} +#for item in $provider_net_mappings +#if "controller" in $item["role"] +#set $contr_prv_mappings[$item["network"]] = {"bridge":$item["name"],"interface":$item["interface"]} +#end if +#if "compute" in $item["role"] +#set $compu_prv_mappings[$item["network"]] = {"bridge":$item["name"],"interface":$item["interface"]} +#end if +#end for + #set neutron_cfg = $getVar('neutron_config', {}) #set ovs_config = $neutron_cfg.openvswitch #set has = $getVar('ha', []) @@ -51,7 +68,15 @@ 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 + +provider_net_mappings: $network_cfg["provider_net_mappings"] + +contr_sys_mappings: $contr_sys_mappings +compu_sys_mappings: $compu_sys_mappings + +contr_prv_mappings: $contr_prv_mappings +compu_prv_mappings: $compu_prv_mappings + deploy_type: $getVar('deploy_type', 'virtual') mgmt_cidr: $mgmt_cfg["cidr"] @@ -59,6 +84,7 @@ external_cidr: $external_cfg["cidr"] tenant_cidr: $tenant_cfg["cidr"] storage_cidr: $storage_cfg["cidr"] +tenant_net_info: "{{ network_cfg.tenant_net_info }}" public_net_info: "{{ network_cfg.public_net_info }}" host_ip_settings: "{{ ip_settings[inventory_hostname] }}" @@ -71,19 +97,19 @@ offline_repo_port: $getVar('offline_repo_port', '5151') internal_vip: ip: $network_cfg["internal_vip"]["ip"] netmask: $network_cfg["internal_vip"]["netmask"] -#if "vlan_tag" in $sys_intf_mappings[$network_cfg["internal_vip"]["interface"]] - interface: $sys_intf_mappings[$network_cfg["internal_vip"]["interface"]]["name"] +#if "vlan_tag" in $contr_sys_mappings[$network_cfg["internal_vip"]["interface"]] + interface: $contr_sys_mappings[$network_cfg["internal_vip"]["interface"]]["name"] #else - interface: $sys_intf_mappings[$network_cfg["internal_vip"]["interface"]]["interface"] + interface: $contr_sys_mappings[$network_cfg["internal_vip"]["interface"]]["interface"] #end if public_vip: ip: $network_cfg["public_vip"]["ip"] netmask: $network_cfg["public_vip"]["netmask"] -#if "vlan_tag" in $sys_intf_mappings[$network_cfg["public_vip"]["interface"]] - interface: $sys_intf_mappings[$network_cfg["public_vip"]["interface"]]["name"] +#if "vlan_tag" in $contr_sys_mappings[$network_cfg["public_vip"]["interface"]] + interface: $contr_sys_mappings[$network_cfg["public_vip"]["interface"]]["name"] #else - interface: $sys_intf_mappings[$network_cfg["public_vip"]["interface"]]["interface"] + interface: $contr_sys_mappings[$network_cfg["public_vip"]["interface"]]["interface"] #end if db_host: "{{ internal_vip.ip }}" @@ -182,12 +208,17 @@ CONGRESS_PASS: $congress_pass DEMO_PASS: $demo_pass ADMIN_PASS: $admin_pass -#set neutron_service_plugins=['router'] +#set plugins = $getVar('plugins', []) +#for item in plugins +#set keys = $item.keys() +#set values = $item.values() +$keys[0]: $values[0] +#end for +#set neutron_service_plugins=['router'] #if $getVar('enable_fwaas', True) #neutron_service_plugins.append('firewall') #end if - #if $getVar('enable_vpnaas', True) #neutron_service_plugins.append('vpnaas') #end if diff --git a/deploy/conf/hardware_environment/huawei-pod1/network.yml b/deploy/conf/hardware_environment/huawei-pod1/network.yml index 8c45ed96..77160d69 100644 --- a/deploy/conf/hardware_environment/huawei-pod1/network.yml +++ b/deploy/conf/hardware_environment/huawei-pod1/network.yml @@ -14,15 +14,15 @@ bond_mappings: [] provider_net_mappings: - name: br-provider network: physnet - interface: eth1 + interface: eth10 type: ovs role: - controller - - compute sys_intf_mappings: - name: mgmt interface: eth0 + type: normal vlan_tag: None role: - controller @@ -30,6 +30,7 @@ sys_intf_mappings: - name: tenant interface: eth1 + type: normal vlan_tag: 101 role: - controller @@ -37,6 +38,7 @@ sys_intf_mappings: - name: storage interface: eth1 + type: normal vlan_tag: 102 role: - controller @@ -44,6 +46,7 @@ sys_intf_mappings: - name: external interface: eth1 + type: normal vlan_tag: None role: - controller @@ -102,6 +105,11 @@ public_vip: interface: external onos_nic: eth2 +tenant_net_info: + type: vxlan + range: "1:1000" + provider_network: None + public_net_info: enable: "True" network: ext-net diff --git a/deploy/conf/vm_environment/huawei-virtual1/network.yml b/deploy/conf/vm_environment/huawei-virtual1/network.yml index 924a4ea4..4359202e 100644 --- a/deploy/conf/vm_environment/huawei-virtual1/network.yml +++ b/deploy/conf/vm_environment/huawei-virtual1/network.yml @@ -14,15 +14,15 @@ bond_mappings: [] provider_net_mappings: - name: br-provider network: physnet - interface: eth1 + interface: eth10 type: ovs role: - controller - - compute sys_intf_mappings: - name: mgmt interface: eth0 + type: normal vlan_tag: None role: - controller @@ -30,6 +30,7 @@ sys_intf_mappings: - name: tenant interface: eth1 + type: normal vlan_tag: 101 role: - controller @@ -37,6 +38,7 @@ sys_intf_mappings: - name: storage interface: eth1 + type: normal vlan_tag: 102 role: - controller @@ -44,6 +46,7 @@ sys_intf_mappings: - name: external interface: eth1 + type: normal vlan_tag: None role: - controller @@ -102,6 +105,11 @@ public_vip: interface: external onos_nic: eth2 +tenant_net_info: + type: vxlan + range: "1:1000" + provider_network: None + public_net_info: enable: "True" network: ext-net diff --git a/deploy/conf/vm_environment/huawei-virtual2/network.yml b/deploy/conf/vm_environment/huawei-virtual2/network.yml index 924a4ea4..4359202e 100644 --- a/deploy/conf/vm_environment/huawei-virtual2/network.yml +++ b/deploy/conf/vm_environment/huawei-virtual2/network.yml @@ -14,15 +14,15 @@ bond_mappings: [] provider_net_mappings: - name: br-provider network: physnet - interface: eth1 + interface: eth10 type: ovs role: - controller - - compute sys_intf_mappings: - name: mgmt interface: eth0 + type: normal vlan_tag: None role: - controller @@ -30,6 +30,7 @@ sys_intf_mappings: - name: tenant interface: eth1 + type: normal vlan_tag: 101 role: - controller @@ -37,6 +38,7 @@ sys_intf_mappings: - name: storage interface: eth1 + type: normal vlan_tag: 102 role: - controller @@ -44,6 +46,7 @@ sys_intf_mappings: - name: external interface: eth1 + type: normal vlan_tag: None role: - controller @@ -102,6 +105,11 @@ public_vip: interface: external onos_nic: eth2 +tenant_net_info: + type: vxlan + range: "1:1000" + provider_network: None + public_net_info: enable: "True" network: ext-net diff --git a/deploy/conf/vm_environment/huawei-virtual8/network.yml b/deploy/conf/vm_environment/huawei-virtual8/network.yml index 924a4ea4..4359202e 100644 --- a/deploy/conf/vm_environment/huawei-virtual8/network.yml +++ b/deploy/conf/vm_environment/huawei-virtual8/network.yml @@ -14,15 +14,15 @@ bond_mappings: [] provider_net_mappings: - name: br-provider network: physnet - interface: eth1 + interface: eth10 type: ovs role: - controller - - compute sys_intf_mappings: - name: mgmt interface: eth0 + type: normal vlan_tag: None role: - controller @@ -30,6 +30,7 @@ sys_intf_mappings: - name: tenant interface: eth1 + type: normal vlan_tag: 101 role: - controller @@ -37,6 +38,7 @@ sys_intf_mappings: - name: storage interface: eth1 + type: normal vlan_tag: 102 role: - controller @@ -44,6 +46,7 @@ sys_intf_mappings: - name: external interface: eth1 + type: normal vlan_tag: None role: - controller @@ -102,6 +105,11 @@ public_vip: interface: external onos_nic: eth2 +tenant_net_info: + type: vxlan + range: "1:1000" + provider_network: None + public_net_info: enable: "True" network: ext-net diff --git a/deploy/conf/vm_environment/huawei-virtual9/network.yml b/deploy/conf/vm_environment/huawei-virtual9/network.yml index 924a4ea4..4359202e 100644 --- a/deploy/conf/vm_environment/huawei-virtual9/network.yml +++ b/deploy/conf/vm_environment/huawei-virtual9/network.yml @@ -14,15 +14,15 @@ bond_mappings: [] provider_net_mappings: - name: br-provider network: physnet - interface: eth1 + interface: eth10 type: ovs role: - controller - - compute sys_intf_mappings: - name: mgmt interface: eth0 + type: normal vlan_tag: None role: - controller @@ -30,6 +30,7 @@ sys_intf_mappings: - name: tenant interface: eth1 + type: normal vlan_tag: 101 role: - controller @@ -37,6 +38,7 @@ sys_intf_mappings: - name: storage interface: eth1 + type: normal vlan_tag: 102 role: - controller @@ -44,6 +46,7 @@ sys_intf_mappings: - name: external interface: eth1 + type: normal vlan_tag: None role: - controller @@ -102,6 +105,11 @@ public_vip: interface: external onos_nic: eth2 +tenant_net_info: + type: vxlan + range: "1:1000" + provider_network: None + public_net_info: enable: "True" network: ext-net diff --git a/deploy/conf/vm_environment/network.yml b/deploy/conf/vm_environment/network.yml index 924a4ea4..4359202e 100644 --- a/deploy/conf/vm_environment/network.yml +++ b/deploy/conf/vm_environment/network.yml @@ -14,15 +14,15 @@ bond_mappings: [] provider_net_mappings: - name: br-provider network: physnet - interface: eth1 + interface: eth10 type: ovs role: - controller - - compute sys_intf_mappings: - name: mgmt interface: eth0 + type: normal vlan_tag: None role: - controller @@ -30,6 +30,7 @@ sys_intf_mappings: - name: tenant interface: eth1 + type: normal vlan_tag: 101 role: - controller @@ -37,6 +38,7 @@ sys_intf_mappings: - name: storage interface: eth1 + type: normal vlan_tag: 102 role: - controller @@ -44,6 +46,7 @@ sys_intf_mappings: - name: external interface: eth1 + type: normal vlan_tag: None role: - controller @@ -102,6 +105,11 @@ public_vip: interface: external onos_nic: eth2 +tenant_net_info: + type: vxlan + range: "1:1000" + provider_network: None + public_net_info: enable: "True" network: ext-net diff --git a/plugins/moon/roles/moon/templates/compute.j2 b/plugins/moon/roles/moon/templates/compute.j2 index 30355311..b23550f9 100755 --- a/plugins/moon/roles/moon/templates/compute.j2 +++ b/plugins/moon/roles/moon/templates/compute.j2 @@ -10,35 +10,35 @@ auto eth0 iface eth0 inet manual # external interface -{% set intf_external = sys_intf_mappings["external"]["interface"] %} -{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %} -{% set intf_external = intf_external + '.' + sys_intf_mappings["external"]["vlan_tag"]|string %} +{% set intf_external = compu_sys_mappings["external"]["interface"] %} +{% if compu_sys_mappings["external"]["vlan_tag"] | int %} +{% set intf_external = intf_external + '.' + compu_sys_mappings["external"]["vlan_tag"]|string %} {% endif %} auto {{ intf_external }} iface {{ intf_external }} inet manual -{% if sys_intf_mappings["external"]["vlan_tag"] != "None" %} +{% if compu_sys_mappings["external"]["vlan_tag"] | int %} vlan-raw-device {{ intf_external }} {% endif %} # tenant interface -{% set intf_tenant = sys_intf_mappings["tenant"]["interface"] %} -{% if sys_intf_mappings["tenant"]["interface"] != "None" %} -{% set intf_tenant = intf_tenant + '.' + sys_intf_mappings["tenant"]["vlan_tag"]|string %} +{% set intf_tenant = compu_sys_mappings["tenant"]["interface"] %} +{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %} +{% set intf_tenant = intf_tenant + '.' + compu_sys_mappings["tenant"]["vlan_tag"]|string %} {% endif %} auto {{ intf_tenant }} iface {{ intf_tenant }} inet manual -{% if sys_intf_mappings["tenant"]["interface"] != "None" %} +{% if compu_sys_mappings["tenant"]["vlan_tag"] | int %} vlan-raw-device {{ intf_tenant }} {% endif %} # storage interface -{% set intf_storage = sys_intf_mappings["storage"]["interface"] %} -{% if sys_intf_mappings["storage"]["interface"] != "None" %} -{% set intf_storage = intf_storage + '.' + sys_intf_mappings["storage"]["vlan_tag"]|string %} +{% set intf_storage = compu_sys_mappings["storage"]["interface"] %} +{% if compu_sys_mappings["storage"]["vlan_tag"] | int %} +{% set intf_storage = intf_storage + '.' + compu_sys_mappings["storage"]["vlan_tag"]|string %} {% endif %} auto {{ intf_storage }} iface {{ intf_storage }} inet manual -{% if sys_intf_mappings["storage"]["interface"] != "None" %} +{% if compu_sys_mappings["storage"]["vlan_tag"] | int %} vlan-raw-device {{ intf_storage }} {% endif %} @@ -91,4 +91,3 @@ iface br-storage inet static bridge_ports {{ intf_storage }} address {{ ip_settings[inventory_hostname]["storage"]["ip"] }} netmask 255.255.255.0 - diff --git a/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service b/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service deleted file mode 100644 index f4801a36..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/files/opendaylight.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=OpenDaylight -After= - - -[Service] -User=root -Group=root -Type=simple -WorkingDirectory=/opt/opendaylight -PermissionsStartOnly=true -ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/karaf.branding-1.8.1-SNAPSHOT.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main -Restart=on-failure -LimitNOFILE=65535 -TimeoutStopSec=15 - -[Install] -WantedBy=multi-user.target - diff --git a/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml b/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml deleted file mode 100755 index 2650d072..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/handlers/main.yml +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################## -# 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: restart odl service - service: name=opendaylight state=restarted diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml deleted file mode 100644 index dc071cc7..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-1.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- - -- name: install crudini - package: - name: crudini - state: latest - -- name: install networking-odl - pip: - name: networking-odl - version: "{{ networking_odl_version }}" - virtualenv: /openstack/venvs/neutron-15.1.4 - -- name: configure vsctl for dhcp agent - shell: | - crudini --set /etc/neutron/dhcp_agent.ini OVS \ - ovsdb_interface vsctl; - when: - - inventory_hostname not in groups['nova_compute'] - -- name: configure vsctl for l3 agent - shell: | - crudini --set /etc/neutron/l3_agent.ini OVS \ - ovsdb_interface vsctl; - when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute'] - -- name: stop neutron l3 agent - service: name=neutron-l3-agent state=stopped enabled=no - when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute'] - -- name: shut down and disable Neutron's openvswitch agent services - service: name={{ service_ovs_agent_name }} state=stopped enabled=no - -- name: Stop the Open vSwitch service and clear existing OVSDB - shell: > - service {{ service_ovs_name }} stop ; - rm -rf /var/log/openvswitch/* ; - rm -rf /etc/openvswitch/conf.db ; - service {{ service_ovs_name }} start ; diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml deleted file mode 100644 index f53a3ac8..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-2.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- - -- name: set opendaylight as the manager - command: | - su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}:6640;" - -- name: check br-int - shell: | - ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; \ - ovs-vsctl list-br | grep br-int; done - -# yamllint disable rule:line-length -- name: set local ip in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config={'local_ip'=' {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }} '}; - when: inventory_hostname not in groups['nova_compute'] - -- name: set local ip in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config={'local_ip'=' {{ hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address'] }} '}; - when: inventory_hostname in groups['nova_compute'] -# yamllint enable rule:line-length - -- name: Setup br-provider - openvswitch_bridge: - bridge: br-provider - state: present - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: add ovs uplink - openvswitch_port: - bridge: br-provider - port: "eth12" - state: present - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: set external nic in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config:provider_mappings=physnet:br-provider - when: - - odl_l3_agent == "Disable" - - inventory_hostname not in groups['nova_compute'] - -- name: set external nic in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config:provider_mappings=physnet:eth12 - when: - - odl_l3_agent == "Enable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ - --datapath_type=system --bridge_mappings=physnet:br-provider - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig - --datapath_type=system --bridge_mappings=physnet:eth12 - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Enable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system - when: - - inventory_hostname in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig - --datapath_type=system --bridge_mappings=physnet:eth12 - when: - - inventory_hostname in groups['nova_compute'] - - odl_l3_agent == "Enable" diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml deleted file mode 100644 index 68446a83..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-agents-3.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- - -- name: configure opendaylight -> ml2 - shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider; - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; - when: odl_l3_agent == "Enable" - -- name: configure external bridge name for L2 - shell: | - crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider; - when: odl_l3_agent == "Disable" - -- name: configure opendaylight in ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ - http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ - pseudo-agentdb-binding; - -- name: configure metadata for l3 configuration - shell: | - crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ - enable_isolated_metadata "True"; - when: - - inventory_hostname not in groups['nova_compute'] - -- name: force metadata for l3 configuration - shell: | - crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ - force_metadata "True"; - when: - - inventory_hostname not in groups['nova_compute'] diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml deleted file mode 100644 index 3cef9792..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-db-1.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -- name: drop and recreate neutron database - shell: | - mysql -e "drop database if exists neutron;"; - mysql -e "create database neutron character set utf8;"; - mysql -e "grant all on neutron.* to 'neutron'@'%' identified by \ - '{{ neutron_container_mysql_password }}';"; diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml deleted file mode 100644 index 6879340e..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-1.yml +++ /dev/null @@ -1,100 +0,0 @@ ---- - -- name: check sdn_package cache - stat: - path=/opt/sdn_package.tar.gz - register: sdn_cache # Todo: remove hard code and add md5 check - -- name: debug - debug: msg="{{ sdn_cache }}" - -- name: get sdn_package - get_url: - url: "{{ sdn_package }}" - dest: /opt/ - when: sdn_cache.stat.exists != 'true' - -- name: create odl group - group: name=odl system=yes state=present - -- name: create odl user - user: - name: odl - group: odl - home: "{{ odl_home }}" - createhome: "yes" - system: "yes" - shell: "/bin/false" - -- name: clear sdn_package - command: su -s /bin/sh -c "rm -rf /opt/sdn_package" - -- name: clear jdk8 package - command: su -s /bin/sh -c "rm -rf /opt/install_jdk8" - -- name: unarchive sdn_package - command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/" - -- name: copy java package - command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/" - -- name: unarchive java_install package - command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/" - -- name: install java - command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" - -- name: clear odl package - command: su -s /bin/sh -c "rm -rf {{ odl_home }}*" - -- name: extract odl package - command: | - su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \ - --strip-components 1" odl - -- name: opendaylight system file - copy: - src: "{{ service_file.src }}" - dest: "{{ service_file.dst }}" - mode: 0755 - -- name: set l3 fwd enable in custom.properties - template: - src: custom.properties - dest: "{{ odl_home }}/etc/custom.properties" - owner: odl - group: odl - mode: 0775 - when: odl_l3_agent == "Enable" - -- name: create karaf config - template: - src: org.apache.karaf.features.cfg - dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" - owner: odl - group: odl - mode: 0775 - -- name: copy acl configuration script - template: - src: acl_conf.sh - dest: "/opt/acl_conf.sh" - mode: 0777 - -- name: execute acl configuration script - command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl - -- name: create jetty config - shell: > - sed -i 's/default="8181"/default="8081"/' - {{ odl_home }}etc/jetty.xml - -- name: create tomcat config - shell: > - sed -i 's/port="8282"/port="8081"/' - {{ odl_home }}configuration/tomcat-server.xml - -- name: remove karaf data directory - file: - path: "{{ odl_home }}data" - state: absent diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml deleted file mode 100644 index b8d9403a..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-hosts-2.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- - -- name: chown opendaylight directory and files - shell: > - chown -R odl:odl "{{ odl_home }}"; - chown odl:odl "{{ service_file.dst }}"; - -- name: start opendaylight - service: name=opendaylight state=started - when: ansible_os_family == "Debian" - -- name: set opendaylight autostart - shell: chkconfig opendaylight on - when: ansible_os_family == "RedHat" - -- name: start opendaylight - shell: service opendaylight start - when: ansible_os_family == "RedHat" - -- name: check if opendaylight running - shell: | - netstat -lpen --tcp | grep java | grep 6653; - while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml deleted file mode 100644 index 8427e4f0..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-repos-1.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- - -- name: download networking-odl - get_url: - url: "{{ odl_pip }}" - dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64 - -- name: patch networking-odl to fix a bug - shell: | - cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ - tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify - rm -rf networking-odl-4.0.0.tar.gz - sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt - tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/ - rm -rf networking-odl-4.0.0/ - pip install networking-odl-4.0.0.tar.gz -d ./ - cd - diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml deleted file mode 100644 index 459c734a..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-1.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- - -- name: install crudini - package: - name: crudini - state: latest - -- name: install networking-odl - pip: - name: networking-odl - version: "{{ networking_odl_version }}" - virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify - -- name: turn off neutron-server on control node - service: name=neutron-server state=stopped diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml deleted file mode 100644 index 59b3aa2f..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-2.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- - -- name: configure odl l3 driver - shell: | - crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ - odl-router,metering; - when: odl_l3_agent == "Enable" - -- name: configure opendaylight -> ml2 - shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider; - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; - when: odl_l3_agent == "Enable" - -- name: turn off l3 ha for odl l2 - shell: | - crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; - when: odl_l3_agent == "Disable" - -- name: configure opendaylight in ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ - http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ - pseudo-agentdb-binding; diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml deleted file mode 100644 index 3d5c307b..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/control-servers-3.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- - -- name: Perform a Neutron DB online upgrade - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage - --config-file /etc/neutron/neutron.conf - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini - upgrade --expand - become: "yes" - become_user: "neutron" - -- name: Perform a Neutron DB offline upgrade - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage - --config-file /etc/neutron/neutron.conf - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini - upgrade --contract - become: "yes" - become_user: "neutron" diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml deleted file mode 100644 index 44359056..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/main.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- - -- include_vars: "{{ ansible_os_family }}.yml" - -- include: control-hosts-1.yml - when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts - -- include: control-repos-1.yml - vars: - odl_pip: "{{ networking_odl_url }}" - when: inventory_hostname in groups['repo_container'] - -- include: control-servers-1.yml - when: inventory_hostname in groups['neutron_server'] - -- include: control-agents-1.yml - when: inventory_hostname in groups['neutron_openvswitch_agent'] - -- include: control-hosts-2.yml - when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts - -- include: control-agents-2.yml - when: inventory_hostname in groups['neutron_openvswitch_agent'] - -- include: control-servers-2.yml - when: inventory_hostname in groups['neutron_server'] - -- include: control-agents-3.yml - when: inventory_hostname in groups['neutron_openvswitch_agent'] - -- include: control-db-1.yml - when: inventory_hostname == groups['galera_container'][0] - -- include: control-servers-3.yml - when: - - inventory_hostname in groups['neutron_server'][0] - - inventory_hostname not in groups['network_hosts'] - -- include: odl-post.yml diff --git a/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml b/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml deleted file mode 100644 index 9f1cb79e..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/tasks/odl-post.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- - -- name: restart neutron-server - service: name=neutron-server state=restarted enabled=yes - when: inventory_hostname in groups['neutron_server'] - -- name: restart neutron-l3-agent server - service: name=neutron-l3-agent state=restarted - when: - - odl_l3_agent == "Disable" - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] - -- name: restart neutron-dhcp-agent server - service: name=neutron-dhcp-agent state=restarted - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] - -- name: restart neutron-metadata-agent server - service: name=neutron-metadata-agent state=restarted - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] - -- name: remove karaf data directory - file: - path: "{{ odl_home }}data" - state: absent - when: inventory_hostname in groups['network_hosts'] - -- name: restart opendaylight - shell: sleep 60; service opendaylight restart; sleep 60; - when: inventory_hostname in groups['network_hosts'] diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh b/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh deleted file mode 100755 index 4962a17c..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/templates/acl_conf.sh +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################## -# 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 -############################################################################## -mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ -CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") -cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml -sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties b/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties deleted file mode 100755 index f103c1b8..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/templates/custom.properties +++ /dev/null @@ -1,105 +0,0 @@ -# Extra packages to import from the boot class loader -org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch,com.sun.media.sound - -# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578 -# Extend the framework to avoid the resources to be presented with -# a URL of type bundleresource: but to be presented as file: -osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator - -# Embedded Tomcat configuration File -org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml -org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true - -# Use Equinox as default OSGi Framework Implementation -karaf.framework=equinox - -# Show a progress bar on startup and start the console when all bundles are up and running. -# (If you are in a hurry you can still type enter to start the shell faster.) -karaf.delay.console=true - -# Set security provider to BouncyCastle -org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider - -# We set this to false to disable the Aries BlueprintExtender from doing its orderly container -# shutdown so we can do it after the CSS has shut down all its modules. Otherwise Aries will -# shutdown blueprint containers when the karaf framework starts shutdown (ie when bundle 0 is -# stopped) which can cause failures on CSS module shutdown due to the core blueprint containers -# and services already being shut down. This setting can be removed when/if CSS is removed -# completely from ODL. -org.apache.aries.blueprint.preemptiveShutdown=false - -netconf.config.persister.active=1 - -netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter -netconf.config.persister.1.properties.fileStorage=etc/opendaylight/current/controller.currentconfig.xml -netconf.config.persister.1.properties.numberOfBackups=1 - -# logback configuration -logback.configurationFile=configuration/logback.xml - -# Container configuration -container.profile = Container - -# Connection manager configuration -connection.scheme = ANY_CONTROLLER_ONE_MASTER - -# OVSDB configuration -# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections. -ovsdb.listenPort=6640 - -# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version. -# default Openflow version = 1.0, we also support 1.3. -# ovsdb.of.version=1.3 - -# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is -# disabled by default. -ovsdb.l3.fwd.enabled=yes - -# ovsdb can be configured with ml2 to perform arp responder, enabled by default. -ovsdb.l3.arp.responder.disabled=no - -# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default -# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that -# specific arp/neighDiscovery lookup. -# ovsdb.l3gateway.mac=00:00:5E:00:02:01 - -# TLS configuration -# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. -# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate -# entries, including switches' Certification Authority (CA) certificates. For example, -# secureChannelEnabled=true -# controllerKeyStore=./configuration/ctlKeyStore -# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters) -# controllerTrustStore=./configuration/ctlTrustStore -# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters) - -secureChannelEnabled=false -controllerKeyStore= -controllerKeyStorePassword= -controllerTrustStore= -controllerTrustStorePassword= - -# User Manager configurations -enableStrongPasswordCheck = false - -#Jolokia configurations -#org.jolokia.listenForHttpService=false - -# Logging configuration for Tomcat-JUL logging -java.util.logging.config.file=configuration/tomcat-logging.properties - -#Hosttracker hostsdb key scheme setting -hosttracker.keyscheme=IP - -# LISP Flow Mapping configuration -# Enable merging RLOC sets received from different xTR-IDs for the same EID (default: false) -lisp.mappingMerge = false -# Enable the Solicit-Map-Request (SMR) mechanism (default: true) -lisp.smr = true -# Choose policy for Explicit Locator Path (ELP) handling -# There are three options: -# default: don't add or remove locator records, return mapping as-is -# both: keep the ELP, but add the next hop as a standalone non-LCAF locator with a lower priority -# replace: remove the ELP, add the next hop as a standalone non-LCAF locator -lisp.elpPolicy = default - diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh b/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh deleted file mode 100755 index 0d42e48b..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/templates/ml2_conf.sh +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################## -# 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 -############################################################################## -cat <> /etc/neutron/plugins/ml2/ml2_conf.ini -[ml2_odl] -password = admin -username = admin -url = http://{{ internal_vip.ip }}:8080/controller/nb/v2/neutron -EOT diff --git a/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg b/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg deleted file mode 100755 index bc625cda..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/templates/org.apache.karaf.features.cfg +++ /dev/null @@ -1,54 +0,0 @@ -################################################################################ -# -# 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.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.6.1-SNAPSHOT/xml/features - -# -# Comma separated list of features to install at startup -# -featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-dluxapps-nodes,odl-dluxapps-topology,odl-dluxapps-yangui,odl-dluxapps-yangvisualizer,odl-l2switch-switch,odl-l2switch-switch-ui,odl-ovsdb-hwvtepsouthbound-ui,odl-ovsdb-southbound-impl-ui,odl-netvirt-ui,odl-openflowplugin-flow-services-ui,odl-neutron-logger - -# -# Defines if the boot features are started in asynchronous mode (in a dedicated thread) -# -featuresBootAsynchronous=false - -# -# Store cfg file for config element in feature -# -#configCfgStore=true diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml b/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml deleted file mode 100755 index c78c5221..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/vars/Debian.yml +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- - -common_packages: - - crudini - -service_ovs_name: openvswitch-switch -service_ovs_agent_name: neutron-openvswitch-agent - -service_file: - src: opendaylight.service - dst: /lib/systemd/system/opendaylight.service - -# networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml b/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml deleted file mode 100755 index a2e6d01d..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/vars/RedHat.yml +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- - -common_packages: - - crudini - -service_ovs_name: openvswitch -service_ovs_agent_name: neutron-openvswitch-agent - -service_file: - src: opendaylight.service - dst: /lib/systemd/system/opendaylight.service diff --git a/plugins/odl_cluster/roles/odl_cluster/vars/main.yml b/plugins/odl_cluster/roles/odl_cluster/vars/main.yml deleted file mode 100755 index 42e1acb1..00000000 --- a/plugins/odl_cluster/roles/odl_cluster/vars/main.yml +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- -odl_username: admin -odl_password: admin -odl_api_port: 8181 - -odl_pkg_url: distribution-karaf-0.6.1-Carbon.tar.gz -odl_pkg_name: distribution-karaf-0.6.1-Carbon.tar.gz -odl_home: "/opt/opendaylight/" -odl_base_features: - - config - - standard - - region - - package - - kar - - ssh - - management - - odl-restconf - - odl-l2switch-switch - - odl-openflowplugin-all - - odl-mdsal-apidocs - - odl-dlux-all - - odl-adsal-northbound - - odl-nsf-all - - odl-ovsdb-openstack - - odl-ovsdb-northbound - - odl-dlux-core - -odl_extra_features: - - odl-restconf-all - - odl-mdsal-clustering - - odl-openflowplugin-flow-services - - http - - jolokia-osgi - -odl_features: "{{ odl_base_features + odl_extra_features }}" - -sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz - -# yamllint disable rule:line-length -networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz -# yamllint enable rule:line-length - -jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz -jdk8_script_name: install_jdk8.tar - -common_packages_noarch: [] - -odl_pip: networking-odl-3.2.0 - -networking_odl_version: 4.0.0 - -networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service new file mode 100755 index 00000000..f4801a36 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/files/opendaylight.service @@ -0,0 +1,20 @@ +[Unit] +Description=OpenDaylight +After= + + +[Service] +User=root +Group=root +Type=simple +WorkingDirectory=/opt/opendaylight +PermissionsStartOnly=true +ExecStartPre= +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/karaf.branding-1.8.1-SNAPSHOT.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main +Restart=on-failure +LimitNOFILE=65535 +TimeoutStopSec=15 + +[Install] +WantedBy=multi-user.target + diff --git a/plugins/odl_cluster/roles/setup-odl/handlers/main.yml b/plugins/odl_cluster/roles/setup-odl/handlers/main.yml new file mode 100755 index 00000000..2650d072 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/handlers/main.yml @@ -0,0 +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: restart odl service + service: name=opendaylight state=restarted diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml new file mode 100755 index 00000000..dc071cc7 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-1.yml @@ -0,0 +1,39 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- name: install networking-odl + pip: + name: networking-odl + version: "{{ networking_odl_version }}" + virtualenv: /openstack/venvs/neutron-15.1.4 + +- name: configure vsctl for dhcp agent + shell: | + crudini --set /etc/neutron/dhcp_agent.ini OVS \ + ovsdb_interface vsctl; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: configure vsctl for l3 agent + shell: | + crudini --set /etc/neutron/l3_agent.ini OVS \ + ovsdb_interface vsctl; + when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute'] + +- name: stop neutron l3 agent + service: name=neutron-l3-agent state=stopped enabled=no + when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute'] + +- name: shut down and disable Neutron's openvswitch agent services + service: name={{ service_ovs_agent_name }} state=stopped enabled=no + +- name: Stop the Open vSwitch service and clear existing OVSDB + shell: > + service {{ service_ovs_name }} stop ; + rm -rf /var/log/openvswitch/* ; + rm -rf /etc/openvswitch/conf.db ; + service {{ service_ovs_name }} start ; diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml new file mode 100755 index 00000000..82a26005 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-2.yml @@ -0,0 +1,100 @@ +--- + +- name: set opendaylight as the manager + command: | + su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}:6640;" + +- name: check br-int + shell: | + ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; \ + ovs-vsctl list-br | grep br-int; done + +# yamllint disable rule:line-length +- name: set local ip in openvswitch + shell: > + local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini | + sed 's/local_ip =//g'); + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) + other_config={'local_ip'="$local_ip"}; + when: inventory_hostname not in groups['nova_compute'] + +- name: set local ip in openvswitch + shell: > + local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini | + sed 's/local_ip =//g'); + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) + other_config={'local_ip'="$local_ip"}; + when: inventory_hostname in groups['nova_compute'] +# yamllint enable rule:line-length + +- name: Setup br-provider + openvswitch_bridge: + bridge: "{{ public_bridge }}" + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: add ovs uplink + openvswitch_port: + bridge: "{{ public_bridge }}" + port: "{{ contr_public_intf }}" + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings={{ contr_l2_mappings }} + when: + - odl_l3_agent == "Disable" + - inventory_hostname not in groups['nova_compute'] + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings={{ contr_l3_mappings }} + when: + - odl_l3_agent == "Enable" + - inventory_hostname not in groups['nova_compute'] + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings={{ compu_l3_mappings }} + when: + - odl_l3_agent == "Enable" + - inventory_hostname in groups['nova_compute'] + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + --datapath_type=system --bridge_mappings={{ contr_l2_mappings }} + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + --datapath_type=system --bridge_mappings={{ contr_l3_mappings }} + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Enable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system + when: + - inventory_hostname in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig + --datapath_type=system --bridge_mappings={{ compu_l3_mappings }} + when: + - inventory_hostname in groups['nova_compute'] + - odl_l3_agent == "Enable" diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml new file mode 100755 index 00000000..2527852e --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-agents-3.yml @@ -0,0 +1,69 @@ +--- + +- name: configure opendaylight -> ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; + +- name: configure bridge_mappings -> ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ contr_l2_mappings }}"; + when: + - odl_l3_agent == "Disable" + - inventory_hostname not in groups['nova_compute'] + +- name: configure bridge_mappings -> ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ compu_l2_mappings }}"; + when: + - odl_l3_agent == "Disable" + - inventory_hostname in groups['nova_compute'] + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ contr_l3_mappings }}"; + when: + - odl_l3_agent == "Enable" + - inventory_hostname not in groups['nova_compute'] + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ compu_l3_mappings }}"; + when: + - odl_l3_agent == "Enable" + - inventory_hostname in groups['nova_compute'] + +- name: configure external bridge name for L2 + shell: | + crudini --set /etc/neutron/l3_agent.ini \ + DEFAULT external_network_bridge "{{ public_bridge }}"; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; + +- name: configure metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + enable_isolated_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: force metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + force_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml new file mode 100755 index 00000000..3cef9792 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-db-1.yml @@ -0,0 +1,8 @@ +--- + +- name: drop and recreate neutron database + shell: | + mysql -e "drop database if exists neutron;"; + mysql -e "create database neutron character set utf8;"; + mysql -e "grant all on neutron.* to 'neutron'@'%' identified by \ + '{{ neutron_container_mysql_password }}';"; diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml new file mode 100755 index 00000000..6879340e --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-1.yml @@ -0,0 +1,100 @@ +--- + +- name: check sdn_package cache + stat: + path=/opt/sdn_package.tar.gz + register: sdn_cache # Todo: remove hard code and add md5 check + +- name: debug + debug: msg="{{ sdn_cache }}" + +- name: get sdn_package + get_url: + url: "{{ sdn_package }}" + dest: /opt/ + when: sdn_cache.stat.exists != 'true' + +- name: create odl group + group: name=odl system=yes state=present + +- name: create odl user + user: + name: odl + group: odl + home: "{{ odl_home }}" + createhome: "yes" + system: "yes" + shell: "/bin/false" + +- name: clear sdn_package + command: su -s /bin/sh -c "rm -rf /opt/sdn_package" + +- name: clear jdk8 package + command: su -s /bin/sh -c "rm -rf /opt/install_jdk8" + +- name: unarchive sdn_package + command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/" + +- name: copy java package + command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/" + +- name: unarchive java_install package + command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/" + +- name: install java + command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" + +- name: clear odl package + command: su -s /bin/sh -c "rm -rf {{ odl_home }}*" + +- name: extract odl package + command: | + su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \ + --strip-components 1" odl + +- name: opendaylight system file + copy: + src: "{{ service_file.src }}" + dest: "{{ service_file.dst }}" + mode: 0755 + +- name: set l3 fwd enable in custom.properties + template: + src: custom.properties + dest: "{{ odl_home }}/etc/custom.properties" + owner: odl + group: odl + mode: 0775 + when: odl_l3_agent == "Enable" + +- name: create karaf config + template: + src: org.apache.karaf.features.cfg + dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" + owner: odl + group: odl + mode: 0775 + +- name: copy acl configuration script + template: + src: acl_conf.sh + dest: "/opt/acl_conf.sh" + mode: 0777 + +- name: execute acl configuration script + command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl + +- name: create jetty config + shell: > + sed -i 's/default="8181"/default="8081"/' + {{ odl_home }}etc/jetty.xml + +- name: create tomcat config + shell: > + sed -i 's/port="8282"/port="8081"/' + {{ odl_home }}configuration/tomcat-server.xml + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml new file mode 100755 index 00000000..b8d9403a --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-hosts-2.yml @@ -0,0 +1,23 @@ +--- + +- name: chown opendaylight directory and files + shell: > + chown -R odl:odl "{{ odl_home }}"; + chown odl:odl "{{ service_file.dst }}"; + +- name: start opendaylight + service: name=opendaylight state=started + when: ansible_os_family == "Debian" + +- name: set opendaylight autostart + shell: chkconfig opendaylight on + when: ansible_os_family == "RedHat" + +- name: start opendaylight + shell: service opendaylight start + when: ansible_os_family == "RedHat" + +- name: check if opendaylight running + shell: | + netstat -lpen --tcp | grep java | grep 6653; + while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml new file mode 100755 index 00000000..8427e4f0 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-repos-1.yml @@ -0,0 +1,17 @@ +--- + +- name: download networking-odl + get_url: + url: "{{ odl_pip }}" + dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64 + +- name: patch networking-odl to fix a bug + shell: | + cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ + tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify + rm -rf networking-odl-4.0.0.tar.gz + sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt + tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/ + rm -rf networking-odl-4.0.0/ + pip install networking-odl-4.0.0.tar.gz -d ./ + cd - diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml new file mode 100755 index 00000000..459c734a --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-1.yml @@ -0,0 +1,15 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- name: install networking-odl + pip: + name: networking-odl + version: "{{ networking_odl_version }}" + virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify + +- name: turn off neutron-server on control node + service: name=neutron-server state=stopped diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml new file mode 100755 index 00000000..a5d31d4c --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-2.yml @@ -0,0 +1,36 @@ +--- + +- name: configure odl l3 driver + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ + odl-router,metering; + when: odl_l3_agent == "Enable" + +- name: configure opendaylight -> ml2 + shell: > + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings + "{{ contr_l2_mappings }}"; + +- name: configure bridge_mappings for L3 + shell: > + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings + "{{ contr_l3_mappings }}"; + when: odl_l3_agent == "Enable" + +- name: turn off l3 ha for odl l2 + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml new file mode 100755 index 00000000..3d5c307b --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/control-servers-3.yml @@ -0,0 +1,19 @@ +--- + +- name: Perform a Neutron DB online upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --expand + become: "yes" + become_user: "neutron" + +- name: Perform a Neutron DB offline upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --contract + become: "yes" + become_user: "neutron" diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/main.yml b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml new file mode 100755 index 00000000..e65be002 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/main.yml @@ -0,0 +1,4 @@ +--- + +- include: odl-cluster.yml + when: opendaylight is defined and opendaylight == "Enable" diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml new file mode 100755 index 00000000..5b57fb00 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-cluster.yml @@ -0,0 +1,46 @@ +--- + +- include_vars: "{{ ansible_os_family }}.yml" + +- include_vars: "{{ openstack_passwd_file }}" + +- include: odl-pre.yml + when: inventory_hostname == "localhost" + +- include_vars: /tmp/odl-extra-vars.yml + +- include: control-hosts-1.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-repos-1.yml + vars: + odl_pip: "{{ networking_odl_url }}" + when: inventory_hostname in groups['repo_container'] + +- include: control-servers-1.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-agents-1.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-hosts-2.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-agents-2.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-servers-2.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-agents-3.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-db-1.yml + when: inventory_hostname == groups['galera_container'][0] + +- include: control-servers-3.yml + when: + - inventory_hostname in groups['neutron_server'][0] + - inventory_hostname not in groups['network_hosts'] + +- include: odl-post.yml diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml new file mode 100755 index 00000000..9f1cb79e --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-post.yml @@ -0,0 +1,34 @@ +--- + +- name: restart neutron-server + service: name=neutron-server state=restarted enabled=yes + when: inventory_hostname in groups['neutron_server'] + +- name: restart neutron-l3-agent server + service: name=neutron-l3-agent state=restarted + when: + - odl_l3_agent == "Disable" + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-dhcp-agent server + service: name=neutron-dhcp-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-metadata-agent server + service: name=neutron-metadata-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent + when: inventory_hostname in groups['network_hosts'] + +- name: restart opendaylight + shell: sleep 60; service opendaylight restart; sleep 60; + when: inventory_hostname in groups['network_hosts'] diff --git a/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml b/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml new file mode 100755 index 00000000..64631663 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/tasks/odl-pre.yml @@ -0,0 +1,46 @@ +--- + +- name: set l2_mapping l3_mapping + copy: + dest: /tmp/odl-extra-vars.yml + content: | + {% set contr_l2_list = [] %} + {% set contr_l3_list = [] %} + {% set pub_l2_mapping = [] %} + {% set pub_l3_mapping = [] %} + {% set pub_intf = [] %} + {% set pub_bridge = [] %} + {% for key, value in contr_prv_mappings.iteritems() %} + {% set l2_mapping = key + ":" + value["bridge"] %} + {% set l3_mapping = key + ":" + value["interface"] %} + {% set _ = contr_l2_list.append(l2_mapping) %} + {% set _ = contr_l3_list.append(l3_mapping) %} + {% if key == public_net_info["provider_network"] %} + {% set _ = pub_l2_mapping.append(l2_mapping) %} + {% set _ = pub_l3_mapping.append(l3_mapping) %} + {% set _ = pub_intf.append(value["interface"]) %} + {% set _ = pub_bridge.append(value["bridge"]) %} + {% endif %} + {% endfor %} + {% set compu_l2_list = [] %} + {% set compu_l3_list = [] %} + {% set compu_pub_intf = compu_sys_mappings["external"]["interface"] %} + {% set compu_pub_vlan = compu_sys_mappings["external"]["vlan_tag"] %} + {% if compu_pub_vlan | int %} + {% set compu_pub_intf = compu_pub_intf + '.' + compu_pub_vlan|string %} + {% endif %} + {% for key, value in compu_prv_mappings.iteritems() %} + {% set l2_mapping = key + ":" + value["bridge"] %} + {% set l3_mapping = key + ":" + value["interface"] %} + {% set _ = compu_l2_list.append(l2_mapping) %} + {% set _ = compu_l3_list.append(l3_mapping) %} + {% endfor %} + {% set pub_l3_mapping = pub_l3_mapping[0].replace(pub_intf[0], compu_pub_intf) %} + {% set _ = compu_l2_list.append(pub_l2_mapping[0]) %} + {% set _ = compu_l3_list.append(pub_l3_mapping) %} + public_bridge: "{{ pub_bridge[0] }}" + contr_public_intf: "{{ pub_intf[0] }}" + contr_l2_mappings: "{{ ','.join(contr_l2_list) }}" + contr_l3_mappings: "{{ ','.join(contr_l3_list) }}" + compu_l2_mappings: "{{ ','.join(compu_l2_list) }}" + compu_l3_mappings: "{{ ','.join(compu_l3_list) }}" diff --git a/plugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh b/plugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh new file mode 100755 index 00000000..4962a17c --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/templates/acl_conf.sh @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## +mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ +CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") +cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml +sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/plugins/odl_cluster/roles/setup-odl/templates/custom.properties b/plugins/odl_cluster/roles/setup-odl/templates/custom.properties new file mode 100755 index 00000000..f103c1b8 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/templates/custom.properties @@ -0,0 +1,105 @@ +# Extra packages to import from the boot class loader +org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch,com.sun.media.sound + +# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578 +# Extend the framework to avoid the resources to be presented with +# a URL of type bundleresource: but to be presented as file: +osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator + +# Embedded Tomcat configuration File +org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml +org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true + +# Use Equinox as default OSGi Framework Implementation +karaf.framework=equinox + +# Show a progress bar on startup and start the console when all bundles are up and running. +# (If you are in a hurry you can still type enter to start the shell faster.) +karaf.delay.console=true + +# Set security provider to BouncyCastle +org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider + +# We set this to false to disable the Aries BlueprintExtender from doing its orderly container +# shutdown so we can do it after the CSS has shut down all its modules. Otherwise Aries will +# shutdown blueprint containers when the karaf framework starts shutdown (ie when bundle 0 is +# stopped) which can cause failures on CSS module shutdown due to the core blueprint containers +# and services already being shut down. This setting can be removed when/if CSS is removed +# completely from ODL. +org.apache.aries.blueprint.preemptiveShutdown=false + +netconf.config.persister.active=1 + +netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter +netconf.config.persister.1.properties.fileStorage=etc/opendaylight/current/controller.currentconfig.xml +netconf.config.persister.1.properties.numberOfBackups=1 + +# logback configuration +logback.configurationFile=configuration/logback.xml + +# Container configuration +container.profile = Container + +# Connection manager configuration +connection.scheme = ANY_CONTROLLER_ONE_MASTER + +# OVSDB configuration +# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections. +ovsdb.listenPort=6640 + +# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version. +# default Openflow version = 1.0, we also support 1.3. +# ovsdb.of.version=1.3 + +# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is +# disabled by default. +ovsdb.l3.fwd.enabled=yes + +# ovsdb can be configured with ml2 to perform arp responder, enabled by default. +ovsdb.l3.arp.responder.disabled=no + +# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default +# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that +# specific arp/neighDiscovery lookup. +# ovsdb.l3gateway.mac=00:00:5E:00:02:01 + +# TLS configuration +# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. +# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate +# entries, including switches' Certification Authority (CA) certificates. For example, +# secureChannelEnabled=true +# controllerKeyStore=./configuration/ctlKeyStore +# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters) +# controllerTrustStore=./configuration/ctlTrustStore +# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters) + +secureChannelEnabled=false +controllerKeyStore= +controllerKeyStorePassword= +controllerTrustStore= +controllerTrustStorePassword= + +# User Manager configurations +enableStrongPasswordCheck = false + +#Jolokia configurations +#org.jolokia.listenForHttpService=false + +# Logging configuration for Tomcat-JUL logging +java.util.logging.config.file=configuration/tomcat-logging.properties + +#Hosttracker hostsdb key scheme setting +hosttracker.keyscheme=IP + +# LISP Flow Mapping configuration +# Enable merging RLOC sets received from different xTR-IDs for the same EID (default: false) +lisp.mappingMerge = false +# Enable the Solicit-Map-Request (SMR) mechanism (default: true) +lisp.smr = true +# Choose policy for Explicit Locator Path (ELP) handling +# There are three options: +# default: don't add or remove locator records, return mapping as-is +# both: keep the ELP, but add the next hop as a standalone non-LCAF locator with a lower priority +# replace: remove the ELP, add the next hop as a standalone non-LCAF locator +lisp.elpPolicy = default + diff --git a/plugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh b/plugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh new file mode 100755 index 00000000..0d42e48b --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/templates/ml2_conf.sh @@ -0,0 +1,14 @@ +############################################################################## +# 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 +############################################################################## +cat <> /etc/neutron/plugins/ml2/ml2_conf.ini +[ml2_odl] +password = admin +username = admin +url = http://{{ internal_vip.ip }}:8080/controller/nb/v2/neutron +EOT diff --git a/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg new file mode 100755 index 00000000..bc625cda --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/templates/org.apache.karaf.features.cfg @@ -0,0 +1,54 @@ +################################################################################ +# +# 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.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.6.1-SNAPSHOT/xml/features + +# +# Comma separated list of features to install at startup +# +featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-dluxapps-nodes,odl-dluxapps-topology,odl-dluxapps-yangui,odl-dluxapps-yangvisualizer,odl-l2switch-switch,odl-l2switch-switch-ui,odl-ovsdb-hwvtepsouthbound-ui,odl-ovsdb-southbound-impl-ui,odl-netvirt-ui,odl-openflowplugin-flow-services-ui,odl-neutron-logger + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false + +# +# Store cfg file for config element in feature +# +#configCfgStore=true diff --git a/plugins/odl_cluster/roles/setup-odl/vars/Debian.yml b/plugins/odl_cluster/roles/setup-odl/vars/Debian.yml new file mode 100755 index 00000000..c78c5221 --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/vars/Debian.yml @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch-switch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service + +# networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_cluster/roles/setup-odl/vars/RedHat.yml b/plugins/odl_cluster/roles/setup-odl/vars/RedHat.yml new file mode 100755 index 00000000..a2e6d01d --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/vars/RedHat.yml @@ -0,0 +1,19 @@ +############################################################################## +# 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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service diff --git a/plugins/odl_cluster/roles/setup-odl/vars/main.yml b/plugins/odl_cluster/roles/setup-odl/vars/main.yml new file mode 100755 index 00000000..5e6325fb --- /dev/null +++ b/plugins/odl_cluster/roles/setup-odl/vars/main.yml @@ -0,0 +1,62 @@ +############################################################################## +# 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 +############################################################################## +--- +openstack_passwd_file: /etc/openstack_deploy/user_secrets.yml + +odl_username: admin +odl_password: admin +odl_api_port: 8181 + +odl_pkg_url: distribution-karaf-0.6.1-Carbon.tar.gz +odl_pkg_name: distribution-karaf-0.6.1-Carbon.tar.gz +odl_home: "/opt/opendaylight/" +odl_base_features: + - config + - standard + - region + - package + - kar + - ssh + - management + - odl-restconf + - odl-l2switch-switch + - odl-openflowplugin-all + - odl-mdsal-apidocs + - odl-dlux-all + - odl-adsal-northbound + - odl-nsf-all + - odl-ovsdb-openstack + - odl-ovsdb-northbound + - odl-dlux-core + +odl_extra_features: + - odl-restconf-all + - odl-mdsal-clustering + - odl-openflowplugin-flow-services + - http + - jolokia-osgi + +odl_features: "{{ odl_base_features + odl_extra_features }}" + +sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz + +# yamllint disable rule:line-length +networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz +# yamllint enable rule:line-length + +jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz +jdk8_script_name: install_jdk8.tar + +common_packages_noarch: [] + +odl_pip: networking-odl-3.2.0 + +networking_odl_version: 4.0.0 + +networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml b/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml deleted file mode 100644 index 3abca829..00000000 --- a/plugins/odl_cluster/roles/setup-opendaylight/tasks/main.yml +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################## -# 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: copy setup-odl.yml - template: - src: setup-odl.yml.j2 - dest: /opt/openstack-ansible/playbooks/setup-odl.yml - -- name: copy odl_cluster role - copy: - src: /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster - dest: /etc/ansible/roles/ - -- name: setup odl - shell: "export ANSIBLE_LOG_PATH=/var/ansible/run/openstack_ocata-opnfv2/ansible.log; \ - cd /opt/openstack-ansible/playbooks; \ - openstack-ansible setup-odl.yml > /dev/null" - when: opendaylight is defined and opendaylight == "Enable" diff --git a/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 b/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 deleted file mode 100644 index 18446ce5..00000000 --- a/plugins/odl_cluster/roles/setup-opendaylight/templates/setup-odl.yml.j2 +++ /dev/null @@ -1,12 +0,0 @@ ---- - -- name: run opendaylight role - hosts: neutron_all | galera_container | network_hosts | repo_container - max_fail_percentage: 20 - user: root - roles: - - odl_cluster - vars: - - odl_l3_agent: "{{ odl_l3_agent }}" - tags: - - odl diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service b/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service deleted file mode 100644 index f4801a36..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/files/opendaylight.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=OpenDaylight -After= - - -[Service] -User=root -Group=root -Type=simple -WorkingDirectory=/opt/opendaylight -PermissionsStartOnly=true -ExecStartPre= -ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/karaf.branding-1.8.1-SNAPSHOT.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main -Restart=on-failure -LimitNOFILE=65535 -TimeoutStopSec=15 - -[Install] -WantedBy=multi-user.target - diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf b/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf deleted file mode 100644 index acf2e2f4..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/files/sfc.conf +++ /dev/null @@ -1,9 +0,0 @@ -[DEFAULT] - -service_plugins = odl-router,metering,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin - -[sfc] -drivers = odl - -[flowclassifier] -drivers = odl diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml deleted file mode 100644 index 2650d072..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/handlers/main.yml +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################## -# 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: restart odl service - service: name=opendaylight state=restarted diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml deleted file mode 100644 index dc071cc7..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-1.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- - -- name: install crudini - package: - name: crudini - state: latest - -- name: install networking-odl - pip: - name: networking-odl - version: "{{ networking_odl_version }}" - virtualenv: /openstack/venvs/neutron-15.1.4 - -- name: configure vsctl for dhcp agent - shell: | - crudini --set /etc/neutron/dhcp_agent.ini OVS \ - ovsdb_interface vsctl; - when: - - inventory_hostname not in groups['nova_compute'] - -- name: configure vsctl for l3 agent - shell: | - crudini --set /etc/neutron/l3_agent.ini OVS \ - ovsdb_interface vsctl; - when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute'] - -- name: stop neutron l3 agent - service: name=neutron-l3-agent state=stopped enabled=no - when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute'] - -- name: shut down and disable Neutron's openvswitch agent services - service: name={{ service_ovs_agent_name }} state=stopped enabled=no - -- name: Stop the Open vSwitch service and clear existing OVSDB - shell: > - service {{ service_ovs_name }} stop ; - rm -rf /var/log/openvswitch/* ; - rm -rf /etc/openvswitch/conf.db ; - service {{ service_ovs_name }} start ; diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml deleted file mode 100644 index f53a3ac8..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-2.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- - -- name: set opendaylight as the manager - command: | - su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}:6640;" - -- name: check br-int - shell: | - ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; \ - ovs-vsctl list-br | grep br-int; done - -# yamllint disable rule:line-length -- name: set local ip in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config={'local_ip'=' {{ hostvars[inventory_hostname]['container_networks']['tunnel_address']['address'] }} '}; - when: inventory_hostname not in groups['nova_compute'] - -- name: set local ip in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config={'local_ip'=' {{ hostvars[inventory_hostname]['ansible_br_vxlan']['ipv4']['address'] }} '}; - when: inventory_hostname in groups['nova_compute'] -# yamllint enable rule:line-length - -- name: Setup br-provider - openvswitch_bridge: - bridge: br-provider - state: present - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: add ovs uplink - openvswitch_port: - bridge: br-provider - port: "eth12" - state: present - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: set external nic in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config:provider_mappings=physnet:br-provider - when: - - odl_l3_agent == "Disable" - - inventory_hostname not in groups['nova_compute'] - -- name: set external nic in openvswitch - shell: | - ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ - other_config:provider_mappings=physnet:eth12 - when: - - odl_l3_agent == "Enable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ - --datapath_type=system --bridge_mappings=physnet:br-provider - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig - --datapath_type=system --bridge_mappings=physnet:eth12 - when: - - inventory_hostname not in groups['nova_compute'] - - odl_l3_agent == "Enable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system - when: - - inventory_hostname in groups['nova_compute'] - - odl_l3_agent == "Disable" - -- name: Set host OVS configurations - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig - --datapath_type=system --bridge_mappings=physnet:eth12 - when: - - inventory_hostname in groups['nova_compute'] - - odl_l3_agent == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml deleted file mode 100644 index 68446a83..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-agents-3.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- - -- name: configure opendaylight -> ml2 - shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider; - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; - when: odl_l3_agent == "Enable" - -- name: configure external bridge name for L2 - shell: | - crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider; - when: odl_l3_agent == "Disable" - -- name: configure opendaylight in ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ - http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ - pseudo-agentdb-binding; - -- name: configure metadata for l3 configuration - shell: | - crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ - enable_isolated_metadata "True"; - when: - - inventory_hostname not in groups['nova_compute'] - -- name: force metadata for l3 configuration - shell: | - crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ - force_metadata "True"; - when: - - inventory_hostname not in groups['nova_compute'] diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml deleted file mode 100644 index 3cef9792..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-db-1.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -- name: drop and recreate neutron database - shell: | - mysql -e "drop database if exists neutron;"; - mysql -e "create database neutron character set utf8;"; - mysql -e "grant all on neutron.* to 'neutron'@'%' identified by \ - '{{ neutron_container_mysql_password }}';"; diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml deleted file mode 100644 index 6879340e..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-1.yml +++ /dev/null @@ -1,100 +0,0 @@ ---- - -- name: check sdn_package cache - stat: - path=/opt/sdn_package.tar.gz - register: sdn_cache # Todo: remove hard code and add md5 check - -- name: debug - debug: msg="{{ sdn_cache }}" - -- name: get sdn_package - get_url: - url: "{{ sdn_package }}" - dest: /opt/ - when: sdn_cache.stat.exists != 'true' - -- name: create odl group - group: name=odl system=yes state=present - -- name: create odl user - user: - name: odl - group: odl - home: "{{ odl_home }}" - createhome: "yes" - system: "yes" - shell: "/bin/false" - -- name: clear sdn_package - command: su -s /bin/sh -c "rm -rf /opt/sdn_package" - -- name: clear jdk8 package - command: su -s /bin/sh -c "rm -rf /opt/install_jdk8" - -- name: unarchive sdn_package - command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/" - -- name: copy java package - command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/" - -- name: unarchive java_install package - command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/" - -- name: install java - command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" - -- name: clear odl package - command: su -s /bin/sh -c "rm -rf {{ odl_home }}*" - -- name: extract odl package - command: | - su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \ - --strip-components 1" odl - -- name: opendaylight system file - copy: - src: "{{ service_file.src }}" - dest: "{{ service_file.dst }}" - mode: 0755 - -- name: set l3 fwd enable in custom.properties - template: - src: custom.properties - dest: "{{ odl_home }}/etc/custom.properties" - owner: odl - group: odl - mode: 0775 - when: odl_l3_agent == "Enable" - -- name: create karaf config - template: - src: org.apache.karaf.features.cfg - dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" - owner: odl - group: odl - mode: 0775 - -- name: copy acl configuration script - template: - src: acl_conf.sh - dest: "/opt/acl_conf.sh" - mode: 0777 - -- name: execute acl configuration script - command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl - -- name: create jetty config - shell: > - sed -i 's/default="8181"/default="8081"/' - {{ odl_home }}etc/jetty.xml - -- name: create tomcat config - shell: > - sed -i 's/port="8282"/port="8081"/' - {{ odl_home }}configuration/tomcat-server.xml - -- name: remove karaf data directory - file: - path: "{{ odl_home }}data" - state: absent diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml deleted file mode 100644 index b8d9403a..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-hosts-2.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- - -- name: chown opendaylight directory and files - shell: > - chown -R odl:odl "{{ odl_home }}"; - chown odl:odl "{{ service_file.dst }}"; - -- name: start opendaylight - service: name=opendaylight state=started - when: ansible_os_family == "Debian" - -- name: set opendaylight autostart - shell: chkconfig opendaylight on - when: ansible_os_family == "RedHat" - -- name: start opendaylight - shell: service opendaylight start - when: ansible_os_family == "RedHat" - -- name: check if opendaylight running - shell: | - netstat -lpen --tcp | grep java | grep 6653; - while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml deleted file mode 100644 index 2e58e141..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-repos-1.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- - -- name: download networking-odl - get_url: - url: "{{ odl_pip }}" - dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64 - -- name: download networking-sfc - shell: | - mkdir -p /opt/tmp - pip install networking-sfc==4.0.0 -d /opt/tmp/ - cp /opt/tmp/networking* /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ - rm -rf /opt/tmp - when: - - odl_sfc == "Enable" - - inventory_hostname in groups['repo_container'][0] - -- name: patch networking-odl to fix a bug - shell: | - cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ - tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify - rm -rf networking-odl-4.0.0.tar.gz - sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt - tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/ - rm -rf networking-odl-4.0.0/ - pip install networking-odl-4.0.0.tar.gz -d ./ - cd - diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml deleted file mode 100644 index e2dd128d..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-1.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- - -- name: install crudini - package: - name: crudini - state: latest - -- name: install networking-odl - pip: - name: networking-odl - version: "{{ networking_odl_version }}" - virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify - -- name: install networking-sfc - pip: - name: networking-sfc - version: "4.0.0" - virtualenv: /openstack/venvs/neutron-15.1.4 - when: odl_sfc == "Enable" - -- name: turn off neutron-server on control node - service: name=neutron-server state=stopped diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml deleted file mode 100644 index 5d743382..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-2.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- - -- name: configure odl l3 driver - shell: | - crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ - odl-router,metering; - when: odl_l3_agent == "Enable" - -- name: configure opendaylight -> ml2 - shell: > - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:br-provider; - -- name: configure bridge_mappings for L3 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; - when: odl_l3_agent == "Enable" - -- name: turn off l3 ha for odl l2 - shell: | - crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; - when: odl_l3_agent == "Disable" - -- name: configure opendaylight in ml2 - shell: | - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ - http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; - crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ - pseudo-agentdb-binding; - -- name: copy sfc.conf - copy: - src: "{{ sfc_plugins.src }}" - dest: "{{ sfc_plugins.dst }}" - mode: 0755 - when: odl_sfc == "Enable" - -- name: Configure SFC driver - shell: crudini --merge /etc/neutron/neutron.conf < /opt/sfc.conf - when: odl_sfc == "Enable" - -- name: delete sfc.conf - shell: rm -rf {{ sfc_plugins.dst }} - when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml deleted file mode 100644 index 0c11e36f..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-servers-3.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- - -- name: Perform a Neutron DB online upgrade - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage - --config-file /etc/neutron/neutron.conf - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini - upgrade --expand - become: "yes" - become_user: "neutron" - -- name: Perform a Neutron DB offline upgrade - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage - --config-file /etc/neutron/neutron.conf - --config-file /etc/neutron/plugins/ml2/ml2_conf.ini - upgrade --contract - become: "yes" - become_user: "neutron" - -- name: SFC DB upgrade - command: | - /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage - --subproject networking-sfc - upgrade head - become: "yes" - become_user: "neutron" - when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml deleted file mode 100644 index 613c796b..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/control-utility-1.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -- name: Install networking-sfc for CLI - pip: - name: networking-sfc - version: "4.0.0" - when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml deleted file mode 100644 index 91fc71fa..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/main.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- - -- include_vars: "{{ ansible_os_family }}.yml" - -- include: control-hosts-1.yml - when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts - -- include: control-repos-1.yml - vars: - odl_pip: "{{ networking_odl_url }}" - when: inventory_hostname in groups['repo_container'] - -- include: control-servers-1.yml - when: inventory_hostname in groups['neutron_server'] - -- include: control-utility-1.yml - when: - - inventory_hostname in groups['utility'] - - odl_sfc == "Enable" - -- include: control-agents-1.yml - when: inventory_hostname in groups['neutron_openvswitch_agent'] - -- include: control-hosts-2.yml - when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts - -- include: control-agents-2.yml - when: inventory_hostname in groups['neutron_openvswitch_agent'] - -- include: control-servers-2.yml - when: inventory_hostname in groups['neutron_server'] - -- include: control-agents-3.yml - when: inventory_hostname in groups['neutron_openvswitch_agent'] - -- include: control-db-1.yml - when: inventory_hostname == groups['galera_container'][0] - -- include: control-servers-3.yml - when: - - inventory_hostname in groups['neutron_server'][0] - - inventory_hostname not in groups['network_hosts'] - -- include: odl-post.yml diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml deleted file mode 100644 index 9f1cb79e..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/tasks/odl-post.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- - -- name: restart neutron-server - service: name=neutron-server state=restarted enabled=yes - when: inventory_hostname in groups['neutron_server'] - -- name: restart neutron-l3-agent server - service: name=neutron-l3-agent state=restarted - when: - - odl_l3_agent == "Disable" - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] - -- name: restart neutron-dhcp-agent server - service: name=neutron-dhcp-agent state=restarted - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] - -- name: restart neutron-metadata-agent server - service: name=neutron-metadata-agent state=restarted - when: - - inventory_hostname in groups['neutron_openvswitch_agent'] - - inventory_hostname not in groups['nova_compute'] - -- name: remove karaf data directory - file: - path: "{{ odl_home }}data" - state: absent - when: inventory_hostname in groups['network_hosts'] - -- name: restart opendaylight - shell: sleep 60; service opendaylight restart; sleep 60; - when: inventory_hostname in groups['network_hosts'] diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh deleted file mode 100644 index 4962a17c..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/acl_conf.sh +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################## -# 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 -############################################################################## -mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ -CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") -cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml -sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties deleted file mode 100644 index f103c1b8..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/custom.properties +++ /dev/null @@ -1,105 +0,0 @@ -# Extra packages to import from the boot class loader -org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch,com.sun.media.sound - -# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578 -# Extend the framework to avoid the resources to be presented with -# a URL of type bundleresource: but to be presented as file: -osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator - -# Embedded Tomcat configuration File -org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml -org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true - -# Use Equinox as default OSGi Framework Implementation -karaf.framework=equinox - -# Show a progress bar on startup and start the console when all bundles are up and running. -# (If you are in a hurry you can still type enter to start the shell faster.) -karaf.delay.console=true - -# Set security provider to BouncyCastle -org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider - -# We set this to false to disable the Aries BlueprintExtender from doing its orderly container -# shutdown so we can do it after the CSS has shut down all its modules. Otherwise Aries will -# shutdown blueprint containers when the karaf framework starts shutdown (ie when bundle 0 is -# stopped) which can cause failures on CSS module shutdown due to the core blueprint containers -# and services already being shut down. This setting can be removed when/if CSS is removed -# completely from ODL. -org.apache.aries.blueprint.preemptiveShutdown=false - -netconf.config.persister.active=1 - -netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter -netconf.config.persister.1.properties.fileStorage=etc/opendaylight/current/controller.currentconfig.xml -netconf.config.persister.1.properties.numberOfBackups=1 - -# logback configuration -logback.configurationFile=configuration/logback.xml - -# Container configuration -container.profile = Container - -# Connection manager configuration -connection.scheme = ANY_CONTROLLER_ONE_MASTER - -# OVSDB configuration -# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections. -ovsdb.listenPort=6640 - -# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version. -# default Openflow version = 1.0, we also support 1.3. -# ovsdb.of.version=1.3 - -# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is -# disabled by default. -ovsdb.l3.fwd.enabled=yes - -# ovsdb can be configured with ml2 to perform arp responder, enabled by default. -ovsdb.l3.arp.responder.disabled=no - -# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default -# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that -# specific arp/neighDiscovery lookup. -# ovsdb.l3gateway.mac=00:00:5E:00:02:01 - -# TLS configuration -# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. -# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate -# entries, including switches' Certification Authority (CA) certificates. For example, -# secureChannelEnabled=true -# controllerKeyStore=./configuration/ctlKeyStore -# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters) -# controllerTrustStore=./configuration/ctlTrustStore -# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters) - -secureChannelEnabled=false -controllerKeyStore= -controllerKeyStorePassword= -controllerTrustStore= -controllerTrustStorePassword= - -# User Manager configurations -enableStrongPasswordCheck = false - -#Jolokia configurations -#org.jolokia.listenForHttpService=false - -# Logging configuration for Tomcat-JUL logging -java.util.logging.config.file=configuration/tomcat-logging.properties - -#Hosttracker hostsdb key scheme setting -hosttracker.keyscheme=IP - -# LISP Flow Mapping configuration -# Enable merging RLOC sets received from different xTR-IDs for the same EID (default: false) -lisp.mappingMerge = false -# Enable the Solicit-Map-Request (SMR) mechanism (default: true) -lisp.smr = true -# Choose policy for Explicit Locator Path (ELP) handling -# There are three options: -# default: don't add or remove locator records, return mapping as-is -# both: keep the ELP, but add the next hop as a standalone non-LCAF locator with a lower priority -# replace: remove the ELP, add the next hop as a standalone non-LCAF locator -lisp.elpPolicy = default - diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh deleted file mode 100644 index 0d42e48b..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/ml2_conf.sh +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################## -# 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 -############################################################################## -cat <> /etc/neutron/plugins/ml2/ml2_conf.ini -[ml2_odl] -password = admin -username = admin -url = http://{{ internal_vip.ip }}:8080/controller/nb/v2/neutron -EOT diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg deleted file mode 100755 index b07e028f..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/templates/org.apache.karaf.features.cfg +++ /dev/null @@ -1,54 +0,0 @@ -################################################################################ -# -# 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.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.6.1-SNAPSHOT/xml/features - -# -# Comma separated list of features to install at startup -# -featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-dluxapps-nodes,odl-dluxapps-topology,odl-dluxapps-yangui,odl-dluxapps-yangvisualizer,odl-l2switch-switch,odl-l2switch-switch-ui,odl-ovsdb-hwvtepsouthbound-ui,odl-ovsdb-southbound-impl-ui,odl-netvirt-ui,odl-openflowplugin-flow-services-ui,odl-neutron-logger,odl-netvirt-sfc - -# -# Defines if the boot features are started in asynchronous mode (in a dedicated thread) -# -featuresBootAsynchronous=false - -# -# Store cfg file for config element in feature -# -#configCfgStore=true diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml deleted file mode 100644 index c78c5221..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/Debian.yml +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- - -common_packages: - - crudini - -service_ovs_name: openvswitch-switch -service_ovs_agent_name: neutron-openvswitch-agent - -service_file: - src: opendaylight.service - dst: /lib/systemd/system/opendaylight.service - -# networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml deleted file mode 100644 index a2e6d01d..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/RedHat.yml +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- - -common_packages: - - crudini - -service_ovs_name: openvswitch -service_ovs_agent_name: neutron-openvswitch-agent - -service_file: - src: opendaylight.service - dst: /lib/systemd/system/opendaylight.service diff --git a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml b/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml deleted file mode 100644 index a9466ea0..00000000 --- a/plugins/odl_sfc/roles/odl_cluster_sfc/vars/main.yml +++ /dev/null @@ -1,65 +0,0 @@ -############################################################################## -# 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 -############################################################################## ---- -odl_username: admin -odl_password: admin -odl_api_port: 8181 - -# odl_sfc -sfc_plugins: - src: sfc.conf - dst: /opt/sfc.conf - -odl_pkg_url: distribution-karaf-0.6.1-Carbon.tar.gz -odl_pkg_name: distribution-karaf-0.6.1-Carbon.tar.gz -odl_home: "/opt/opendaylight/" -odl_base_features: - - config - - standard - - region - - package - - kar - - ssh - - management - - odl-restconf - - odl-l2switch-switch - - odl-openflowplugin-all - - odl-mdsal-apidocs - - odl-dlux-all - - odl-adsal-northbound - - odl-nsf-all - - odl-ovsdb-openstack - - odl-ovsdb-northbound - - odl-dlux-core - -odl_extra_features: - - odl-restconf-all - - odl-mdsal-clustering - - odl-openflowplugin-flow-services - - http - - jolokia-osgi - -odl_features: "{{ odl_base_features + odl_extra_features }}" - -sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz - -# yamllint disable rule:line-length -networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz -# yamllint enable rule:line-length - -jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz -jdk8_script_name: install_jdk8.tar - -common_packages_noarch: [] - -odl_pip: networking-odl-3.2.0 - -networking_odl_version: 4.0.0 - -networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service new file mode 100755 index 00000000..f4801a36 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/opendaylight.service @@ -0,0 +1,20 @@ +[Unit] +Description=OpenDaylight +After= + + +[Service] +User=root +Group=root +Type=simple +WorkingDirectory=/opt/opendaylight +PermissionsStartOnly=true +ExecStartPre= +ExecStart=/usr/lib/jvm/java-8-oracle/bin/java -Djava.security.properties=/opt/opendaylight/etc/odl.java.security -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Djava.security.egd=file:/dev/./urandom -Djava.endorsed.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/endorsed:/usr/lib/jvm/java-8-oracle/lib/endorsed:/opt/opendaylight/lib/endorsed -Djava.ext.dirs=/usr/lib/jvm/java-8-oracle/jre/lib/ext:/usr/lib/jvm/java-8-oracle/lib/ext:/opt/opendaylight/lib/ext -Dkaraf.instances=/opt/opendaylight/instances -Dkaraf.home=/opt/opendaylight -Dkaraf.base=/opt/opendaylight -Dkaraf.data=/opt/opendaylight/data -Dkaraf.etc=/opt/opendaylight/etc -Djava.io.tmpdir=/opt/opendaylight/data/tmp -Djava.util.logging.config.file=/opt/opendaylight/etc/java.util.logging.properties -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -classpath /opt/opendaylight/lib/karaf.branding-1.8.1-SNAPSHOT.jar:/opt/opendaylight/lib/karaf-jaas-boot.jar:/opt/opendaylight/lib/karaf.jar:/opt/opendaylight/lib/karaf-org.osgi.core.jar org.apache.karaf.main.Main +Restart=on-failure +LimitNOFILE=65535 +TimeoutStopSec=15 + +[Install] +WantedBy=multi-user.target + diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf new file mode 100755 index 00000000..acf2e2f4 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/files/sfc.conf @@ -0,0 +1,9 @@ +[DEFAULT] + +service_plugins = odl-router,metering,networking_sfc.services.sfc.plugin.SfcPlugin,networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin + +[sfc] +drivers = odl + +[flowclassifier] +drivers = odl diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml new file mode 100755 index 00000000..2650d072 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/handlers/main.yml @@ -0,0 +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: restart odl service + service: name=opendaylight state=restarted diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml new file mode 100755 index 00000000..dc071cc7 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-1.yml @@ -0,0 +1,39 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- name: install networking-odl + pip: + name: networking-odl + version: "{{ networking_odl_version }}" + virtualenv: /openstack/venvs/neutron-15.1.4 + +- name: configure vsctl for dhcp agent + shell: | + crudini --set /etc/neutron/dhcp_agent.ini OVS \ + ovsdb_interface vsctl; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: configure vsctl for l3 agent + shell: | + crudini --set /etc/neutron/l3_agent.ini OVS \ + ovsdb_interface vsctl; + when: odl_l3_agent == "Disable" and inventory_hostname not in groups['nova_compute'] + +- name: stop neutron l3 agent + service: name=neutron-l3-agent state=stopped enabled=no + when: odl_l3_agent == "Enable" and inventory_hostname not in groups['nova_compute'] + +- name: shut down and disable Neutron's openvswitch agent services + service: name={{ service_ovs_agent_name }} state=stopped enabled=no + +- name: Stop the Open vSwitch service and clear existing OVSDB + shell: > + service {{ service_ovs_name }} stop ; + rm -rf /var/log/openvswitch/* ; + rm -rf /etc/openvswitch/conf.db ; + service {{ service_ovs_name }} start ; diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml new file mode 100755 index 00000000..82a26005 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-2.yml @@ -0,0 +1,100 @@ +--- + +- name: set opendaylight as the manager + command: | + su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_lb_vip_address }}:6640;" + +- name: check br-int + shell: | + ovs-vsctl list-br | grep br-int; while [ $? -ne 0 ]; do sleep 10; \ + ovs-vsctl list-br | grep br-int; done + +# yamllint disable rule:line-length +- name: set local ip in openvswitch + shell: > + local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini | + sed 's/local_ip =//g'); + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) + other_config={'local_ip'="$local_ip"}; + when: inventory_hostname not in groups['nova_compute'] + +- name: set local ip in openvswitch + shell: > + local_ip=$(grep local_ip /etc/neutron/plugins/ml2/openvswitch_agent.ini | + sed 's/local_ip =//g'); + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) + other_config={'local_ip'="$local_ip"}; + when: inventory_hostname in groups['nova_compute'] +# yamllint enable rule:line-length + +- name: Setup br-provider + openvswitch_bridge: + bridge: "{{ public_bridge }}" + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: add ovs uplink + openvswitch_port: + bridge: "{{ public_bridge }}" + port: "{{ contr_public_intf }}" + state: present + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings={{ contr_l2_mappings }} + when: + - odl_l3_agent == "Disable" + - inventory_hostname not in groups['nova_compute'] + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings={{ contr_l3_mappings }} + when: + - odl_l3_agent == "Enable" + - inventory_hostname not in groups['nova_compute'] + +- name: set external nic in openvswitch + shell: | + ovs-vsctl set Open_vSwitch $(ovs-vsctl show | head -n 1) \ + other_config:provider_mappings={{ compu_l3_mappings }} + when: + - odl_l3_agent == "Enable" + - inventory_hostname in groups['nova_compute'] + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + --datapath_type=system --bridge_mappings={{ contr_l2_mappings }} + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig \ + --datapath_type=system --bridge_mappings={{ contr_l3_mappings }} + when: + - inventory_hostname not in groups['nova_compute'] + - odl_l3_agent == "Enable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig --datapath_type=system + when: + - inventory_hostname in groups['nova_compute'] + - odl_l3_agent == "Disable" + +- name: Set host OVS configurations + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-odl-ovs-hostconfig + --datapath_type=system --bridge_mappings={{ compu_l3_mappings }} + when: + - inventory_hostname in groups['nova_compute'] + - odl_l3_agent == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml new file mode 100755 index 00000000..2527852e --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-agents-3.yml @@ -0,0 +1,69 @@ +--- + +- name: configure opendaylight -> ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; + +- name: configure bridge_mappings -> ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ contr_l2_mappings }}"; + when: + - odl_l3_agent == "Disable" + - inventory_hostname not in groups['nova_compute'] + +- name: configure bridge_mappings -> ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ compu_l2_mappings }}"; + when: + - odl_l3_agent == "Disable" + - inventory_hostname in groups['nova_compute'] + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ contr_l3_mappings }}"; + when: + - odl_l3_agent == "Enable" + - inventory_hostname not in groups['nova_compute'] + +- name: configure bridge_mappings for L3 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini \ + ovs bridge_mappings "{{ compu_l3_mappings }}"; + when: + - odl_l3_agent == "Enable" + - inventory_hostname in groups['nova_compute'] + +- name: configure external bridge name for L2 + shell: | + crudini --set /etc/neutron/l3_agent.ini \ + DEFAULT external_network_bridge "{{ public_bridge }}"; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; + +- name: configure metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + enable_isolated_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] + +- name: force metadata for l3 configuration + shell: | + crudini --set /etc/neutron/dhcp_agent.ini DEFAULT \ + force_metadata "True"; + when: + - inventory_hostname not in groups['nova_compute'] diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml new file mode 100755 index 00000000..3cef9792 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-db-1.yml @@ -0,0 +1,8 @@ +--- + +- name: drop and recreate neutron database + shell: | + mysql -e "drop database if exists neutron;"; + mysql -e "create database neutron character set utf8;"; + mysql -e "grant all on neutron.* to 'neutron'@'%' identified by \ + '{{ neutron_container_mysql_password }}';"; diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml new file mode 100755 index 00000000..6879340e --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-1.yml @@ -0,0 +1,100 @@ +--- + +- name: check sdn_package cache + stat: + path=/opt/sdn_package.tar.gz + register: sdn_cache # Todo: remove hard code and add md5 check + +- name: debug + debug: msg="{{ sdn_cache }}" + +- name: get sdn_package + get_url: + url: "{{ sdn_package }}" + dest: /opt/ + when: sdn_cache.stat.exists != 'true' + +- name: create odl group + group: name=odl system=yes state=present + +- name: create odl user + user: + name: odl + group: odl + home: "{{ odl_home }}" + createhome: "yes" + system: "yes" + shell: "/bin/false" + +- name: clear sdn_package + command: su -s /bin/sh -c "rm -rf /opt/sdn_package" + +- name: clear jdk8 package + command: su -s /bin/sh -c "rm -rf /opt/install_jdk8" + +- name: unarchive sdn_package + command: su -s /bin/sh -c "tar xzf /opt/sdn_package.tar.gz -C /opt/" + +- name: copy java package + command: su -s /bin/sh -c "cp /opt/sdn_package/java/jdk-8u51-linux-x64.tar.gz /opt/" + +- name: unarchive java_install package + command: su -s /bin/sh -c "tar xvf /opt/sdn_package/java/install_jdk8.tar -C /opt/" + +- name: install java + command: su -s /bin/sh -c "/opt/install_jdk8/install_jdk8.sh" + +- name: clear odl package + command: su -s /bin/sh -c "rm -rf {{ odl_home }}*" + +- name: extract odl package + command: | + su -s /bin/sh -c "tar xzf /opt/sdn_package/odl/{{ odl_pkg_name }} -C {{ odl_home }} \ + --strip-components 1" odl + +- name: opendaylight system file + copy: + src: "{{ service_file.src }}" + dest: "{{ service_file.dst }}" + mode: 0755 + +- name: set l3 fwd enable in custom.properties + template: + src: custom.properties + dest: "{{ odl_home }}/etc/custom.properties" + owner: odl + group: odl + mode: 0775 + when: odl_l3_agent == "Enable" + +- name: create karaf config + template: + src: org.apache.karaf.features.cfg + dest: "{{ odl_home }}/etc/org.apache.karaf.features.cfg" + owner: odl + group: odl + mode: 0775 + +- name: copy acl configuration script + template: + src: acl_conf.sh + dest: "/opt/acl_conf.sh" + mode: 0777 + +- name: execute acl configuration script + command: su -s /bin/sh -c "/opt/acl_conf.sh;" odl + +- name: create jetty config + shell: > + sed -i 's/default="8181"/default="8081"/' + {{ odl_home }}etc/jetty.xml + +- name: create tomcat config + shell: > + sed -i 's/port="8282"/port="8081"/' + {{ odl_home }}configuration/tomcat-server.xml + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml new file mode 100755 index 00000000..b8d9403a --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-hosts-2.yml @@ -0,0 +1,23 @@ +--- + +- name: chown opendaylight directory and files + shell: > + chown -R odl:odl "{{ odl_home }}"; + chown odl:odl "{{ service_file.dst }}"; + +- name: start opendaylight + service: name=opendaylight state=started + when: ansible_os_family == "Debian" + +- name: set opendaylight autostart + shell: chkconfig opendaylight on + when: ansible_os_family == "RedHat" + +- name: start opendaylight + shell: service opendaylight start + when: ansible_os_family == "RedHat" + +- name: check if opendaylight running + shell: | + netstat -lpen --tcp | grep java | grep 6653; + while [ $? -ne 0 ]; do sleep 10; netstat -lpen --tcp | grep java | grep 6653; done diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml new file mode 100755 index 00000000..2e58e141 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-repos-1.yml @@ -0,0 +1,27 @@ +--- + +- name: download networking-odl + get_url: + url: "{{ odl_pip }}" + dest: /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64 + +- name: download networking-sfc + shell: | + mkdir -p /opt/tmp + pip install networking-sfc==4.0.0 -d /opt/tmp/ + cp /opt/tmp/networking* /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ + rm -rf /opt/tmp + when: + - odl_sfc == "Enable" + - inventory_hostname in groups['repo_container'][0] + +- name: patch networking-odl to fix a bug + shell: | + cd /var/www/repo/os-releases/15.1.4/ubuntu-16.04-x86_64/ + tar -zxf networking-odl-4.0.0.tar.gz # hard code, need to modify + rm -rf networking-odl-4.0.0.tar.gz + sed -i 's/^Babel.*/Babel!=2.4.0,>=2.3.4/' networking-odl-4.0.0/requirements.txt + tar -zcf networking-odl-4.0.0.tar.gz networking-odl-4.0.0/ + rm -rf networking-odl-4.0.0/ + pip install networking-odl-4.0.0.tar.gz -d ./ + cd - diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml new file mode 100755 index 00000000..e2dd128d --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-1.yml @@ -0,0 +1,22 @@ +--- + +- name: install crudini + package: + name: crudini + state: latest + +- name: install networking-odl + pip: + name: networking-odl + version: "{{ networking_odl_version }}" + virtualenv: /openstack/venvs/neutron-15.1.4 # Todo: hardcode, need to modify + +- name: install networking-sfc + pip: + name: networking-sfc + version: "4.0.0" + virtualenv: /openstack/venvs/neutron-15.1.4 + when: odl_sfc == "Enable" + +- name: turn off neutron-server on control node + service: name=neutron-server state=stopped diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml new file mode 100755 index 00000000..b54fce22 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-2.yml @@ -0,0 +1,51 @@ +--- + +- name: configure odl l3 driver + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT service_plugins \ + odl-router,metering; + when: odl_l3_agent == "Enable" + +- name: configure opendaylight -> ml2 + shell: > + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers opendaylight_v2; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types vxlan; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs enable_tunneling "True"; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings + "{{ contr_l2_mappings }}"; + +- name: configure bridge_mappings for L3 + shell: > + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings + "{{ contr_l3_mappings }}"; + when: odl_l3_agent == "Enable" + +- name: turn off l3 ha for odl l2 + shell: | + crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; + when: odl_l3_agent == "Disable" + +- name: configure opendaylight in ml2 + shell: | + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl password admin; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl url \ + http://{{ internal_lb_vip_address }}:8080/controller/nb/v2/neutron; + crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl port_binding_controller \ + pseudo-agentdb-binding; + +- name: copy sfc.conf + copy: + src: "{{ sfc_plugins.src }}" + dest: "{{ sfc_plugins.dst }}" + mode: 0755 + when: odl_sfc == "Enable" + +- name: Configure SFC driver + shell: crudini --merge /etc/neutron/neutron.conf < /opt/sfc.conf + when: odl_sfc == "Enable" + +- name: delete sfc.conf + shell: rm -rf {{ sfc_plugins.dst }} + when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml new file mode 100755 index 00000000..0c11e36f --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-servers-3.yml @@ -0,0 +1,28 @@ +--- + +- name: Perform a Neutron DB online upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --expand + become: "yes" + become_user: "neutron" + +- name: Perform a Neutron DB offline upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --config-file /etc/neutron/neutron.conf + --config-file /etc/neutron/plugins/ml2/ml2_conf.ini + upgrade --contract + become: "yes" + become_user: "neutron" + +- name: SFC DB upgrade + command: | + /openstack/venvs/neutron-15.1.4/bin/neutron-db-manage + --subproject networking-sfc + upgrade head + become: "yes" + become_user: "neutron" + when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml new file mode 100755 index 00000000..613c796b --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/control-utility-1.yml @@ -0,0 +1,7 @@ +--- + +- name: Install networking-sfc for CLI + pip: + name: networking-sfc + version: "4.0.0" + when: odl_sfc == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml new file mode 100755 index 00000000..e65be002 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/main.yml @@ -0,0 +1,4 @@ +--- + +- include: odl-cluster.yml + when: opendaylight is defined and opendaylight == "Enable" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml new file mode 100755 index 00000000..a22e980f --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-cluster.yml @@ -0,0 +1,51 @@ +--- + +- include_vars: "{{ ansible_os_family }}.yml" + +- include_vars: "{{ openstack_passwd_file }}" + +- include_vars: odl-pre.yml + when: inventory_hostname == "localhost" + +- include_vars: /tmp/odl-extra-vars.yml + +- include: control-hosts-1.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-repos-1.yml + vars: + odl_pip: "{{ networking_odl_url }}" + when: inventory_hostname in groups['repo_container'] + +- include: control-servers-1.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-utility-1.yml + when: + - inventory_hostname in groups['utility'] + - odl_sfc == "Enable" + +- include: control-agents-1.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-hosts-2.yml + when: inventory_hostname in groups['network_hosts'] # Todo: modify to odl_hosts + +- include: control-agents-2.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-servers-2.yml + when: inventory_hostname in groups['neutron_server'] + +- include: control-agents-3.yml + when: inventory_hostname in groups['neutron_openvswitch_agent'] + +- include: control-db-1.yml + when: inventory_hostname == groups['galera_container'][0] + +- include: control-servers-3.yml + when: + - inventory_hostname in groups['neutron_server'][0] + - inventory_hostname not in groups['network_hosts'] + +- include: odl-post.yml diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml new file mode 100755 index 00000000..9f1cb79e --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-post.yml @@ -0,0 +1,34 @@ +--- + +- name: restart neutron-server + service: name=neutron-server state=restarted enabled=yes + when: inventory_hostname in groups['neutron_server'] + +- name: restart neutron-l3-agent server + service: name=neutron-l3-agent state=restarted + when: + - odl_l3_agent == "Disable" + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-dhcp-agent server + service: name=neutron-dhcp-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: restart neutron-metadata-agent server + service: name=neutron-metadata-agent state=restarted + when: + - inventory_hostname in groups['neutron_openvswitch_agent'] + - inventory_hostname not in groups['nova_compute'] + +- name: remove karaf data directory + file: + path: "{{ odl_home }}data" + state: absent + when: inventory_hostname in groups['network_hosts'] + +- name: restart opendaylight + shell: sleep 60; service opendaylight restart; sleep 60; + when: inventory_hostname in groups['network_hosts'] diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml new file mode 100755 index 00000000..64631663 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/tasks/odl-pre.yml @@ -0,0 +1,46 @@ +--- + +- name: set l2_mapping l3_mapping + copy: + dest: /tmp/odl-extra-vars.yml + content: | + {% set contr_l2_list = [] %} + {% set contr_l3_list = [] %} + {% set pub_l2_mapping = [] %} + {% set pub_l3_mapping = [] %} + {% set pub_intf = [] %} + {% set pub_bridge = [] %} + {% for key, value in contr_prv_mappings.iteritems() %} + {% set l2_mapping = key + ":" + value["bridge"] %} + {% set l3_mapping = key + ":" + value["interface"] %} + {% set _ = contr_l2_list.append(l2_mapping) %} + {% set _ = contr_l3_list.append(l3_mapping) %} + {% if key == public_net_info["provider_network"] %} + {% set _ = pub_l2_mapping.append(l2_mapping) %} + {% set _ = pub_l3_mapping.append(l3_mapping) %} + {% set _ = pub_intf.append(value["interface"]) %} + {% set _ = pub_bridge.append(value["bridge"]) %} + {% endif %} + {% endfor %} + {% set compu_l2_list = [] %} + {% set compu_l3_list = [] %} + {% set compu_pub_intf = compu_sys_mappings["external"]["interface"] %} + {% set compu_pub_vlan = compu_sys_mappings["external"]["vlan_tag"] %} + {% if compu_pub_vlan | int %} + {% set compu_pub_intf = compu_pub_intf + '.' + compu_pub_vlan|string %} + {% endif %} + {% for key, value in compu_prv_mappings.iteritems() %} + {% set l2_mapping = key + ":" + value["bridge"] %} + {% set l3_mapping = key + ":" + value["interface"] %} + {% set _ = compu_l2_list.append(l2_mapping) %} + {% set _ = compu_l3_list.append(l3_mapping) %} + {% endfor %} + {% set pub_l3_mapping = pub_l3_mapping[0].replace(pub_intf[0], compu_pub_intf) %} + {% set _ = compu_l2_list.append(pub_l2_mapping[0]) %} + {% set _ = compu_l3_list.append(pub_l3_mapping) %} + public_bridge: "{{ pub_bridge[0] }}" + contr_public_intf: "{{ pub_intf[0] }}" + contr_l2_mappings: "{{ ','.join(contr_l2_list) }}" + contr_l3_mappings: "{{ ','.join(contr_l3_list) }}" + compu_l2_mappings: "{{ ','.join(compu_l2_list) }}" + compu_l3_mappings: "{{ ','.join(compu_l3_list) }}" diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh b/plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh new file mode 100755 index 00000000..4962a17c --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/acl_conf.sh @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## +mkdir -p {{ odl_home }}etc/opendaylight/datastore/initial/config/ +CONFFILE=$(find {{ odl_home }} -name "*aclservice*config.xml") +cp $CONFFILE {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml +sed -i s/stateful/transparent/ {{ odl_home }}etc/opendaylight/datastore/initial/config/netvirt-aclservice-config.xml diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties b/plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties new file mode 100755 index 00000000..f103c1b8 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/custom.properties @@ -0,0 +1,105 @@ +# Extra packages to import from the boot class loader +org.osgi.framework.system.packages.extra=org.apache.karaf.branding,sun.reflect,sun.reflect.misc,sun.misc,sun.nio.ch,com.sun.media.sound + +# https://bugs.eclipse.org/bugs/show_bug.cgi?id=325578 +# Extend the framework to avoid the resources to be presented with +# a URL of type bundleresource: but to be presented as file: +osgi.hook.configurators.include=org.eclipse.virgo.kernel.equinox.extensions.hooks.ExtensionsHookConfigurator + +# Embedded Tomcat configuration File +org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml +org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true + +# Use Equinox as default OSGi Framework Implementation +karaf.framework=equinox + +# Show a progress bar on startup and start the console when all bundles are up and running. +# (If you are in a hurry you can still type enter to start the shell faster.) +karaf.delay.console=true + +# Set security provider to BouncyCastle +org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider + +# We set this to false to disable the Aries BlueprintExtender from doing its orderly container +# shutdown so we can do it after the CSS has shut down all its modules. Otherwise Aries will +# shutdown blueprint containers when the karaf framework starts shutdown (ie when bundle 0 is +# stopped) which can cause failures on CSS module shutdown due to the core blueprint containers +# and services already being shut down. This setting can be removed when/if CSS is removed +# completely from ODL. +org.apache.aries.blueprint.preemptiveShutdown=false + +netconf.config.persister.active=1 + +netconf.config.persister.1.storageAdapterClass=org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter +netconf.config.persister.1.properties.fileStorage=etc/opendaylight/current/controller.currentconfig.xml +netconf.config.persister.1.properties.numberOfBackups=1 + +# logback configuration +logback.configurationFile=configuration/logback.xml + +# Container configuration +container.profile = Container + +# Connection manager configuration +connection.scheme = ANY_CONTROLLER_ONE_MASTER + +# OVSDB configuration +# ovsdb plugin supports both active and passive connections. It listens on port 6640 by default for Active connections. +ovsdb.listenPort=6640 + +# ovsdb creates Openflow nodes/bridges. This configuration configures the bridge's Openflow version. +# default Openflow version = 1.0, we also support 1.3. +# ovsdb.of.version=1.3 + +# ovsdb can be configured with ml2 to perform l3 forwarding. The config below enables that functionality, which is +# disabled by default. +ovsdb.l3.fwd.enabled=yes + +# ovsdb can be configured with ml2 to perform arp responder, enabled by default. +ovsdb.l3.arp.responder.disabled=no + +# ovsdb can be configured with ml2 to perform l3 forwarding. When used in that scenario, the mac address of the default +# gateway --on the external subnet-- is expected to be resolved from its inet address. The config below overrides that +# specific arp/neighDiscovery lookup. +# ovsdb.l3gateway.mac=00:00:5E:00:02:01 + +# TLS configuration +# To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files. +# The Java KeyStore contains controller's private key and certificate. The Java TrustStore contains the trusted certificate +# entries, including switches' Certification Authority (CA) certificates. For example, +# secureChannelEnabled=true +# controllerKeyStore=./configuration/ctlKeyStore +# controllerKeyStorePassword=xxxxxxxx (this password should match the password used for KeyStore generation and at least 6 characters) +# controllerTrustStore=./configuration/ctlTrustStore +# controllerTrustStorePassword=xxxxxxxx (this password should match the password used for TrustStore generation and at least 6 characters) + +secureChannelEnabled=false +controllerKeyStore= +controllerKeyStorePassword= +controllerTrustStore= +controllerTrustStorePassword= + +# User Manager configurations +enableStrongPasswordCheck = false + +#Jolokia configurations +#org.jolokia.listenForHttpService=false + +# Logging configuration for Tomcat-JUL logging +java.util.logging.config.file=configuration/tomcat-logging.properties + +#Hosttracker hostsdb key scheme setting +hosttracker.keyscheme=IP + +# LISP Flow Mapping configuration +# Enable merging RLOC sets received from different xTR-IDs for the same EID (default: false) +lisp.mappingMerge = false +# Enable the Solicit-Map-Request (SMR) mechanism (default: true) +lisp.smr = true +# Choose policy for Explicit Locator Path (ELP) handling +# There are three options: +# default: don't add or remove locator records, return mapping as-is +# both: keep the ELP, but add the next hop as a standalone non-LCAF locator with a lower priority +# replace: remove the ELP, add the next hop as a standalone non-LCAF locator +lisp.elpPolicy = default + diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh b/plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh new file mode 100755 index 00000000..0d42e48b --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/ml2_conf.sh @@ -0,0 +1,14 @@ +############################################################################## +# 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 +############################################################################## +cat <> /etc/neutron/plugins/ml2/ml2_conf.ini +[ml2_odl] +password = admin +username = admin +url = http://{{ internal_vip.ip }}:8080/controller/nb/v2/neutron +EOT diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg new file mode 100755 index 00000000..b07e028f --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/templates/org.apache.karaf.features.cfg @@ -0,0 +1,54 @@ +################################################################################ +# +# 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.8/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.8/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.2.9/xml/features,mvn:org.apache.karaf.features/spring/3.0.8/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.6.1-SNAPSHOT/xml/features + +# +# Comma separated list of features to install at startup +# +featuresBoot=config,standard,region,package,kar,ssh,management,odl-restconf-all,odl-aaa-authn,odl-dlux-all,odl-netvirt-openstack,odl-mdsal-apidocs,odl-dlux-core,odl-dluxapps-nodes,odl-dluxapps-topology,odl-dluxapps-yangui,odl-dluxapps-yangvisualizer,odl-l2switch-switch,odl-l2switch-switch-ui,odl-ovsdb-hwvtepsouthbound-ui,odl-ovsdb-southbound-impl-ui,odl-netvirt-ui,odl-openflowplugin-flow-services-ui,odl-neutron-logger,odl-netvirt-sfc + +# +# Defines if the boot features are started in asynchronous mode (in a dedicated thread) +# +featuresBootAsynchronous=false + +# +# Store cfg file for config element in feature +# +#configCfgStore=true diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml new file mode 100755 index 00000000..c78c5221 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/Debian.yml @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch-switch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service + +# networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml new file mode 100755 index 00000000..a2e6d01d --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/RedHat.yml @@ -0,0 +1,19 @@ +############################################################################## +# 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 +############################################################################## +--- + +common_packages: + - crudini + +service_ovs_name: openvswitch +service_ovs_agent_name: neutron-openvswitch-agent + +service_file: + src: opendaylight.service + dst: /lib/systemd/system/opendaylight.service diff --git a/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml new file mode 100755 index 00000000..a9466ea0 --- /dev/null +++ b/plugins/odl_sfc/roles/setup-odl-sfc/vars/main.yml @@ -0,0 +1,65 @@ +############################################################################## +# 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 +############################################################################## +--- +odl_username: admin +odl_password: admin +odl_api_port: 8181 + +# odl_sfc +sfc_plugins: + src: sfc.conf + dst: /opt/sfc.conf + +odl_pkg_url: distribution-karaf-0.6.1-Carbon.tar.gz +odl_pkg_name: distribution-karaf-0.6.1-Carbon.tar.gz +odl_home: "/opt/opendaylight/" +odl_base_features: + - config + - standard + - region + - package + - kar + - ssh + - management + - odl-restconf + - odl-l2switch-switch + - odl-openflowplugin-all + - odl-mdsal-apidocs + - odl-dlux-all + - odl-adsal-northbound + - odl-nsf-all + - odl-ovsdb-openstack + - odl-ovsdb-northbound + - odl-dlux-core + +odl_extra_features: + - odl-restconf-all + - odl-mdsal-clustering + - odl-openflowplugin-flow-services + - http + - jolokia-osgi + +odl_features: "{{ odl_base_features + odl_extra_features }}" + +sdn_package: http://artifacts.opnfv.org/compass4nfv/packages/master/sdn_package.tar.gz + +# yamllint disable rule:line-length +networking_odl_url: https://launchpad.net/networking-odl/4.0-ocata/4.0.0/+download/networking-odl-4.0.0.tar.gz +# yamllint enable rule:line-length + +jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz +jdk8_script_name: install_jdk8.tar + +common_packages_noarch: [] + +odl_pip: networking-odl-3.2.0 + +networking_odl_version: 4.0.0 + +networking_odl_pkg_name: networking-odl-3.2.0.tar.gz diff --git a/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 b/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 deleted file mode 100644 index 0d0cbe90..00000000 --- a/plugins/odl_sfc/roles/setup-sfc/files/setup-odl.yml.j2 +++ /dev/null @@ -1,13 +0,0 @@ ---- - -- name: run opendaylight role - hosts: neutron_all | galera_container | network_hosts | repo_container | utility - max_fail_percentage: 20 - user: root - roles: - - odl_cluster - vars: - - odl_l3_agent: "{{ odl_l3_agent }}" - - odl_sfc: "{{ odl_sfc }}" - tags: - - odl diff --git a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml index 9fa9175f..eb8b5aa6 100644 --- a/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml +++ b/plugins/odl_sfc/roles/setup-sfc/tasks/setup_sfc.yml @@ -7,24 +7,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## --- -# yamllint disable rule:line-length -- name: clear setup-odl.yml.j2 - file: - path: "/var/ansible/run/openstack_ocata-opnfv2/roles/setup-opendaylight/templates/setup-odl.yml.j2" - state: absent -# yamllint enable rule:line-length - -- name: override setup-odl.yml.j2 - copy: - src: setup-odl.yml.j2 - dest: "/var/ansible/run/openstack_ocata-opnfv2/roles/setup-opendaylight/templates/" - -- name: clear odl_cluster for sfc - file: - path: "/var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster" - state: absent - name: copy odl_cluster role shell: | - cp -r /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster_sfc \ - /var/ansible/run/openstack_ocata-opnfv2/roles/odl_cluster + cp -rf /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl-sfc \ + /var/ansible/run/openstack_ocata-opnfv2/roles/setup-odl -- cgit 1.2.3-korg