| 125 | |
| 126 | @classmethod |
| 127 | def parse_arg(cls, config: _NetworkConfigurationSerialization) -> Self | None: |
| 128 | nic_type = config.get('type', None) |
| 129 | if not nic_type: |
| 130 | return None |
| 131 | |
| 132 | match NicType(nic_type): |
| 133 | case NicType.ISO: |
| 134 | return cls(NicType.ISO) |
| 135 | case NicType.NM: |
| 136 | return cls(NicType.NM) |
| 137 | case NicType.NM_IWD: |
| 138 | return cls(NicType.NM_IWD) |
| 139 | case NicType.IWD: |
| 140 | return cls(NicType.IWD) |
| 141 | case NicType.MANUAL: |
| 142 | nics_arg = config.get('nics', []) |
| 143 | if nics_arg: |
| 144 | nics = [Nic.parse_arg(n) for n in nics_arg] |
| 145 | return cls(NicType.MANUAL, nics) |
| 146 | |
| 147 | return None |
| 148 | |
| 149 | |
| 150 | @dataclass |