From 4e328f9407635258d6bdb456672c8c15e6253dc1 Mon Sep 17 00:00:00 2001 From: vista Date: Thu, 18 Jan 2024 11:38:25 +0100 Subject: [PATCH] Add net and extras API endpoints --- src/pypeeringmanager/core/api.py | 4 +++- src/pypeeringmanager/core/app.py | 4 +++- src/pypeeringmanager/models/extras.py | 9 +++++++++ src/pypeeringmanager/models/net.py | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/pypeeringmanager/models/extras.py create mode 100644 src/pypeeringmanager/models/net.py diff --git a/src/pypeeringmanager/core/api.py b/src/pypeeringmanager/core/api.py index cd8f413..79ed95e 100644 --- a/src/pypeeringmanager/core/api.py +++ b/src/pypeeringmanager/core/api.py @@ -1,4 +1,4 @@ -import requests +import requests, sys from pynetbox.core.api import Api as PyNetboxApi from pypeeringmanager.core.app import App @@ -48,6 +48,8 @@ def __init__( self.threading = threading self.peering = App(self, "peering") + self.net = App(self, "net") + self.extras = App(self, "extras") @property def version(self): diff --git a/src/pypeeringmanager/core/app.py b/src/pypeeringmanager/core/app.py index c71e672..5c83728 100644 --- a/src/pypeeringmanager/core/app.py +++ b/src/pypeeringmanager/core/app.py @@ -1,5 +1,5 @@ from pynetbox.core.app import App as PyNetboxApp -from pypeeringmanager.models import peering +from pypeeringmanager.models import peering, net, extras class App(PyNetboxApp): """ Represents apps in Peering-Manager. @@ -11,4 +11,6 @@ class App(PyNetboxApp): models = { "peering": peering, + "net": net, + "extras": extras, } diff --git a/src/pypeeringmanager/models/extras.py b/src/pypeeringmanager/models/extras.py new file mode 100644 index 0000000..ed4c269 --- /dev/null +++ b/src/pypeeringmanager/models/extras.py @@ -0,0 +1,9 @@ +from pynetbox.core.response import Record, JsonField + +class ObjectChanges(Record): + object_data = JsonField + postchange_data = JsonField + prechange_data = JsonField + + def __str__(self): + return self.request_id diff --git a/src/pypeeringmanager/models/net.py b/src/pypeeringmanager/models/net.py new file mode 100644 index 0000000..14ca3c1 --- /dev/null +++ b/src/pypeeringmanager/models/net.py @@ -0,0 +1,6 @@ +from pynetbox.core.response import Record +from pypeeringmanager.models.peering import Routers, InternetExchanges + +class Connections(Record): + internet_exchange_point = InternetExchanges + router = Routers