From aff3b647716f8623950bfcecd3055b7edcf634bf Mon Sep 17 00:00:00 2001 From: sdi Date: Thu, 10 Jul 2025 21:55:47 +0300 Subject: [PATCH 1/9] Add timezone --- yeti_switch_api/orm/__init__.py | 1 + yeti_switch_api/orm/account.py | 3 ++- yeti_switch_api/orm/orm_client.py | 2 ++ yeti_switch_api/orm/timezone.py | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 yeti_switch_api/orm/timezone.py diff --git a/yeti_switch_api/orm/__init__.py b/yeti_switch_api/orm/__init__.py index 816b0e7..5a54125 100644 --- a/yeti_switch_api/orm/__init__.py +++ b/yeti_switch_api/orm/__init__.py @@ -23,3 +23,4 @@ from .country import Country # noqa: F401 from .network import Network # noqa: F401 from .network_type import NetworkType # noqa: F401 +from .timezone import Timezone # noqa: F401 diff --git a/yeti_switch_api/orm/account.py b/yeti_switch_api/orm/account.py index ac2d58c..8bffe64 100644 --- a/yeti_switch_api/orm/account.py +++ b/yeti_switch_api/orm/account.py @@ -7,6 +7,7 @@ class Meta: type = "account" contractor = RelationField("contractor") + timezone = RelationField("timezone") name = AttributeField("name") balance = AttributeField("balance") @@ -14,4 +15,4 @@ class Meta: max_balance = AttributeField("max-balance") def creatable_fields(self): - return ["contractor", "min_balace", "max_balance"] + return ["name", "contractor", "timezone", "min_balance", "max_balance"] diff --git a/yeti_switch_api/orm/orm_client.py b/yeti_switch_api/orm/orm_client.py index 9f3f91b..990bd9d 100644 --- a/yeti_switch_api/orm/orm_client.py +++ b/yeti_switch_api/orm/orm_client.py @@ -26,6 +26,7 @@ from .country import Country from .network import Network from .network_type import NetworkType +from .timezone import Timezone class OrmClient: @@ -63,6 +64,7 @@ def __register_models(cls): cls.__register_model(Country) cls.__register_model(Network) cls.__register_model(NetworkType) + cls.__register_model(Timezone) @classmethod def __register_model(cls, model_class): diff --git a/yeti_switch_api/orm/timezone.py b/yeti_switch_api/orm/timezone.py new file mode 100644 index 0000000..f17e2dd --- /dev/null +++ b/yeti_switch_api/orm/timezone.py @@ -0,0 +1,10 @@ +from .base_model import BaseModel, AttributeField, RelationField + + +class Timezone(BaseModel): + class Meta: + path = "timezones" + type = "timezones" + + name = AttributeField("name") + From 7e821aa392d287bb82aff895346d6e9211a5bd73 Mon Sep 17 00:00:00 2001 From: sdi Date: Thu, 10 Jul 2025 22:03:14 +0300 Subject: [PATCH 2/9] fix account type --- yeti_switch_api/orm/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yeti_switch_api/orm/account.py b/yeti_switch_api/orm/account.py index 8bffe64..957b812 100644 --- a/yeti_switch_api/orm/account.py +++ b/yeti_switch_api/orm/account.py @@ -4,7 +4,7 @@ class Account(BaseModel): class Meta: path = "accounts" - type = "account" + type = "accounts" contractor = RelationField("contractor") timezone = RelationField("timezone") From f746b5d5fc595c6db9a9d25fe6829f80f2f660dd Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 12:06:54 +0300 Subject: [PATCH 3/9] fixes --- yeti_switch_api/orm/account.py | 2 +- yeti_switch_api/orm/customers_auth.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/yeti_switch_api/orm/account.py b/yeti_switch_api/orm/account.py index 957b812..5af40dd 100644 --- a/yeti_switch_api/orm/account.py +++ b/yeti_switch_api/orm/account.py @@ -15,4 +15,4 @@ class Meta: max_balance = AttributeField("max-balance") def creatable_fields(self): - return ["name", "contractor", "timezone", "min_balance", "max_balance"] + return ["name", "contractor", "timezone", "min-balance", "max-balance"] diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index d0c0a32..d6e9238 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -7,4 +7,18 @@ class Meta: type = "customers-auths" name = AttributeField("name") - src_numberlist = RelationField("src_numberlist") + src_numberlist = RelationField("src-numberlist") + dst_numberlist = RelationField("dst-numberlist") + + customer = RelationField("customer") + account = RelationField("account") + rateplan = RelationField("rateplan") + routing_plan = RelationField("routing-plan") + gateway = RelationField("gateway") + pop = RelationField("pop") + + ip = AttributeField("ip") + src_prefix = AttributeField("src-prefix") + dst_prefix = AttributeField("dst-prefix") + x_yeti_auth = AttributeField("x-yeti-auth") + From 66327971d272bec4aa453805e2a586cb0913c01f Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 12:20:14 +0300 Subject: [PATCH 4/9] add RoutingPlan --- yeti_switch_api/orm/__init__.py | 1 + yeti_switch_api/orm/orm_client.py | 2 ++ yeti_switch_api/orm/routing_plan.py | 13 +++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 yeti_switch_api/orm/routing_plan.py diff --git a/yeti_switch_api/orm/__init__.py b/yeti_switch_api/orm/__init__.py index 5a54125..8766eda 100644 --- a/yeti_switch_api/orm/__init__.py +++ b/yeti_switch_api/orm/__init__.py @@ -13,6 +13,7 @@ from .numberlist import Numberlist # noqa: F401 from .numberlist_item import NumberlistItem # noqa: F401 from .rateplan import Rateplan # noqa: F401 +from .routing_plan import RoutingPlan # noqa: F401 from .routing_tag import RoutingTag # noqa: F401 from .gateway import Gateway # noqa: F401 diff --git a/yeti_switch_api/orm/orm_client.py b/yeti_switch_api/orm/orm_client.py index 990bd9d..fddf2f6 100644 --- a/yeti_switch_api/orm/orm_client.py +++ b/yeti_switch_api/orm/orm_client.py @@ -16,6 +16,7 @@ from .numberlist import Numberlist from .numberlist_item import NumberlistItem from .rateplan import Rateplan +from .routing_plan import RoutingPlan from .routing_tag import RoutingTag from .gateway import Gateway @@ -56,6 +57,7 @@ def __register_models(cls): cls.__register_model(Numberlist) cls.__register_model(NumberlistItem) cls.__register_model(Rateplan) + cls.__register_model(RoutingPlan) cls.__register_model(RoutingTag) cls.__register_model(Gateway) cls.__register_model(GatewayGroup) diff --git a/yeti_switch_api/orm/routing_plan.py b/yeti_switch_api/orm/routing_plan.py new file mode 100644 index 0000000..25ec38f --- /dev/null +++ b/yeti_switch_api/orm/routing_plan.py @@ -0,0 +1,13 @@ +from .base_model import BaseModel, AttributeField + + +class RoutingPlan(BaseModel): + class Meta: + path = "routing-plans" + type = "routing-plans" + + name = AttributeField("name") + rate_delta_max = AttributeField("rate-delta-max") + use_lnp = AttributeField("use-lnp") + max_rerouting_attempts = AttributeField("max-rerouting-attempts") + From 96c3ee562313dd546ca54d8c932bcb5bb35a4834 Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 14:54:18 +0300 Subject: [PATCH 5/9] add RoutingPlan --- yeti_switch_api/orm/customers_auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index d6e9238..d94fdee 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -13,7 +13,7 @@ class Meta: customer = RelationField("customer") account = RelationField("account") rateplan = RelationField("rateplan") - routing_plan = RelationField("routing-plan") + routing_plan = RelationField("routing_plan") gateway = RelationField("gateway") pop = RelationField("pop") From dec9965fb0d99a769f246d1a3f26b23b5bfdef4c Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 15:05:01 +0300 Subject: [PATCH 6/9] add RoutingPlan --- .github/workflows/tests.yml | 2 +- yeti_switch_api/orm/customers_auth.py | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa4929c..7c14324 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v2 diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index d94fdee..a16d07a 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -7,13 +7,14 @@ class Meta: type = "customers-auths" name = AttributeField("name") + enabled = AttributeField("enabled") src_numberlist = RelationField("src-numberlist") dst_numberlist = RelationField("dst-numberlist") customer = RelationField("customer") account = RelationField("account") rateplan = RelationField("rateplan") - routing_plan = RelationField("routing_plan") + routing_plan = RelationField("routing-plan") gateway = RelationField("gateway") pop = RelationField("pop") @@ -22,3 +23,22 @@ class Meta: dst_prefix = AttributeField("dst-prefix") x_yeti_auth = AttributeField("x-yeti-auth") + def creatable_fields(self): + return [ + "name", + "enabled", + "src-numberlist" + "dst-numberlist", + "customer", + "account", + "rateplan", + "routing-plan", + "gateway", + "pop", + "ip", + "src-prefix", + "dst-prefix", + "x-yeti-auth" + ] + + From 10ae4863f500b8fdaeea39d8acd6e17ed72bdd7e Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 15:21:50 +0300 Subject: [PATCH 7/9] add RoutingPlan --- yeti_switch_api/orm/customers_auth.py | 4 +--- yeti_switch_api/orm/routing_plan.py | 1 - yeti_switch_api/orm/timezone.py | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index a16d07a..2d8abc4 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -10,7 +10,7 @@ class Meta: enabled = AttributeField("enabled") src_numberlist = RelationField("src-numberlist") dst_numberlist = RelationField("dst-numberlist") - + customer = RelationField("customer") account = RelationField("account") rateplan = RelationField("rateplan") @@ -40,5 +40,3 @@ def creatable_fields(self): "dst-prefix", "x-yeti-auth" ] - - diff --git a/yeti_switch_api/orm/routing_plan.py b/yeti_switch_api/orm/routing_plan.py index 25ec38f..406fc1e 100644 --- a/yeti_switch_api/orm/routing_plan.py +++ b/yeti_switch_api/orm/routing_plan.py @@ -10,4 +10,3 @@ class Meta: rate_delta_max = AttributeField("rate-delta-max") use_lnp = AttributeField("use-lnp") max_rerouting_attempts = AttributeField("max-rerouting-attempts") - diff --git a/yeti_switch_api/orm/timezone.py b/yeti_switch_api/orm/timezone.py index f17e2dd..7d893d6 100644 --- a/yeti_switch_api/orm/timezone.py +++ b/yeti_switch_api/orm/timezone.py @@ -1,4 +1,4 @@ -from .base_model import BaseModel, AttributeField, RelationField +from .base_model import BaseModel, AttributeField class Timezone(BaseModel): @@ -7,4 +7,3 @@ class Meta: type = "timezones" name = AttributeField("name") - From 32a8236b9a57e070699e46bf308975e9eee88573 Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 15:23:33 +0300 Subject: [PATCH 8/9] add RoutingPlan --- yeti_switch_api/orm/customers_auth.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index 2d8abc4..2697c76 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -10,14 +10,12 @@ class Meta: enabled = AttributeField("enabled") src_numberlist = RelationField("src-numberlist") dst_numberlist = RelationField("dst-numberlist") - customer = RelationField("customer") account = RelationField("account") rateplan = RelationField("rateplan") routing_plan = RelationField("routing-plan") gateway = RelationField("gateway") pop = RelationField("pop") - ip = AttributeField("ip") src_prefix = AttributeField("src-prefix") dst_prefix = AttributeField("dst-prefix") From 6ee5ca1954e6e9a972c5993f41a1f66c0fe29682 Mon Sep 17 00:00:00 2001 From: sdi Date: Fri, 11 Jul 2025 15:26:12 +0300 Subject: [PATCH 9/9] add RoutingPlan --- yeti_switch_api/orm/customers_auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yeti_switch_api/orm/customers_auth.py b/yeti_switch_api/orm/customers_auth.py index 2697c76..a8660d8 100644 --- a/yeti_switch_api/orm/customers_auth.py +++ b/yeti_switch_api/orm/customers_auth.py @@ -25,7 +25,7 @@ def creatable_fields(self): return [ "name", "enabled", - "src-numberlist" + "src-numberlist", "dst-numberlist", "customer", "account", @@ -36,5 +36,5 @@ def creatable_fields(self): "ip", "src-prefix", "dst-prefix", - "x-yeti-auth" + "x-yeti-auth", ]