Subscriptions
A collection of methods that make interaction with coreDB more straight-forward.
This prevents someone from having to re-write database statements many times, that might turn out to be erroneous or inconsistent when not careful. These methods relate to operations on subscriptions.
get_subscriptions(product_types=None, lifecycles=None, includes=None, excludes=None, partner_id=None)
Retrieve active subscriptions for a specific product type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
product_types
|
list[ProductType] | None
|
The types of the product for which to retrieve subscriptions. |
None
|
lifecycles
|
list[SubscriptionLifecycle] | None
|
The lifecycles that the products must be in. |
None
|
includes
|
list[str] | None
|
List of fields to be included in the returned Subscription objects. |
None
|
excludes
|
list[str] | None
|
List of fields to be excluded from the returned Subscription objects. |
None
|
partner_id
|
UUIDstr | None
|
The customer id of subscriptions. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of |
Source code in gso/services/subscriptions.py
get_router_subscriptions(includes=None, lifecycles=None)
Retrieve subscriptions specifically for routers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
The fields to be included in the returned Subscription objects. |
None
|
lifecycles
|
list[SubscriptionLifecycle] | None
|
The subscription lifecycle states that should be included in the results. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of Subscription objects for routers. |
Source code in gso/services/subscriptions.py
get_active_router_subscriptions(includes=None)
Retrieve active subscriptions specifically for routers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
The fields to be included in the returned Subscription objects. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of Subscription objects for routers. |
Source code in gso/services/subscriptions.py
get_provisioning_router_subscriptions(includes=None)
Retrieve provisioning subscriptions specifically for routers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
The fields to be included in the returned Subscription objects. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of router Subscription objects. |
Source code in gso/services/subscriptions.py
get_active_switch_subscriptions(includes=None)
Retrieve active subscriptions specifically for switches.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
The fields to be included in the returned Subscription objects. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of Subscription objects for switches. |
Source code in gso/services/subscriptions.py
get_active_iptrunk_subscriptions(includes=None)
Retrieve active subscriptions specifically for IP trunks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
The fields to be included in the returned Subscription objects. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of Subscription objects for IP trunks. |
Source code in gso/services/subscriptions.py
get_non_terminated_iptrunk_subscriptions(includes=None)
Retrieve all IP trunk subscriptions that are not terminated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
Fields to be included in the returned Subscription objects. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of IP trunk subscriptions. |
Source code in gso/services/subscriptions.py
get_trunks_that_terminate_on_router(subscription_id, lifecycle_state)
Get all IP trunk subscriptions that terminate on the given subscription_id
of a Router.
Given a subscription_id
of a Router subscription, this method gives a list of all IP trunk subscriptions that
terminate on this Router. The given lifecycle state dictates the state of trunk subscriptions that are counted as
terminating on this router.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subscription_id
|
UUIDstr
|
Subscription ID of a Router |
required |
lifecycle_state
|
SubscriptionLifecycle
|
Required lifecycle state of the IP trunk |
required |
Returns:
Type | Description |
---|---|
list[SubscriptionTable]
|
A list of IP trunk subscriptions |
Source code in gso/services/subscriptions.py
get_active_l3_services_linked_to_edge_port(edge_port_id)
Retrieve all active l3 core services that are on top of the given edge port.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edge_port_id
|
UUIDstr
|
The ID of the edge port. |
required |
Returns:
Type | Description |
---|---|
list[SubscriptionModel]
|
A list of active services that are on top of the edge port. |
Source code in gso/services/subscriptions.py
get_active_l2_circuit_services_linked_to_edge_port(edge_port_id)
Retrieve all active l2 circuit services that are on top of the given edge port.
Source code in gso/services/subscriptions.py
get_active_vrfs_linked_to_router(router_id)
Retrieve all active VRFs that are linked to the router.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
router_id
|
UUIDstr
|
The ID of the router. |
required |
Returns:
Type | Description |
---|---|
list[SubscriptionModel]
|
A list of active VRFs that are linked to the router. |
Source code in gso/services/subscriptions.py
get_active_ip_trunks_linked_to_router(router_id)
Retrieve all active IP trunks that are linked to the router.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
router_id
|
UUIDstr
|
The ID of the router. |
required |
Returns:
Type | Description |
---|---|
list[SubscriptionModel]
|
A list of active IP trunks that are linked to the router. |
Source code in gso/services/subscriptions.py
get_product_id_by_name(product_name)
Retrieve the UUID of a product by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
product_name
|
ProductName
|
The name of the product. |
required |
Returns:
Type | Description |
---|---|
UUID
|
The UUID of the product. |
Source code in gso/services/subscriptions.py
get_active_subscriptions_by_field_and_value(field_name, field_value)
Retrieve a list of active subscriptions based on a specified field and its value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field_name
|
str
|
The name of the field to filter by. |
required |
field_value
|
str
|
The value of the field to match. |
required |
Returns:
Type | Description |
---|---|
list[SubscriptionTable]
|
A list of active Subscription objects that match the criteria. |
Source code in gso/services/subscriptions.py
get_subscription_by_process_id(process_id)
Get a subscription from a process ID.
Source code in gso/services/subscriptions.py
get_active_insync_subscriptions()
Retrieve all subscriptions that are currently active and in sync.
Source code in gso/services/subscriptions.py
get_active_site_subscriptions(includes=None)
Retrieve active subscriptions specifically for sites.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
includes
|
list[str] | None
|
The fields to be included in the returned Subscription objects. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionType]
|
A list of Subscription objects for sites. |
Source code in gso/services/subscriptions.py
get_active_edge_port_subscriptions(partner_id=None)
Retrieve active Edge Port subscriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
partner_id
|
UUIDstr | None
|
The customer id of subscriptions. |
None
|
Returns:
Type | Description |
---|---|
list[SubscriptionModel]
|
A list of Subscription objects for Edge Ports. |
Source code in gso/services/subscriptions.py
get_site_by_name(site_name)
Get a site by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
site_name
|
str
|
The name of the site. |
required |
Source code in gso/services/subscriptions.py
get_all_active_sites()
Retrieve all active sites subscription together with instance values.
Returns:
Type | Description |
---|---|
list[dict[str, Any]]
|
A list of active sites with their subscription IDs and site instances. |
Source code in gso/services/subscriptions.py
is_resource_type_value_unique(resource_type, value)
Check if the given value for the specified resource type is unique in the database.
This function verifies if the specified value for the given resource type is not already in the core database.
:param resource_type: The resource type to check. :type resource_type: str :param value: The value to check. :type value: str :return: True if the value is unique (not found), False if it exists. :rtype: bool
Source code in gso/services/subscriptions.py
is_virtual_circuit_id_available(virtual_circuit_id)
Check if the given virtual circuit ID is unique in the database.
This function verifies if the specified virtual circuit ID is not already present in the core database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
virtual_circuit_id
|
str
|
The virtual circuit ID to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the virtual circuit ID is unique (not found), False if it exists. |
Source code in gso/services/subscriptions.py
generate_unique_id(prefix)
Generate a unique ID using a shared sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix
|
str
|
The prefix for the "GA" or "GS" IDs. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A unique ID in the format |
Raises:
Type | Description |
---|---|
ValueError
|
If there is an error generating the ID. |