Пример #1
0
    def SetSMFSessions(self, request, context):
        """
        Setup the 5G Session flows for the subscriber
        """
        self._log_grpc_payload(request)

        # if 5G Services are not enabled return UNAVAILABLE
        if not self._service_manager.is_ng_app_enabled(
                NGServiceController.APP_NAME,
        ):
            context.set_code(grpc.StatusCode.UNAVAILABLE)
            context.set_details('Service not enabled!')
            return UPFSessionContextState()

        fut = Future()
        self._loop.call_soon_threadsafe(\
                      self.ng_update_session_flows, request, fut,
        )
        try:
            return fut.result(timeout=self._call_timeout)
        except concurrent.futures.TimeoutError:
            logging.error("SetSMFSessions processing timed out")
            context.set_code(grpc.StatusCode.DEADLINE_EXCEEDED)
            context.set_details('SetSMFSessions processing timed out')
            return UPFSessionContextState()
Пример #2
0
    def process_session_message(self, new_session, process_pdr_rules):
        """
        Process the messages recevied from session. Return True
        if parsing is successfull.
        """

        # Assume things are green
        context_response =\
             UPFSessionContextState(cause_info=CauseIE(cause_ie=CauseIE.REQUEST_ACCEPTED),
                                    session_snapshot=UPFSessionState(subscriber_id=new_session.subscriber_id,
                                                                     local_f_teid=new_session.local_f_teid,
                                                                     session_version=new_session.session_version))

        context_response.cause_info.cause_ie = \
                  SessionStateManager.validate_session_msg(new_session)
        if context_response.cause_info.cause_ie != CauseIE.REQUEST_ACCEPTED:
            self.logger.error(
                "Error : Parsing Error in SetInterface Message %d",
                context_response.cause_info.cause_ie)
            return context_response

        #Create PDR rules
        pdr_validator = SessionStateManager._pdr_create_rule_group(
            new_session, process_pdr_rules)
        if pdr_validator:
            context_response.failure_rule_id.pdr.extend(
                [pdr_validator.offending_ie])
            context_response.cause_info.cause_ie = pdr_validator.cause_info

        return context_response