From 98b06a058688c955e5b70e57b83b0a21cee7bbb5 Mon Sep 17 00:00:00 2001 From: Zhijiang Hu Date: Thu, 25 Jan 2018 05:14:19 -0500 Subject: [PATCH] Let haproxy to be ODL websocket's frontend This PS does: 1) Let haproxy to be ODL websocket's frontend and listen on port 8185. 2) Add 10-rest-connector.xml config file template for ODL container. 3) ODL websocket backend listen only on api interface, port is also 8185. Closes-Bug: #1745323 Change-Id: Id330d610c7cd8a239b0f77c8f5f47422d48b9977 Signed-off-by: Zhijiang Hu --- ansible/group_vars/all.yml | 1 + .../roles/haproxy/templates/haproxy.cfg.j2 | 7 ++++ ansible/roles/opendaylight/handlers/main.yml | 1 + ansible/roles/opendaylight/tasks/config.yml | 12 ++++++ .../templates/10-rest-connector.xml.j2 | 42 +++++++++++++++++++ .../templates/opendaylight.json.j2 | 6 +++ 6 files changed, 69 insertions(+) create mode 100644 ansible/roles/opendaylight/templates/10-rest-connector.xml.j2 diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 6339a8857e..ff41eb2cbc 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -315,6 +315,7 @@ opendaylight_tomcat_redirect_port: "8663" opendaylight_karaf_ssh_port: "8101" opendaylight_openflow_port: "6653" opendaylight_ovsdb_port: "6641" +opendaylight_websocket_port: "8185" vitrage_api_port: "8999" diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 index 6215afd27a..282afc7dcd 100644 --- a/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -929,4 +929,11 @@ listen opendaylight_api_backup server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ opendaylight_restconf_port_backup }} check fall 5 inter 2000 rise 2 {% endfor %} +listen opendaylight_websocket + bind {{ kolla_internal_vip_address }}:{{ opendaylight_websocket_port }} + balance source +{% for host in groups['opendaylight'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ opendaylight_websocket_port }} check fall 5 inter 2000 rise 2 +{% endfor %} + {% endif %} diff --git a/ansible/roles/opendaylight/handlers/main.yml b/ansible/roles/opendaylight/handlers/main.yml index 0a5f9eec70..683ade5631 100644 --- a/ansible/roles/opendaylight/handlers/main.yml +++ b/ansible/roles/opendaylight/handlers/main.yml @@ -28,4 +28,5 @@ or opendaylight_config_akka | changed or opendaylight_config_modules | changed or opendaylight_config_module_shards | changed + or opendaylight_config_10_rest_connector | changed or check_opendaylight_containers | changed diff --git a/ansible/roles/opendaylight/tasks/config.yml b/ansible/roles/opendaylight/tasks/config.yml index 06e4957337..ada85cb210 100644 --- a/ansible/roles/opendaylight/tasks/config.yml +++ b/ansible/roles/opendaylight/tasks/config.yml @@ -160,6 +160,18 @@ notify: - Restart opendaylight container +- name: Copying over 10-rest-connector.xml + template: + src: "{{ item }}" + dest: "{{ node_config_directory }}/opendaylight/10-rest-connector.xml" + with_first_found: + - "{{ node_custom_config }}/opendaylight/{{ inventory_hostname }}/10-rest-connector.xml" + - "{{ node_custom_config }}/opendaylight/10-rest-connector.xml" + - "10-rest-connector.xml.j2" + register: opendaylight_config_10_rest_connector + notify: + - Restart opendaylight container + - name: Check opendaylight containers kolla_docker: action: "compare_container" diff --git a/ansible/roles/opendaylight/templates/10-rest-connector.xml.j2 b/ansible/roles/opendaylight/templates/10-rest-connector.xml.j2 new file mode 100644 index 0000000000..427125f7d2 --- /dev/null +++ b/ansible/roles/opendaylight/templates/10-rest-connector.xml.j2 @@ -0,0 +1,42 @@ + + + + + + + + + rest:rest-connector-impl + rest-connector-default-impl + {{ hostvars[inventory_hostname]['ansible_' + hostvars[inventory_hostname]['api_interface']]['ipv4']['address'] }} + {{ opendaylight_websocket_port }} + + dom:dom-broker-osgi-registry + dom-broker + + + + + + + rest:rest-connector + + rest-connector-default + + /modules/module[type='rest-connector-impl'][name='rest-connector-default-impl'] + + + + + + + + urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector?module=opendaylight-rest-connector&revision=2014-07-24 + + diff --git a/ansible/roles/opendaylight/templates/opendaylight.json.j2 b/ansible/roles/opendaylight/templates/opendaylight.json.j2 index e475b9cb15..4bce8fde1c 100644 --- a/ansible/roles/opendaylight/templates/opendaylight.json.j2 +++ b/ansible/roles/opendaylight/templates/opendaylight.json.j2 @@ -78,6 +78,12 @@ "dest": "/opt/opendaylight/configuration/initial/module-shards.conf", "owner": "odl", "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/10-rest-connector.xml", + "dest": "/opt/opendaylight/etc/opendaylight/karaf/10-rest-connector.xml", + "owner": "odl", + "perm": "0600" } ], "permissions": [