-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_stat_interface.rb
More file actions
99 lines (77 loc) · 3.12 KB
/
get_stat_interface.rb
File metadata and controls
99 lines (77 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
describe "Get statistical interface attributes" do
### Build-Up ###
before(:all) do
puts "+#{Time.now}: Preconfig started"
#Load Environment Data
@env = YAML::load(File.open('Environment.yaml'))
@points = EventPointEater.eat_header(@env['build_dir'])
@tftp = [@env["tftpserver"]["ip"],
@env["tftpserver"]["dir"]]
@timestamp = Time.now.strftime("%b%d-%H%M%S")
@name = [@timestamp]
@ifTable_nonstat_columns = ["ifIndex",
"ifDescr",
"ifType",
"ifMtu",
"ifSpeed",
"ifPhysAddress",
"ifAdminStatus",
"ifOperStatus",
"ifLastChange",
"ifName",
"ifLinkUpDownTrapEnable",
"ifPromiscuousMode",
"ifConnectorPresent",
"ifAlias"]
#Establish XR connections
@conn = XrTelnet.new(@env['console'],
@env['auxilary'],
@env["workspace"]+ '/' + @name.join('/'))
@conn.config do |console|
#Prevent MORE from running
console.cmd("line con 0")
console.cmd("length 0")
#Configure SNMP
console.cmd("logging console debugging")
console.cmd("snmp-server community public RW SystemOwner")
console.cmd("snmp-server community sdr_owner SDROwner")
console.cmd("snmp-server community sys_owner SystemOwner")
end
end
### Test Cases ###
it "Get statistical attribute for interface" do
100.times do |num|
#Create config file with interfaces
ConfigCreate.create_loopback_conf(:start => (num * 100),
:size => 100,
:copy_loc => "/tftpboot/#{@tftp[1]}")
#Copy config file
@conn.exec("copy tftp://#{@tftp.join('/')}/running.config nvram:changeset\n\n")
#Load changes
@conn.config("load nvram:changeset")
@ifTable_nonstat_columns.each do |attr|
@name = [@timestamp, "sample_#{num}"]
SNMP::Manager.open(:Host => @mgmt_port) do |manager|
# @conn.start_logger(10)
# manager.get(attr) {}
end
#Copy logs of UUT
# @conn.copy_log(@tftp.join('/'), "#{@name.join('_')}.kev")
# Cook kev file into csv
# csvs = Cooker.cook("/tftpboot/#{@tftp[1]}",
# @env["workspace"],
# @name,
# @points)
# Graph csv data using gnuplot
# csvs.each {|csv| GraphPerf.graph_test(csv,
# :start => 100,
# :iterval => 100)}
end
end
end
### Tear-Down ###
after(:all) do
#Close XR connections
@conn.close
end
end