# ============LICENSE_END============================================
#
#
-"""structures
-"""
import collections
import inspect
import os
from tests import cached_yaml as yaml
from tests.helpers import load_yaml, get_param
-from .utils import nested_dict
+from tests.utils import nested_dict
VERSION = "4.2.0"
)
-class HeatResourceGroupProcessor(HeatProcessor):
- """ Heat ResourceGroup
- """
-
- resource_type = "OS::Heat::ResourceGroup"
- re_rids = collections.OrderedDict(
- [
- (
- "subint",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_subint"
- r"_(?P<network_role>.+)"
- r"_port_(?P<port_index>\d+)"
- r"_subinterfaces"
- r"$"
- ),
- )
- ]
- )
-
-
class NeutronNetProcessor(HeatProcessor):
""" Neutron Net resource
"""
re.search("(^(%(x)s)_)|(_(%(x)s)_)|(_(%(x)s)$)" % dict(x=part), name)
)
+ def iter_nested_heat(self):
+ """
+ Returns an iterable of tuples (int, heat) where the first parameter is the
+ depth of the nested file and the second item is an instance of Heat
+ """
+
+ def walk_nested(heat, level=1):
+ resources = [Resource(r_id, data) for r_id, data in heat.resources.items()]
+ for resource in resources:
+ if resource.is_nested():
+ nested_path = os.path.join(
+ self.dirname, resource.get_nested_filename()
+ )
+ nested_heat = Heat(nested_path)
+ yield level, nested_heat
+ yield from walk_nested(nested_heat, level + 1)
+
+ yield from walk_nested(self)
+
+ def __str__(self):
+ return "Heat({})".format(self.filepath)
+
+ def __repr__(self):
+ return str(self)
+
class Env(Heat):
"""An Environment file
else:
return {}
+ def __str__(self):
+ return "Resource(id={}, type={})".format(self.resource_id, self.resource_type)
+
+ def __repr__(self):
+ return str(self)
+
def get_all_resources(yaml_files):
"""Return a dict, resource id: resource