diff --git a/python/ironic-understack/ironic_understack/flavor_spec.py b/python/ironic-understack/ironic_understack/flavor_spec.py index a56448a1..8848f80d 100644 --- a/python/ironic-understack/ironic_understack/flavor_spec.py +++ b/python/ironic-understack/ironic_understack/flavor_spec.py @@ -9,22 +9,24 @@ @dataclass class FlavorSpec: name: str + manufacturer: str + model: str memory_gb: int cpu_cores: int cpu_models: list[str] drives: list[int] - devices: list[str] @staticmethod def from_yaml(yaml_str: str) -> "FlavorSpec": data = yaml.safe_load(yaml_str) return FlavorSpec( name=data["name"], + manufacturer=data["manufacturer"], + model=data["model"], memory_gb=data["memory_gb"], cpu_cores=data["cpu_cores"], cpu_models=data["cpu_models"], drives=data["drives"], - devices=data["devices"], ) @staticmethod diff --git a/python/ironic-understack/ironic_understack/tests/test_flavor_spec.py b/python/ironic-understack/ironic_understack/tests/test_flavor_spec.py index a575e68f..16cdcc8b 100644 --- a/python/ironic-understack/ironic_understack/tests/test_flavor_spec.py +++ b/python/ironic-understack/ironic_understack/tests/test_flavor_spec.py @@ -10,6 +10,8 @@ def valid_yaml(): return """ --- name: gp2.ultramedium +manufacturer: Dell +model: PowerEdge R7615 memory_gb: 7777 cpu_cores: 245 cpu_models: @@ -17,9 +19,6 @@ def valid_yaml(): drives: - 960 - 960 -devices: - - PowerEdge R7515 - - PowerEdge R7615 """ @@ -47,11 +46,12 @@ def yaml_directory(tmp_path, valid_yaml, invalid_yaml): def test_from_yaml(valid_yaml): spec = FlavorSpec.from_yaml(valid_yaml) assert spec.name == "gp2.ultramedium" + assert spec.manufacturer == "Dell" + assert spec.model == "PowerEdge R7615" assert spec.memory_gb == 7777 assert spec.cpu_cores == 245 assert spec.cpu_models == ["AMD EPYC 9254 245-Core Processor"] assert spec.drives == [960, 960] - assert spec.devices == ["PowerEdge R7515", "PowerEdge R7615"] def test_from_yaml_invalid(invalid_yaml): @@ -115,27 +115,30 @@ def flavors(): return [ FlavorSpec( name="small", + manufacturer="Dell", + model="Fake Machine", memory_gb=100, cpu_cores=13, - cpu_models=["AMD EPYC 9254 245-Core Processor", "Pentium 60"], + cpu_models=["AMD EPYC 9254 245-Core Processor"], drives=[500, 500], - devices=[], ), FlavorSpec( name="medium", + manufacturer="Dell", + model="Fake Machine", memory_gb=200, cpu_cores=15, - cpu_models=["AMD EPYC 9254 245-Core Processor", "Intel 80386DX"], + cpu_models=["AMD EPYC 9254 245-Core Processor"], drives=[1500, 1500], - devices=[], ), FlavorSpec( name="large", + manufacturer="Dell", + model="Fake Machine", memory_gb=400, cpu_cores=27, cpu_models=["AMD EPYC 9254 245-Core Processor"], drives=[1800, 1800], - devices=[], ), ] diff --git a/python/ironic-understack/ironic_understack/tests/test_matcher.py b/python/ironic-understack/ironic_understack/tests/test_matcher.py index b32561b2..89dd22f8 100644 --- a/python/ironic-understack/ironic_understack/tests/test_matcher.py +++ b/python/ironic-understack/ironic_understack/tests/test_matcher.py @@ -9,27 +9,30 @@ def sample_flavors(): return [ FlavorSpec( name="small", + manufacturer="Dell", + model="Fake Machine", memory_gb=4, cpu_cores=2, - cpu_models=["x86", "ARM"], + cpu_models=["x86"], drives=[20], - devices=[], ), FlavorSpec( name="medium", + manufacturer="Dell", + model="Fake Machine", memory_gb=8, cpu_cores=4, cpu_models=["x86"], drives=[40], - devices=[], ), FlavorSpec( name="large", + manufacturer="Dell", + model="Fake Machine", memory_gb=16, cpu_cores=8, cpu_models=["x86"], drives=[80], - devices=[], ), ]