aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
authorchenshuai@huawei.com <chenshuai@huawei.com>2015-12-15 23:09:47 +0800
committershuai chen <chenshuai@huawei.com>2015-12-25 00:52:29 +0000
commit21e1b393c0fc7f52c831882b53454877f6942495 (patch)
tree397c47f7e22450542522aeb5cdc5b9eabced273f /deploy
parent01338238984e899dc7274e03618c9e9998c63d96 (diff)
bugfix: remove service check temporily during install odl
JIRA: COMPASS-203 Change-Id: I4cb9109c687a869ac8bef94b472ec3fbc0b74df5 Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy')
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/files/recover_network.py65
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/main.yml8
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml32
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml65
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg9
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/vars/main.yml4
6 files changed, 151 insertions, 32 deletions
diff --git a/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py b/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py
new file mode 100755
index 00000000..8d48ac1c
--- /dev/null
+++ b/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py
@@ -0,0 +1,65 @@
+import yaml
+import netaddr
+import os
+import log as logging
+
+LOG = logging.getLogger("net-recover")
+config_path = os.path.join(os.path.dirname(__file__), "network.cfg")
+
+def setup_bondings(bond_mappings):
+ print bond_mappings
+
+def add_ovs_port(ovs_br, ifname, uplink, vlan_id=None):
+ LOG.info("add_ovs_port enter")
+ cmd = "ovs-vsctl --may-exist add-port %s %s" % (ovs_br, ifname)
+ if vlan_id:
+ cmd += " tag=%s" % vlan_id
+ cmd += " -- set Interface %s type=internal;" % ifname
+ cmd += "ip link set dev %s address `ip link show %s |awk '/link\/ether/{print $2}'`;" \
+ % (ifname, uplink)
+ cmd += "ip link set %s up;" % ifname
+ LOG.info("add_ovs_port: cmd=%s" % cmd)
+ os.system(cmd)
+
+def setup_ips(ip_settings, sys_intf_mappings):
+ LOG.info("setup_ips enter")
+ for intf_info in ip_settings.values():
+ network = netaddr.IPNetwork(intf_info["cidr"])
+ if sys_intf_mappings[intf_info["name"]]["type"] == "ovs":
+ intf_name = intf_info["name"]
+ else:
+ intf_name = intf_info["alias"]
+ if "gw" in intf_info:
+ cmd = "ip addr add %s/%s brd %s dev %s;" \
+ % (intf_info["ip"], intf_info["netmask"], str(network.broadcast),intf_name)
+ cmd += "route del default;"
+ cmd += "ip route add default via %s dev %s" % (intf_info["gw"], intf_name)
+ LOG.info("setup_ips: cmd=%s" % cmd)
+ os.system(cmd)
+
+def setup_intfs(sys_intf_mappings, uplink_map):
+ LOG.info("setup_intfs enter")
+ for intf_name, intf_info in sys_intf_mappings.items():
+ if intf_info["type"] == "ovs":
+ add_ovs_port(
+ intf_info["interface"],
+ intf_name,
+ uplink_map[intf_info["interface"]],
+ vlan_id=intf_info.get("vlan_tag"))
+ else:
+ pass
+
+def main(config):
+ uplink_map = {}
+ setup_bondings(config["bond_mappings"])
+ for provider_net in config["provider_net_mappings"]:
+ uplink_map[provider_net['name']] = provider_net['interface']
+
+ setup_intfs(config["sys_intf_mappings"], uplink_map)
+ setup_ips(config["ip_settings"], config["sys_intf_mappings"])
+
+
+if __name__ == "__main__":
+ os.system("service openvswitch-switch status|| service openvswitch-switch start")
+ config = yaml.load(open(config_path))
+ main(config)
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
index 2254f11f..738da5b2 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/main.yml
@@ -12,9 +12,9 @@
- meta: flush_handlers
- name: check out new flow table if enable
- shell: ovs-ofctl --protocol=OpenFlow13 dump-flows br-prv | grep CONTROLLER; while [ $? -ne 0 ]; do sleep 10; ovs-ofctl --protocol=OpenFlow13 dump-flows br-prv | grep CONTROLLER; done
+ shell: ovs-ofctl --protocol=OpenFlow13 dump-flows br-int | grep CONTROLLER; while [ $? -ne 0 ]; do sleep 10; ovs-ofctl --protocol=OpenFlow13 dump-flows br-int | grep CONTROLLER; done
when: groups['odl']|length !=0
-- name: remove controller from br-prv
- shell: ovs-vsctl del-controller br-prv;
- when: groups['odl']|length !=0
+#- name: remove controller from br-prv
+# shell: ovs-vsctl del-controller br-prv;
+# when: groups['odl']|length !=0
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
index 0c13ff21..2cd4e23a 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/odl_controller.yml
@@ -66,15 +66,15 @@
dest: "{{ service_file.dst }}"
mode: 0644
-#- 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
-# notify:
-# - restart odl service
+- 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
+ notify:
+ - restart odl service
- name: create tomcat config
template:
@@ -83,6 +83,12 @@
notify:
- restart odl service
+
+- name: install odl pip packages
+ pip: name={{ item }} state=present
+ with_items: odl_pip_packages
+
+
#- name: restart odl service
# service: name=opendaylight state=started pattern="opendaylight"
@@ -153,6 +159,9 @@
##########################################################################################################
################################ OpenDayLight connect with OpenStack ################################
##########################################################################################################
+- name: Turn off neutron-server Daemon on control node
+ shell: sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
+
- name: Turn off neutron-server on control node
service: name=neutron-server state=stopped
@@ -193,3 +202,8 @@
- name: Restart neutron-server
service: name=neutron-server state=started
+
+- name: Add service daemon
+ shell: >
+ echo opendaylight >> /opt/service ;
+ echo neutron-server >> /opt/service ;
diff --git a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
index 3bef2af3..6f063c76 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/tasks/openvswitch.yml
@@ -12,31 +12,72 @@
- name: Adjust Service Daemon
shell: >
sed -i '/neutron-plugin-openvswitch-agent/d' /opt/service ;
- echo opendaylight >> /opt/service ;
- name: shut down and disable Neutron's openvswitch agent services
service: name=neutron-plugin-openvswitch-agent state=stopped
-- name: Stop the Open vSwitch service and clear existing OVSDB
- shell: >
- ovs-ofctl del-flows br-int ;
- ovs-vsctl del-br br-tun ;
- ovs-vsctl del-manager ;
+#- name: Stop the Open vSwitch service and clear existing OVSDB
+# shell: >
+# ovs-ofctl del-flows br-int ;
+# ovs-vsctl del-br br-tun ;
+# ovs-vsctl del-port br-int patch-tun;
+# ovs-vsctl del-manager ;
+
+#- name: Restart OpenVSwitch
+# shell: service openvswitch-switch restart;
#- name: remove Neutron's openvswitch agent services
# shell: >
# update-rc.d neutron-plugin-openvswitch-agent remove
-#- name: Stop the Open vSwitch service and clear existing OVSDB
-# shell: >
-# service openvswitch-switch stop ;
-# rm -rf /var/log/openvswitch/* ;
-# rm -rf /etc/openvswitch/conf.db ;
-# service openvswitch-switch start ;
+- name: Check External network
+ shell: ovs-vsctl list-br | grep br-prv
+ register: extbr
+
+- name: Stop the Open vSwitch service and clear existing OVSDB
+ shell: >
+ service openvswitch-switch stop ;
+ rm -rf /var/log/openvswitch/* ;
+ rm -rf /etc/openvswitch/conf.db ;
+ service openvswitch-switch start ;
- name: Set OpenDaylight as the manager
command: su -s /bin/sh -c "ovs-vsctl set-manager tcp:{{ internal_vip.ip }}:6640;"
+##################################################################
+################ Recover External network #######################
+##################################################################
+- name: add ovs bridge
+ openvswitch_bridge: bridge={{ item["name"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and extbr.rc == 0
+
+- name: add ovs uplink
+ openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: item["type"] == "ovs" and extbr.rc == 0
+
+- name: copy recovery script
+ copy: src={{ item }} dest=/opt/setup_networks
+ with_items:
+ - recover_network.py
+ when: extbr.rc == 0
+
+- name: Recover external script
+ shell: python /opt/setup_networks/recover_network.py
+ when: extbr.rc == 0
+
+- name: start and disable Neutron's agent services
+ shell: service keepalived restart
+ when: inventory_hostname in groups['odl'] and extbr.rc == 0
+
+##################################################################
+##################################################################
+##################################################################
+
+
+
+
#- name: start and disable Neutron's agent services
# service: name=neutron-plugin-openvswitch-agent state=started
diff --git a/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg
index 4f439c25..05c66ffd 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg
+++ b/deploy/adapters/ansible/roles/odl_cluster/templates/org.apache.karaf.features.cfg
@@ -36,19 +36,14 @@
#
# Comma separated list of features repositories to register by default
#
-#featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.4/xml/features
-
-featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.1/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.1/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.0/xml/features,mvn:org.apache.karaf.features/spring/3.0.1/xml/features,mvn:org.opendaylight.integration/features-integration/0.2.2-Helium-SR2/xml/features,mvn:org.jolokia/jolokia-osgi/1.1.5/xml/features
+featuresRepositories = mvn:org.apache.karaf.features/standard/3.0.3/xml/features,mvn:org.apache.karaf.features/enterprise/3.0.3/xml/features,mvn:org.ops4j.pax.web/pax-web-features/3.1.4/xml/features,mvn:org.apache.karaf.features/spring/3.0.3/xml/features,mvn:org.opendaylight.integration/features-integration-index/0.3.2-Lithium-SR2/xml/features
#
# Comma separated list of features to install at startup
-# Default features:
-# config,standard,region,package,kar,ssh,management
#
-featuresBoot= {{ odl_features | join(",") }}
+featuresBoot=config,standard,region,package,kar,ssh,management,odl-base-all,odl-restconf,odl-ovsdb-openstack,odl-dlux-all,odl-mdsal-apidocs,odl-mdsal-clustering,odl-openflowplugin-flow-services
#
# Defines if the boot features are started in asynchronous mode (in a dedicated thread)
#
featuresBootAsynchronous=false
-
diff --git a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml
index 450ee0d0..cd4cb62f 100755
--- a/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml
+++ b/deploy/adapters/ansible/roles/odl_cluster/vars/main.yml
@@ -16,3 +16,7 @@ jdk8_pkg_name: jdk-8u51-linux-x64.tar.gz
controller_packages_noarch: []
compute_packages_noarch: []
+
+odl_pip_packages:
+ - networking_odl
+