MCPcopy Create free account
hub / github.com/F-Stack/f-stack / from_dict

Method from_dict

dpdk/dts/framework/config/__init__.py:121–149  ·  view source on GitHub ↗
(d: dict)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 6

ArchitectureClass · 0.85
OSClass · 0.85
TGNodeConfigurationClass · 0.85
from_dictMethod · 0.45

Tested by

no test coverage detected