Skip to content

Commit

Permalink
feat(subscriberdb): Handle NW NGC config nil check correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Moinuddin Khan <moinuddin.khan@wavelabs.ai>
  • Loading branch information
moinuddin1980 committed Jun 29, 2022
1 parent 87d314c commit 8afa51f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 9 additions & 6 deletions lte/cloud/go/services/subscriberdb/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,19 @@ func LoadSuciProtos(ctx context.Context, networkID string) ([]*lte_protos.SuciPr
return nil, fmt.Errorf("network loading failed: %w", err)
}

suciProtos := []*lte_protos.SuciProfile{}

ngcModel := &lte_models.NetworkNgcConfigs{}
ngcConfig := ngcModel.GetFromNetwork(network).(*lte_models.NetworkNgcConfigs)
ngcConfig := ngcModel.GetFromNetwork(network)
if ngcConfig == nil {
return nil, fmt.Errorf("ngcConfig is nil: %w", err)
return suciProtos, fmt.Errorf("ngcConfig is nil: %w", err)
}

suciProfiles := ngcConfig.SuciProfiles
suciProtos := []*lte_protos.SuciProfile{}
for _, suciProfile := range suciProfiles {
suciProtos = append(suciProtos, ngcModel.ConvertSuciEntsToProtos(suciProfile))
if ngcConfig.(*lte_models.NetworkNgcConfigs) != nil {
suciProfiles := ngcConfig.(*lte_models.NetworkNgcConfigs).SuciProfiles
for _, suciProfile := range suciProfiles {
suciProtos = append(suciProtos, ngcModel.ConvertSuciEntsToProtos(suciProfile))
}
}

return suciProtos, nil
Expand Down
4 changes: 1 addition & 3 deletions lte/gateway/python/magma/subscriberdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def __init__(

async def _run(self) -> None:

suciprofiles_info = await self._list_suciprofiles()
if suciprofiles_info is None:
return
await self._list_suciprofiles()

in_sync = await self._check_subscribers_in_sync()
if in_sync:
Expand Down

0 comments on commit 8afa51f

Please sign in to comment.