def UpdateLocation(self, request, context): imsi = request.user_name ula = s6a_proxy_pb2.UpdateLocationAnswer() try: profile = self.lte_processor.get_sub_profile(imsi) except SubscriberNotFoundError as e: ula.error_code = s6a_proxy_pb2.USER_UNKNOWN logging.warning('Subscriber not found for ULR: %s', e) return ula ula.error_code = s6a_proxy_pb2.SUCCESS ula.default_context_id = 0 ula.total_ambr.max_bandwidth_ul = profile.max_ul_bit_rate ula.total_ambr.max_bandwidth_dl = profile.max_dl_bit_rate ula.all_apns_included = 0 apn = ula.apn.add() apn.context_id = 0 apn.service_selection = 'oai.ipv4' apn.qos_profile.class_id = 9 apn.qos_profile.priority_level = 15 apn.qos_profile.preemption_capability = 1 apn.qos_profile.preemption_vulnerability = 0 apn.ambr.max_bandwidth_ul = profile.max_ul_bit_rate apn.ambr.max_bandwidth_dl = profile.max_dl_bit_rate apn.pdn = s6a_proxy_pb2.UpdateLocationAnswer.APNConfiguration.IPV4 return ula
def UpdateLocation(self, request, context): imsi = request.user_name ula = s6a_proxy_pb2.UpdateLocationAnswer() # sign and send to brokerd # TODO: # process locally try: profile = self.lte_processor.get_sub_profile(imsi) except SubscriberNotFoundError as e: ula.error_code = s6a_proxy_pb2.USER_UNKNOWN logging.warning('Subscriber not found for ULR: %s', e) return ula try: sub_data = self.lte_processor.get_sub_data(imsi) except SubscriberNotFoundError as e: ula.error_code = s6a_proxy_pb2.USER_UNKNOWN logging.warning("Subscriber not found for ULR: %s", e) return ula ula.error_code = s6a_proxy_pb2.SUCCESS ula.default_context_id = 0 ula.total_ambr.max_bandwidth_ul = profile.max_ul_bit_rate ula.total_ambr.max_bandwidth_dl = profile.max_dl_bit_rate ula.all_apns_included = 0 apn = ula.apn.add() apn.context_id = 0 apn.service_selection = "oai.ipv4" apn.qos_profile.class_id = 9 apn.qos_profile.priority_level = 15 apn.qos_profile.preemption_capability = 1 apn.qos_profile.preemption_vulnerability = 0 apn.ambr.max_bandwidth_ul = profile.max_ul_bit_rate apn.ambr.max_bandwidth_dl = profile.max_dl_bit_rate apn.pdn = s6a_proxy_pb2.UpdateLocationAnswer.APNConfiguration.IPV4 # Secondary PDN context_id = 0 for apn in sub_data.non_3gpp.apn_config: sec_apn = ula.apn.add() # Context id 0 is assigned to oai.ipv4 apn. So start from 1 sec_apn.context_id = context_id + 1 context_id += 1 sec_apn.service_selection = apn.service_selection sec_apn.qos_profile.class_id = apn.qos_profile.class_id sec_apn.qos_profile.priority_level = apn.qos_profile.priority_level sec_apn.qos_profile.preemption_capability = ( apn.qos_profile.preemption_capability) sec_apn.qos_profile.preemption_vulnerability = ( apn.qos_profile.preemption_vulnerability) sec_apn.ambr.max_bandwidth_ul = apn.ambr.max_bandwidth_ul sec_apn.ambr.max_bandwidth_dl = apn.ambr.max_bandwidth_dl sec_apn.pdn = ( s6a_proxy_pb2.UpdateLocationAnswer.APNConfiguration.IPV4) return ula
def UpdateLocation(self, request, context): self._print_grpc(request) imsi = request.user_name ula = s6a_proxy_pb2.UpdateLocationAnswer() try: profile = self.lte_processor.get_sub_profile(imsi) except SubscriberNotFoundError as e: ula.error_code = s6a_proxy_pb2.USER_UNKNOWN logging.warning('Subscriber not found for ULR: %s', e) self._print_grpc(ula) return ula try: sub_data = self.lte_processor.get_sub_data(imsi) except SubscriberNotFoundError as e: ula.error_code = s6a_proxy_pb2.USER_UNKNOWN logging.warning("Subscriber not found for ULR: %s", e) return ula ula.error_code = s6a_proxy_pb2.SUCCESS ula.default_context_id = 0 ula.total_ambr.max_bandwidth_ul = profile.max_ul_bit_rate ula.total_ambr.max_bandwidth_dl = profile.max_dl_bit_rate ula.all_apns_included = 0 ula.msisdn = self.encode_msisdn(sub_data.non_3gpp.msisdn) context_id = 0 for apn in sub_data.non_3gpp.apn_config: sec_apn = ula.apn.add() sec_apn.context_id = context_id context_id += 1 sec_apn.service_selection = apn.service_selection sec_apn.qos_profile.class_id = apn.qos_profile.class_id sec_apn.qos_profile.priority_level = apn.qos_profile.priority_level sec_apn.qos_profile.preemption_capability = ( apn.qos_profile.preemption_capability) sec_apn.qos_profile.preemption_vulnerability = ( apn.qos_profile.preemption_vulnerability) sec_apn.ambr.max_bandwidth_ul = apn.ambr.max_bandwidth_ul sec_apn.ambr.max_bandwidth_dl = apn.ambr.max_bandwidth_dl sec_apn.ambr.unit = ( s6a_proxy_pb2.UpdateLocationAnswer \ .AggregatedMaximumBitrate.BitrateUnitsAMBR.BPS ) sec_apn.pdn = ( apn.pdn if apn.pdn else s6a_proxy_pb2.UpdateLocationAnswer.APNConfiguration.IPV4) self._print_grpc(ula) return ula