Skip to content

Settings

GSO settings.

Ensuring that the required parameters are set correctly. An example file oss-params-example.json is present in the GSO package itself.

EnvironmentEnum

Bases: strEnum

The different environments in which the GSO system can run.

Source code in gso/settings.py
class EnvironmentEnum(strEnum):
    """The different environments in which the GSO system can run."""

    DEVELOPMENT = "development"
    """A local development environment."""
    TEST = "test"
    """The test environment."""
    UAT = "uat"
    """The user acceptance environment."""
    PRODUCTION = "production"
    """The production environment."""

DEVELOPMENT = 'development' class-attribute instance-attribute

A local development environment.

TEST = 'test' class-attribute instance-attribute

The test environment.

UAT = 'uat' class-attribute instance-attribute

The user acceptance environment.

PRODUCTION = 'production' class-attribute instance-attribute

The production environment.

GeneralParams

Bases: BaseSettings

General parameters for a GSO configuration file.

Source code in gso/settings.py
class GeneralParams(BaseSettings):
    """General parameters for a GSO configuration file."""

    public_hostname: str
    """The hostname that GSO is publicly served at, used for building callback URLs for public use."""
    internal_hostname: str
    """The hostname of GSO that is for internal use, such as the provisioning proxy."""
    isis_high_metric: int
    environment: EnvironmentEnum
    """The environment in which GSO is running, such as development, test, uat, or production."""
    pre_check_cli_max_output_lines: int = 50
    """The maximum number of lines to print when displaying the output of a bgp_status_precheck CLI command."""
    pre_check_cli_http_timeout_sec: int = 300
    """The timeout in seconds for the HTTP request to the LSO pre-check endpoint."""
    l2_migration_stagger_step_seconds: float = 30.0
    """The number of seconds to wait between starting two L2 migration workflows."""
    l3_migration_stagger_step_seconds: float = 30.0
    """The number of seconds to wait between starting two L3 migration workflows."""

public_hostname instance-attribute

The hostname that GSO is publicly served at, used for building callback URLs for public use.

internal_hostname instance-attribute

The hostname of GSO that is for internal use, such as the provisioning proxy.

environment instance-attribute

The environment in which GSO is running, such as development, test, uat, or production.

pre_check_cli_max_output_lines = 50 class-attribute instance-attribute

The maximum number of lines to print when displaying the output of a bgp_status_precheck CLI command.

pre_check_cli_http_timeout_sec = 300 class-attribute instance-attribute

The timeout in seconds for the HTTP request to the LSO pre-check endpoint.

l2_migration_stagger_step_seconds = 30.0 class-attribute instance-attribute

The number of seconds to wait between starting two L2 migration workflows.

l3_migration_stagger_step_seconds = 30.0 class-attribute instance-attribute

The number of seconds to wait between starting two L3 migration workflows.

CelerySettings

Bases: BaseSettings

Parameters for Celery.

Source code in gso/settings.py
class CelerySettings(BaseSettings):
    """Parameters for Celery."""

    broker_url: str = "redis://localhost:6379/0"
    result_backend: str = "redis://localhost:6379/0"
    result_expires: int = 3600

    class Config:
        """The prefix for the environment variables."""

        env_prefix = "CELERY_"

Config

The prefix for the environment variables.

Source code in gso/settings.py
class Config:
    """The prefix for the environment variables."""

    env_prefix = "CELERY_"

InfoBloxParams

Bases: BaseSettings

Parameters related to InfoBlox.

Source code in gso/settings.py
class InfoBloxParams(BaseSettings):
    """Parameters related to InfoBlox."""

    scheme: str
    wapi_version: str
    host: str
    username: str
    password: str

SolrParams

Bases: BaseSettings

Parameters related to Solr.

