gufo.thor.config¶
Config data structures.
CliConfig
dataclass
¶
Bases: object
Config populated during runtime.
Should not be set by user. Populated from CLI options.
Config
dataclass
¶
Bases: object
The Gufo Thor config.
Attributes:
Name | Type | Description |
---|---|---|
project |
Optional[str]
|
Optional project name used to prefix the services and volumes. If not set - directory name is used. Should be unique within Thor projects on same host. |
noc |
NocConfig
|
The |
expose |
ExposeConfig
|
The |
services |
Dict[str, ServiceConfig]
|
The |
labs |
Dict[str, LabConfig]
|
The |
ExposeConfig
dataclass
¶
Bases: object
The expose
section of the config.
Attributes:
default()
staticmethod
¶
from_dict(data)
staticmethod
¶
Generate ExposeConfig instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
Incoming data. |
required |
Returns:
Type | Description |
---|---|
ExposeConfig
|
A configured ExposeConfig instance. |
IsisLinkProtocolConfig
dataclass
¶
Bases: object
ISIS protocol configuration for link.
from_dict(data)
staticmethod
¶
Generate IsisLinkProtocolConfig from dict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
Incoming data. |
required |
Returns:
Type | Description |
---|---|
IsisLinkProtocolConfig
|
IsisLinkProtocolConfig instance. |
LabConfig
dataclass
¶
Bases: object
The labs
section of the config.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
lab name. |
nodes |
Dict[str, LabNodeConfig]
|
Nodes configuration. |
pool |
Optional[str]
|
Lab pool. |
LabLinkConfig
dataclass
¶
LabNodeConfig
dataclass
¶
Bases: object
The labs.nodes
section of config.
from_dict(name, data)
staticmethod
¶
Generate LabNodeConfig from dict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Node name. |
required |
data
|
Dict[str, Optional[str]]
|
Incoming data. |
required |
Returns:
Type | Description |
---|---|
LabNodeConfig
|
LabNodeConfig instance. |
LabNodeSnmpV2cCredentials
dataclass
¶
Bases: TypedDict
SNMP v2c Credentials.
LabNodeUserCredentials
dataclass
¶
Bases: object
User credentials.
Attributes:
Name | Type | Description |
---|---|---|
user |
str
|
Local user name. |
password |
str
|
Plain-text password. |
from_dict(data)
staticmethod
¶
Get user credentials from dict.
LinkProtocolConfig
¶
Bases: TypedDict
Protocol settings.
Listen
dataclass
¶
Bases: object
Listener configuration.
Used to proxy host's ports into the container.
Accepts formats:
* <port>
* "<port>"
* "<address>:<port>"
* {"port": <port>}
* {"address": "<address>", "port": <port>}
Attributes:
Name | Type | Description |
---|---|---|
address |
str
|
Listen address. |
port |
int
|
Listen port. |
docker_compose_port(container_port)
¶
Generate configuration for port forwarding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container_port
|
int
|
Port in the container. |
required |
Returns:
Type | Description |
---|---|
str
|
Port configuration for docker compose. |
NocConfig
dataclass
¶
Bases: object
The noc
section of the config.
Attributes:
Name | Type | Description |
---|---|---|
tag |
str
|
NOC image tag |
path |
Optional[str]
|
An optional path to the NOC source code. If not empty,
image's |
custom |
Optional[str]
|
Optional path to the custom, will be mounted
in the |
installation_name |
str
|
The installation name which will be shown in the interface. |
theme |
Literal['noc', 'gray']
|
Web interface theme. One of: |
migrate |
bool
|
Run migrations on start |
config |
Optional[Dict[str, Any]]
|
User-defined config. |
default()
staticmethod
¶
PoolAddressConfig
dataclass
¶
Bases: object
Pool addresses configuration.
Attributes:
Name | Type | Description |
---|---|---|
gw |
Optional[IPv4Address]
|
Gateway address for |
syslog |
Optional[IPv4Address]
|
Syslog collector address. |
trap |
Optional[IPv4Address]
|
SNMP trap address. |
PoolConfig
dataclass
¶
Bases: object
The pools
section of config.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Pool name. |
subnet |
IPv4Prefix
|
Allocated subnet. |
from_dict(name, data)
staticmethod
¶
Generate PoolConfig instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Pool name. |
required |
data
|
Dict[str, Any]
|
Incoming data. |
required |
Returns:
Type | Description |
---|---|
PoolConfig
|
A configured PoolConfig instance. |
ServiceConfig
dataclass
¶
Bases: object
The services
section of the config.
Attributes:
Name | Type | Description |
---|---|---|
tag |
Optional[str]
|
Override |
scale |
int
|
Number of concurrently running servers. 0 - disable. |
default()
staticmethod
¶
Get default ServiceConfig.
from_dict(data)
staticmethod
¶
Generate ServiceConfig instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
Incoming data. |
required |
Returns:
Type | Description |
---|---|
ServiceConfig
|
A configured ServiceConfig instance. |
get_sample(name)
¶
Get preconfigured config sample by name.
All samples are preserved in samples
directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Sample name, without |
required |
Returns:
Type | Description |
---|---|
str
|
A string containinng sample code. |