Exemplo n.º 1
0
    def DeactivateFlows(self, request, context):
        """
        Deactivate flows for a subscriber
        """
        if not self._service_manager.is_app_enabled(
                EnforcementController.APP_NAME):
            context.set_code(grpc.StatusCode.UNAVAILABLE)
            context.set_details('Service not enabled!')
            return None

        self._loop.call_soon_threadsafe(self._deactivate_flows, request)
        return DeactivateFlowsResult()
Exemplo n.º 2
0
 def DeactivateFlows(self, request, context):
     """
     Deactivate flows for a subscriber
     """
     if not self._service_manager.is_app_enabled(
             EnforcementController.APP_NAME):
         context.set_code(grpc.StatusCode.UNAVAILABLE)
         context.set_details('Service not enabled!')
         return None
     for rule_id in request.rule_ids:
         self._service_manager.session_rule_version_mapper.update_version(
             request.sid.id, rule_id)
     self._loop.call_soon_threadsafe(self._enforcer_app.deactivate_rules,
                                     request.sid.id, request.rule_ids)
     return DeactivateFlowsResult()
Exemplo n.º 3
0
    def DeactivateFlows(self, request, context):
        """
        Deactivate flows for a subscriber
        """
        self._log_grpc_payload(request)
        if not self._service_manager.is_app_enabled(
                EnforcementController.APP_NAME):
            context.set_code(grpc.StatusCode.UNAVAILABLE)
            context.set_details('Service not enabled!')
            return None

        for controller in [self._gy_app, self._enforcer_app,
                           self._enforcement_stats]:
            if not controller.is_controller_ready():
                context.set_code(grpc.StatusCode.UNAVAILABLE)
                context.set_details('Enforcement service not initialized!')
                return ActivateFlowsResult()

        self._loop.call_soon_threadsafe(self._deactivate_flows, request)
        return DeactivateFlowsResult()