mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-10-31 23:22:49 +00:00
Répare l'API pour les Ports en ajoutant la sérialisation des PortProfile.
This commit is contained in:
parent
b140e26f0a
commit
470b02be94
3 changed files with 23 additions and 4 deletions
|
@ -470,10 +470,10 @@ class SwitchPortSerializer(NamespacedHMSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = topologie.Port
|
model = topologie.Port
|
||||||
fields = ('switch', 'port', 'room', 'machine_interface', 'related',
|
fields = ('switch', 'port', 'room', 'machine_interface', 'related',
|
||||||
'radius', 'vlan_force', 'details', 'api_url')
|
'custom_profile', 'state', 'details', 'api_url')
|
||||||
extra_kwargs = {
|
extra_kwargs = {
|
||||||
'related': {'view_name': 'switchport-detail'},
|
'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')
|
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
|
# USERS
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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/constructorswitch', views.ConstructorSwitchViewSet)
|
||||||
router.register_viewset(r'topologie/switchbay', views.SwitchBayViewSet)
|
router.register_viewset(r'topologie/switchbay', views.SwitchBayViewSet)
|
||||||
router.register_viewset(r'topologie/building', views.BuildingViewSet)
|
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_viewset(r'topologie/room', views.RoomViewSet)
|
||||||
|
router.register(r'topologie/portprofile', views.PortProfileViewSet)
|
||||||
# USERS
|
# USERS
|
||||||
router.register_viewset(r'users/user', views.UserViewSet)
|
router.register_viewset(r'users/user', views.UserViewSet)
|
||||||
router.register_viewset(r'users/club', views.ClubViewSet)
|
router.register_viewset(r'users/club', views.ClubViewSet)
|
||||||
|
|
|
@ -403,6 +403,12 @@ class RoomViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
serializer_class = serializers.RoomSerializer
|
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
|
# USER
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue