Interfaces
Custom types for interfaces, both physical and logical.
LAGMember
Bases: BaseModel
A LAG member interface that consists of a name and description.
Source code in gso/utils/types/interfaces.py
__hash__()
interface_description_is_not_empty(input_data)
Clean up input for Interface description.
If an input form thinks the input is an empty string, it should be None instead.
Otherwise, we store empty strings in the database when creating interface objects.
Source code in gso/utils/types/interfaces.py
JuniperLAGMember
PhysicalPortCapacity
Bases: strEnum
Physical port capacity enumerator.
An enumerator that has the different possible capacities of ports that are available to use in subscriptions.
Source code in gso/utils/types/interfaces.py
ONE_GIGABIT_PER_SECOND = '1G'
class-attribute
instance-attribute
1Gbps.
TEN_GIGABIT_PER_SECOND = '10G'
class-attribute
instance-attribute
10Gbps.
HUNDRED_GIGABIT_PER_SECOND = '100G'
class-attribute
instance-attribute
100Gbps.
FOUR_HUNDRED_GIGABIT_PER_SECOND = '400G'
class-attribute
instance-attribute
400Gbps.
validate_interface_names_are_unique(interfaces)
Verify if interfaces are unique.
Raises a ValueError if the interfaces are not unique.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interfaces
|
list[LAGMember]
|
The list of interfaces. |
required |
Returns:
| Type | Description |
|---|---|
list[LAGMember]
|
The list of interfaces |
Source code in gso/utils/types/interfaces.py
validate_juniper_phy_interface_name(interface_name)
Validate that the provided interface name matches the expected pattern.
The expected pattern for the interface name is one of 'ge', 'et', 'xe' followed by a dash '-', then a number between 0 and 19, a forward slash '/', another number between 0 and 99, another forward slash '/', and ends with a number between 0 and 99. For example: 'xe-1/0/0'. This only applies to Juniper-brand hardware.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
interface_name
|
str
|
Interface name to validate. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The interface name if match was successful, otherwise it will throw a ValueError exception. |
Source code in gso/utils/types/interfaces.py
validate_juniper_ae_interface_name(interface_name)
Validate that the provided interface name matches the expected pattern for a LAG interface.
Interface names must match the pattern 'ae' followed by a one- or two-digit number.
Source code in gso/utils/types/interfaces.py
bandwidth_string_is_valid(bandwidth_string)
Expect a bandwidth definition to follow the pattern of an int followed by a single letter.
If this string does not consist of a number followed by a single