Edit some post update tasks logic

1. Spelling mismatch in ODL net mapping doesnot generate
its endpoitn clearly.
2. Rectified another small syntax correction for string
replace.
3. Delete upgrade flag and then set it to false. ODL
doesnot allow it to be set without deleting.
4. Other changes in accordance with ODL update process.

Change-Id: Ib549e29f50bbbb434183ac9423bcf776807ff1a4
Closes-Bug: 1779410
This commit is contained in:
Janki Chhatbar 2018-06-29 20:11:29 +05:30 committed by Janki Chhatbar
parent d75fca71ed
commit 989a36faf1
4 changed files with 56 additions and 82 deletions

View File

@ -221,18 +221,6 @@ outputs:
mode: 0644
when: step|int == 1
post_upgrade_tasks: &odl_container_post_upgrade_tasks
- name: Disable Upgrade Flag via Rest
shell:
str_replace:
template: 'curl -k -v --silent --fail -u ODL_USERNAME:$ODL_PASSWORD -X \
PUT -d "{ "config": { "upgradeInProgress": false } }" \
-H "Content-Type: application/json" \
$ODL_URI/restconf/config/genius-mdsalutil:config'
params:
$ODL_USERNAME: {get_attr: [OpenDaylightBase, role_data, config_settings, 'opendaylight::username']}
$ODL_PASSWORD: {get_attr: [OpenDaylightBase, role_data, config_settings, 'opendaylight::password']}
$ODL_URI: {get_param: [EndpointMap, OpenDaylightInternal, uri]}
when: step|int == 0
- name: Disable Upgrade in Config File
copy:
dest: /var/lib/config-data/puppet-generated/opendaylight/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml
@ -244,6 +232,24 @@ outputs:
group: 42462
mode: 0644
when: step|int == 0
# 2 commands in 1 task because the sequence of commands needs to be ensured
# and that no other task is executed in between.
- name: Delete Upgrade Flag and Unset it via Rest
shell:
str_replace:
template: >
curl -k -v --silent --fail -u $ODL_USERNAME:$ODL_PASSWORD
-H "Content-Type: application/json" -X DELETE
$ODL_URI/restconf/config/genius-mdsalutil:config;
curl -k -v --silent --fail -u $ODL_USERNAME:$ODL_PASSWORD
-H "Content-Type: application/json" -X POST
$ODL_URI/restconf/config/genius-mdsalutil:config
-d "{ "upgradeInProgress": false }"
params:
$ODL_USERNAME: {get_attr: [OpenDaylightBase, role_data, config_settings, 'opendaylight::username']}
$ODL_PASSWORD: {get_attr: [OpenDaylightBase, role_data, config_settings, 'opendaylight::password']}
$ODL_URI: {get_param: [EndpointMap, OpenDaylightInternal, uri]}
when: step|int == 0
update_tasks:
- name: Get ODL update level
block: &get_odl_update_level

View File

@ -412,7 +412,7 @@ DockerRegistry:
OpenDaylight:
Internal:
net_param: OpenDaylightApi
net_param: OpendaylightApi
Admin:
net_param: OpenDaylightApi
net_param: OpendaylightApi
port: 8081

View File

@ -7127,14 +7127,14 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- str_replace:
params:
NETWORK:
get_param: [ServiceNetMap, OpenDaylightApiNetwork]
get_param: [ServiceNetMap, OpendaylightApiNetwork]
template: NETWORK_uri
host_nobrackets:
str_replace:
@ -7144,11 +7144,11 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
port:
get_param: [EndpointMap, OpenDaylightAdmin, port]
protocol:
@ -7165,14 +7165,14 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- str_replace:
params:
NETWORK:
get_param: [ServiceNetMap, OpenDaylightApiNetwork]
get_param: [ServiceNetMap, OpendaylightApiNetwork]
template: NETWORK_uri
port:
get_param: [EndpointMap, OpenDaylightAdmin, port]
@ -7188,14 +7188,14 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- str_replace:
params:
NETWORK:
get_param: [ServiceNetMap, OpenDaylightApiNetwork]
get_param: [ServiceNetMap, OpendaylightApiNetwork]
template: NETWORK_uri
port:
get_param: [EndpointMap, OpenDaylightAdmin, port]
@ -7208,14 +7208,14 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- str_replace:
params:
NETWORK:
get_param: [ServiceNetMap, OpenDaylightApiNetwork]
get_param: [ServiceNetMap, OpendaylightApiNetwork]
template: NETWORK_uri
host_nobrackets:
str_replace:
@ -7225,11 +7225,11 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
port:
get_param: [EndpointMap, OpenDaylightInternal, port]
protocol:
@ -7246,14 +7246,14 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- str_replace:
params:
NETWORK:
get_param: [ServiceNetMap, OpenDaylightApiNetwork]
get_param: [ServiceNetMap, OpendaylightApiNetwork]
template: NETWORK_uri
port:
get_param: [EndpointMap, OpenDaylightInternal, port]
@ -7269,14 +7269,14 @@ outputs:
CLOUDNAME:
get_param:
- CloudEndpoints
- get_param: [ServiceNetMap, OpenDaylightApiNetwork]
- get_param: [ServiceNetMap, OpendaylightApiNetwork]
IP_ADDRESS:
get_param:
- NetIpMap
- str_replace:
params:
NETWORK:
get_param: [ServiceNetMap, OpenDaylightApiNetwork]
get_param: [ServiceNetMap, OpendaylightApiNetwork]
template: NETWORK_uri
port:
get_param: [EndpointMap, OpenDaylightInternal, port]

