Coverity(phase2)-CWE 398:Code Quality 95/14295/2
author36970 <jegan.s@tataelxsi.co.in>
Mon, 1 Apr 2024 16:47:36 +0000 (16:47 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 5 Apr 2024 10:21:48 +0000 (12:21 +0200)
Added fix for CWE 398: Code Quality

Change-Id: Ie86246c6606bc5fd12d00b297a5b19661747baa7
Signed-off-by: 36970 <jegan.s@tataelxsi.co.in>
osmclient/sol005/sdncontroller.py
osmclient/sol005/vim.py
osmclient/sol005/wim.py

index 3d4b7f7..b8860d7 100644 (file)
@@ -61,10 +61,7 @@ class SdnController(object):
         """Returns id of name, or the id itself if given as argument"""
         self._logger.debug("")
         for sdnc in self.list():
-            if name == sdnc["_id"]:
-                return sdnc["_id"]
-        for sdnc in self.list():
-            if name == sdnc["name"]:
+            if name == sdnc["_id"] or name == sdnc["name"]:
                 return sdnc["_id"]
         return ""
 
index 4962a91..6be1dbb 100644 (file)
@@ -62,10 +62,7 @@ class Vim(object):
         self._logger.debug("")
         self._client.get_token()
         for vim in self.list():
-            if name == vim["uuid"]:
-                return vim["uuid"]
-        for vim in self.list():
-            if name == vim["name"]:
+            if name == vim["uuid"] or name == vim["name"]:
                 return vim["uuid"]
         return ""
 
index 2466113..c9249d0 100644 (file)
@@ -61,10 +61,7 @@ class Wim(object):
         """Returns id of name, or the id itself if given as argument"""
         self._logger.debug("")
         for wim in self.list():
-            if name == wim["uuid"]:
-                return wim["uuid"]
-        for wim in self.list():
-            if name == wim["name"]:
+            if name == wim["uuid"] or name == wim["name"]:
                 return wim["uuid"]
         return ""