mu 5.7.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Mu_Gem.html +1591 -0
- data/bin/mu +11 -0
- data/lib/mu.rb +65 -0
- data/lib/mu/api/ddt.rb +233 -0
- data/lib/mu/api/homepage.rb +54 -0
- data/lib/mu/api/muapi.rb +231 -0
- data/lib/mu/api/netconfig.rb +233 -0
- data/lib/mu/api/scale.rb +199 -0
- data/lib/mu/api/system.rb +40 -0
- data/lib/mu/client.rb +31 -0
- data/lib/mu/command.rb +28 -0
- data/lib/mu/command/api.rb +95 -0
- data/lib/mu/command/cmd_appid.rb +486 -0
- data/lib/mu/command/cmd_cli.rb +151 -0
- data/lib/mu/command/cmd_ddt.rb +449 -0
- data/lib/mu/command/cmd_homepage.rb +146 -0
- data/lib/mu/command/cmd_muapi.rb +361 -0
- data/lib/mu/command/cmd_netconfig.rb +262 -0
- data/lib/mu/command/cmd_runscale.rb +533 -0
- data/lib/mu/command/cmd_runscenario.rb +258 -0
- data/lib/mu/command/cmd_runverify.rb +336 -0
- data/lib/mu/command/cmd_scale.rb +333 -0
- data/lib/mu/command/cmd_system.rb +127 -0
- data/lib/mu/command/curl.rb +246 -0
- data/lib/mu/command/help.rb +29 -0
- data/lib/mu/curl/error.rb +54 -0
- data/lib/mu/curl/verify.rb +137 -0
- data/lib/mu/helper.rb +55 -0
- data/lib/mu/http_helper.rb +232 -0
- data/rdoc/classes/Mu.html +305 -0
- data/rdoc/classes/Mu/Client.html +265 -0
- data/rdoc/classes/Mu/Command.html +208 -0
- data/rdoc/classes/Mu/Command/API.html +524 -0
- data/rdoc/classes/Mu/Command/Cmd_appid.html +934 -0
- data/rdoc/classes/Mu/Command/Cmd_cli.html +515 -0
- data/rdoc/classes/Mu/Command/Cmd_ddt.html +1169 -0
- data/rdoc/classes/Mu/Command/Cmd_homepage.html +489 -0
- data/rdoc/classes/Mu/Command/Cmd_muapi.html +968 -0
- data/rdoc/classes/Mu/Command/Cmd_netconfig.html +743 -0
- data/rdoc/classes/Mu/Command/Cmd_runscale.html +970 -0
- data/rdoc/classes/Mu/Command/Cmd_runscenario.html +530 -0
- data/rdoc/classes/Mu/Command/Cmd_runverify.html +621 -0
- data/rdoc/classes/Mu/Command/Cmd_scale.html +939 -0
- data/rdoc/classes/Mu/Command/Cmd_system.html +426 -0
- data/rdoc/classes/Mu/Command/Curl.html +524 -0
- data/rdoc/classes/Mu/Command/Help.html +166 -0
- data/rdoc/classes/Mu/Curl.html +116 -0
- data/rdoc/classes/Mu/Curl/Error.html +157 -0
- data/rdoc/classes/Mu/Curl/Error/Authorize.html +178 -0
- data/rdoc/classes/Mu/Curl/Error/Connect.html +149 -0
- data/rdoc/classes/Mu/Curl/Error/DNS.html +113 -0
- data/rdoc/classes/Mu/Curl/Error/Region.html +160 -0
- data/rdoc/classes/Mu/Curl/Error/Status.html +149 -0
- data/rdoc/classes/Mu/Curl/Error/Timeout.html +149 -0
- data/rdoc/classes/Mu/Curl/Verify.html +282 -0
- data/rdoc/classes/Mu/Curl/Verify/Request.html +227 -0
- data/rdoc/classes/Mu/Curl/Verify/Response.html +187 -0
- data/rdoc/classes/Mu/Curl/Verify/Result.html +188 -0
- data/rdoc/classes/Mu/Ddt.html +914 -0
- data/rdoc/classes/Mu/Helper.html +308 -0
- data/rdoc/classes/Mu/Homepage.html +377 -0
- data/rdoc/classes/Mu/HttpHelper.html +639 -0
- data/rdoc/classes/Mu/Muapi.html +816 -0
- data/rdoc/classes/Mu/Netconfig.html +781 -0
- data/rdoc/classes/Mu/Scale.html +832 -0
- data/rdoc/classes/Mu/System.html +281 -0
- data/rdoc/classes/Object.html +148 -0
- data/rdoc/classes/TCTestMu.html +1793 -0
- data/rdoc/classes/Test.html +107 -0
- data/rdoc/classes/Test/Unit.html +107 -0
- data/rdoc/classes/Test/Unit/TestCase.html +113 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/lib/mu/api/ddt_rb.html +101 -0
- data/rdoc/files/lib/mu/api/homepage_rb.html +101 -0
- data/rdoc/files/lib/mu/api/muapi_rb.html +101 -0
- data/rdoc/files/lib/mu/api/netconfig_rb.html +101 -0
- data/rdoc/files/lib/mu/api/scale_rb.html +101 -0
- data/rdoc/files/lib/mu/api/system_rb.html +101 -0
- data/rdoc/files/lib/mu/client_rb.html +101 -0
- data/rdoc/files/lib/mu/command/api_rb.html +101 -0
- data/rdoc/files/lib/mu/command/cmd_appid_rb.html +119 -0
- data/rdoc/files/lib/mu/command/cmd_cli_rb.html +108 -0
- data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +117 -0
- data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +115 -0
- data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +116 -0
- data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +116 -0
- data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +119 -0
- data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +115 -0
- data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +117 -0
- data/rdoc/files/lib/mu/command/cmd_scale_rb.html +115 -0
- data/rdoc/files/lib/mu/command/cmd_system_rb.html +116 -0
- data/rdoc/files/lib/mu/command/curl_rb.html +101 -0
- data/rdoc/files/lib/mu/command/help_rb.html +101 -0
- data/rdoc/files/lib/mu/command_rb.html +107 -0
- data/rdoc/files/lib/mu/curl/error_rb.html +101 -0
- data/rdoc/files/lib/mu/curl/verify_rb.html +101 -0
- data/rdoc/files/lib/mu/helper_rb.html +101 -0
- data/rdoc/files/lib/mu/http_helper_rb.html +101 -0
- data/rdoc/files/lib/mu_rb.html +121 -0
- data/rdoc/files/test/helper_rb.html +112 -0
- data/rdoc/files/test/tc_test_mu_rb.html +111 -0
- data/rdoc/fr_class_index.html +68 -0
- data/rdoc/fr_file_index.html +55 -0
- data/rdoc/fr_method_index.html +374 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/test/data/app_id_stats.csv +1 -0
- data/test/data/data_cgi.msl +94 -0
- data/test/data/data_cgi.xml +322 -0
- data/test/data/default_test.csv +3 -0
- data/test/data/ftp_with_channel.xml +1643 -0
- data/test/data/irc.xml +3837 -0
- data/test/data/scale_configuration.json +25 -0
- data/test/data/test_data_cgi_error.xml +35 -0
- data/test/helper.rb +18 -0
- data/test/tc_test_mu.rb +716 -0
- metadata +322 -0
@@ -0,0 +1,970 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Mu::Command::Cmd_runscale</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Mu::Command::Cmd_runscale</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mu/command/cmd_runscale_rb.html">
|
59
|
+
lib/mu/command/cmd_runscale.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Command
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000178">cmd_help</a>
|
90
|
+
<a href="#M000180">cmd_run_dir</a>
|
91
|
+
<a href="#M000179">cmd_run_file</a>
|
92
|
+
<a href="#M000183">cmd_running?</a>
|
93
|
+
<a href="#M000184">configure_hosts</a>
|
94
|
+
<a href="#M000187">dump_status</a>
|
95
|
+
<a href="#M000192">help</a>
|
96
|
+
<a href="#M000188">output_csv</a>
|
97
|
+
<a href="#M000191">parse_cli</a>
|
98
|
+
<a href="#M000190">parse_status</a>
|
99
|
+
<a href="#M000189">parse_verify_response</a>
|
100
|
+
<a href="#M000182">run</a>
|
101
|
+
<a href="#M000186">set_hosts</a>
|
102
|
+
<a href="#M000185">set_hosts_byname</a>
|
103
|
+
<a href="#M000181">setup</a>
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
|
110
|
+
<!-- if includes -->
|
111
|
+
|
112
|
+
<div id="section">
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<div id="attribute-list">
|
119
|
+
<h3 class="section-bar">Attributes</h3>
|
120
|
+
|
121
|
+
<div class="name-list">
|
122
|
+
<table>
|
123
|
+
<tr class="top-aligned-row context-row">
|
124
|
+
<td class="context-item-name">addr_indexes</td>
|
125
|
+
<td class="context-item-value"> [RW] </td>
|
126
|
+
<td class="context-item-desc"></td>
|
127
|
+
</tr>
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">api</td>
|
130
|
+
<td class="context-item-value"> [RW] </td>
|
131
|
+
<td class="context-item-desc"></td>
|
132
|
+
</tr>
|
133
|
+
<tr class="top-aligned-row context-row">
|
134
|
+
<td class="context-item-name">hosts</td>
|
135
|
+
<td class="context-item-value"> [RW] </td>
|
136
|
+
<td class="context-item-desc"></td>
|
137
|
+
</tr>
|
138
|
+
<tr class="top-aligned-row context-row">
|
139
|
+
<td class="context-item-name">offset_indexes</td>
|
140
|
+
<td class="context-item-value"> [RW] </td>
|
141
|
+
<td class="context-item-desc"></td>
|
142
|
+
</tr>
|
143
|
+
<tr class="top-aligned-row context-row">
|
144
|
+
<td class="context-item-name">params</td>
|
145
|
+
<td class="context-item-value"> [RW] </td>
|
146
|
+
<td class="context-item-desc"></td>
|
147
|
+
</tr>
|
148
|
+
</table>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<!-- if method_list -->
|
155
|
+
<div id="methods">
|
156
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
157
|
+
|
158
|
+
<div id="method-M000178" class="method-detail">
|
159
|
+
<a name="M000178"></a>
|
160
|
+
|
161
|
+
<div class="method-heading">
|
162
|
+
<a href="#M000178" class="method-signature">
|
163
|
+
<span class="method-name">cmd_help</span><span class="method-args">(argv)</span>
|
164
|
+
</a>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
<p>
|
169
|
+
displays command-line <a href="Cmd_runscale.html#M000192">help</a>
|
170
|
+
</p>
|
171
|
+
<pre>
|
172
|
+
* argv = command-line arguments
|
173
|
+
</pre>
|
174
|
+
<p><a class="source-toggle" href="#"
|
175
|
+
onclick="toggleCode('M000178-source');return false;">[Source]</a></p>
|
176
|
+
<div class="method-source-code" id="M000178-source">
|
177
|
+
<pre>
|
178
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 14</span>
|
179
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_help</span> <span class="ruby-identifier">argv</span>
|
180
|
+
<span class="ruby-identifier">help</span>
|
181
|
+
<span class="ruby-keyword kw">end</span>
|
182
|
+
</pre>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div id="method-M000180" class="method-detail">
|
188
|
+
<a name="M000180"></a>
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<a href="#M000180" class="method-signature">
|
192
|
+
<span class="method-name">cmd_run_dir</span><span class="method-args">(argv)</span>
|
193
|
+
</a>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="method-description">
|
197
|
+
<p>
|
198
|
+
sets up, executes, and closes a Studio <a href="../Scale.html">Scale</a>
|
199
|
+
test for each scenario (.msl file) found in the specified directory
|
200
|
+
</p>
|
201
|
+
<pre>
|
202
|
+
* argv = command-line arguments, requires a directory (-d) argument
|
203
|
+
</pre>
|
204
|
+
<p><a class="source-toggle" href="#"
|
205
|
+
onclick="toggleCode('M000180-source');return false;">[Source]</a></p>
|
206
|
+
<div class="method-source-code" id="M000180-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 59</span>
|
209
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_run_dir</span> <span class="ruby-identifier">argv</span>
|
210
|
+
<span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
|
211
|
+
|
212
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'dir'</span>]
|
213
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
214
|
+
<span class="ruby-keyword kw">else</span>
|
215
|
+
<span class="ruby-ivar">@dir</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'dir'</span>]
|
216
|
+
<span class="ruby-keyword kw">end</span>
|
217
|
+
|
218
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"app_id_status.json"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-value str">"app_id_status.json"</span>)
|
219
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"app_id_stats.csv"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-value str">"app_id_stats.csv"</span>)
|
220
|
+
|
221
|
+
<span class="ruby-ivar">@api</span> = <span class="ruby-constant">Scale</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@@mu_ip</span>, <span class="ruby-ivar">@@mu_admin_user</span>, <span class="ruby-ivar">@@mu_admin_pass</span>)
|
222
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-value str">"pattern"</span>, <span class="ruby-ivar">@cmd_line_pattern</span>)
|
223
|
+
<span class="ruby-ivar">@params</span> = {}
|
224
|
+
<span class="ruby-ivar">@params</span>[<span class="ruby-value str">"dir"</span>] = <span class="ruby-ivar">@dir</span>
|
225
|
+
<span class="ruby-ivar">@params</span>[<span class="ruby-value str">"hosts"</span>] = <span class="ruby-ivar">@cmd_line_hosts</span>
|
226
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value str">"dir"</span>])
|
227
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"app_id_status.json"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-value str">"app_id_status.json"</span>)
|
228
|
+
<span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-value str">"*.msl"</span>)
|
229
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">files</span>.<span class="ruby-identifier">empty?</span>
|
230
|
+
<span class="ruby-identifier">files</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">|</span>
|
231
|
+
<span class="ruby-identifier">run</span>(<span class="ruby-identifier">f</span>)
|
232
|
+
<span class="ruby-identifier">output_csv</span>(<span class="ruby-identifier">f</span>)
|
233
|
+
<span class="ruby-identifier">sleep</span> <span class="ruby-value">2</span>
|
234
|
+
<span class="ruby-keyword kw">end</span>
|
235
|
+
<span class="ruby-keyword kw">else</span>
|
236
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"no msl files found in #{@dir}"</span>
|
237
|
+
<span class="ruby-keyword kw">end</span>
|
238
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">release</span>
|
239
|
+
<span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div id="method-M000179" class="method-detail">
|
246
|
+
<a name="M000179"></a>
|
247
|
+
|
248
|
+
<div class="method-heading">
|
249
|
+
<a href="#M000179" class="method-signature">
|
250
|
+
<span class="method-name">cmd_run_file</span><span class="method-args">(argv)</span>
|
251
|
+
</a>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
<div class="method-description">
|
255
|
+
<p>
|
256
|
+
sets up, executes, and closes a Studio <a href="../Scale.html">Scale</a>
|
257
|
+
test
|
258
|
+
</p>
|
259
|
+
<pre>
|
260
|
+
* argv = command-line arguments , requires a scenario (-s) argument
|
261
|
+
</pre>
|
262
|
+
<p><a class="source-toggle" href="#"
|
263
|
+
onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
|
264
|
+
<div class="method-source-code" id="M000179-source">
|
265
|
+
<pre>
|
266
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 20</span>
|
267
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_run_file</span> <span class="ruby-identifier">argv</span>
|
268
|
+
<span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
|
269
|
+
|
270
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'scenario'</span>]
|
271
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"scenario required"</span>
|
272
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
273
|
+
<span class="ruby-keyword kw">else</span>
|
274
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'scenario'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-value str">".msl"</span>)
|
275
|
+
<span class="ruby-identifier">scenario</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'scenario'</span>]
|
276
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># TODO: eventually, xml and mus file may be supported by scale api</span>
|
277
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"only .msl files are currently supported"</span>
|
278
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
279
|
+
<span class="ruby-keyword kw">end</span>
|
280
|
+
<span class="ruby-keyword kw">end</span>
|
281
|
+
|
282
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'dir'</span>]
|
283
|
+
<span class="ruby-ivar">@dir</span> = <span class="ruby-value str">""</span>
|
284
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">scenario</span>
|
285
|
+
<span class="ruby-keyword kw">else</span>
|
286
|
+
<span class="ruby-ivar">@dir</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'dir'</span>]
|
287
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-ivar">@dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">scenario</span>
|
288
|
+
<span class="ruby-keyword kw">end</span>
|
289
|
+
|
290
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">path</span>)
|
291
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"*** Error: File #{path} does not exist"</span>
|
292
|
+
<span class="ruby-keyword kw">end</span>
|
293
|
+
|
294
|
+
<span class="ruby-ivar">@api</span> = <span class="ruby-constant">Scale</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@@mu_ip</span>, <span class="ruby-ivar">@@mu_admin_user</span>, <span class="ruby-ivar">@@mu_admin_pass</span>)
|
295
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-value str">"pattern"</span>, <span class="ruby-ivar">@cmd_line_pattern</span>)
|
296
|
+
<span class="ruby-ivar">@params</span> = {}
|
297
|
+
<span class="ruby-ivar">@params</span>[<span class="ruby-value str">"dir"</span>] = <span class="ruby-ivar">@dir</span>
|
298
|
+
<span class="ruby-ivar">@params</span>[<span class="ruby-value str">"msl"</span>] = <span class="ruby-identifier">scenario</span>
|
299
|
+
<span class="ruby-ivar">@params</span>[<span class="ruby-value str">"hosts"</span>] = <span class="ruby-ivar">@cmd_line_hosts</span>
|
300
|
+
<span class="ruby-identifier">run</span>(<span class="ruby-identifier">scenario</span>)
|
301
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">release</span>
|
302
|
+
<span class="ruby-keyword kw">end</span>
|
303
|
+
</pre>
|
304
|
+
</div>
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
|
308
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
309
|
+
|
310
|
+
<div id="method-M000183" class="method-detail">
|
311
|
+
<a name="M000183"></a>
|
312
|
+
|
313
|
+
<div class="method-heading">
|
314
|
+
<a href="#M000183" class="method-signature">
|
315
|
+
<span class="method-name">cmd_running?</span><span class="method-args">()</span>
|
316
|
+
</a>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
<div class="method-description">
|
320
|
+
<p><a class="source-toggle" href="#"
|
321
|
+
onclick="toggleCode('M000183-source');return false;">[Source]</a></p>
|
322
|
+
<div class="method-source-code" id="M000183-source">
|
323
|
+
<pre>
|
324
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 191</span>
|
325
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_running?</span>
|
326
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">nil?</span>
|
327
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"false"</span>
|
328
|
+
<span class="ruby-keyword kw">return</span>
|
329
|
+
<span class="ruby-keyword kw">end</span>
|
330
|
+
|
331
|
+
<span class="ruby-identifier">status</span> = <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">status</span>
|
332
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">status</span>.<span class="ruby-identifier">nil?</span>
|
333
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>].<span class="ruby-identifier">nil?</span>
|
334
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"running"</span>]
|
335
|
+
<span class="ruby-keyword kw">end</span>
|
336
|
+
<span class="ruby-keyword kw">else</span>
|
337
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"false"</span>
|
338
|
+
<span class="ruby-keyword kw">end</span>
|
339
|
+
<span class="ruby-keyword kw">end</span>
|
340
|
+
</pre>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
<div id="method-M000184" class="method-detail">
|
346
|
+
<a name="M000184"></a>
|
347
|
+
|
348
|
+
<div class="method-heading">
|
349
|
+
<a href="#M000184" class="method-signature">
|
350
|
+
<span class="method-name">configure_hosts</span><span class="method-args">()</span>
|
351
|
+
</a>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<div class="method-description">
|
355
|
+
<p><a class="source-toggle" href="#"
|
356
|
+
onclick="toggleCode('M000184-source');return false;">[Source]</a></p>
|
357
|
+
<div class="method-source-code" id="M000184-source">
|
358
|
+
<pre>
|
359
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 207</span>
|
360
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure_hosts</span>
|
361
|
+
<span class="ruby-ivar">@hosts</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
362
|
+
<span class="ruby-ivar">@addr_indexes</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
363
|
+
<span class="ruby-ivar">@offset_indexes</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
364
|
+
<span class="ruby-identifier">hosts</span> = <span class="ruby-ivar">@params</span>[<span class="ruby-value str">"hosts"</span>]
|
365
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">nil?</span>
|
366
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
367
|
+
<span class="ruby-identifier">p</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">h</span> <span class="ruby-operator">|</span>
|
368
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"-"</span>) <span class="ruby-comment cmt"># b1-1000,b2-1 to indicate addr_count</span>
|
369
|
+
<span class="ruby-identifier">q</span> = <span class="ruby-identifier">h</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"-"</span>)
|
370
|
+
<span class="ruby-ivar">@hosts</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">q</span>[<span class="ruby-value">0</span>]
|
371
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">q</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-value str">":"</span>) <span class="ruby-comment cmt"># -1000:20 to indicate offset within range</span>
|
372
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">q</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">":"</span>)
|
373
|
+
<span class="ruby-ivar">@addr_indexes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>]
|
374
|
+
<span class="ruby-ivar">@offset_indexes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">1</span>]
|
375
|
+
<span class="ruby-keyword kw">else</span>
|
376
|
+
<span class="ruby-ivar">@addr_indexes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">q</span>[<span class="ruby-value">1</span>]
|
377
|
+
<span class="ruby-ivar">@offset_indexes</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
|
378
|
+
<span class="ruby-keyword kw">end</span>
|
379
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># default to the 1st addr index</span>
|
380
|
+
<span class="ruby-ivar">@hosts</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">h</span>
|
381
|
+
<span class="ruby-ivar">@addr_indexes</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
|
382
|
+
<span class="ruby-ivar">@offset_indexes</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
|
383
|
+
<span class="ruby-keyword kw">end</span>
|
384
|
+
<span class="ruby-keyword kw">end</span>
|
385
|
+
<span class="ruby-keyword kw">else</span>
|
386
|
+
<span class="ruby-ivar">@hosts</span> = [<span class="ruby-value str">'b1'</span>,<span class="ruby-value str">'b2'</span>]
|
387
|
+
<span class="ruby-ivar">@addr_indexes</span> = [<span class="ruby-value">1</span>,<span class="ruby-value">1</span>]
|
388
|
+
<span class="ruby-ivar">@offset_indexes</span> = [<span class="ruby-value">1</span>,<span class="ruby-value">1</span>]
|
389
|
+
<span class="ruby-keyword kw">end</span>
|
390
|
+
|
391
|
+
<span class="ruby-identifier">set_hosts_byname</span>(<span class="ruby-ivar">@hosts</span>, <span class="ruby-ivar">@addr_indexes</span>, <span class="ruby-ivar">@offset_indexes</span>)
|
392
|
+
<span class="ruby-keyword kw">end</span>
|
393
|
+
</pre>
|
394
|
+
</div>
|
395
|
+
</div>
|
396
|
+
</div>
|
397
|
+
|
398
|
+
<div id="method-M000187" class="method-detail">
|
399
|
+
<a name="M000187"></a>
|
400
|
+
|
401
|
+
<div class="method-heading">
|
402
|
+
<a href="#M000187" class="method-signature">
|
403
|
+
<span class="method-name">dump_status</span><span class="method-args">(status, msl)</span>
|
404
|
+
</a>
|
405
|
+
</div>
|
406
|
+
|
407
|
+
<div class="method-description">
|
408
|
+
<p><a class="source-toggle" href="#"
|
409
|
+
onclick="toggleCode('M000187-source');return false;">[Source]</a></p>
|
410
|
+
<div class="method-source-code" id="M000187-source">
|
411
|
+
<pre>
|
412
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 295</span>
|
413
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dump_status</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">msl</span>)
|
414
|
+
<span class="ruby-identifier">filename</span> = <span class="ruby-value str">"app_id_status.json"</span>
|
415
|
+
<span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">"a"</span>)
|
416
|
+
<span class="ruby-identifier">status</span>[<span class="ruby-value str">"filename"</span>] = <span class="ruby-identifier">msl</span>
|
417
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">pretty_generate</span>(<span class="ruby-identifier">status</span>)
|
418
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">","</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">zero?</span>(<span class="ruby-identifier">f</span>) <span class="ruby-comment cmt"># if appending, we need to insert a comma</span>
|
419
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">str</span>)
|
420
|
+
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">close</span>
|
421
|
+
<span class="ruby-keyword kw">end</span>
|
422
|
+
</pre>
|
423
|
+
</div>
|
424
|
+
</div>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
<div id="method-M000192" class="method-detail">
|
428
|
+
<a name="M000192"></a>
|
429
|
+
|
430
|
+
<div class="method-heading">
|
431
|
+
<a href="#M000192" class="method-signature">
|
432
|
+
<span class="method-name">help</span><span class="method-args">()</span>
|
433
|
+
</a>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
<div class="method-description">
|
437
|
+
<p><a class="source-toggle" href="#"
|
438
|
+
onclick="toggleCode('M000192-source');return false;">[Source]</a></p>
|
439
|
+
<div class="method-source-code" id="M000192-source">
|
440
|
+
<pre>
|
441
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 479</span>
|
442
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
|
443
|
+
<span class="ruby-identifier">helps</span> = [
|
444
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-c'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--csv'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'name of the csv testset to run'</span> },
|
445
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-d'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--dir'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'directory containing the scenario file'</span> },
|
446
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-f'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--default_host'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'default_host setting'</span> },
|
447
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-h'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--help'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'help on command line options'</span> },
|
448
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-i'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--interfaces'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'comma-separated list of interfaces, e.g. b1,b2 or b1-1000,b2 for ip range'</span> },
|
449
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-m'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--mu_string'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'user, password, mu_ip in the form of admin:admin@10.9.8.7'</span> },
|
450
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-o'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--output'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'output logging to this file'</span> },
|
451
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-p'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--pattern'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'pattern in the form of comma-separated concurrency_start-end:duration patterns, e.g. 1-100:60,100-100:60,100-1:60'</span> },
|
452
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-s'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--scenario'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'<string>'</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'scenario file to run'</span> },
|
453
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-t'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--test'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'do verify only'</span> },
|
454
|
+
{ <span class="ruby-identifier">:short</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'-v'</span>, <span class="ruby-identifier">:long</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'--verbose'</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-value str">''</span>, <span class="ruby-identifier">:help</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'set Logger::DEBUG level'</span> }
|
455
|
+
]
|
456
|
+
|
457
|
+
<span class="ruby-identifier">cmds</span> = [
|
458
|
+
<span class="ruby-value str">"mu cmd_runscale:help"</span>,
|
459
|
+
<span class="ruby-value str">"mu cmd_runscale:run_file -s <scenario> -i <hosts, e.g. a1,dell-9> -p <pattern, e.g. 1-1000:30>"</span>,
|
460
|
+
<span class="ruby-value str">"mu cmd_runscale:run_dir -d <scenario_directory>"</span>,
|
461
|
+
<span class="ruby-value str">"mu cmd_runscale:running?"</span>
|
462
|
+
]
|
463
|
+
|
464
|
+
<span class="ruby-identifier">max_long_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:long</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
|
465
|
+
<span class="ruby-identifier">max_value_size</span> = <span class="ruby-identifier">helps</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, <span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> [ <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">size</span>, <span class="ruby-identifier">memo</span> ].<span class="ruby-identifier">max</span> }
|
466
|
+
<span class="ruby-identifier">puts</span>
|
467
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Usage: mu cmd_runscale:<command> <options>"</span>
|
468
|
+
<span class="ruby-identifier">puts</span>
|
469
|
+
<span class="ruby-identifier">helps</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span>
|
470
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"%-*s %*s %-*s %s"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">max_long_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:long</span>], <span class="ruby-value">2</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:short</span>], <span class="ruby-identifier">max_value_size</span>, <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:value</span>], <span class="ruby-identifier">h</span>[<span class="ruby-identifier">:help</span>]]
|
471
|
+
<span class="ruby-keyword kw">end</span>
|
472
|
+
<span class="ruby-identifier">puts</span>
|
473
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Available Commands"</span>
|
474
|
+
<span class="ruby-identifier">puts</span>
|
475
|
+
<span class="ruby-identifier">cmds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">|</span>
|
476
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">c</span>
|
477
|
+
<span class="ruby-keyword kw">end</span>
|
478
|
+
<span class="ruby-identifier">puts</span>
|
479
|
+
<span class="ruby-keyword kw">end</span>
|
480
|
+
</pre>
|
481
|
+
</div>
|
482
|
+
</div>
|
483
|
+
</div>
|
484
|
+
|
485
|
+
<div id="method-M000188" class="method-detail">
|
486
|
+
<a name="M000188"></a>
|
487
|
+
|
488
|
+
<div class="method-heading">
|
489
|
+
<a href="#M000188" class="method-signature">
|
490
|
+
<span class="method-name">output_csv</span><span class="method-args">(msl_file)</span>
|
491
|
+
</a>
|
492
|
+
</div>
|
493
|
+
|
494
|
+
<div class="method-description">
|
495
|
+
<p><a class="source-toggle" href="#"
|
496
|
+
onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
|
497
|
+
<div class="method-source-code" id="M000188-source">
|
498
|
+
<pre>
|
499
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 305</span>
|
500
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_csv</span>(<span class="ruby-identifier">msl_file</span>)
|
501
|
+
<span class="ruby-identifier">filename</span> = <span class="ruby-value str">"app_id_stats.csv"</span>
|
502
|
+
<span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">"a"</span>)
|
503
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-node">"#{msl_file},#{@executed},#{@errors.to_i},#{@timeouts.to_i},#{@client_tx_bytes},#{@client_tx_msgs},#{@client_rx_bytes},#{@client_rx_msgs},#{@server_tx_bytes},#{@server_tx_msgs},#{@server_rx_bytes},#{@server_rx_msgs}\n"</span>
|
504
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">'a'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">doc</span>) }
|
505
|
+
<span class="ruby-keyword kw">end</span>
|
506
|
+
</pre>
|
507
|
+
</div>
|
508
|
+
</div>
|
509
|
+
</div>
|
510
|
+
|
511
|
+
<div id="method-M000191" class="method-detail">
|
512
|
+
<a name="M000191"></a>
|
513
|
+
|
514
|
+
<div class="method-heading">
|
515
|
+
<a href="#M000191" class="method-signature">
|
516
|
+
<span class="method-name">parse_cli</span><span class="method-args">(argv)</span>
|
517
|
+
</a>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div class="method-description">
|
521
|
+
<p><a class="source-toggle" href="#"
|
522
|
+
onclick="toggleCode('M000191-source');return false;">[Source]</a></p>
|
523
|
+
<div class="method-source-code" id="M000191-source">
|
524
|
+
<pre>
|
525
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 389</span>
|
526
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
|
527
|
+
<span class="ruby-ivar">@hash</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
528
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">empty?</span>
|
529
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'-'</span>
|
530
|
+
|
531
|
+
<span class="ruby-identifier">k</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
|
532
|
+
|
533
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-c'</span>, <span class="ruby-value str">'--csv'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
534
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'testset'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
535
|
+
<span class="ruby-keyword kw">next</span>
|
536
|
+
<span class="ruby-keyword kw">end</span>
|
537
|
+
|
538
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-d'</span>, <span class="ruby-value str">'--dir'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
539
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'dir'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
540
|
+
<span class="ruby-keyword kw">next</span>
|
541
|
+
<span class="ruby-keyword kw">end</span>
|
542
|
+
|
543
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-f'</span>, <span class="ruby-value str">'--default_host'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
544
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'default_host'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
545
|
+
<span class="ruby-keyword kw">next</span>
|
546
|
+
<span class="ruby-keyword kw">end</span>
|
547
|
+
|
548
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-i'</span>, <span class="ruby-value str">'--interfaces'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
549
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'interfaces'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
550
|
+
<span class="ruby-keyword kw">next</span>
|
551
|
+
<span class="ruby-keyword kw">end</span>
|
552
|
+
|
553
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-h'</span>, <span class="ruby-value str">'--help'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
554
|
+
<span class="ruby-identifier">help</span>
|
555
|
+
<span class="ruby-identifier">exit</span>
|
556
|
+
<span class="ruby-keyword kw">end</span>
|
557
|
+
|
558
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-m'</span>, <span class="ruby-value str">'--mu_string'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
559
|
+
<span class="ruby-identifier">mu_string</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
560
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mu_string</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.+?):(.+?)@(.*)/</span>
|
561
|
+
<span class="ruby-ivar">@@mu_admin_user</span> = <span class="ruby-identifier">$1</span>
|
562
|
+
<span class="ruby-ivar">@@mu_admin_pass</span> = <span class="ruby-identifier">$2</span>
|
563
|
+
<span class="ruby-ivar">@@mu_ip</span> = <span class="ruby-identifier">$3</span>
|
564
|
+
<span class="ruby-keyword kw">end</span>
|
565
|
+
<span class="ruby-keyword kw">next</span>
|
566
|
+
<span class="ruby-keyword kw">end</span>
|
567
|
+
|
568
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-o'</span>, <span class="ruby-value str">'--output'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
569
|
+
<span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">reopen</span>(<span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>), <span class="ruby-value str">"w"</span>)
|
570
|
+
<span class="ruby-keyword kw">next</span>
|
571
|
+
<span class="ruby-keyword kw">end</span>
|
572
|
+
|
573
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-p'</span>, <span class="ruby-value str">'--pattern'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
574
|
+
<span class="ruby-identifier">patterns</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
575
|
+
<span class="ruby-identifier">pattern_string</span> = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
576
|
+
<span class="ruby-identifier">pstrings</span> = <span class="ruby-identifier">pattern_string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
577
|
+
<span class="ruby-identifier">pstrings</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">|</span>
|
578
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.+?)-(.+?):(.*)/</span> <span class="ruby-comment cmt"># e.g. 1-10000:60</span>
|
579
|
+
<span class="ruby-identifier">start_vol</span> = <span class="ruby-identifier">$1</span>
|
580
|
+
<span class="ruby-identifier">end_vol</span> = <span class="ruby-identifier">$2</span>
|
581
|
+
<span class="ruby-identifier">duration</span> = <span class="ruby-identifier">$3</span>
|
582
|
+
<span class="ruby-identifier">patterns</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"{\"iterations\":1, \"end\":#{end_vol}, \"start\":#{start_vol}, \"duration\":#{duration} }"</span>
|
583
|
+
<span class="ruby-keyword kw">end</span>
|
584
|
+
<span class="ruby-keyword kw">end</span>
|
585
|
+
<span class="ruby-identifier">ps</span> = <span class="ruby-value str">"{ \"iterations\": 1, \"intervals\": ["</span>
|
586
|
+
<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">|</span>
|
587
|
+
<span class="ruby-identifier">ps</span> = <span class="ruby-identifier">ps</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">p</span> <span class="ruby-operator">+</span> <span class="ruby-value str">","</span>
|
588
|
+
<span class="ruby-keyword kw">end</span>
|
589
|
+
<span class="ruby-identifier">ps</span> = <span class="ruby-identifier">ps</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">ps</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>] <span class="ruby-comment cmt"># remove final comma</span>
|
590
|
+
<span class="ruby-identifier">ps</span> = <span class="ruby-identifier">ps</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"] }"</span>
|
591
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'pattern'</span>] = <span class="ruby-identifier">ps</span>
|
592
|
+
<span class="ruby-keyword kw">next</span>
|
593
|
+
<span class="ruby-keyword kw">end</span>
|
594
|
+
|
595
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-s'</span>, <span class="ruby-value str">'--scenario'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
596
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'scenario'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
597
|
+
<span class="ruby-keyword kw">next</span>
|
598
|
+
<span class="ruby-keyword kw">end</span>
|
599
|
+
|
600
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-t'</span>, <span class="ruby-value str">'--test'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
601
|
+
<span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'test'</span>] = <span class="ruby-keyword kw">true</span>
|
602
|
+
<span class="ruby-keyword kw">next</span>
|
603
|
+
<span class="ruby-keyword kw">end</span>
|
604
|
+
|
605
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-v'</span>, <span class="ruby-value str">'--verbose'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
606
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">level</span> = <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
607
|
+
<span class="ruby-keyword kw">next</span>
|
608
|
+
<span class="ruby-keyword kw">end</span>
|
609
|
+
|
610
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Unknown option #{k}"</span>
|
611
|
+
<span class="ruby-keyword kw">end</span>
|
612
|
+
|
613
|
+
<span class="ruby-ivar">@hash</span>
|
614
|
+
<span class="ruby-keyword kw">end</span>
|
615
|
+
</pre>
|
616
|
+
</div>
|
617
|
+
</div>
|
618
|
+
</div>
|
619
|
+
|
620
|
+
<div id="method-M000190" class="method-detail">
|
621
|
+
<a name="M000190"></a>
|
622
|
+
|
623
|
+
<div class="method-heading">
|
624
|
+
<a href="#M000190" class="method-signature">
|
625
|
+
<span class="method-name">parse_status</span><span class="method-args">(status)</span>
|
626
|
+
</a>
|
627
|
+
</div>
|
628
|
+
|
629
|
+
<div class="method-description">
|
630
|
+
<p><a class="source-toggle" href="#"
|
631
|
+
onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
|
632
|
+
<div class="method-source-code" id="M000190-source">
|
633
|
+
<pre>
|
634
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 336</span>
|
635
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_status</span>(<span class="ruby-identifier">status</span>)
|
636
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">nil?</span>
|
637
|
+
<span class="ruby-ivar">@reported_volume</span> = <span class="ruby-value">0</span>
|
638
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"error"</span>].<span class="ruby-identifier">nil?</span>
|
639
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"error"</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
|
640
|
+
<span class="ruby-ivar">@error</span> = <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"error"</span>]
|
641
|
+
<span class="ruby-ivar">@reason</span> = <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"reason"</span>]
|
642
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"*** Error = #{@error}, reason = #{@reason} ***\n\n"</span>
|
643
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
644
|
+
<span class="ruby-keyword kw">end</span>
|
645
|
+
<span class="ruby-keyword kw">end</span>
|
646
|
+
|
647
|
+
<span class="ruby-ivar">@stats_summary</span> = <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"statistics"</span>][<span class="ruby-value str">"summary"</span>]
|
648
|
+
<span class="ruby-ivar">@duration</span> = <span class="ruby-ivar">@stats_summary</span>[<span class="ruby-value str">"duration"</span>]
|
649
|
+
<span class="ruby-ivar">@instances</span> = <span class="ruby-ivar">@stats_summary</span>[<span class="ruby-value str">"instances"</span>]
|
650
|
+
<span class="ruby-ivar">@total_instances</span> = <span class="ruby-ivar">@instances</span>[<span class="ruby-value str">"total"</span>]
|
651
|
+
<span class="ruby-ivar">@executed</span> = <span class="ruby-ivar">@instances</span>[<span class="ruby-value str">"executed"</span>]
|
652
|
+
<span class="ruby-ivar">@timeouts</span> = <span class="ruby-ivar">@instances</span>[<span class="ruby-value str">"timeouts"</span>]
|
653
|
+
<span class="ruby-ivar">@errors</span> = <span class="ruby-ivar">@instances</span>[<span class="ruby-value str">"errors"</span>]
|
654
|
+
<span class="ruby-ivar">@asserts_failed</span> = <span class="ruby-ivar">@stats_summary</span>[<span class="ruby-value str">"asserts"</span>][<span class="ruby-value str">"failed"</span>]
|
655
|
+
<span class="ruby-ivar">@server</span> = <span class="ruby-ivar">@stats_summary</span>[<span class="ruby-value str">"server"</span>]
|
656
|
+
<span class="ruby-ivar">@server_tx_bytes</span> = <span class="ruby-ivar">@server</span>[<span class="ruby-value str">"tx"</span>][<span class="ruby-value str">"bytes"</span>]
|
657
|
+
<span class="ruby-ivar">@server_tx_msgs</span> = <span class="ruby-ivar">@server</span>[<span class="ruby-value str">"tx"</span>][<span class="ruby-value str">"msgs"</span>]
|
658
|
+
<span class="ruby-ivar">@server_rx_bytes</span> = <span class="ruby-ivar">@server</span>[<span class="ruby-value str">"rx"</span>][<span class="ruby-value str">"bytes"</span>]
|
659
|
+
<span class="ruby-ivar">@server_rx_msgs</span> = <span class="ruby-ivar">@server</span>[<span class="ruby-value str">"rx"</span>][<span class="ruby-value str">"msgs"</span>]
|
660
|
+
<span class="ruby-ivar">@client</span> = <span class="ruby-ivar">@stats_summary</span>[<span class="ruby-value str">"client"</span>]
|
661
|
+
<span class="ruby-ivar">@client_tx_bytes</span> = <span class="ruby-ivar">@client</span>[<span class="ruby-value str">"tx"</span>][<span class="ruby-value str">"bytes"</span>]
|
662
|
+
<span class="ruby-ivar">@client_tx_msgs</span> = <span class="ruby-ivar">@client</span>[<span class="ruby-value str">"tx"</span>][<span class="ruby-value str">"msgs"</span>]
|
663
|
+
<span class="ruby-ivar">@client_rx_bytes</span> = <span class="ruby-ivar">@client</span>[<span class="ruby-value str">"rx"</span>][<span class="ruby-value str">"bytes"</span>]
|
664
|
+
<span class="ruby-ivar">@client_rx_msgs</span> = <span class="ruby-ivar">@client</span>[<span class="ruby-value str">"rx"</span>][<span class="ruby-value str">"msgs"</span>]
|
665
|
+
<span class="ruby-ivar">@scenarios</span> = <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"statistics"</span>][<span class="ruby-value str">"scenarios"</span>]
|
666
|
+
<span class="ruby-ivar">@scenarios</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">scenario</span> <span class="ruby-operator">|</span>
|
667
|
+
<span class="ruby-ivar">@reported_volume</span> = <span class="ruby-ivar">@reported_volume</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">scenario</span>[<span class="ruby-value str">"volume"</span>]
|
668
|
+
<span class="ruby-keyword kw">end</span>
|
669
|
+
|
670
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">""</span>
|
671
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"duration: #{format_float(2, @duration)}"</span>
|
672
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"concurrency: #{@reported_volume}"</span>
|
673
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"tests/sec: #{format_float(2, @executed.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
674
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"passed: #{@executed}"</span>
|
675
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"errors: #{@errors}"</span>
|
676
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"timeouts: #{@timeouts}"</span>
|
677
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"client tx bytes/sec #{format_float(2, @client_tx_bytes.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
678
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"client tx msgs/sec #{format_float(2, @client_tx_msgs.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
679
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"client rx bytes/sec #{format_float(2, @client_rx_bytes.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
680
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"client rx msgs/sec #{format_float(2, @client_rx_msgs.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
681
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"server tx bytes/sec #{format_float(2, @server_tx_bytes.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
682
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"server tx msgs/sec #{format_float(2, @server_tx_msgs.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
683
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"server rx bytes/sec #{format_float(2, @server_rx_bytes.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
684
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"server rx msgs/sec #{format_float(2, @server_rx_msgs.to_f / @duration)}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@duration</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
685
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">""</span>
|
686
|
+
<span class="ruby-keyword kw">end</span>
|
687
|
+
</pre>
|
688
|
+
</div>
|
689
|
+
</div>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
<div id="method-M000189" class="method-detail">
|
693
|
+
<a name="M000189"></a>
|
694
|
+
|
695
|
+
<div class="method-heading">
|
696
|
+
<a href="#M000189" class="method-signature">
|
697
|
+
<span class="method-name">parse_verify_response</span><span class="method-args">(response)</span>
|
698
|
+
</a>
|
699
|
+
</div>
|
700
|
+
|
701
|
+
<div class="method-description">
|
702
|
+
<p><a class="source-toggle" href="#"
|
703
|
+
onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
|
704
|
+
<div class="method-source-code" id="M000189-source">
|
705
|
+
<pre>
|
706
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 312</span>
|
707
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_verify_response</span>(<span class="ruby-identifier">response</span>)
|
708
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment cmt"># || response.empty?</span>
|
709
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"*** error = no response received from /verify ***\n\n"</span>
|
710
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
711
|
+
<span class="ruby-keyword kw">end</span>
|
712
|
+
<span class="ruby-keyword kw">begin</span>
|
713
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">pretty_generate</span>(<span class="ruby-identifier">response</span>), <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
714
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">response</span>[<span class="ruby-value str">"status"</span>].<span class="ruby-identifier">nil?</span>
|
715
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"error"</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
|
716
|
+
<span class="ruby-ivar">@error</span> = <span class="ruby-identifier">response</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"error"</span>]
|
717
|
+
<span class="ruby-ivar">@reason</span> = <span class="ruby-identifier">response</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"reason"</span>]
|
718
|
+
<span class="ruby-identifier">dump_status</span>(<span class="ruby-identifier">response</span>)
|
719
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"*** Error = #{@error}, reason = #{@reason} ***\n\n"</span>
|
720
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
721
|
+
<span class="ruby-keyword kw">end</span>
|
722
|
+
<span class="ruby-keyword kw">end</span>
|
723
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"*** verify: okay ***"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
724
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-value str">"*** verify: okay ***"</span>
|
725
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
726
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">e</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
727
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
728
|
+
<span class="ruby-keyword kw">end</span>
|
729
|
+
<span class="ruby-keyword kw">end</span>
|
730
|
+
</pre>
|
731
|
+
</div>
|
732
|
+
</div>
|
733
|
+
</div>
|
734
|
+
|
735
|
+
<div id="method-M000182" class="method-detail">
|
736
|
+
<a name="M000182"></a>
|
737
|
+
|
738
|
+
<div class="method-heading">
|
739
|
+
<a href="#M000182" class="method-signature">
|
740
|
+
<span class="method-name">run</span><span class="method-args">(scenario)</span>
|
741
|
+
</a>
|
742
|
+
</div>
|
743
|
+
|
744
|
+
<div class="method-description">
|
745
|
+
<p><a class="source-toggle" href="#"
|
746
|
+
onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
|
747
|
+
<div class="method-source-code" id="M000182-source">
|
748
|
+
<pre>
|
749
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 123</span>
|
750
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">scenario</span>)
|
751
|
+
<span class="ruby-comment cmt"># assume the scenario and testset files are in dir unless they contain '/'</span>
|
752
|
+
<span class="ruby-comment cmt"># in which case they are assumed to be absolute paths</span>
|
753
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scenario</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"/"</span>)
|
754
|
+
<span class="ruby-identifier">musl_file</span> = <span class="ruby-identifier">scenario</span>
|
755
|
+
<span class="ruby-keyword kw">else</span>
|
756
|
+
<span class="ruby-identifier">musl_file</span> = <span class="ruby-ivar">@params</span>[<span class="ruby-value str">"dir"</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">scenario</span>
|
757
|
+
<span class="ruby-keyword kw">end</span>
|
758
|
+
<span class="ruby-comment cmt"># msg musl_file, Logger::DEBUG</span>
|
759
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-value str">"musl"</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">musl_file</span>))
|
760
|
+
|
761
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@testset</span>.<span class="ruby-identifier">empty?</span>
|
762
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@testset</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"/"</span>)
|
763
|
+
<span class="ruby-identifier">csv_file</span> = <span class="ruby-ivar">@testset</span>
|
764
|
+
<span class="ruby-keyword kw">else</span>
|
765
|
+
<span class="ruby-identifier">csv_file</span> = <span class="ruby-ivar">@params</span>[<span class="ruby-value str">"dir"</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@testset</span>
|
766
|
+
<span class="ruby-keyword kw">end</span>
|
767
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-value str">"csv"</span>, <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">csv_file</span>))
|
768
|
+
<span class="ruby-keyword kw">end</span>
|
769
|
+
|
770
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"app_id_status.json"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-value str">"app_id_status.json"</span>)
|
771
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"app_id_stats.csv"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-value str">"app_id_stats.csv"</span>)
|
772
|
+
|
773
|
+
<span class="ruby-identifier">configure_hosts</span>
|
774
|
+
|
775
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"verifying #{scenario} ..."</span>
|
776
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">verify</span>
|
777
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">response</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
778
|
+
<span class="ruby-comment cmt"># sleep 3</span>
|
779
|
+
<span class="ruby-identifier">v</span> = <span class="ruby-identifier">parse_verify_response</span>(<span class="ruby-identifier">response</span>)
|
780
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"#{v}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
781
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span>
|
782
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"error in verify"</span>
|
783
|
+
<span class="ruby-keyword kw">return</span>
|
784
|
+
<span class="ruby-keyword kw">end</span>
|
785
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verify_only</span>
|
786
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">v</span>
|
787
|
+
<span class="ruby-keyword kw">return</span>
|
788
|
+
<span class="ruby-keyword kw">end</span>
|
789
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"starting #{scenario} ..."</span>
|
790
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">start</span>
|
791
|
+
<span class="ruby-identifier">start_time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
|
792
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
793
|
+
<span class="ruby-identifier">sleep</span> <span class="ruby-value">5</span>
|
794
|
+
<span class="ruby-identifier">status</span> = <span class="ruby-ivar">@api</span>.<span class="ruby-identifier">status</span>
|
795
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">status</span>.<span class="ruby-identifier">nil?</span>
|
796
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>].<span class="ruby-identifier">nil?</span>
|
797
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span>[<span class="ruby-value str">"status"</span>][<span class="ruby-value str">"running"</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
|
798
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"running = #{status["status"]["running"]}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
799
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">parse_status</span>(<span class="ruby-identifier">status</span>)
|
800
|
+
<span class="ruby-identifier">dump_status</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">musl_file</span>)
|
801
|
+
<span class="ruby-keyword kw">return</span>
|
802
|
+
<span class="ruby-keyword kw">else</span>
|
803
|
+
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">parse_status</span>(<span class="ruby-identifier">status</span>)
|
804
|
+
<span class="ruby-keyword kw">end</span>
|
805
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># status['status'].nil? ... no bonafide status was returned</span>
|
806
|
+
<span class="ruby-identifier">time_now</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_i</span>
|
807
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time_now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">start_time</span> <span class="ruby-operator">></span> <span class="ruby-value">20</span>
|
808
|
+
<span class="ruby-comment cmt"># puts "\nError: timing out after 20 seconds. Test had failed to start or verify"</span>
|
809
|
+
<span class="ruby-keyword kw">break</span>
|
810
|
+
<span class="ruby-keyword kw">end</span>
|
811
|
+
<span class="ruby-keyword kw">end</span>
|
812
|
+
<span class="ruby-keyword kw">end</span>
|
813
|
+
<span class="ruby-keyword kw">end</span>
|
814
|
+
<span class="ruby-keyword kw">ensure</span>
|
815
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"stopping #{scenario} ..."</span>
|
816
|
+
<span class="ruby-keyword kw">end</span>
|
817
|
+
</pre>
|
818
|
+
</div>
|
819
|
+
</div>
|
820
|
+
</div>
|
821
|
+
|
822
|
+
<div id="method-M000186" class="method-detail">
|
823
|
+
<a name="M000186"></a>
|
824
|
+
|
825
|
+
<div class="method-heading">
|
826
|
+
<a href="#M000186" class="method-signature">
|
827
|
+
<span class="method-name">set_hosts</span><span class="method-args">(hosts=["b1","b2"])</span>
|
828
|
+
</a>
|
829
|
+
</div>
|
830
|
+
|
831
|
+
<div class="method-description">
|
832
|
+
<p>
|
833
|
+
expects full strings: e.g. b1/12.89.0.1 …
|
834
|
+
</p>
|
835
|
+
<p><a class="source-toggle" href="#"
|
836
|
+
onclick="toggleCode('M000186-source');return false;">[Source]</a></p>
|
837
|
+
<div class="method-source-code" id="M000186-source">
|
838
|
+
<pre>
|
839
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 269</span>
|
840
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_hosts</span>(<span class="ruby-identifier">hosts</span>=[<span class="ruby-value str">"b1"</span>,<span class="ruby-value str">"b2"</span>])
|
841
|
+
<span class="ruby-identifier">host_params</span> = {}
|
842
|
+
|
843
|
+
<span class="ruby-comment cmt"># assign hosts to consecutive string keys, host_0, host_1, etc ...</span>
|
844
|
+
<span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">|</span>
|
845
|
+
<span class="ruby-identifier">host_params</span>[<span class="ruby-node">"host_#{i}"</span>] = <span class="ruby-identifier">hosts</span>[<span class="ruby-identifier">i</span>]
|
846
|
+
<span class="ruby-keyword kw">end</span>
|
847
|
+
|
848
|
+
<span class="ruby-comment cmt"># convert keys to symbols</span>
|
849
|
+
<span class="ruby-comment cmt"># host_params.each_key { |k| host_params[k.to_sym] = host_params[k] }</span>
|
850
|
+
<span class="ruby-identifier">new_host_params</span> = {}
|
851
|
+
<span class="ruby-identifier">host_params</span>.<span class="ruby-identifier">each_key</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">new_host_params</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">host_params</span>[<span class="ruby-identifier">k</span>] }
|
852
|
+
|
853
|
+
??
|
854
|
+
|
855
|
+
<span class="ruby-ivar">@api</span>.<span class="ruby-identifier">configure</span>(<span class="ruby-value str">"hosts"</span>, <span class="ruby-identifier">new_host_params</span>)
|
856
|
+
|
857
|
+
<span class="ruby-keyword kw">end</span>
|
858
|
+
</pre>
|
859
|
+
</div>
|
860
|
+
</div>
|
861
|
+
</div>
|
862
|
+
|
863
|
+
<div id="method-M000185" class="method-detail">
|
864
|
+
<a name="M000185"></a>
|
865
|
+
|
866
|
+
<div class="method-heading">
|
867
|
+
<a href="#M000185" class="method-signature">
|
868
|
+
<span class="method-name">set_hosts_byname</span><span class="method-args">(hosts=@hosts, count=[1,1], offset=[1,1], v4=true)</span>
|
869
|
+
</a>
|
870
|
+
</div>
|
871
|
+
|
872
|
+
<div class="method-description">
|
873
|
+
<p><a class="source-toggle" href="#"
|
874
|
+
onclick="toggleCode('M000185-source');return false;">[Source]</a></p>
|
875
|
+
<div class="method-source-code" id="M000185-source">
|
876
|
+
<pre>
|
877
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 241</span>
|
878
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_hosts_byname</span>(<span class="ruby-identifier">hosts</span>=<span class="ruby-ivar">@hosts</span>, <span class="ruby-identifier">count</span>=[<span class="ruby-value">1</span>,<span class="ruby-value">1</span>], <span class="ruby-identifier">offset</span>=[<span class="ruby-value">1</span>,<span class="ruby-value">1</span>], <span class="ruby-identifier">v4</span>=<span class="ruby-keyword kw">true</span>)
|
879
|
+
<span class="ruby-identifier">new_hosts</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
880
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">""</span>
|
881
|
+
<span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
882
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^[ab][1-4]$/</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"."</span>) <span class="ruby-comment cmt"># possible vlan</span>
|
883
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">count</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">count</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">nil?</span>
|
884
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-node">"#{n}/*"</span>
|
885
|
+
<span class="ruby-keyword kw">else</span>
|
886
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-node">"#{n}/*,#{count[i]},#{offset[i]}"</span>
|
887
|
+
<span class="ruby-keyword kw">end</span>
|
888
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"using host #{str}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
889
|
+
<span class="ruby-keyword kw">else</span>
|
890
|
+
<span class="ruby-ivar">@net</span> = <span class="ruby-constant">Netconfig</span>.<span class="ruby-identifier">new</span>
|
891
|
+
<span class="ruby-ivar">@net</span>.<span class="ruby-identifier">setup</span>(<span class="ruby-ivar">@hosts</span>, <span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>)
|
892
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v4</span>
|
893
|
+
<span class="ruby-identifier">addr</span> = <span class="ruby-ivar">@net</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"hosts/#{n}"</span>)[<span class="ruby-value str">'v4_addr'</span>]
|
894
|
+
<span class="ruby-keyword kw">else</span>
|
895
|
+
<span class="ruby-identifier">addr</span> = <span class="ruby-ivar">@net</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">"hosts/#{n}"</span>)[<span class="ruby-value str">'v6_addr'</span>]
|
896
|
+
<span class="ruby-keyword kw">end</span>
|
897
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-node">"#{addr}"</span>
|
898
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"using host #{str}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
899
|
+
<span class="ruby-keyword kw">end</span>
|
900
|
+
<span class="ruby-identifier">new_hosts</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
901
|
+
<span class="ruby-keyword kw">end</span>
|
902
|
+
<span class="ruby-identifier">set_hosts</span>(<span class="ruby-identifier">new_hosts</span>)
|
903
|
+
<span class="ruby-keyword kw">end</span>
|
904
|
+
</pre>
|
905
|
+
</div>
|
906
|
+
</div>
|
907
|
+
</div>
|
908
|
+
|
909
|
+
<div id="method-M000181" class="method-detail">
|
910
|
+
<a name="M000181"></a>
|
911
|
+
|
912
|
+
<div class="method-heading">
|
913
|
+
<a href="#M000181" class="method-signature">
|
914
|
+
<span class="method-name">setup</span><span class="method-args">(argv)</span>
|
915
|
+
</a>
|
916
|
+
</div>
|
917
|
+
|
918
|
+
<div class="method-description">
|
919
|
+
<p><a class="source-toggle" href="#"
|
920
|
+
onclick="toggleCode('M000181-source');return false;">[Source]</a></p>
|
921
|
+
<div class="method-source-code" id="M000181-source">
|
922
|
+
<pre>
|
923
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runscale.rb, line 93</span>
|
924
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span> <span class="ruby-identifier">argv</span>
|
925
|
+
<span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
|
926
|
+
<span class="ruby-ivar">@params</span> = {}
|
927
|
+
|
928
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'test'</span>]
|
929
|
+
<span class="ruby-ivar">@verify_only</span> = <span class="ruby-keyword kw">true</span>
|
930
|
+
<span class="ruby-keyword kw">else</span>
|
931
|
+
<span class="ruby-ivar">@verify_only</span> = <span class="ruby-keyword kw">false</span>
|
932
|
+
<span class="ruby-keyword kw">end</span>
|
933
|
+
|
934
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'testset'</span>]
|
935
|
+
<span class="ruby-ivar">@testset</span> = <span class="ruby-value str">""</span>
|
936
|
+
<span class="ruby-keyword kw">else</span>
|
937
|
+
<span class="ruby-ivar">@testset</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'testset'</span>]
|
938
|
+
<span class="ruby-keyword kw">end</span>
|
939
|
+
|
940
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'pattern'</span>]
|
941
|
+
<span class="ruby-ivar">@cmd_line_pattern</span> = <span class="ruby-value str">"{ \"iterations\": 1, \"intervals\": [ {\"iterations\":1, \"end\":100, \"start\":1, \"duration\":20 } ] }"</span>
|
942
|
+
<span class="ruby-keyword kw">else</span>
|
943
|
+
<span class="ruby-ivar">@cmd_line_pattern</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'pattern'</span>]
|
944
|
+
<span class="ruby-keyword kw">end</span>
|
945
|
+
|
946
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'interfaces'</span>]
|
947
|
+
<span class="ruby-ivar">@cmd_line_hosts</span> = <span class="ruby-value str">"b1,b2"</span>
|
948
|
+
<span class="ruby-keyword kw">else</span>
|
949
|
+
<span class="ruby-ivar">@cmd_line_hosts</span> = <span class="ruby-ivar">@hash</span>[<span class="ruby-value str">'interfaces'</span>]
|
950
|
+
<span class="ruby-keyword kw">end</span>
|
951
|
+
|
952
|
+
<span class="ruby-keyword kw">end</span>
|
953
|
+
</pre>
|
954
|
+
</div>
|
955
|
+
</div>
|
956
|
+
</div>
|
957
|
+
|
958
|
+
|
959
|
+
</div>
|
960
|
+
|
961
|
+
|
962
|
+
</div>
|
963
|
+
|
964
|
+
|
965
|
+
<div id="validator-badges">
|
966
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
967
|
+
</div>
|
968
|
+
|
969
|
+
</body>
|
970
|
+
</html>
|