# Path: hardware/generate.py
# def generate(model, prefix=_PREFIX):
#     """Generate a list of dict according to a model.
# 
#     Ipv4 ranges are handled by _generate_ip.
#     """
# 
#     # Safe guard for models without ranges
#     for value in model.values():
#         if type(value) != STRING_TYPE:
#             break
#         elif _RANGE_REGEXP.search(value):
#             break
#     else:
#         return [model]
#     # The model has at least one range starting from here
#     result = []
#     yielded = {}
#     yielded.update(model)
#     yielded_copy = yielded.copy()
#     for key, value in yielded_copy.items():
#         if not prefix or key[0] == prefix:
#             if prefix:
#                 yielded[key[1:]] = _generate_values(value, prefix)
#                 del yielded[key]
#             else:
#                 if isinstance(value, str) and not _RANGE_REGEXP.search(value):
#                     yielded[key] = value
#                 else:
#                     yielded[key] = _generate_values(value, prefix)
#         else:
#             yielded[key] = value
#     while True:
#         try:
#             result.append(_call_nexts(yielded))
#         except StopIteration:
#             break
#     return result


from collections import OrderedDict
from hardware import generate
import unittest
        self.assertEqual(list(generate._generate_range('100-100:94-90')),
                         ['100', '94', '93', '92', '91', '90'])

    def test_generate_range_invalid(self):
        self.assertEqual(list(generate._generate_range('D7-H.1.0.0')),
                         ['D7-H.1.0.0'])

    def test_generate_norange(self):
        model = {'gw': '192.168.1.1'}
        self.assertEqual(
            generate.generate(model),
            [{'gw': '192.168.1.1'}]
        )

    def test_generate(self):
        model = {'gw': '192.168.1.1',
                 'ip': '192.168.1.10-12',
                 'hostname': 'host10-12'}
        self.assertEqual(
            generate.generate(model),
            [{'gw': '192.168.1.1', 'ip': '192.168.1.10', 'hostname': 'host10'},
             {'gw': '192.168.1.1', 'ip': '192.168.1.11', 'hostname': 'host11'},
             {'gw': '192.168.1.1', 'ip': '192.168.1.12', 'hostname': 'host12'}]
        )

    def test_generate_with_zeros(self):
        model = {'gw': '192.168.1.1',
                 'ip': '192.168.1.1-6',
                 'hostname': 'ceph001-006'}
        self.assertEqual(

# Path: hardware/generate.py
# def generate(model, prefix=_PREFIX):
#     """Generate a list of dict according to a model.
# 
#     Ipv4 ranges are handled by _generate_ip.
#     """
# 
#     # Safe guard for models without ranges
#     for value in model.values():
#         if type(value) != STRING_TYPE:
#             break
#         elif _RANGE_REGEXP.search(value):
#             break
#     else:
#         return [model]
#     # The model has at least one range starting from here
#     result = []
#     yielded = {}
#     yielded.update(model)
#     yielded_copy = yielded.copy()
#     for key, value in yielded_copy.items():
#         if not prefix or key[0] == prefix:
#             if prefix:
#                 yielded[key[1:]] = _generate_values(value, prefix)
#                 del yielded[key]
#             else:
#                 if isinstance(value, str) and not _RANGE_REGEXP.search(value):
#                     yielded[key] = value
#                 else:
#                     yielded[key] = _generate_values(value, prefix)
#         else:
#             yielded[key] = value
#     while True:
#         try:
#             result.append(_call_nexts(yielded))
#         except StopIteration:
#             break
#     return result


# Path: hardware/tests/test_generate.py
from collections import OrderedDict
from hardware import generate
import unittest

        self.assertEqual(list(generate._generate_range('100-100:94-90')),
                         ['100', '94', '93', '92', '91', '90'])

    def test_generate_range_invalid(self):
        self.assertEqual(list(generate._generate_range('D7-H.1.0.0')),
                         ['D7-H.1.0.0'])

    def test_generate_norange(self):
        model = {'gw': '192.168.1.1'}
        self.assertEqual(
            generate.generate(model),
            [{'gw': '192.168.1.1'}]
        )

    def test_generate(self):
        model = {'gw': '192.168.1.1',
                 'ip': '192.168.1.10-12',
                 'hostname': 'host10-12'}
        self.assertEqual(
            generate.generate(model),
            [{'gw': '192.168.1.1', 'ip': '192.168.1.10', 'hostname': 'host10'},
             {'gw': '192.168.1.1', 'ip': '192.168.1.11', 'hostname': 'host11'},
             {'gw': '192.168.1.1', 'ip': '192.168.1.12', 'hostname': 'host12'}]
        )

    def test_generate_with_zeros(self):
        model = {'gw': '192.168.1.1',
                 'ip': '192.168.1.1-6',
                 'hostname': 'ceph001-006'}
        self.assertEqual(

            generate.generate(model),