예제 #1
0
 def process_update(self, stream_name: str, updates: List[DataUpdate],
                    resync: bool):
     logging.info('Processing %d rating group updates', len(updates))
     for update in updates:
         rg = RatingGroup()
         rg.ParseFromString(update.value)
         self._rating_groups[update.key] = rg
예제 #2
0
 def setUp(self):
     rating_groups_by_id = {
         1: RatingGroup(
             id=1,
             limit_type=RatingGroup.INFINITE_UNMETERED,
         ),
         2: RatingGroup(
             id=2,
             limit_type=RatingGroup.INFINITE_METERED,
         ),
     }
     basenames_dict = {
         'bn1': ChargingRuleNameSet(RuleNames=['p5']),
         'bn2': ChargingRuleNameSet(RuleNames=['p6']),
     }
     apn_rules_by_sid = {
         "IMSI1234":
         SubscriberPolicySet(rules_per_apn=[
             ApnPolicySet(
                 apn="apn1",
                 assigned_base_names=[],
                 assigned_policies=["redirect"],
             ),
         ], ),
         "IMSI2345":
         SubscriberPolicySet(rules_per_apn=[
             ApnPolicySet(
                 apn="apn1",
                 assigned_base_names=["bn1"],
                 assigned_policies=[],
             ),
             ApnPolicySet(
                 apn="apn2",
                 assigned_base_names=["bn2"],
                 assigned_policies=[],
             ),
         ], ),
         "IMSI3456":
         SubscriberPolicySet(
             global_base_names=["bn1"],
             global_policies=[],
             rules_per_apn=[
                 ApnPolicySet(
                     apn="apn1",
                     assigned_base_names=[],
                     assigned_policies=[],
                 ),
             ],
         ),
     }
     self.servicer = SessionRpcServicer(
         self._get_mconfig(),
         rating_groups_by_id,
         basenames_dict,
         apn_rules_by_sid,
     )
예제 #3
0
 def setUp(self):
     rating_groups_by_id = {
         1: RatingGroup(
             id=1,
             limit_type=RatingGroup.INFINITE_UNMETERED,
         ),
         2: RatingGroup(
             id=2,
             limit_type=RatingGroup.INFINITE_METERED,
         ),
     }
     self.servicer = SessionRpcServicer(self._get_mconfig(),
                                        rating_groups_by_id,
                                        MockSubscriberDBStub())