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

Add "show queue-monitor length" command. #30

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

Conversation

denysaleksandrov
Copy link

Add parsing of json output of the command
"show queue-monitor length [interface] [limit] [seconds|sample] [seconds|samples]".

If merged on the Sand platforms will be possible to do this:

	showqueue := &module.ShowQueueMonitor{}
	showqueue.SetCmd("Et24/1", true, "seconds", 10)
	fmt.Println(showqueue.Cmd)

	handle, _ := node.GetHandle("json")
	if err = handle.Enable(showqueue); err != nil {
		panic(err)
	}

	fmt.Println(showqueue.ReportTime)
	fmt.Println(showqueue.GlobalHitCount)
	for _, entry := range showqueue.EntryList {
		fmt.Println(entry.Interface)
		fmt.Println(entry.EntryTime)
		fmt.Println(entry.EntryTimeUsecs)
		fmt.Println(entry.QueueLength)
		for _, port := range entry.IngressPortSet {
			fmt.Println(port)
		}
	}
go run arista_command.go                                                                                                                                                           40232❮ ◀12:16:39
show queue-monitor length Et24/1 limit 10 seconds
1.569233803510707e+09
0
Ethernet24/1
1.569233799625076e+09
1569233799625076
144336
Ethernet24/3
Ethernet13/1
Ethernet35/1
Ethernet23/1
Ethernet33/1
Ethernet19/1
Ethernet14/1
Ethernet18/1
Ethernet24/1
Ethernet34/1
Ethernet24/4
Ethernet24/2

@codecov-io
Copy link

codecov-io commented Sep 23, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@49dadde). Click here to learn what that means.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #30   +/-   ##
=========================================
  Coverage          ?   88.81%           
=========================================
  Files             ?       21           
  Lines             ?     2190           
  Branches          ?        0           
=========================================
  Hits              ?     1945           
  Misses            ?      197           
  Partials          ?       48
Impacted Files Coverage Δ
module/queue.go 72.72% <72.72%> (ø)

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 49dadde...506fc69. Read the comment docs.

module/queue.go Outdated
return l.Cmd
}

func (s *ShowEntity) ShowQueueMonitor(port string, limit bool, limitBy string, limitValue int) (ShowQueueMonitor, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The only request I would make relates to the method name. It may be better to rename this ShowQueueMonitorWithLimit() and remove the requirement for limit bool. You could then have another method ShowQueueMonitor() that performs the underlying call to SetCmd() with no limit set.

Copy link
Author

Choose a reason for hiding this comment

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

Applied. There are two methods now as requested:
ShowQueueMonitorWithLimit()
ShowQueueMonitor()

show := module.Show(node)
showqueue, _ := show.ShowQueueMonitor("Et24/1")

or
show := module.Show(node)
showqueue, _ := show.ShowQueueMonitorWithLimit("Et24/1", "seconds", 60)

or
showqueueLimit := &module.ShowQueueMonitor{}
showqueueLimit.SetCmd("Et24/1", "seconds", 10)
showqueueNoLimit := &module.ShowQueueMonitor{}
showqueueNoLimit.SetCmd("Et24/1", "", 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants