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

Update py_gnmicli.py for gNMI Subscribe support #65

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tejaskumark
Copy link
Contributor

Adding support for gNMI subscribe.

Adding support for gNMI subscribe.
@codecov-io
Copy link

codecov-io commented Feb 28, 2019

Codecov Report

Merging #65 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #65   +/-   ##
=======================================
  Coverage   52.79%   52.79%           
=======================================
  Files          10       10           
  Lines        1197     1197           
=======================================
  Hits          632      632           
  Misses        482      482           
  Partials       83       83

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64f55df...cdd72b5. Read the comment docs.

Discarded redundant print response.
Added subscribe request example.
@tejaskumark
Copy link
Contributor Author

@mike-albano Can you please help to get this merge, this has fix for xpath construction with (- and /) and also subscribe request. Thanks.

Copy link
Collaborator

@mike-albano mike-albano left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together. Looking forward to giving it a shot.

Can you up the version, and resolve the branch conflicts?

gNMI SubscribeRequest object.
"""
mysubs = []
mysub = gnmi_pb2.Subscription(path=paths, mode=opt["submode"], sample_interval=opt["interval"]*1000000000, heartbeat_interval=opt['heartbeat']*1000000000, suppress_redundant=opt['suppress'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fix line length.

myqos = gnmi_pb2.QOSMarking(marking=opt["qos"])
else:
myqos = None
mysblist = gnmi_pb2.SubscriptionList(prefix=myprefix, mode=opt['subscribe_mode'], allow_aggregation=opt['aggregate'], encoding=opt['encoding'], subscription=mysubs, use_aliases=opt['use_alias'], qos=myqos)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line length

if response.HasField('sync_response'):
print('Sync Response received\n'+str(response))
elif response.HasField('error'):
print('gNMI Error '+str(response.error.code)+' received\n'+str(response.error.message) + str(response.error))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line length

@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2020

Codecov Report

Merging #65 into master will increase coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
+ Coverage   52.32%   52.44%   +0.11%     
==========================================
  Files          10       12       +2     
  Lines        1204     1249      +45     
==========================================
+ Hits          630      655      +25     
- Misses        491      510      +19     
- Partials       83       84       +1     
Impacted Files Coverage Δ
gnoi/gnoi.go 63.63% <0.00%> (-3.04%) ⬇️
gnoi/reset/client.go 53.57% <0.00%> (ø)
gnoi/reset/server.go 66.66% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92c6d0d...965d41d. Read the comment docs.

@tejaskumark
Copy link
Contributor Author

@mike-albano Changes done. Please review. Thanks.

- Version updated.
- Updated info section.
@samribeiro samribeiro added the py label Jul 8, 2020
@tejaskumark
Copy link
Contributor Author

@mike-albano Just to make sure this is not missed.

lguohan pushed a commit to lguohan/gnxi that referenced this pull request Nov 10, 2020
- Adding support for subscribe mode. The code is mostly based on this patch: google#65
- Adding a new parameter to limit the number of updates, e.g. after a number of streaming updates the client would stop listening. It is convenient for testing purposes.
- Changing the sample interval unit to millisecond. This is also required for testing cases.

Co-authored-by: Murat Acikgoz <muacikgo@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants