Skip to content
Snippets Groups Projects

added partner model

Merged Mohammad Torkashvand requested to merge feature/NAT-472-add-partner-model into develop
All threads resolved!
25 files
+ 362
106
Compare changes
  • Side-by-side
  • Inline
Files
25
+ 12
12
@@ -14,7 +14,7 @@ from gso.products.product_blocks.iptrunk import IptrunkType, PhyPortCapacity
from gso.products.product_blocks.router import RouterRole
from gso.products.product_blocks.site import SiteTier
from gso.services import subscriptions
from gso.services.crm import CustomerNotFoundError, get_customer_by_name
from gso.services.partners import PartnerNotFoundError, get_partner_by_name
from gso.utils.helpers import BaseSiteValidatorModel, LAGMember
from gso.utils.shared_enums import PortNumber, Vendor
@@ -41,13 +41,13 @@ class SiteImportModel(BaseSiteValidatorModel):
site_internal_id: int
site_tier: SiteTier
site_ts_address: str
customer: str
partner: str
class RouterImportModel(BaseModel):
"""Required fields for importing an existing :class:`gso.product.product_types.router`."""
customer: str
partner: str
router_site: str
hostname: str
ts_port: int
@@ -61,7 +61,7 @@ class RouterImportModel(BaseModel):
class IptrunkImportModel(BaseModel):
"""Required fields for importing an existing :class:`gso.products.product_types.iptrunk`."""
customer: str
partner: str
geant_s_sid: str
iptrunk_type: IptrunkType
iptrunk_description: str
@@ -87,13 +87,13 @@ class IptrunkImportModel(BaseModel):
for router in subscriptions.get_active_router_subscriptions(includes=["subscription_id"])
}
@validator("customer")
def check_if_customer_exists(cls, value: str) -> str:
"""Validate that the customer exists."""
@validator("partner")
def check_if_partner_exists(cls, value: str) -> str:
"""Validate that the partner exists."""
try:
get_customer_by_name(value)
except CustomerNotFoundError as e:
msg = f"Customer {value} not found"
get_partner_by_name(value)
except PartnerNotFoundError as e:
msg = f"partner {value} not found"
raise ValueError(msg) from e
return value
@@ -140,7 +140,7 @@ class IptrunkImportModel(BaseModel):
class SuperPopSwitchImportModel(BaseModel):
"""Required fields for importing an existing :class:`gso.product.product_types.super_pop_switch`."""
customer: str
partner: str
super_pop_switch_site: str
hostname: str
super_pop_switch_ts_port: PortNumber
@@ -150,7 +150,7 @@ class SuperPopSwitchImportModel(BaseModel):
class OfficeRouterImportModel(BaseModel):
"""Required fields for importing an existing :class:`gso.product.product_types.office_router`."""
customer: str
partner: str
office_router_site: str
office_router_fqdn: str
office_router_ts_port: PortNumber
Loading