Merge "Remove unnecessary check for pytest.skip"
[vvp/validation-scripts.git] / ice_validator / tests / structures.py
index 12bfc63..887917c 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
@@ -495,7 +499,10 @@ class NeutronPortProcessor(HeatProcessor):
         An OS::Nova:Port with the property binding:vnic_type
         """
         resource_properties = nested_dict.get(resource, "properties", default={})
-        if nested_dict.get(resource, "type") == cls.resource_type and resource_properties.get("binding:vnic_type", "") == "direct":
+        if (
+            nested_dict.get(resource, "type") == cls.resource_type
+            and resource_properties.get("binding:vnic_type", "") == "direct"
+        ):
             return True
 
         return False
@@ -598,6 +605,10 @@ class Heat(object):
             self.load_env(envpath)
         self.heat_processors = self.get_heat_processors()
 
+    @property
+    def is_heat(self):
+        return "heat_template_version" in self.yml
+
     @property
     def contrail_resources(self):
         """This attribute is a dict of Contrail resources.
@@ -785,10 +796,12 @@ class Resource(object):
             try:
                 return int(count_value)
             except (ValueError, TypeError):
-                print((
-                    "WARNING: Invalid value for count parameter {}. Expected "
-                    "an integer, but got {}. Defaulting to 1"
-                ).format(count_param, count_value))
+                print(
+                    (
+                        "WARNING: Invalid value for count parameter {}. Expected "
+                        "an integer, but got {}. Defaulting to 1"
+                    ).format(count_param, count_value)
+                )
         return 1
 
     @property