Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(subscriberdb): Handle NW NGC config nil check correctly #13081

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
moinuddin1980 marked this conversation as resolved.
Show resolved Hide resolved
}

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
29 changes: 10 additions & 19 deletions lte/gateway/python/magma/subscriberdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,17 @@ def __init__(

async def _run(self) -> None:

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

in_sync = await self._check_subscribers_in_sync()
if in_sync:
return

resync = await self._sync_subscribers()
if not resync:
return

subscribers_info = await self._get_all_subscribers()
if subscribers_info is None:
return

# failure between the calls
self._process_subscribers(subscribers_info.subscribers)
self._update_root_digest(subscribers_info.root_digest)
self._update_leaf_digests(subscribers_info.leaf_digests)
if not in_sync:
resync = await self._sync_subscribers()
if resync:
subscribers_info = await self._get_all_subscribers()
if subscribers_info:
# failure between the calls
self._process_subscribers(subscribers_info.subscribers)
self._update_root_digest(subscribers_info.root_digest)
self._update_leaf_digests(subscribers_info.leaf_digests)
await self._list_suciprofiles()

async def _check_subscribers_in_sync(self) -> bool:
"""
Expand Down