parse_switchmatrix¶
Parser functions for switch matrix and list file configurations.
This module provides utilities for parsing switch matrix CSV files and list files used in fabric definition. It handles expansion of port definitions, connection mappings, and validation of port configurations.
Attributes¶
Functions¶
|
Expand the .list file entry into a list of tuples. |
|
Parse a list file and expand the list file information into a list of tuples. |
|
Parse the matrix CSV into a dictionary from destination to source. |
|
Parse a single line of the port configuration from the CSV file. |
Module Contents¶
- expandListPorts(port, portList)[source]¶
Expand the .list file entry into a list of tuples.
- Parameters:
- Raises:
ValueError – If the port entry contains “[” or “{” without matching closing bracket “]”/”}”.
- Return type:
None
- parseList(filePath: Path, collect: Literal['pair'] = 'pair') list[tuple[str, str]][source]¶
- parseList(filePath: Path, collect: Literal['source', 'sink']) dict[str, list[str]]
Parse a list file and expand the list file information into a list of tuples.
- Parameters:
filePath (Path) – The path to the list file to parse.
collect (Literal["pair", "source", "sink"], optional) – Collect value by source, sink or just as pair. Defaults to “pair”.
- Raises:
FileNotFoundError – The file does not exist.
InvalidListFileDefinition – Invalid format in the list file.
- Returns:
Return either a list of connection pairs or a dictionary of lists which is collected by the specified option, source or sink.
- Return type:
- parseMatrix(fileName, tileName)[source]¶
Parse the matrix CSV into a dictionary from destination to source.