Skip to content

Commit

Permalink
Rename sh_profile to xcap_profile
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkneipp committed Nov 13, 2023
1 parent 2db2eb1 commit d9eea3f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added CORS headers: [Zarya/171](https://github.com/nickvsnetworking/pyhss/pull/171)
- Gx RAR now dynamically creates TFT up to 512k based on UE request.
- SQN Resync now propogates via Geored when enabled
- Renamed sh_profile to xcap_profile in ims_subscriber

### Fixed

Expand All @@ -25,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optional immediateReattach parameter in Request_16777251_317, via CLR-Flags
- Sh-IMS-Data and IMSPrivateUserIdentity to default_sh_user_data.xml
- Optional config parameter `api.enable_insecure_auc` to allow retrieval of AuC keys through API
- sh_template_path in ims_subscriber

## [1.0.0] - 2023-09-27

Expand Down
5 changes: 0 additions & 5 deletions default_sh_user_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@
<IMSUserState>{{ Sh_template_vars['imsUserState'] }}</IMSUserState>
</Sh-IMS-Data>

<!-- This container for the XCAP Data for the Subscriber -->

<!-- XCAP data from Database -->
{{ Sh_template_vars['sh_profile'] }}

</Sh-Data>
2 changes: 1 addition & 1 deletion docs/provisioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ curl -X 'PUT' \
"msisdn_list": "12341235",
"imsi": "001010000000002",
"ifc_path": "string",
"sh_profile": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><simservs>Your XCAP Data...</simservs>"
"xcap_profile": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><simservs>Your XCAP Data...</simservs>"
}'
```
14 changes: 7 additions & 7 deletions lib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,18 @@ class IMS_SUBSCRIBER(Base):
msisdn = Column(String(18), unique=True, doc=SUBSCRIBER.msisdn.doc)
msisdn_list = Column(String(1200), doc='Comma Separated list of additional MSISDNs for Subscriber')
imsi = Column(String(18), unique=False, doc=SUBSCRIBER.imsi.doc)
ifc_path = Column(String(18), doc='Path to template file for the Initial Filter Criteria')
ifc_path = Column(String(512), doc='Path to template file for the Initial Filter Criteria')
pcscf = Column(String(512), doc='Proxy-CSCF serving this subscriber')
pcscf_realm = Column(String(512), doc='Realm of PCSCF')
pcscf_active_session = Column(String(512), doc='Session Id for the PCSCF when in a call')
pcscf_timestamp = Column(DateTime, doc='Timestamp of last ue attach to PCSCF')
pcscf_peer = Column(String(512), doc='Diameter peer used to reach PCSCF')
sh_profile = Column(Text(12000), doc='Sh Subscriber Profile')
pcscf_peer = Column(String(512), doc='Diameter peer used to reach PCSCF')
xcap_profile = Column(Text(12000), doc='XCAP Subscriber Profile')
scscf = Column(String(512), doc='Serving-CSCF serving this subscriber')
scscf_timestamp = Column(DateTime, doc='Timestamp of last ue attach to SCSCF')
scscf_realm = Column(String(512), doc='Realm of SCSCF')
scscf_peer = Column(String(512), doc='Diameter peer used to reach SCSCF')
scscf_peer = Column(String(512), doc='Diameter peer used to reach SCSCF')
sh_template_path = Column(String(512), doc='Path to template file for the Sh Profile')
last_modified = Column(String(100), default=datetime.datetime.now(tz=timezone.utc), doc='Timestamp of last modification')
operation_logs = relationship("IMS_SUBSCRIBER_OPERATION_LOG", back_populates="ims_subscriber")

Expand Down Expand Up @@ -2432,9 +2433,8 @@ def get_device_info_from_TAC(self, imei) -> dict:
"msisdn": newObj['msisdn'],
"msisdn_list": newObj['msisdn'],
"imsi": subscriber_json['imsi'],
"ifc_path" : "default_ifc.xml",
"sh_profile" : "default_sh_user_data.xml"
}
"ifc_path" : "default_ifc.xml"
}
print(ims_subscriber_json)
newObj = database.CreateObj(IMS_SUBSCRIBER, ims_subscriber_json)
print(newObj)
Expand Down
11 changes: 5 additions & 6 deletions lib/diameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2274,7 +2274,7 @@ def Answer_16777217_306(self, packet_vars, avps):
subscriber_details['mcc'] = self.MCC.zfill(3)

self.logTool.log(service='HSS', level='debug', message="Rendering template with values: " + str(subscriber_details), redisClient=self.redisMessaging)
xmlbody = template.render(Sh_template_vars=subscriber_details) # this is where to put args to the template renderer
xmlbody = template.render(Sh_template_vars=subscriber_details)
avp += self.generate_vendor_avp(702, "c0", 10415, str(binascii.hexlify(str.encode(xmlbody)),'ascii'))

avp += self.generate_avp(268, 40, "000007d1") #DIAMETER_SUCCESS
Expand All @@ -2300,7 +2300,7 @@ def Answer_16777217_307(self, packet_vars, avps):
#Push updated User Data into IMS Backend
#Start with the Current User Data
subscriber_ims_details = self.database.Get_IMS_Subscriber(imsi=imsi)
self.database.UpdateObj(self.database.IMS_SUBSCRIBER, {'sh_profile': sh_user_data}, subscriber_ims_details['ims_subscriber_id'])
self.database.UpdateObj(self.database.IMS_SUBSCRIBER, {'xcap_profile': sh_user_data}, subscriber_ims_details['ims_subscriber_id'])

avp = '' #Initiate empty var AVP #Session-ID
session_id = self.get_avp_data(avps, 263)[0] #Get Session-ID
Expand Down Expand Up @@ -2426,13 +2426,12 @@ def Answer_16777236_265(self, packet_vars, avps):
pass

"""
The below charging rule needs to be replaced by the following logic:
The below logic is applied:
1. Grab the Flow Rules and bitrates from the PCSCF in the AAR,
2. Compare it to a given backup rule
- If the flowrates are greater than the backup rule (UE is asking for more than allowed), use the backup rule
- If the flowrates are lesser than the backup rule, use the requested flowrates. This will allow for better utilization of radio resources.
3. Maybe something to do with the TFT's
4. Send the winning rule.
- If the flowrates are lesser than the backup rule, use the requested flowrates.
3. Send the winning rule.
"""

chargingRule = {
Expand Down

0 comments on commit d9eea3f

Please sign in to comment.