Source code in gso/settings.py
class SolrParams(BaseSettings):
    """Parameters related to Solr."""

    url: str = "http://localhost:8983/solr/gso"
    """The URL of the Solr instance used by GSO."""
    always_commit: bool = True
    """Whether to always commit changes to the Solr instance immediately."""
    timeout: int = 5
    """The timeout in seconds for requests to the Solr instance."""
    max_retries: int = 3
    """The maximum number of retries for requests to the Solr instance."""
    backoff_seconds: int = 1
    """The number of seconds to wait before retrying a request to the Solr instance."""
    enabled: bool = False
    """Whether the Solr client is enabled. If set to False, the client will not be used."""
    indexing_batch_size: int = 200
    """The number of documents to index in a single batch when indexing data into Solr."""

url = 'http://localhost:8983/solr/gso' class-attribute instance-attribute

The URL of the Solr instance used by GSO.

always_commit = True class-attribute instance-attribute

Whether to always commit changes to the Solr instance immediately.

timeout = 5 class-attribute instance-attribute

The timeout in seconds for requests to the Solr instance.

max_retries = 3 class-attribute instance-attribute

The maximum number of retries for requests to the Solr instance.

backoff_seconds = 1 class-attribute instance-attribute

The number of seconds to wait before retrying a request to the Solr instance.

enabled = False class-attribute instance-attribute

Whether the Solr client is enabled. If set to False, the client will not be used.

indexing_batch_size = 200 class-attribute instance-attribute

The number of documents to index in a single batch when indexing data into Solr.

V4NetworkParams

Bases: BaseSettings

A set of parameters that describe an IPv4 network in InfoBlox.

Source code in gso/settings.py
class V4NetworkParams(BaseSettings):
    """A set of parameters that describe an IPv4 network in InfoBlox."""

    containers: list[ipaddress.IPv4Network] = Field(default_factory=list)
    networks: list[ipaddress.IPv4Network] = Field(default_factory=list)
    mask: IPv4Netmask

    @model_validator(mode="after")
    def check_exactly_one_attribute_set(self) -> Self:
        """Exactly one of containers or networks must be defined."""
        if self.containers and self.networks:
            msg = "Both containers and networks are defined. Only one is allowed."
            raise ValueError(msg)
        if not self.containers and not self.networks:
            msg = "At least one container or network must be defined."
            raise ValueError(msg)
        return self

check_exactly_one_attribute_set()

Exactly one of containers or networks must be defined.

Source code in gso/settings.py
@model_validator(mode="after")
def check_exactly_one_attribute_set(self) -> Self:
    """Exactly one of containers or networks must be defined."""
    if self.containers and self.networks:
        msg = "Both containers and networks are defined. Only one is allowed."
        raise ValueError(msg)
    if not self.containers and not self.networks:
        msg = "At least one container or network must be defined."
        raise ValueError(msg)
    return self

V6NetworkParams

Bases: BaseSettings

A set of parameters that describe an IPv6 network in InfoBlox.

Source code in gso/settings.py
class V6NetworkParams(BaseSettings):
    """A set of parameters that describe an IPv6 network in InfoBlox."""

    containers: list[ipaddress.IPv6Network] = Field(default_factory=list)
    networks: list[ipaddress.IPv6Network] = Field(default_factory=list)
    mask: IPv6Netmask

    @model_validator(mode="after")
    def check_exactly_one_attribute_set(self) -> Self:
        """Exactly one of containers or networks must be defined."""
        if self.containers and self.networks:
            msg = "Both containers and networks are defined. Only one is allowed."
            raise ValueError(msg)
        if not self.containers and not self.networks:
            msg = "At least one container or network must be defined."
            raise ValueError(msg)
        return self

check_exactly_one_attribute_set()

Exactly one of containers or networks must be defined.

Source code in gso/settings.py
@model_validator(mode="after")
def check_exactly_one_attribute_set(self) -> Self:
    """Exactly one of containers or networks must be defined."""
    if self.containers and self.networks:
        msg = "Both containers and networks are defined. Only one is allowed."
        raise ValueError(msg)
    if not self.containers and not self.networks:
        msg = "At least one container or network must be defined."
        raise ValueError(msg)
    return self

