(d: dict)
| 119 | |
| 120 | @staticmethod |
| 121 | def from_dict(d: dict) -> Union["SutNodeConfiguration", "TGNodeConfiguration"]: |
| 122 | hugepage_config = d.get("hugepages") |
| 123 | if hugepage_config: |
| 124 | if "force_first_numa" not in hugepage_config: |
| 125 | hugepage_config["force_first_numa"] = False |
| 126 | hugepage_config = HugepageConfiguration(**hugepage_config) |
| 127 | |
| 128 | common_config = { |
| 129 | "name": d["name"], |
| 130 | "hostname": d["hostname"], |
| 131 | "user": d["user"], |
| 132 | "password": d.get("password"), |
| 133 | "arch": Architecture(d["arch"]), |
| 134 | "os": OS(d["os"]), |
| 135 | "lcores": d.get("lcores", "1"), |
| 136 | "use_first_core": d.get("use_first_core", False), |
| 137 | "hugepages": hugepage_config, |
| 138 | "ports": [PortConfig.from_dict(d["name"], port) for port in d["ports"]], |
| 139 | } |
| 140 | |
| 141 | if "traffic_generator" in d: |
| 142 | return TGNodeConfiguration( |
| 143 | traffic_generator=TrafficGeneratorConfig.from_dict(d["traffic_generator"]), |
| 144 | **common_config, |
| 145 | ) |
| 146 | else: |
| 147 | return SutNodeConfiguration( |
| 148 | memory_channels=d.get("memory_channels", 1), **common_config |
| 149 | ) |
| 150 | |
| 151 | |
| 152 | @dataclass(slots=True, frozen=True) |
nothing calls this directly
no test coverage detected