Skip to content

Commit

Permalink
Encode PLMN update
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvsnetworking committed Jan 12, 2024
1 parent becbc85 commit a9ff02e
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions lib/diameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,24 @@ def DecodePLMN(self, plmn):
return mcc, mnc

def EncodePLMN(self, mcc, mnc):
plmn = list('XXXXXX')
plmn[0] = self.Reverse(mcc)[1]
plmn[1] = self.Reverse(mcc)[2]
plmn[2] = "f"
plmn[3] = self.Reverse(mcc)[0]
plmn[4] = self.Reverse(mnc)[0]
plmn[5] = self.Reverse(mnc)[1]
plmn_list = plmn
plmn = ''
if len(mnc) == 2:
plmn[0] = self.Reverse(mcc)[1]
plmn[1] = self.Reverse(mcc)[2]
plmn[2] = "f"
plmn[3] = self.Reverse(mcc)[0]
plmn[4] = self.Reverse(mnc)[0]
plmn[5] = self.Reverse(mnc)[1]
plmn_list = plmn
plmn = ''
else:
plmn[0] = self.Reverse(mcc)[1]
plmn[1] = self.Reverse(mcc)[2]
plmn[2] = self.Reverse(mnc)[0]
plmn[3] = self.Reverse(mcc)[0]
plmn[4] = self.Reverse(mnc)[1]
plmn[5] = self.Reverse(mnc)[2]
plmn_list = plmn
plmn = ''
for bits in plmn_list:
plmn = plmn + bits
self.logTool.log(service='HSS', level='debug', message="Encoded PLMN: " + str(plmn), redisClient=self.redisMessaging)
Expand Down

0 comments on commit a9ff02e

Please sign in to comment.