From 4ee04a6a4c5b473af1bc505961f5825dcdd6afc7 Mon Sep 17 00:00:00 2001 From: Francisco Garcia Alvarez Date: Fri, 27 Mar 2020 08:42:44 +0100 Subject: [PATCH] Fix bug 1030 forcing to wait taskIds 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 --- .../osm_rosdn_arista/aristaConfigLet.py | 20 +++++++++---------- .../osm_rosdn_arista/wimconn_arista.py | 11 +++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/RO-SDN-arista/osm_rosdn_arista/aristaConfigLet.py b/RO-SDN-arista/osm_rosdn_arista/aristaConfigLet.py index bceaa3ce..a48f0b96 100644 --- a/RO-SDN-arista/osm_rosdn_arista/aristaConfigLet.py +++ b/RO-SDN-arista/osm_rosdn_arista/aristaConfigLet.py @@ -30,16 +30,16 @@ class AristaSDNConfigLet: _configLet_SRIOV = """ -!# service: {} -interface {} +interface {interface} + !! service: {uuid} switchport switchport mode trunk - switchport trunk group {}{} + switchport trunk group {service}{vlan_id} ! """ def _get_sriov(self, uuid, interface, vlan_id, s_type, index): - return self._configLet_SRIOV.format(uuid, interface, s_type, vlan_id) + return self._configLet_SRIOV.format(uuid=uuid, interface=interface, service=s_type, vlan_id=vlan_id) def getElan_sriov(self, uuid, interface, vlan_id, index): return self._get_sriov(uuid, interface, vlan_id, "ELAN", index) @@ -48,16 +48,16 @@ interface {} return self._get_sriov(uuid, interface, vlan_id, "ELINE", index) _configLet_PASSTROUGH = """ -!# service: {} -interface {} +interface {interface} + !! service: {uuid} switchport switchport mode access - switchport access vlan {} + switchport access vlan {vlan_id} ! """ def _get_passthrough(self, uuid, interface, vlan_id, s_type, index): - return self._configLet_PASSTROUGH.format(uuid, interface, vlan_id) + return self._configLet_PASSTROUGH.format(uuid=uuid, interface=interface, vlan_id=vlan_id) def getElan_passthrough(self, uuid, interface, vlan_id, index): return self._get_passthrough(uuid, interface, vlan_id, "ELAN", index) @@ -66,8 +66,8 @@ interface {} return self._get_passthrough(uuid, interface, vlan_id, "ELINE", index) _configLet_VLAN = """ -!## service: {service} {vlan} {uuid} vlan {vlan} + !! service: {service} {vlan} {uuid} name {service}{vlan} trunk group {service}{vlan} trunk group MLAGPEER @@ -87,9 +87,9 @@ interface VXLAN1 return self._get_vlan(uuid, vlan_id, vni_id, "ELINE") _configLet_BGP = """ -!# service: {uuid} router bgp {bgp} vlan {vlan} + !! service: {uuid} rd {loopback}:{vni} route-target both {vni}:{vni} redistribute learned diff --git a/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py b/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py index 67db7395..cde8e211 100644 --- a/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py +++ b/RO-SDN-arista/osm_rosdn_arista/wimconn_arista.py @@ -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( -- 2.25.1