Beispiel #1
0
    def post(self, request, *args, **kwargs):
        """ Inserts new SDN flows on the remote Controller """
        environment_id = kwargs.get('environment_id')
        flow_id = kwargs.get('flow_id')

        user = request.user

        task = facade.insert_flow(environment_id, request.DATA, user.id)

        response = {'id': flow_id or environment_id, 'task_id': task.id}

        return Response(response, status=status.HTTP_201_CREATED)
Beispiel #2
0
    def put(self, request, *args, **kwargs):
        """ Updates an Environment by flushing it and then inserting flows """
        environment_id = kwargs.get('environment_id')
        flow_id = kwargs.get('flow_id')

        user = request.user

        if flow_id:
            task = facade.insert_flow(environment_id, request.DATA, user.id)
        else:
            task = facade.update_flows(environment_id, request.DATA, user.id)

        response = {'id': flow_id or environment_id, 'task_id': task.id}

        return Response(response, status=status.HTTP_200_OK)
Beispiel #3
0
    def post(self, request, *args, **kwargs):
        """ Inserts new SDN flows on the remote Controller """
        environment_id = kwargs.get('environment_id')
        flow_id = kwargs.get('flow_id')

        user = request.user

        task = facade.insert_flow(environment_id, request.DATA, user.id)

        response = {
            'id': flow_id or environment_id,
            'task_id': task.id
        }

        return Response(response, status=status.HTTP_201_CREATED)
Beispiel #4
0
    def put(self, request, *args, **kwargs):
        """ Updates an Environment by flushing it and then inserting flows """
        environment_id = kwargs.get('environment_id')
        flow_id = kwargs.get('flow_id')

        user = request.user

        if flow_id:
            task = facade.insert_flow(environment_id, request.DATA, user.id)
        else:
            task = facade.update_flows(environment_id, request.DATA, user.id)

        response = {
            'id': flow_id or environment_id,
            'task_id': task.id
        }

        return Response(response, status=status.HTTP_200_OK)