ServiceNetworkParams

Bases: BaseSettings

Parameters for InfoBlox.

The parameters describe IPv4 and v6 networks, and the corresponding domain name that should be used as a suffix.

Source code in gso/settings.py
class ServiceNetworkParams(BaseSettings):
    """Parameters for InfoBlox.

    The parameters describe IPv4 and v6 networks, and the corresponding domain name that should be used as a suffix.
    """

    V4: V4NetworkParams
    V6: V6NetworkParams
    domain_name: str
    dns_view: str
    network_view: str

ManagementServiceNetworkParams

Bases: ServiceNetworkParams

Parameters for InfoBlox that include a default VLAN ID.

Source code in gso/settings.py
class ManagementServiceNetworkParams(ServiceNetworkParams):
    """Parameters for InfoBlox that include a default VLAN ID."""

    default_vlan_id: VLAN_ID

IPAMParams

Bases: BaseSettings

A set of parameters related to IPAM.

Source code in gso/settings.py
class IPAMParams(BaseSettings):
    """A set of parameters related to IPAM."""

    INFOBLOX: InfoBloxParams
    LO: ServiceNetworkParams
    TRUNK: ServiceNetworkParams
    SWITCH_MANAGEMENT: ManagementServiceNetworkParams
    OPTICAL_MANAGEMENT: ManagementServiceNetworkParams

MonitoringSNMPV2Params

Bases: BaseSettings

Parameters related to SNMPv2.

Source code in gso/settings.py
class MonitoringSNMPV2Params(BaseSettings):
    """Parameters related to SNMPv2."""

    community: str

MonitoringSNMPV3Params

Bases: BaseSettings

Parameters related to SNMPv3.

Source code in gso/settings.py
class MonitoringSNMPV3Params(BaseSettings):
    """Parameters related to SNMPv3."""

    authlevel: str
    authname: str
    authpass: str
    authalgo: str
    cryptopass: str
    cryptoalgo: str

MonitoringLibreNMSParams

Bases: BaseSettings

Parameters related to LibreNMS.

Source code in gso/settings.py
class MonitoringLibreNMSParams(BaseSettings):
    """Parameters related to LibreNMS."""

    base_url: str
    token: str

SNMPParams

Bases: BaseSettings

Parameters for SNMP in LibreNMS.

Source code in gso/settings.py
class SNMPParams(BaseSettings):
    """Parameters for SNMP in LibreNMS."""

    v2c: MonitoringSNMPV2Params
    v3: MonitoringSNMPV3Params | None = None
    """
    !!! example "Optional parameter"

        Support for SNMP v3 will get added in a later version of GSO. Parameters are optional for now.
    """

v3 = None class-attribute instance-attribute

Optional parameter

Support for SNMP v3 will get added in a later version of GSO. Parameters are optional for now.

MonitoringParams

Bases: BaseSettings

Parameters related to the monitoring.

Source code in gso/settings.py
class MonitoringParams(BaseSettings):
    """Parameters related to the monitoring."""

    LIBRENMS: MonitoringLibreNMSParams
    SNMP: SNMPParams

ProvisioningProxyParams

Bases: BaseSettings

Parameters for the provisioning proxy.

Source code in gso/settings.py
class ProvisioningProxyParams(BaseSettings):
    """Parameters for the provisioning proxy."""

    scheme: str
    api_base: str
    api_version: int

NetBoxParams

Bases: BaseSettings

Parameters for NetBox.

Source code in gso/settings.py
class NetBoxParams(BaseSettings):
    """Parameters for NetBox."""

    token: str
    api: str

EmailParams

Bases: BaseSettings

Parameters for the email service.

Attributes:

Name Type Description
notification_email_destinations str

List of email addresses that should receive notifications when validation of a subscription fails. Can be a comma-separated list of multiple addresses.

kentik_email_destinations str

