Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
470b02be
Commit
470b02be
authored
Aug 04, 2018
by
Hugo LEVY-FALK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Répare l'API pour les Ports en ajoutant la sérialisation des PortProfile.
parent
b140e26f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
api/serializers.py
api/serializers.py
+14
-2
api/urls.py
api/urls.py
+2
-1
api/views.py
api/views.py
+7
-1
No files found.
api/serializers.py
View file @
470b02be
...
...
@@ -470,10 +470,10 @@ class SwitchPortSerializer(NamespacedHMSerializer):
class
Meta
:
model
=
topologie
.
Port
fields
=
(
'switch'
,
'port'
,
'room'
,
'machine_interface'
,
'related'
,
'
radius'
,
'vlan_forc
e'
,
'details'
,
'api_url'
)
'
custom_profile'
,
'stat
e'
,
'details'
,
'api_url'
)
extra_kwargs
=
{
'related'
:
{
'view_name'
:
'switchport-detail'
},
'api_url'
:
{
'view_name'
:
'switchport-detail'
}
'api_url'
:
{
'view_name'
:
'switchport-detail'
}
,
}
...
...
@@ -485,6 +485,18 @@ class RoomSerializer(NamespacedHMSerializer):
fields
=
(
'name'
,
'details'
,
'api_url'
)
class
PortProfileSerializer
(
NamespacedHMSerializer
):
vlan_untagged
=
VlanSerializer
(
read_only
=
True
)
class
Meta
:
model
=
topologie
.
PortProfile
fields
=
(
'name'
,
'profil_default'
,
'vlan_untagged'
,
'vlan_tagged'
,
'radius_type'
,
'radius_mode'
,
'speed'
,
'mac_limit'
,
'flow_control'
,
'dhcp_snooping'
,
'dhcpv6_snooping'
,
'arp_protect'
,
'ra_guard'
,
'loop_protect'
,
'vlan_untagged'
,
'vlan_tagged'
)
# USERS
...
...
api/urls.py
View file @
470b02be
...
...
@@ -81,8 +81,9 @@ router.register_viewset(r'topologie/modelswitch', views.ModelSwitchViewSet)
router
.
register_viewset
(
r
'topologie/constructorswitch'
,
views
.
ConstructorSwitchViewSet
)
router
.
register_viewset
(
r
'topologie/switchbay'
,
views
.
SwitchBayViewSet
)
router
.
register_viewset
(
r
'topologie/building'
,
views
.
BuildingViewSet
)
router
.
register
_viewset
(
r
'topologie/switchport'
,
views
.
SwitchPortViewSet
,
base_name
=
'switchport'
)
router
.
register
(
r
'topologie/switchport'
,
views
.
SwitchPortViewSet
,
base_name
=
'switchport'
)
router
.
register_viewset
(
r
'topologie/room'
,
views
.
RoomViewSet
)
router
.
register
(
r
'topologie/portprofile'
,
views
.
PortProfileViewSet
)
# USERS
router
.
register_viewset
(
r
'users/user'
,
views
.
UserViewSet
)
router
.
register_viewset
(
r
'users/club'
,
views
.
ClubViewSet
)
...
...
api/views.py
View file @
470b02be
...
...
@@ -403,6 +403,12 @@ class RoomViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class
=
serializers
.
RoomSerializer
class
PortProfileViewSet
(
viewsets
.
ReadOnlyModelViewSet
):
"""Exposes list and details of `topologie.models.PortProfile` objects.
"""
queryset
=
topologie
.
PortProfile
.
objects
.
all
()
serializer_class
=
serializers
.
PortProfileSerializer
# USER
...
...
@@ -542,7 +548,7 @@ class SubnetPortsOpenView(generics.ListAPIView):
class
DNSZonesView
(
generics
.
ListAPIView
):
"""Exposes the detailed information about each extension (hostnames,
"""Exposes the detailed information about each extension (hostnames,
IPs, DNS records, etc.) in order to build the DNS zone files.
"""
queryset
=
(
machines
.
Extension
.
objects
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment