-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from DanSheps/develop
EIGRP Support
- Loading branch information
Showing
36 changed files
with
2,360 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from rest_framework import serializers | ||
|
||
from dcim.api.serializers_.device_components import InterfaceSerializer | ||
from dcim.api.serializers_.devices import DeviceSerializer | ||
from ipam.api.serializers_.ip import PrefixSerializer | ||
from netbox.api.serializers import NetBoxModelSerializer | ||
from netbox_routing.models import ( | ||
EIGRPRouter, EIGRPAddressFamily, EIGRPNetwork, EIGRPInterface | ||
) | ||
|
||
|
||
__all__ = ( | ||
'EIGRPRouterSerializer', | ||
'EIGRPAddressFamilySerializer', | ||
'EIGRPNetworkSerializer', | ||
'EIGRPInterfaceSerializer', | ||
) | ||
|
||
|
||
class EIGRPRouterSerializer(NetBoxModelSerializer): | ||
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_routing-api:eigrprouter-detail') | ||
device = DeviceSerializer(nested=True) | ||
|
||
class Meta: | ||
model = EIGRPRouter | ||
fields = ('url', 'id', 'display', 'name', 'pid', 'rid', 'device', 'description', 'comments', ) | ||
brief_fields = ('url', 'id', 'display', 'name', 'pid', 'rid', 'device', ) | ||
|
||
|
||
class EIGRPAddressFamilySerializer(NetBoxModelSerializer): | ||
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_routing-api:eigrpaddressfamily-detail') | ||
router = EIGRPRouterSerializer(nested=True) | ||
|
||
|
||
class Meta: | ||
model = EIGRPAddressFamily | ||
fields = ( | ||
'url', 'id', 'display', 'router', 'family', 'description', 'comments', | ||
) | ||
brief_fields = ('url', 'id', 'display', 'router', 'family',) | ||
|
||
|
||
class EIGRPNetworkSerializer(NetBoxModelSerializer): | ||
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_routing-api:eigrpnetwork-detail') | ||
router = EIGRPRouterSerializer(nested=True) | ||
address_family = EIGRPAddressFamilySerializer(nested=True) | ||
network = PrefixSerializer(nested=True) | ||
|
||
class Meta: | ||
model = EIGRPNetwork | ||
fields = ( | ||
'url', 'id', 'display', 'router', 'address_family', 'network', 'description', 'comments', | ||
) | ||
brief_fields = ('url', 'id', 'display', 'router', 'address_family', 'network',) | ||
|
||
|
||
class EIGRPInterfaceSerializer(NetBoxModelSerializer): | ||
url = serializers.HyperlinkedIdentityField(view_name='plugins-api:netbox_routing-api:eigrpinterface-detail') | ||
router = EIGRPRouterSerializer(nested=True) | ||
address_family = EIGRPAddressFamilySerializer(nested=True) | ||
interface = InterfaceSerializer(nested=True) | ||
|
||
class Meta: | ||
model = EIGRPInterface | ||
fields = ( | ||
'url', 'id', 'display', 'router', 'address_family', 'interface', 'passive', 'bfd', | ||
'authentication', 'passphrase', 'description', 'comments', | ||
) | ||
brief_fields = ( | ||
'url', 'id', 'display', 'router', 'address_family', 'interface', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from netbox.api.viewsets import NetBoxModelViewSet | ||
from netbox_routing import filtersets | ||
from netbox_routing.api.serializers import ( | ||
EIGRPRouterSerializer, EIGRPRouterSerializer, EIGRPAddressFamilySerializer, | ||
EIGRPInterfaceSerializer, EIGRPNetworkSerializer | ||
) | ||
from netbox_routing.models import ( | ||
EIGRPRouter, EIGRPAddressFamily, EIGRPNetwork, EIGRPInterface | ||
) | ||
|
||
|
||
__all__ = ( | ||
'EIGRPRouterViewSet', | ||
'EIGRPAddressFamilyViewSet', | ||
'EIGRPNetworkViewSet', | ||
'EIGRPInterfaceViewSet', | ||
) | ||
|
||
|
||
class EIGRPRouterViewSet(NetBoxModelViewSet): | ||
queryset = EIGRPRouter.objects.all() | ||
serializer_class = EIGRPRouterSerializer | ||
filterset_class = filtersets.EIGRPRouterFilterSet | ||
|
||
|
||
class EIGRPAddressFamilyViewSet(NetBoxModelViewSet): | ||
queryset = EIGRPAddressFamily.objects.all() | ||
serializer_class = EIGRPAddressFamilySerializer | ||
filterset_class = filtersets.EIGRPAddressFamilyFilterSet | ||
|
||
|
||
class EIGRPNetworkViewSet(NetBoxModelViewSet): | ||
queryset = EIGRPNetwork.objects.all() | ||
serializer_class = EIGRPNetworkSerializer | ||
filterset_class = filtersets.EIGRPNetworkFilterSet | ||
|
||
|
||
class EIGRPInterfaceViewSet(NetBoxModelViewSet): | ||
queryset = EIGRPInterface.objects.all() | ||
serializer_class = EIGRPInterfaceSerializer | ||
filterset_class = filtersets.EIGRPInterfaceFilterSet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from utilities.choices import ChoiceSet | ||
|
||
|
||
class EIGRPRouterChoices(ChoiceSet): | ||
CLASSIC = 'classic' | ||
NAMED = 'named' | ||
|
||
CHOICES = [ | ||
(CLASSIC, 'Classic Router'), | ||
(NAMED, 'Named Router') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.db.models import Q | ||
|
||
EIGRP_ROUTER_MODELS = Q( | ||
app_label='netbox_routing', | ||
model__in=('eigrpnamedrouter', 'eigrpclassicrouter', ) | ||
) | ||
|
||
EIGRP_ASSIGNABLE_MODELS = Q( | ||
app_label='netbox_routing', | ||
model__in=('eigrpnamedrouter', 'eigrpclassicrouter', 'eigrpaddressfamily', ) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.