fix external port creation/deletion for WIM and sdn-assist 02/7802/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 24 Jul 2019 14:35:42 +0000 (14:35 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 24 Jul 2019 14:35:42 +0000 (14:35 +0000)
Change-Id: I8eac12688d1566b0cc3a48153afae8991a356859
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_ro/vim_thread.py

index ffe721c..f185db8 100644 (file)
@@ -983,8 +983,7 @@ class vim_thread(threading.Thread):
                 if wim_account_name and self.vim.config["wim_external_ports"]:
                     # add external port to connect WIM. Try with compute node __WIM:wim_name and __WIM
                     action_text = "attaching external port to ovim network"
-                    sdn_port_name = sdn_net_id + "." + task["vim_id"]
-                    sdn_port_name = sdn_port_name[:63]
+                    sdn_port_name = "external_port"
                     sdn_port_data = {
                         "compute_node": "__WIM:" + wim_account_name[0:58],
                         "pci": None,
@@ -1027,6 +1026,8 @@ class vim_thread(threading.Thread):
         net_vim_id = task["vim_id"]
         sdn_net_id = task["extra"].get("sdn_net_id")
         try:
+            if net_vim_id:
+                self.vim.delete_network(net_vim_id, task["extra"].get("created_items"))
             if sdn_net_id:
                 # Delete any attached port to this sdn network. There can be ports associated to this network in case
                 # it was manually done using 'openmano vim-net-sdn-attach'
@@ -1036,8 +1037,6 @@ class vim_thread(threading.Thread):
                     for port in port_list:
                         self.ovim.delete_port(port['uuid'], idempotent=True)
                     self.ovim.delete_network(sdn_net_id, idempotent=True)
-            if net_vim_id:
-                self.vim.delete_network(net_vim_id, task["extra"].get("created_items"))
             task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
             task["error_msg"] = None
             return None