def process_mme_tunnel_request( self, tunnel_msg: UESessionSet, ) -> UESessionContextResponse: """Do process the mme tunnel message and send response Entry point to MME session creation in UPF Args: tunnel_msg: Tunnel Creation/Modification/Deletion message Returns: UESessionContextResponse: Tunnel ops result """ cause_ie = CauseIE.REQUEST_ACCEPTED result = True ue_session_entry = create_ue_session_entry(tunnel_msg) # Call the mme state machine session_state = ue_session_entry.ue_session_state self.logger.debug("UE State = %d\n", session_state) result = self.mme_fsm[session_state](ue_session_entry) if result is False: cause_ie = CauseIE.RULE_CREATION_OR_MODIFICATION_FAILURE return ( UESessionContextResponse( ue_ipv4_address=tunnel_msg.ue_ipv4_address, ue_ipv6_address=tunnel_msg.ue_ipv6_address, operation_type=ue_session_entry.ue_session_state, cause_info=CauseIE(cause_ie=cause_ie), ) )
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
def UpdateUEState(self, request, context): self._log_grpc_payload(request) if not self._service_manager.is_app_enabled(Classifier.APP_NAME): context.set_code(grpc.StatusCode.UNAVAILABLE) context.set_details('Service not enabled!') return None fut = Future() self._loop.call_soon_threadsafe(\ self._setup_pg_tunnel_update, request, fut) try: return fut.result(timeout=self._call_timeout) except concurrent.futures.TimeoutError: logging.error("UpdateUEState processing timed out") return UESessionContextResponse( operation_type=request.ue_session_state.ue_config_state, cause_info=CauseIE( cause_ie=CauseIE.REQUEST_REJECTED_NO_REASON))
def process_mme_tunnel_request( self, request: UESessionSet, ) -> UESessionContextResponse: """Do process the mme tunnel message and send response Entry point to MME session creation in UPF Args: tunnel_msg: Tunnel Creation/Modification/Deletion message Returns: UESessionContextResponse: Tunnel ops result """ cause_ie = CauseIE.REQUEST_ACCEPTED result = True res = True ue_ipv4_address = None ue_ipv6_address = None if request.ue_ipv4_address.address: addr_str = socket.inet_ntop( socket.AF_INET, request.ue_ipv4_address.address, ) ue_ipv4_address = IPAddress( version=IPAddress.IPV4, address=addr_str.encode('utf8'), ) if request.ue_ipv6_address.address: addr_str6 = socket.inet_ntop( socket.AF_INET6, request.ue_ipv6_address.address, ) ue_ipv6_address = IPAddress( version=IPAddress.IPV6, address=addr_str6.encode('utf8'), ) if ( request.ue_session_state.ue_config_state == \ UESessionState.ACTIVE ): result = self._validate_ue_session(request) if result == False: cause_ie = CauseIE.RULE_CREATION_OR_MODIFICATION_FAILURE else: res = self.add_tunnel_flows( request.precedence, request.in_teid, request.out_teid, ipaddress.ip_address(request.enb_ip_address.address), ue_ipv4_address, encode_imsi(request.subscriber_id.id), False, ue_ipv6_address, request.apn, request.vlan, request.ip_flow_dl, ) elif ( request.ue_session_state.ue_config_state == \ UESessionState.UNREGISTERED ): res = self.delete_tunnel_flows( request.in_teid, ue_ipv4_address, ipaddress.ip_address(request.enb_ip_address.address), request.ip_flow_dl, ) elif ( request.ue_session_state.ue_config_state == \ UESessionState.UNINSTALL_IDLE ): res = self.remove_paging_flow(ue_ipv4_address) elif ( request.ue_session_state.ue_config_state == \ UESessionState.INSTALL_IDLE ): res = self.install_paging_flow( request.in_teid, ue_ipv4_address, False, ) elif ( request.ue_session_state.ue_config_state == \ UESessionState.RESUME_DATA ): res = self.resume_tunnel_flows( request.in_teid, ue_ipv4_address, request.ip_flow_dl, ) elif ( request.ue_session_state.ue_config_state == \ UESessionState.SUSPENDED_DATA ): res = self.discard_tunnel_flows( request.in_teid, ue_ipv4_address, request.ip_flow_dl, ) if res == False: cause_ie = CauseIE.RULE_CREATION_OR_MODIFICATION_FAILURE return( UESessionContextResponse( ue_ipv4_address=request.ue_ipv4_address, ue_ipv6_address=request.ue_ipv6_address, operation_type=request.ue_session_state.ue_config_state, cause_info=CauseIE(cause_ie=cause_ie), ) )