View File

@ -225,55 +225,28 @@ outputs:
list_concat:
- get_attr: [Ovs, role_data, upgrade_tasks]
-
- name: Check if openvswitch is deployed
command: systemctl is-enabled openvswitch
tags: common
ignore_errors: True
register: openvswitch_enabled
- name: "PreUpgrade step0,validation: Check service openvswitch is running"
command: systemctl is-active --quiet openvswitch
when:
- step|int == 0
- openvswitch_enabled.rc == 0
tags: validation
- name: Stop openvswitch service
when:
- step|int == 1
- openvswitch_enabled.rc == 0
service: name=openvswitch state=stopped
# Container upgrade steps.
- name: ODL container L2 update and upgrade tasks
block: &odl_container_upgrade_tasks
- name: Block connections to ODL. #This rule will be inserted at the top.
iptables: chain=OUTPUT action=insert protocol=tcp destination_port={{ item }} jump=DROP
when: step|int == 0
with_items:
- 6640
- 6653
- 6633
post_upgrade_tasks: &odl_container_post_upgrade_tasks
- name: Check service openvswitch is running
command: systemctl is-active --quiet openvswitch
tags: common
register: openvswitch_running
- name: Delete OVS groups and ports
shell: "sudo ovs-ofctl -O Openflow13 del-groups br-int; \
for tun_port in $(ovs-vsctl list-ports br-int | grep 'tun'); \
do; ovs-vsctl del-port br-int $(tun_port); done;"
when: (step|int == 0) and (openvswitch_running.rc == 0)
- name: Stop openvswitch service
when: (step|int == 1) and (openvswitch_running.rc == 0)
service: name=openvswitch state=stopped
- name: Unblock OVS port per compute node. #Delete previously added rule
iptables: chain=OUTPUT action=insert protocol=tcp destination_port={{ item }} jump=DROP state=absent
when: step|int == 2
with_items:
- 6640
- 6653
- 6633
- name: start openvswitch service
when: step|int == 3
service : name=openvswitch state=started
- name: Check if openvswitch is deployed
command: systemctl is-enabled openvswitch
tags: common
ignore_errors: True
register: openvswitch_enabled
- name: "PreUpgrade step0,validation: Check service openvswitch is running"
command: systemctl is-active --quiet openvswitch
when:
- step|int == 0
- openvswitch_enabled.rc == 0
tags: validation
# Container upgrade steps.
- name: Delete OVS groups and ports
shell: >
sudo ovs-ofctl -O Openflow13 del-groups br-int;
for tun_port in $(sudo ovs-vsctl list-ports br-int | grep tun);
do sudo ovs-vsctl del-port br-int $tun_port; done
when:
- step|int == 0
- openvswitch_enabled.rc == 0
update_tasks:
- name: Get ODL update level
block: &get_odl_update_level
@ -283,11 +256,6 @@ outputs:
- name: Run L2 update tasks that are similar to upgrade_tasks when update level is 2
block: *odl_container_upgrade_tasks
when: odl_update_level == 2
post_update_tasks:
- block: *get_odl_update_level
- block: *odl_container_post_upgrade_tasks
when: odl_update_level == 2
metadata_settings:
if:
- internal_tls_enabled