Skip to content

Commit

Permalink
Add net and extras API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
vista- committed Jan 18, 2024
1 parent ed74e28 commit 4e328f9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/pypeeringmanager/core/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import requests
import requests, sys

from pynetbox.core.api import Api as PyNetboxApi
from pypeeringmanager.core.app import App
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion src/pypeeringmanager/core/app.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -11,4 +11,6 @@ class App(PyNetboxApp):

models = {
"peering": peering,
"net": net,
"extras": extras,
}
9 changes: 9 additions & 0 deletions src/pypeeringmanager/models/extras.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions src/pypeeringmanager/models/net.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4e328f9

Please sign in to comment.