gufo.thor.labs.base¶
BaseLab definition.
Attributes:
Name | Type | Description |
---|---|---|
loader |
The lab loader. |
BaseLab
¶
Bases: object
Router for lab.
get(name)
staticmethod
¶
Get Lab instance.
get_compose_config(config, lab_config, node_config)
¶
Generate service config for docker compose.
get_compose_image(config, lab_config, node_config)
¶
Generate compose image name.
get_compose_networks(config, lab_config, node_config)
¶
Get volumes settings.
get_compose_volumes(config, lab_config, node_config)
¶
Get service network settings.
get_config_context(config, lab_config, node_config)
classmethod
¶
Get context to render config.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
Config
|
Full config. |
required |
lab_config
|
LabConfig
|
Full lab config. |
required |
node_config
|
LabNodeConfig
|
Current node's config. |
required |
Returns:
Type | Description |
---|---|
ConfigCtx
|
Context to render templates. |
get_config_dir(lab_config, node_config)
¶
Get root of the configuration directory.
get_eth_interface_name(n)
classmethod
¶
Generate name for ethernet interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n
|
int
|
Interface number (zero-based) |
required |
Returns:
Type | Description |
---|---|
str
|
interface name |
render_file(path, tpl, **kwargs)
classmethod
¶
Apply a context to the template and write to file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
File path |
required |
tpl
|
str
|
Template name (relative to |
required |
kwargs
|
Union[str, int, List[Any]]
|
Template context |
{}
|
ConfigCtx
¶
Bases: TypedDict
Config template context.
Attributes:
Name | Type | Description |
---|---|---|
hostname |
str
|
Hostname, may be empty. |
router_id |
str
|
router-id, may be empty. |
has_protocols |
bool
|
True, if any of protocols set, False otherwise. |
has_isis |
bool
|
IS-IS protocol is configured. |
isis_net |
str
|
IS-IS network, empty if |
eth_interfaces |
List[EthIfaceSettings]
|
List of configured ethernet interfaces. |
EthIfaceSettings
dataclass
¶
Bases: object
Ethernet interface settings.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Interface name. |
address |
str
|
IPv4 address. |
description |
str
|
Interface description. |
is_isis |
bool
|
IS-IS is configured on interface. |
isis_metric |
Optional[int]
|
IS-IS metric for interface, if not empty. |