mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Merge branch 'patch_api_room' into 'dev'
Patch api room See merge request re2o/re2o!556
This commit is contained in:
commit
01e01de4c2
3 changed files with 17 additions and 31 deletions
|
@ -115,8 +115,14 @@ class BuildingSerializer(NamespacedHMSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = topologie.Building
|
model = topologie.Building
|
||||||
fields = ("name", "api_url")
|
fields = ("name", "dormitory", "api_url")
|
||||||
|
|
||||||
|
class DormitorySerializer(NamespacedHMSerializer):
|
||||||
|
"""Serialize `topologie.models.Dormitory` objects
|
||||||
|
"""
|
||||||
|
class Meta:
|
||||||
|
model = topologie.Dormitory
|
||||||
|
fields = ("name", "api_url")
|
||||||
|
|
||||||
class SwitchPortSerializer(NamespacedHMSerializer):
|
class SwitchPortSerializer(NamespacedHMSerializer):
|
||||||
"""Serialize `topologie.models.Port` objects
|
"""Serialize `topologie.models.Port` objects
|
||||||
|
@ -176,7 +182,7 @@ class RoomSerializer(NamespacedHMSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = topologie.Room
|
model = topologie.Room
|
||||||
fields = ("name", "details", "api_url")
|
fields = ("name", "building", "details", "api_url")
|
||||||
|
|
||||||
|
|
||||||
class PortProfileSerializer(NamespacedHMSerializer):
|
class PortProfileSerializer(NamespacedHMSerializer):
|
||||||
|
@ -293,31 +299,3 @@ class PortsSerializer(NamespacedHMSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = topologie.Port
|
model = topologie.Port
|
||||||
fields = ("state", "port", "pretty_name", "get_port_profile")
|
fields = ("state", "port", "pretty_name", "get_port_profile")
|
||||||
|
|
||||||
|
|
||||||
class SwitchPortSerializer(serializers.ModelSerializer):
|
|
||||||
"""Serialize the data about the switches"""
|
|
||||||
|
|
||||||
ports = PortsSerializer(many=True, read_only=True)
|
|
||||||
model = ModelSwitchSerializer(read_only=True)
|
|
||||||
switchbay = SwitchBaySerializer(read_only=True)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = topologie.Switch
|
|
||||||
fields = (
|
|
||||||
"short_name",
|
|
||||||
"model",
|
|
||||||
"switchbay",
|
|
||||||
"ports",
|
|
||||||
"ipv4",
|
|
||||||
"ipv6",
|
|
||||||
"interfaces_subnet",
|
|
||||||
"interfaces6_subnet",
|
|
||||||
"automatic_provision",
|
|
||||||
"rest_enabled",
|
|
||||||
"web_management_enabled",
|
|
||||||
"get_radius_key_value",
|
|
||||||
"get_management_cred_value",
|
|
||||||
"get_radius_servers",
|
|
||||||
"list_modules",
|
|
||||||
)
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ urls_viewset = [
|
||||||
(r"topologie/constructorswitch", views.ConstructorSwitchViewSet, None),
|
(r"topologie/constructorswitch", views.ConstructorSwitchViewSet, None),
|
||||||
(r"topologie/switchbay", views.SwitchBayViewSet, None),
|
(r"topologie/switchbay", views.SwitchBayViewSet, None),
|
||||||
(r"topologie/building", views.BuildingViewSet, None),
|
(r"topologie/building", views.BuildingViewSet, None),
|
||||||
|
(r"topologie/dormitory", views.DormitoryViewSet, None),
|
||||||
(r"topologie/switchport", views.SwitchPortViewSet, "switchport"),
|
(r"topologie/switchport", views.SwitchPortViewSet, "switchport"),
|
||||||
(r"topologie/portprofile", views.PortProfileViewSet, "portprofile"),
|
(r"topologie/portprofile", views.PortProfileViewSet, "portprofile"),
|
||||||
(r"topologie/room", views.RoomViewSet, None)
|
(r"topologie/room", views.RoomViewSet, None)
|
||||||
|
|
|
@ -114,6 +114,13 @@ class RoomViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
queryset = topologie.Room.objects.all()
|
queryset = topologie.Room.objects.all()
|
||||||
serializer_class = serializers.RoomSerializer
|
serializer_class = serializers.RoomSerializer
|
||||||
|
|
||||||
|
class DormitoryViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
|
"""Exposes list and details of `topologie.models.Dormitory`
|
||||||
|
objects.
|
||||||
|
"""
|
||||||
|
|
||||||
|
queryset = topologie.Dormitory.objects.all()
|
||||||
|
serializer_class = serializers.DormitorySerializer
|
||||||
|
|
||||||
class PortProfileViewSet(viewsets.ReadOnlyModelViewSet):
|
class PortProfileViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
"""Exposes list and details of `topologie.models.PortProfile` objects.
|
"""Exposes list and details of `topologie.models.PortProfile` objects.
|
||||||
|
@ -146,4 +153,4 @@ class RoleView(generics.ListAPIView):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
queryset = machines.Role.objects.all().prefetch_related("servers")
|
queryset = machines.Role.objects.all().prefetch_related("servers")
|
||||||
serializer_class = serializers.RoleSerializer
|
serializer_class = serializers.RoleSerializer
|
||||||
|
|
Loading…
Reference in a new issue