def delete_dhcprelayipv6(user, dhcprelayipv6_id): dhcprelayipv6_obj = DHCPRelayIPv6.get_by_pk(id=dhcprelayipv6_id) with distributedlock(LOCK_NETWORK_IPV6 % dhcprelayipv6_obj.networkipv6.id): if not dhcprelayipv6_obj.networkipv6.active: dhcprelayipv6_obj.delete() return True else: raise exceptions.CannotRemoveDHCPRelayFromActiveNetwork()
def get(self, *args, **kwargs): """ Lists DHCPrelay IPv6 entry. """ dhcprelay_id = kwargs['dhcprelay_id'] dhcprelayipv6_obj = DHCPRelayIPv6.get_by_pk(id=dhcprelay_id) serializer_options = DHCPRelayIPv6Serializer(dhcprelayipv6_obj, many=False) return Response(serializer_options.data)
def get(self, *args, **kwargs): '''Lists DHCPrelay IPv6 entry ''' dhcprelay_id = kwargs['dhcprelay_id'] dhcprelayIPv6_obj = DHCPRelayIPv6.get_by_pk(id=dhcprelay_id) serializer_options = DHCPRelayIPv6Serializer( dhcprelayIPv6_obj, many=False ) return Response(serializer_options.data)