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 mode: 0644
when: step|int == 1 when: step|int == 1
post_upgrade_tasks: &odl_container_post_upgrade_tasks 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 - name: Disable Upgrade in Config File
copy: copy:
dest: /var/lib/config-data/puppet-generated/opendaylight/opt/opendaylight/etc/opendaylight/datastore/initial/config/genius-mdsalutil-config.xml 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 group: 42462
mode: 0644 mode: 0644
when: step|int == 0 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: update_tasks:
- name: Get ODL update level - name: Get ODL update level
block: &get_odl_update_level block: &get_odl_update_level

View File

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

View File

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

View File

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