A list of email addresses formatted similarly, but for notifications related to Kentik.

system_email_destinations str

A list of email addresses that receive system notifications such as cleaned up validation tasks.

Source code in gso/settings.py
class EmailParams(BaseSettings):
    """Parameters for the email service.

    Attributes:
        notification_email_destinations: List of email addresses that should receive notifications when validation of a
            subscription fails. Can be a comma-separated list of multiple addresses.
        kentik_email_destinations: A list of email addresses formatted similarly, but for notifications related to
            Kentik.
        system_email_destinations: A list of email addresses that receive system notifications such as cleaned up
            validation tasks.
    """

    from_address: EmailStr
    smtp_host: str
    smtp_port: PortNumber
    starttls_enabled: bool
    smtp_username: str | None = None
    smtp_password: str | None = None
    notification_email_destinations: str
    kentik_email_destinations: str
    system_email_destinations: str

SharepointParams

Bases: BaseSettings

Settings for different Sharepoint sites.

Source code in gso/settings.py
class SharepointParams(BaseSettings):
    """Settings for different Sharepoint sites."""

    client_id: UUIDstr
    tenant_id: UUIDstr
    certificate_path: str
    certificate_password: str
    site_id: UUIDstr
    list_ids: dict[str, UUIDstr]
    scopes: list[str]

KentikParams

Bases: BaseSettings

Settings for accessing Kentik's API.

Source code in gso/settings.py
class KentikParams(BaseSettings):
    """Settings for accessing Kentik's API."""

    api_base: str
    user_email: str
    api_key: str
    device_type: str
    minimize_snmp: bool
    placeholder_license_key: str
    archive_license_key: str
    sample_rate: int
    bgp_type: str
    ASN: int
    snmp_community: str
    md5_password: str

SentryParams

Bases: BaseSettings

Settings for Sentry.

Source code in gso/settings.py
class SentryParams(BaseSettings):
    """Settings for Sentry."""

    DSN: str

MoodiParams

Bases: BaseSettings

Settings for Moodi.

Source code in gso/settings.py
class MoodiParams(BaseSettings):
    """Settings for Moodi."""

    host: str
    moodi_enabled: bool = False

ServiceConfig

Bases: BaseSettings

Base configuration object for setting version information of a service.

Source code in gso/settings.py
class ServiceConfig(BaseSettings):
    """Base configuration object for setting version information of a service."""

    version: dict[str, str]
    default_version: str

ServiceVersionConfig

Bases: BaseSettings

Services offered by GSO that support multiple versions.

Source code in gso/settings.py
class ServiceVersionConfig(BaseSettings):
    """Services offered by GSO that support multiple versions."""

    IP_TRUNK: ServiceConfig
    GEANT_IP: ServiceConfig

OSSParams

Bases: BaseSettings

The set of parameters required for running GSO.

Source code in gso/settings.py
class OSSParams(BaseSettings):
    """The set of parameters required for running GSO."""

    GENERAL: GeneralParams
    IPAM: IPAMParams
    NETBOX: NetBoxParams
    MONITORING: MonitoringParams
    SOLR: SolrParams
    PROVISIONING_PROXY: ProvisioningProxyParams
    THIRD_PARTY_API_KEYS: dict[str, str]
    EMAIL: EmailParams
    SHAREPOINT: SharepointParams
    KENTIK: KentikParams | None = None
    SENTRY: SentryParams | None = None
    MOODI: MoodiParams
    SERVICE_VERSIONS: ServiceVersionConfig

load_oss_params()

Look for OSS_PARAMS_FILENAME in the environment and load the parameters from that file.

Source code in gso/settings.py
def load_oss_params() -> OSSParams:
    """Look for ``OSS_PARAMS_FILENAME`` in the environment and load the parameters from that file."""
    with Path(os.environ["OSS_PARAMS_FILENAME"]).open(encoding="utf-8") as file:
        return OSSParams(**json.loads(file.read()))