Sonarfix in structures.py 77/96577/3
authorEzhilarasi <ezhrajam@in.ibm.com>
Thu, 3 Oct 2019 14:20:11 +0000 (19:50 +0530)
committerEzhilarasi R <ezhrajam@in.ibm.com>
Fri, 4 Oct 2019 09:04:08 +0000 (09:04 +0000)
Reduced cognitive complexity
Change-Id: I2f435ba1d5980405fed66bfb1e4f4ad543b0ba4e
Issue-ID: VVP-286
Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
ice_validator/tests/structures.py

index 0223bc3..a435246 100644 (file)
@@ -252,15 +252,19 @@ class ContrailV2NetworkFlavorBaseProcessor(HeatProcessor):
                     network_flavor = cls.network_flavor_internal
                 else:
                     p = param.get("get_param")
-                    if isinstance(p, str):
-                        if "_int_" in p or p.startswith("int_"):
-                            network_flavor = cls.network_flavor_internal
-                        elif "_subint_" in p:
-                            network_flavor = cls.network_flavor_subint
-                        else:
-                            network_flavor = cls.network_flavor_external
+                    network_flavor = cls.get_network_format(p)
         return network_flavor
 
+    @classmethod
+    def get_network_format(cls, param):
+        if isinstance(param, str):
+            if "_int_" in param or param.startswith("int_"):
+                return cls.network_flavor_internal
+            elif "_subint_" in param:
+                return cls.network_flavor_subint
+            else:
+                return cls.network_flavor_external
+
 
 class ContrailV2InstanceIpProcessor(ContrailV2NetworkFlavorBaseProcessor):
     """ ContrailV2 InstanceIp