- [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
-
- Run Keyword If Any Tests Failed Delete NS ${ns_name}
- Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
- Run Keyword If Any Tests Failed Delete VNFD ${vnfd_volumes_name}
- Run Keyword If Any Tests Failed Delete VNFD ${vnfd_charm_name}
+ [Documentation] Test Suite Cleanup: Deleting Descriptor, instance and vim
+ Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
+ Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
+ Run Keyword If Any Tests Failed Delete VNFD ${VNFD_VOLUMES_NAME}
+ Run Keyword If Any Tests Failed Delete VNFD ${VNFD_CHARM_NAME}
+ Run Keyword If Any Tests Failed Delete Objects In VIM
+
+Delete Objects In VIM
+ [Documentation] Clean up remaining VMs and volumes directly from the VIM.
+ ${error}= Set Variable 0
+ FOR ${vol_id} IN @{VIM_VOLUMES}
+ Log Checking if volume ${vol_id} is still in VIM
+ ${exists}= Check If Volume Exists ${vol_id}
+ IF ${exists}
+ ${error}= Set Variable 1
+ Log Deleting volume ${vol_id}
+ Run Keyword And Ignore Error Delete Volume ${vol_id}
+ END
+ END
+ FOR ${vdu_id} IN @{VIM_VDUS}
+ Log Checking if server ${vdu_id} is still in VIM
+ ${status}= Run Keyword And Ignore Error Get Server Property ${vdu_id} id
+ Log ${status}[0]
+ IF '${status}[0]' == 'PASS'
+ ${error}= Set Variable 1
+ Log Deleting server ${vdu_id}
+ Run Keyword And Ignore Error Delete Server ${vdu_id}
+ END
+ END
+ IF ${error}==1 Fail Some objects created by test were not deleted in VIM