Fix bug 1030 forcing to wait taskIds 32/8732/3
authorFrancisco Garcia Alvarez <francisco.galvarez@atos.net>
Fri, 27 Mar 2020 07:42:44 +0000 (08:42 +0100)
committerFrancisco Garcia Alvarez <francisco.galvarez@atos.net>
Thu, 2 Apr 2020 15:49:59 +0000 (17:49 +0200)
Changelog:
- Fix bug 1030 by Oscar
- Changed comments in configLets according to Itsaso suggestions
- Fix bug in rollback call (modified time to wait in tasks and rollback)

Change-Id: Ib5eadfb44f9d6ff8cd9dbeacc640c925d65d3ea3
Signed-off-by: Francisco Garcia Alvarez <francisco.galvarez@atos.net>
RO-SDN-arista/osm_rosdn_arista/aristaConfigLet.py
RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py

index bceaa3c..a48f0b9 100644 (file)
 \r
 class AristaSDNConfigLet:\r
     _configLet_SRIOV = """\r
-!# service: {}\r
-interface {}\r
+interface {interface}\r
+   !! service: {uuid}\r
    switchport\r
    switchport mode trunk\r
-   switchport trunk group {}{}\r
+   switchport trunk group {service}{vlan_id}\r
 !\r
 """\r
 \r
     def _get_sriov(self, uuid, interface, vlan_id, s_type, index):\r
-        return self._configLet_SRIOV.format(uuid, interface, s_type, vlan_id)\r
+        return self._configLet_SRIOV.format(uuid=uuid, interface=interface, service=s_type, vlan_id=vlan_id)\r
 \r
     def getElan_sriov(self, uuid, interface, vlan_id, index):\r
         return self._get_sriov(uuid, interface, vlan_id, "ELAN", index)\r
@@ -48,16 +48,16 @@ interface {}
         return self._get_sriov(uuid, interface, vlan_id, "ELINE", index)\r
 \r
     _configLet_PASSTROUGH = """\r
-!# service: {}\r
-interface {}\r
+interface {interface}\r
+   !! service: {uuid}\r
    switchport\r
    switchport mode access\r
-   switchport access vlan {}\r
+   switchport access vlan {vlan_id}\r
 !\r
 """\r
 \r
     def _get_passthrough(self, uuid, interface, vlan_id, s_type, index):\r
-        return self._configLet_PASSTROUGH.format(uuid, interface, vlan_id)\r
+        return self._configLet_PASSTROUGH.format(uuid=uuid, interface=interface, vlan_id=vlan_id)\r
 \r
     def getElan_passthrough(self, uuid, interface, vlan_id, index):\r
         return self._get_passthrough(uuid, interface, vlan_id, "ELAN", index)\r
@@ -66,8 +66,8 @@ interface {}
         return self._get_passthrough(uuid, interface, vlan_id, "ELINE", index)\r
 \r
     _configLet_VLAN = """\r
-!## service: {service} {vlan} {uuid}\r
 vlan {vlan}\r
+   !! service: {service} {vlan} {uuid}\r
    name {service}{vlan}\r
    trunk group {service}{vlan}\r
    trunk group MLAGPEER\r
@@ -87,9 +87,9 @@ interface VXLAN1
         return self._get_vlan(uuid, vlan_id, vni_id, "ELINE")\r
 \r
     _configLet_BGP = """\r
-!# service: {uuid}\r
 router bgp {bgp}\r
     vlan {vlan}\r
+    !! service: {uuid}\r
         rd {loopback}:{vni}\r
         route-target both {vni}:{vni}\r
         redistribute learned\r
index 67db739..cde8e21 100644 (file)
@@ -122,8 +122,8 @@ class AristaSdnConnector(SdnConnectorBase):
     __OSM_PREFIX = "osm_"
     __OSM_METADATA = "OSM_metadata"
     __METADATA_PREFIX = '!## Service'
-    __EXC_TASK_EXEC_WAIT = 1
-    __ROLLB_TASK_EXEC_WAIT = 5
+    __EXC_TASK_EXEC_WAIT = 10
+    __ROLLB_TASK_EXEC_WAIT = 10
 
     def __init__(self, wim, wim_account, config=None, logger=None):
         """
@@ -777,8 +777,8 @@ class AristaSdnConnector(SdnConnectorBase):
         except Exception as ex:
             try:
                 self.__rollbackConnection(cls_perSw,
-                                          allLeafConfigured=True,
-                                          allLeafModified=True)
+                                          allLeafConfigured,
+                                          allLeafModified)
             except Exception as e:
                 self.logger.info("Exception rolling back in updating  connection: {}".
                                  format(e))
@@ -1000,7 +1000,8 @@ class AristaSdnConnector(SdnConnectorBase):
                     resp = self.client.api.update_configlet(
                                     configlet['config'],
                                     configlet['data']['key'],
-                                    configlet['data']['name'])
+                                    configlet['data']['name'],
+                                    wait_task_ids=True)
                 elif to_create:
                     operation = 'create'
                     resp = self.client.api.add_configlet(