Esempio n. 1
0
 def GetSubscriberData(self, request, context):
     """
     Return the subscription data for the subscriber
     """
     print_grpc(
         request, self._print_grpc_payload,
         "Get Subscriber Data Request:",
     )
     sid = SIDUtils.to_str(request)
     try:
         response = self._store.get_subscriber_data(sid)
         # get_sub_profile converts the imsi id to a string prependend with IMSI string,
         # so strip the IMSI prefix in sid
         imsi = sid[4:]
         sub_profile = self._lte_processor.get_sub_profile(imsi)
         response.non_3gpp.ambr.max_bandwidth_ul = sub_profile.max_ul_bit_rate
         response.non_3gpp.ambr.max_bandwidth_dl = sub_profile.max_dl_bit_rate
         response.non_3gpp.ambr.br_unit = apn_pb2.AggregatedMaximumBitrate.BitrateUnitsAMBR.BPS
     except SubscriberNotFoundError:
         context.set_details("Subscriber not found: %s" % sid)
         context.set_code(grpc.StatusCode.NOT_FOUND)
         response = subscriberdb_pb2.SubscriberData()
     print_grpc(
         response, self._print_grpc_payload,
         "Get Subscriber Data Response:",
     )
     return response
Esempio n. 2
0
 def GetSubscriberData(self, request, context):
     """
     Returns the subscription data for the subscriber
     """
     sid = SIDUtils.to_str(request)
     try:
         return self._store.get_subscriber_data(sid)
     except SubscriberNotFoundError:
         context.set_details("Subscriber not found: %s" % sid)
         context.set_code(grpc.StatusCode.NOT_FOUND)
         return subscriberdb_pb2.SubscriberData()
Esempio n. 3
0
 def GetSubscriberData(self, request, context):
     """
     Returns the subscription data for the subscriber
     """
     try:
         self._print_grpc(request)
     except Exception as e:  # pylint: disable=broad-except
         logging.debug("Exception while trying to log GRPC: %s", e)
     sid = SIDUtils.to_str(request)
     try:
         return self._store.get_subscriber_data(sid)
     except SubscriberNotFoundError:
         context.set_details("Subscriber not found: %s" % sid)
         context.set_code(grpc.StatusCode.NOT_FOUND)
         return subscriberdb_pb2.SubscriberData()
Esempio n. 4
0
 def GetSubscriberData(self, request, context):
     """
     Return the subscription data for the subscriber
     """
     print_grpc(
         request,
         self._print_grpc_payload,
         "Get Subscriber Data Request:",
     )
     sid = SIDUtils.to_str(request)
     try:
         response = self._store.get_subscriber_data(sid)
     except SubscriberNotFoundError:
         context.set_details("Subscriber not found: %s" % sid)
         context.set_code(grpc.StatusCode.NOT_FOUND)
         response = subscriberdb_pb2.SubscriberData()
     print_grpc(
         response,
         self._print_grpc_payload,
         "Get Subscriber Data Response:",
     )
     return response