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

fix(orc8r): add k8s annotations to trigger subscriberdb for gateway_subscriber_state #13087

Conversation

alexzurbonsen
Copy link
Contributor

Summary

This PR adds the necessary annotations to trigger subscriberdb indexer for gateway_subscriber_state in k8s deployments. This is a follow-up task from #13041.

Test Plan

  • manual test with orc8r deployed locally on minikube (orc8r and lte-orc8r module)

Manual testing is done with grpcurl and the following commands.

  1. Send gateway state with three IMSIs.
grpcurl -vv \
    -insecure \
    -key /tmp/magma_protos/gateway.key \
    -cert /tmp/magma_protos/gateway.crt \
    -authority state-controller.magma.test \
    -protoset /tmp/magma_protos/out.protoset \
    -d '{"states": [{"type": "gateway_subscriber_state",
"deviceID": "d02a138b-04d3-4710-95aa-d810efc61fc1", "value":"eyJzdWJzY3JpYmVycyI6eyJJTVNJMDAyMDIwMDAwMDAwMTIzIjp7Im1hZ21hLmlwdjQiOlt7ImFjdGl2ZV9kdXJhdGlvbl9zZWMiOjAsImFjdGl2ZV9wb2xpY3lfcnVsZXMiOltdLCJhcG4iOiJtYWdtYS5pcHY0IiwiaXB2NCI6IjE5Mi4xNjguMTI4LjEyIiwibGlmZWN5Y2xlX3N0YXRlIjoiU0VTU0lPTl9SRUxFQVNFRCIsIm1zaXNkbiI6IiIsInNlc3Npb25faWQiOiJJTVNJMDAyMDIwMDAwMDAwMTIzLTEyMzQiLCJzZXNzaW9uX3N0YXJ0X3RpbWUiOjE2NTM0ODQxNDR9XX0sIklNU0kwMDIwMjAwMDAwMDA0NTYiOnsibWFnbWEuaXB2NCI6W3siYWN0aXZlX2R1cmF0aW9uX3NlYyI6MSwiYWN0aXZlX3BvbGljeV9ydWxlcyI6W10sImFwbiI6Im1hZ21hLmlwdjQiLCJpcHY0IjoiMTkyLjE2OC4xMjguMTIiLCJsaWZlY3ljbGVfc3RhdGUiOiJTRVNTSU9OX1JFTEVBU0VEIiwibXNpc2RuIjoiIiwic2Vzc2lvbl9pZCI6IklNU0kwMDIwMjAwMDAwMDA0NTYtMTIzNCIsInNlc3Npb25fc3RhcnRfdGltZSI6MTY1MzQ4NDE0NH1dfSwiSU1TSTAwMjAyMDAwMDAwMDc4OSI6eyJtYWdtYS5pcHY0IjpbeyJhY3RpdmVfZHVyYXRpb25fc2VjIjoyLCJhY3RpdmVfcG9saWN5X3J1bGVzIjpbXSwiYXBuIjoibWFnbWEuaXB2NCIsImlwdjQiOiIxOTIuMTY4LjEyOC4xMiIsImxpZmVjeWNsZV9zdGF0ZSI6IlNFU1NJT05fUkVMRUFTRUQiLCJtc2lzZG4iOiIiLCJzZXNzaW9uX2lkIjoiSU1TSTAwMjAyMDAwMDAwMDc4OS0xMjM0Iiwic2Vzc2lvbl9zdGFydF90aW1lIjoxNjUzNDg0MTQ0fV19fX0=", "version":"0"}]}' \
    localhost:7443 \
    magma.orc8r.StateService/ReportStates

The state is written to states table and the indexer writes its entries to the gateway_subscriber_states table.

Screenshot 2022-06-23 at 20 02 25

  1. After sending an empty state
grpcurl -vv \
    -insecure \
    -key /tmp/magma_protos/gateway.key \
    -cert /tmp/magma_protos/gateway.crt \
    -authority state-controller.magma.test \
    -protoset /tmp/magma_protos/out.protoset \
    -d '{"states": [{"type": "gateway_subscriber_state",
"deviceID": "d02a138b-04d3-4710-95aa-d810efc61fc1", "value":"eyJzdWJzY3JpYmVycyI6e319", "version":"0"}]}' \
    localhost:7443 \
    magma.orc8r.StateService/ReportStates

the gateway_subscriber_states table is indeed empty.

  1. Sending mixed states like
'{"states": [{"type": "gateway_subscriber_state",
"deviceID": "d02a138b-04d3-4710-95aa-d810efc61fc1", "value":"eyJzdWJzY3JpYmVycyI6eyJJTVNJMDAyMDIwMDAwMDAwMTIzIjp7Im1hZ21hLmlwdjQiOlt7ImFjdGl2ZV9kdXJhdGlvbl9zZWMiOjAsImFjdGl2ZV9wb2xpY3lfcn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RkcmVzcyI6ICJ3S2lBQUE9PSIsICJwcmVmaXhMZW4iOiAyNH0sICJzdGF0ZSI6ICJBTExPQ0FURUQiLCAic2lkIjogeyJpZCI6ICJJTVNJMDAxMDEwMDAwMzMzMzMzLm1hZ21hLmlwdjQsaXB2NCJ9LCAidHlwZSI6ICJJUF9QT09MIn0=", "version":"0"}
]}'

also works. The respective states get written into the gateway_subscriber_states table as above and subscriberdb_ip_to_imsi.

Additional Information

  • This change is backwards-breaking

…teway_subscriber_state

Signed-off-by: Alexander zur Bonsen <alexander.zur.bonsen@tngtech.com>
@alexzurbonsen alexzurbonsen requested a review from a team June 27, 2022 09:13
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines. label Jun 27, 2022
@github-actions
Copy link
Contributor

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@github-actions github-actions bot added the component: orc8r Orchestrator-related issue label Jun 27, 2022
@@ -111,7 +111,7 @@ subscriberdb:
orc8r.io/state_indexer: "true"
orc8r.io/swagger_spec: "true"
annotations:
orc8r.io/state_indexer_types: "mobilityd_ipdesc_record"
orc8r.io/state_indexer_types: "mobilityd_ipdesc_record,gateway_subscriber_state"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[yamllint] reported by reviewdog 🐶
[error] wrong indentation: expected 5 but found 6 (indentation)

@github-actions
Copy link
Contributor

feg-workflow

    2 files  203 suites   39s ⏱️
374 tests 374 ✔️ 0 💤 0
388 runs  388 ✔️ 0 💤 0

Results for commit cb74ebd.

@github-actions
Copy link
Contributor

dp-workflow

18 tests   18 ✔️  4m 18s ⏱️
  2 suites    0 💤
  2 files      0

Results for commit cb74ebd.

@github-actions
Copy link
Contributor

cloud-workflow

988 tests   988 ✔️  2m 56s ⏱️
355 suites      0 💤
    7 files        0

Results for commit cb74ebd.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 27, 2022

agw-workflow

    2 files      2 suites   3m 25s ⏱️
579 tests 575 ✔️ 4 💤 0
580 runs  576 ✔️ 4 💤 0

Results for commit cb74ebd.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@ShubhamTatvamasi ShubhamTatvamasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShubhamTatvamasi ShubhamTatvamasi merged commit 6a69d18 into magma:master Jun 29, 2022
emakeev pushed a commit to emakeev/magma that referenced this pull request Aug 5, 2022
…teway_subscriber_state (magma#13087)

Signed-off-by: Alexander zur Bonsen <alexander.zur.bonsen@tngtech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: orc8r Orchestrator-related issue size/XS Denotes a PR that changes 0-9 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants