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
6d5a9dc3
Commit
6d5a9dc3
authored
Jun 20, 2018
by
Maël Kervella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing topologie/server endpoint
parent
1951ab46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
api/serializers.py
api/serializers.py
+8
-0
api/tests.py
api/tests.py
+3
-0
api/urls.py
api/urls.py
+1
-0
api/views.py
api/views.py
+7
-0
No files found.
api/serializers.py
View file @
6d5a9dc3
...
...
@@ -400,6 +400,14 @@ class SwitchSerializer(NamespacedHMSerializer):
'stack_member_id'
,
'model'
,
'switchbay'
,
'api_url'
)
class
ServerSerializer
(
NamespacedHMSerializer
):
"""Serialize `topologie.models.Server` objects
"""
class
Meta
:
model
=
topologie
.
Server
fields
=
(
'user'
,
'name'
,
'active'
,
'api_url'
)
class
ModelSwitchSerializer
(
NamespacedHMSerializer
):
"""Serialize `topologie.models.ModelSwitch` objects
"""
...
...
api/tests.py
View file @
6d5a9dc3
...
...
@@ -120,6 +120,8 @@ class APIEndpointsTestCase(APITestCase):
# '/api/topologie/modelswitch/<pk>/',
'/api/topologie/room/'
,
# '/api/topologie/room/<pk>/',
'/api/topologie/server/'
,
# '/api/topologie/server/<pk>/',
'/api/topologie/stack/'
,
# '/api/topologie/stack/<pk>/',
'/api/topologie/switch/'
,
...
...
@@ -362,6 +364,7 @@ class APIPaginationTestCase(APITestCase):
'/api/topologie/constructorswitch/'
,
'/api/topologie/modelswitch/'
,
'/api/topologie/room/'
,
'/api/topologie/server/'
,
'/api/topologie/stack/'
,
'/api/topologie/switch/'
,
'/api/topologie/switchbay/'
,
...
...
api/urls.py
View file @
6d5a9dc3
...
...
@@ -73,6 +73,7 @@ router.register_view(r'preferences/mailmessageoption', views.MailMessageOptionVi
router
.
register_viewset
(
r
'topologie/stack'
,
views
.
StackViewSet
)
router
.
register_viewset
(
r
'topologie/acesspoint'
,
views
.
AccessPointViewSet
)
router
.
register_viewset
(
r
'topologie/switch'
,
views
.
SwitchViewSet
)
router
.
register_viewset
(
r
'topologie/server'
,
views
.
ServerViewSet
)
router
.
register_viewset
(
r
'topologie/modelswitch'
,
views
.
ModelSwitchViewSet
)
router
.
register_viewset
(
r
'topologie/constructorswitch'
,
views
.
ConstructorSwitchViewSet
)
router
.
register_viewset
(
r
'topologie/switchbay'
,
views
.
SwitchBayViewSet
)
...
...
api/views.py
View file @
6d5a9dc3
...
...
@@ -339,6 +339,13 @@ class SwitchViewSet(viewsets.ReadOnlyModelViewSet):
serializer_class
=
serializers
.
SwitchSerializer
class
ServerViewSet
(
viewsets
.
ReadOnlyModelViewSet
):
"""Exposes list and details of `topologie.models.Server` objects.
"""
queryset
=
topologie
.
Server
.
objects
.
all
()
serializer_class
=
serializers
.
ServerSerializer
class
ModelSwitchViewSet
(
viewsets
.
ReadOnlyModelViewSet
):
"""Exposes list and details of `topologie.models.ModelSwitch` 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