Skip to content
Snippets Groups Projects

add tasks for partner creation, modification and deletion

Merged Mohammad Torkashvand requested to merge feature/NAT-677-creat-update-task-for-partner into develop
All threads resolved!
Files
17
+ 1
26
"""Database model definitions and table mappings for the GSO system."""
import enum
import structlog
from orchestrator.db import UtcTimestamp
from orchestrator.db.database import BaseModel
from sqlalchemy import (
Enum,
String,
text,
)
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.orm import mapped_column
logger = structlog.get_logger(__name__)
class PartnerType(str, enum.Enum):
"""Defining different types of partners in the GSO system."""
NREN = "NREN"
RE_PEER = "RE_PEER"
PUBLIC_PEER = "PUBLIC_PEER"
PRIVATE_PEER = "PRIVATE_PEER"
UPSTREAM = "UPSTREAM"
GEANT = "GEANT"
class PartnerTable(BaseModel):
"""Database table for the partners in the GSO system."""
__tablename__ = "partners"
partner_id = mapped_column(String, server_default=text("uuid_generate_v4"), primary_key=True)
name = mapped_column(String, unique=True, nullable=True)
name = mapped_column(String, unique=True, nullable=False)
email = mapped_column(String, unique=True, nullable=False)
partner_type = mapped_column(Enum(PartnerType), nullable=False)
as_number = mapped_column(
String, unique=True, nullable=True
) # the as_number and as_set are mutually exclusive. if you give me one I don't need the other
as_set = mapped_column(String, nullable=True)
route_set = mapped_column(String, nullable=True)
black_listed_as_sets = mapped_column(ARRAY(String), nullable=True)
additional_routers = mapped_column(ARRAY(String), nullable=True)
additional_bgp_speakers = mapped_column(ARRAY(String), nullable=True)
created_at = mapped_column(UtcTimestamp, server_default=text("current_timestamp"), nullable=False)
updated_at = mapped_column(
Loading