mu 5.7.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,621 @@
|
|
|
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_runverify</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_runverify</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_runverify_rb.html">
|
|
59
|
+
lib/mu/command/cmd_runverify.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="#M000248">cmd_help</a>
|
|
90
|
+
<a href="#M000249">cmd_run</a>
|
|
91
|
+
<a href="#M000254">help</a>
|
|
92
|
+
<a href="#M000252">output_results</a>
|
|
93
|
+
<a href="#M000253">parse_cli</a>
|
|
94
|
+
<a href="#M000250">setup</a>
|
|
95
|
+
<a href="#M000251">teardown</a>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<!-- if includes -->
|
|
103
|
+
|
|
104
|
+
<div id="section">
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<div id="attribute-list">
|
|
111
|
+
<h3 class="section-bar">Attributes</h3>
|
|
112
|
+
|
|
113
|
+
<div class="name-list">
|
|
114
|
+
<table>
|
|
115
|
+
<tr class="top-aligned-row context-row">
|
|
116
|
+
<td class="context-item-name">ddt_api</td>
|
|
117
|
+
<td class="context-item-value"> [RW] </td>
|
|
118
|
+
<td class="context-item-desc"></td>
|
|
119
|
+
</tr>
|
|
120
|
+
<tr class="top-aligned-row context-row">
|
|
121
|
+
<td class="context-item-name">errors</td>
|
|
122
|
+
<td class="context-item-value"> [RW] </td>
|
|
123
|
+
<td class="context-item-desc"></td>
|
|
124
|
+
</tr>
|
|
125
|
+
<tr class="top-aligned-row context-row">
|
|
126
|
+
<td class="context-item-name">host</td>
|
|
127
|
+
<td class="context-item-value"> [RW] </td>
|
|
128
|
+
<td class="context-item-desc"></td>
|
|
129
|
+
</tr>
|
|
130
|
+
<tr class="top-aligned-row context-row">
|
|
131
|
+
<td class="context-item-name">password</td>
|
|
132
|
+
<td class="context-item-value"> [RW] </td>
|
|
133
|
+
<td class="context-item-desc"></td>
|
|
134
|
+
</tr>
|
|
135
|
+
<tr class="top-aligned-row context-row">
|
|
136
|
+
<td class="context-item-name">username</td>
|
|
137
|
+
<td class="context-item-value"> [RW] </td>
|
|
138
|
+
<td class="context-item-desc"></td>
|
|
139
|
+
</tr>
|
|
140
|
+
</table>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<!-- if method_list -->
|
|
147
|
+
<div id="methods">
|
|
148
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
149
|
+
|
|
150
|
+
<div id="method-M000248" class="method-detail">
|
|
151
|
+
<a name="M000248"></a>
|
|
152
|
+
|
|
153
|
+
<div class="method-heading">
|
|
154
|
+
<a href="#M000248" class="method-signature">
|
|
155
|
+
<span class="method-name">cmd_help</span><span class="method-args">(argv)</span>
|
|
156
|
+
</a>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div class="method-description">
|
|
160
|
+
<p>
|
|
161
|
+
displays command-line <a href="Cmd_runverify.html#M000254">help</a>
|
|
162
|
+
</p>
|
|
163
|
+
<p><a class="source-toggle" href="#"
|
|
164
|
+
onclick="toggleCode('M000248-source');return false;">[Source]</a></p>
|
|
165
|
+
<div class="method-source-code" id="M000248-source">
|
|
166
|
+
<pre>
|
|
167
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 11</span>
|
|
168
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_help</span> <span class="ruby-identifier">argv</span>
|
|
169
|
+
<span class="ruby-identifier">help</span>
|
|
170
|
+
<span class="ruby-keyword kw">end</span>
|
|
171
|
+
</pre>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<div id="method-M000249" class="method-detail">
|
|
177
|
+
<a name="M000249"></a>
|
|
178
|
+
|
|
179
|
+
<div class="method-heading">
|
|
180
|
+
<a href="#M000249" class="method-signature">
|
|
181
|
+
<span class="method-name">cmd_run</span><span class="method-args">(argv)</span>
|
|
182
|
+
</a>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div class="method-description">
|
|
186
|
+
<p>
|
|
187
|
+
sets up, executes, and closes a Studio Verify session
|
|
188
|
+
</p>
|
|
189
|
+
<pre>
|
|
190
|
+
* argv = command-line arguments, requires a scenario (-s) argument, which must be an xml scenario template to be loaded onto the Mu
|
|
191
|
+
* and a testset (-t) argument of an xml test set template to be loaded on the Mu
|
|
192
|
+
* .msl and .csv files are not currently supported
|
|
193
|
+
</pre>
|
|
194
|
+
<p><a class="source-toggle" href="#"
|
|
195
|
+
onclick="toggleCode('M000249-source');return false;">[Source]</a></p>
|
|
196
|
+
<div class="method-source-code" id="M000249-source">
|
|
197
|
+
<pre>
|
|
198
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 19</span>
|
|
199
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd_run</span> <span class="ruby-identifier">argv</span>
|
|
200
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
|
|
201
|
+
<span class="ruby-identifier">setup</span>
|
|
202
|
+
|
|
203
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'scenario'</span>]
|
|
204
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"scenario required"</span>
|
|
205
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
|
206
|
+
<span class="ruby-keyword kw">else</span>
|
|
207
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'scenario'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-value str">".xml"</span>)
|
|
208
|
+
<span class="ruby-identifier">scenario</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'scenario'</span>]
|
|
209
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># TODO: eventually, msl files may be supported by this api</span>
|
|
210
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"only .xml files are currently supported"</span>
|
|
211
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
|
213
|
+
<span class="ruby-keyword kw">end</span>
|
|
214
|
+
|
|
215
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'testset'</span>]
|
|
216
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"testset required"</span>
|
|
217
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
|
218
|
+
<span class="ruby-keyword kw">else</span>
|
|
219
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'testset'</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-value str">".xml"</span>)
|
|
220
|
+
<span class="ruby-identifier">testset</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'testset'</span>]
|
|
221
|
+
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># TODO: eventually, uploading csv files may be supported by this class</span>
|
|
222
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-value str">"only .xml files are currently supported"</span>
|
|
223
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">help</span>
|
|
224
|
+
<span class="ruby-keyword kw">end</span>
|
|
225
|
+
<span class="ruby-keyword kw">end</span>
|
|
226
|
+
|
|
227
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'dir'</span>]
|
|
228
|
+
<span class="ruby-identifier">dir</span> = <span class="ruby-value str">"."</span>
|
|
229
|
+
<span class="ruby-keyword kw">else</span>
|
|
230
|
+
<span class="ruby-identifier">dir</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'dir'</span>]
|
|
231
|
+
<span class="ruby-keyword kw">end</span>
|
|
232
|
+
|
|
233
|
+
<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>)
|
|
234
|
+
<span class="ruby-identifier">scenario_filename</span> = <span class="ruby-identifier">scenario</span>
|
|
235
|
+
<span class="ruby-keyword kw">else</span>
|
|
236
|
+
<span class="ruby-identifier">scenario_filename</span> = <span class="ruby-identifier">dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">scenario</span>
|
|
237
|
+
<span class="ruby-keyword kw">end</span>
|
|
238
|
+
|
|
239
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">testset</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"/"</span>)
|
|
240
|
+
<span class="ruby-identifier">testset_filename</span> = <span class="ruby-identifier">testset</span>
|
|
241
|
+
<span class="ruby-keyword kw">else</span>
|
|
242
|
+
<span class="ruby-identifier">testset_filename</span> = <span class="ruby-identifier">dir</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">testset</span>
|
|
243
|
+
<span class="ruby-keyword kw">end</span>
|
|
244
|
+
|
|
245
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'interfaces'</span>]
|
|
246
|
+
<span class="ruby-ivar">@interfaces</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment cmt"># initialize an empty array</span>
|
|
247
|
+
<span class="ruby-keyword kw">else</span>
|
|
248
|
+
<span class="ruby-ivar">@interfaces</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'interfaces'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
|
249
|
+
<span class="ruby-keyword kw">end</span>
|
|
250
|
+
|
|
251
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'options'</span>]
|
|
252
|
+
<span class="ruby-ivar">@options</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment cmt"># initialize an empty array</span>
|
|
253
|
+
<span class="ruby-keyword kw">else</span>
|
|
254
|
+
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'options'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
|
255
|
+
<span class="ruby-keyword kw">end</span>
|
|
256
|
+
|
|
257
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">args</span>[<span class="ruby-value str">'channels'</span>]
|
|
258
|
+
<span class="ruby-ivar">@arg_channels</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment cmt"># initialize an empty array</span>
|
|
259
|
+
<span class="ruby-keyword kw">else</span>
|
|
260
|
+
<span class="ruby-ivar">@arg_channels</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value str">'channels'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>)
|
|
261
|
+
<span class="ruby-keyword kw">end</span>
|
|
262
|
+
|
|
263
|
+
<span class="ruby-ivar">@errors</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
264
|
+
<span class="ruby-identifier">hosts_array</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
265
|
+
<span class="ruby-identifier">roles_array</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
266
|
+
|
|
267
|
+
<span class="ruby-keyword kw">begin</span>
|
|
268
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">new_session</span>
|
|
269
|
+
|
|
270
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">testset_filename</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
|
271
|
+
<span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">testset_filename</span>)
|
|
272
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">f</span>)
|
|
273
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">post_xml</span>(<span class="ruby-value str">"templates/import"</span>, <span class="ruby-identifier">doc</span>)
|
|
274
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"response from post(#{testset_filename}):\n#{response}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
|
275
|
+
<span class="ruby-identifier">testset_uuid</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//ddt_set"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'uuid'</span>)
|
|
276
|
+
|
|
277
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-identifier">scenario_filename</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
|
278
|
+
<span class="ruby-identifier">f</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">scenario_filename</span>)
|
|
279
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">f</span>)
|
|
280
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">post_xml</span>(<span class="ruby-value str">"templates/import"</span>, <span class="ruby-identifier">doc</span>)
|
|
281
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"response from post(#{scenario_filename}):\n#{response}"</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
|
|
282
|
+
|
|
283
|
+
<span class="ruby-identifier">scenario_name</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//scenario"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'name'</span>)
|
|
284
|
+
<span class="ruby-identifier">hosts</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host"</span>)
|
|
285
|
+
<span class="ruby-identifier">scenario_uuid</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//scenario"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">attribute</span>(<span class="ruby-value str">'uuid'</span>)
|
|
286
|
+
<span class="ruby-identifier">roles</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host/role"</span>)
|
|
287
|
+
<span class="ruby-identifier">ids</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host/id"</span>)
|
|
288
|
+
<span class="ruby-identifier">channels</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//steps/channel"</span>)
|
|
289
|
+
<span class="ruby-identifier">type</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//hosts/host/type"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">text</span>
|
|
290
|
+
|
|
291
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@interfaces</span>.<span class="ruby-identifier">empty?</span>
|
|
292
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@interfaces</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">hosts</span>.<span class="ruby-identifier">size</span>
|
|
293
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"Error. The number of hosts/interfaces specified on the command-line does not equal the number
|
|
294
|
+
of hosts in the template. #{@interfaces.size} != #{hosts.size}"</span>
|
|
295
|
+
<span class="ruby-keyword kw">return</span>
|
|
296
|
+
<span class="ruby-keyword kw">end</span>
|
|
297
|
+
<span class="ruby-keyword kw">end</span>
|
|
298
|
+
|
|
299
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">load_scenario</span>(<span class="ruby-identifier">scenario_uuid</span>)
|
|
300
|
+
|
|
301
|
+
<span class="ruby-identifier">roles</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">r</span>, <span class="ruby-identifier">i</span> <span class="ruby-operator">|</span>
|
|
302
|
+
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">r</span>.<span class="ruby-identifier">content</span>
|
|
303
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@interfaces</span>.<span class="ruby-identifier">empty?</span>
|
|
304
|
+
<span class="ruby-keyword kw">begin</span>
|
|
305
|
+
<span class="ruby-identifier">host</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\(.*\)/</span>).<span class="ruby-identifier">to_s</span>
|
|
306
|
+
<span class="ruby-identifier">host</span> = <span class="ruby-identifier">host</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">host</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">"."</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>].<span class="ruby-identifier">downcase</span>
|
|
307
|
+
<span class="ruby-identifier">hosts_array</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">host</span>
|
|
308
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
|
309
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>
|
|
310
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"expected to find host name embedded in role, e.g. 'client (A1.V4)'"</span>
|
|
311
|
+
<span class="ruby-keyword kw">end</span>
|
|
312
|
+
<span class="ruby-keyword kw">else</span>
|
|
313
|
+
<span class="ruby-identifier">hosts_array</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@interfaces</span>[<span class="ruby-identifier">i</span>]
|
|
314
|
+
<span class="ruby-keyword kw">end</span>
|
|
315
|
+
<span class="ruby-identifier">roles_array</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">content</span> <span class="ruby-comment cmt"># use the whole name for the role</span>
|
|
316
|
+
<span class="ruby-keyword kw">end</span>
|
|
317
|
+
|
|
318
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">set_hosts</span>(<span class="ruby-identifier">roles_array</span>, <span class="ruby-identifier">hosts_array</span>, <span class="ruby-identifier">type</span>)
|
|
319
|
+
|
|
320
|
+
<span class="ruby-comment cmt"># if there are channels in the scenario, bind them</span>
|
|
321
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
|
322
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@arg_channels</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">size</span>
|
|
323
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"Error. The number of channels specified on the command-line does not equal the number
|
|
324
|
+
of channels in the template. #{@arg_channels.size} != #{channels.size}"</span>
|
|
325
|
+
<span class="ruby-keyword kw">return</span>
|
|
326
|
+
<span class="ruby-keyword kw">end</span>
|
|
327
|
+
|
|
328
|
+
<span class="ruby-identifier">channel_roles</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
329
|
+
<span class="ruby-identifier">channel_names</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
330
|
+
<span class="ruby-ivar">@arg_channels</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>
|
|
331
|
+
<span class="ruby-identifier">channel_roles</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"channel"</span> <span class="ruby-comment cmt"># role is always "channel"</span>
|
|
332
|
+
<span class="ruby-identifier">channel_names</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">c</span>
|
|
333
|
+
<span class="ruby-keyword kw">end</span>
|
|
334
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">set_channels</span>(<span class="ruby-identifier">channel_roles</span>, <span class="ruby-identifier">channel_names</span>)
|
|
335
|
+
<span class="ruby-keyword kw">end</span>
|
|
336
|
+
|
|
337
|
+
<span class="ruby-comment cmt"># if there are options specified on the command-line, set them</span>
|
|
338
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@options</span>.<span class="ruby-identifier">empty?</span>
|
|
339
|
+
<span class="ruby-identifier">option_names</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
340
|
+
<span class="ruby-identifier">option_values</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
|
341
|
+
<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">o</span> <span class="ruby-operator">|</span>
|
|
342
|
+
<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">o</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">":"</span>)
|
|
343
|
+
<span class="ruby-identifier">option_names</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">0</span>]
|
|
344
|
+
<span class="ruby-identifier">option_values</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">1</span>]
|
|
345
|
+
<span class="ruby-keyword kw">end</span>
|
|
346
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">set_options</span>(<span class="ruby-identifier">option_names</span>, <span class="ruby-identifier">option_values</span>)
|
|
347
|
+
<span class="ruby-keyword kw">end</span>
|
|
348
|
+
|
|
349
|
+
<span class="ruby-comment cmt"># verify the scenario</span>
|
|
350
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">setup_test</span>
|
|
351
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">run</span>
|
|
352
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
|
353
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"==> #{scenario_name} run returned without status"</span>
|
|
354
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{scenario_name}: status = #{response}"</span>
|
|
355
|
+
<span class="ruby-keyword kw">else</span>
|
|
356
|
+
<span class="ruby-identifier">doc</span> = <span class="ruby-constant">Nokogiri</span><span class="ruby-operator">::</span><span class="ruby-constant">XML</span>(<span class="ruby-identifier">response</span>)
|
|
357
|
+
<span class="ruby-identifier">status</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">xpath</span>(<span class="ruby-value str">"//status"</span>)[<span class="ruby-value">0</span>].<span class="ruby-identifier">content</span>
|
|
358
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"==> #{scenario_name}: status = #{status}"</span>
|
|
359
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'failed'</span>
|
|
360
|
+
<span class="ruby-comment cmt"># on error, add to the errors array</span>
|
|
361
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{scenario_name}: status = #{status}"</span>
|
|
362
|
+
<span class="ruby-keyword kw">end</span>
|
|
363
|
+
<span class="ruby-keyword kw">end</span>
|
|
364
|
+
|
|
365
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">run_testset</span>(<span class="ruby-identifier">testset_uuid</span>)
|
|
366
|
+
<span class="ruby-identifier">results</span> = <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">collect_results</span> <span class="ruby-comment cmt"># will wait until 'Done' is returned by status</span>
|
|
367
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-node">"results = #{results}"</span>
|
|
368
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">results</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"FAILED"</span>)
|
|
369
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"test failed"</span>
|
|
370
|
+
|
|
371
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">teardown_test</span>
|
|
372
|
+
<span class="ruby-identifier">msg</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">close_session</span>
|
|
373
|
+
|
|
374
|
+
<span class="ruby-comment cmt"># clear the hosts and roles array for the next iteration</span>
|
|
375
|
+
<span class="ruby-identifier">roles_array</span>.<span class="ruby-identifier">clear</span>
|
|
376
|
+
<span class="ruby-identifier">hosts_array</span>.<span class="ruby-identifier">clear</span>
|
|
377
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># if !exclude_list.include? and hosts.length</span>
|
|
378
|
+
<span class="ruby-keyword kw">end</span>
|
|
379
|
+
<span class="ruby-keyword kw">ensure</span>
|
|
380
|
+
<span class="ruby-identifier">teardown</span>
|
|
381
|
+
<span class="ruby-keyword kw">end</span>
|
|
382
|
+
</pre>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
|
|
387
|
+
<h3 class="section-bar">Private Instance methods</h3>
|
|
388
|
+
|
|
389
|
+
<div id="method-M000254" class="method-detail">
|
|
390
|
+
<a name="M000254"></a>
|
|
391
|
+
|
|
392
|
+
<div class="method-heading">
|
|
393
|
+
<a href="#M000254" class="method-signature">
|
|
394
|
+
<span class="method-name">help</span><span class="method-args">()</span>
|
|
395
|
+
</a>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div class="method-description">
|
|
399
|
+
<p><a class="source-toggle" href="#"
|
|
400
|
+
onclick="toggleCode('M000254-source');return false;">[Source]</a></p>
|
|
401
|
+
<div class="method-source-code" id="M000254-source">
|
|
402
|
+
<pre>
|
|
403
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 294</span>
|
|
404
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">help</span>
|
|
405
|
+
<span class="ruby-identifier">helps</span> = [
|
|
406
|
+
{ <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">'--channels'</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 channel hosts'</span> },
|
|
407
|
+
{ <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> },
|
|
408
|
+
{ <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> },
|
|
409
|
+
{ <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/hosts, e.g. b1,dell-server'</span> },
|
|
410
|
+
{ <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> },
|
|
411
|
+
{ <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> },
|
|
412
|
+
{ <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">'--options'</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 of options name:value pairs'</span> },
|
|
413
|
+
{ <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">'name of scenario file to run'</span> },
|
|
414
|
+
{ <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">'--testset'</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 testset to run'</span> },
|
|
415
|
+
{ <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> }
|
|
416
|
+
]
|
|
417
|
+
|
|
418
|
+
<span class="ruby-identifier">cmds</span> = [
|
|
419
|
+
<span class="ruby-value str">"mu cmd_runverify:help"</span>,
|
|
420
|
+
<span class="ruby-value str">"mu cmd_runverify:run -s <scenario> -t <testset> -i <hosts>"</span>
|
|
421
|
+
]
|
|
422
|
+
|
|
423
|
+
<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> }
|
|
424
|
+
<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> }
|
|
425
|
+
<span class="ruby-identifier">puts</span>
|
|
426
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Usage: mu cmd_runverify:<command> <options>"</span>
|
|
427
|
+
<span class="ruby-identifier">puts</span>
|
|
428
|
+
<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>
|
|
429
|
+
<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>]]
|
|
430
|
+
<span class="ruby-keyword kw">end</span>
|
|
431
|
+
<span class="ruby-identifier">puts</span>
|
|
432
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"Available Commands"</span>
|
|
433
|
+
<span class="ruby-identifier">puts</span>
|
|
434
|
+
<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>
|
|
435
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">c</span>
|
|
436
|
+
<span class="ruby-keyword kw">end</span>
|
|
437
|
+
<span class="ruby-identifier">puts</span>
|
|
438
|
+
<span class="ruby-keyword kw">end</span>
|
|
439
|
+
</pre>
|
|
440
|
+
</div>
|
|
441
|
+
</div>
|
|
442
|
+
</div>
|
|
443
|
+
|
|
444
|
+
<div id="method-M000252" class="method-detail">
|
|
445
|
+
<a name="M000252"></a>
|
|
446
|
+
|
|
447
|
+
<div class="method-heading">
|
|
448
|
+
<a href="#M000252" class="method-signature">
|
|
449
|
+
<span class="method-name">output_results</span><span class="method-args">(filename, doc)</span>
|
|
450
|
+
</a>
|
|
451
|
+
</div>
|
|
452
|
+
|
|
453
|
+
<div class="method-description">
|
|
454
|
+
<p><a class="source-toggle" href="#"
|
|
455
|
+
onclick="toggleCode('M000252-source');return false;">[Source]</a></p>
|
|
456
|
+
<div class="method-source-code" id="M000252-source">
|
|
457
|
+
<pre>
|
|
458
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 220</span>
|
|
459
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">output_results</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">doc</span>)
|
|
460
|
+
<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>)
|
|
461
|
+
<span class="ruby-comment cmt"># doc = "#{msl_file},#{@executed},#{@errors.to_i},#{@timeouts.to_i}\n"</span>
|
|
462
|
+
<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>) }
|
|
463
|
+
<span class="ruby-keyword kw">end</span>
|
|
464
|
+
</pre>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
<div id="method-M000253" class="method-detail">
|
|
470
|
+
<a name="M000253"></a>
|
|
471
|
+
|
|
472
|
+
<div class="method-heading">
|
|
473
|
+
<a href="#M000253" class="method-signature">
|
|
474
|
+
<span class="method-name">parse_cli</span><span class="method-args">(argv)</span>
|
|
475
|
+
</a>
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
<div class="method-description">
|
|
479
|
+
<p><a class="source-toggle" href="#"
|
|
480
|
+
onclick="toggleCode('M000253-source');return false;">[Source]</a></p>
|
|
481
|
+
<div class="method-source-code" id="M000253-source">
|
|
482
|
+
<pre>
|
|
483
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 226</span>
|
|
484
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_cli</span> <span class="ruby-identifier">argv</span>
|
|
485
|
+
<span class="ruby-identifier">hash</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
|
486
|
+
<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>
|
|
487
|
+
<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>
|
|
488
|
+
|
|
489
|
+
<span class="ruby-identifier">k</span> = <span class="ruby-identifier">argv</span>.<span class="ruby-identifier">shift</span>
|
|
490
|
+
|
|
491
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-c'</span>, <span class="ruby-value str">'--channels'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
|
492
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'channels'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
|
493
|
+
<span class="ruby-keyword kw">next</span>
|
|
494
|
+
<span class="ruby-keyword kw">end</span>
|
|
495
|
+
|
|
496
|
+
<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>
|
|
497
|
+
<span class="ruby-identifier">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>)
|
|
498
|
+
<span class="ruby-keyword kw">next</span>
|
|
499
|
+
<span class="ruby-keyword kw">end</span>
|
|
500
|
+
|
|
501
|
+
<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>
|
|
502
|
+
<span class="ruby-identifier">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>)
|
|
503
|
+
<span class="ruby-keyword kw">next</span>
|
|
504
|
+
<span class="ruby-keyword kw">end</span>
|
|
505
|
+
|
|
506
|
+
<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>
|
|
507
|
+
<span class="ruby-identifier">help</span>
|
|
508
|
+
<span class="ruby-identifier">exit</span>
|
|
509
|
+
<span class="ruby-keyword kw">end</span>
|
|
510
|
+
|
|
511
|
+
<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>
|
|
512
|
+
<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>)
|
|
513
|
+
<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>
|
|
514
|
+
<span class="ruby-ivar">@@mu_admin_user</span> = <span class="ruby-identifier">$1</span>
|
|
515
|
+
<span class="ruby-ivar">@@mu_admin_pass</span> = <span class="ruby-identifier">$2</span>
|
|
516
|
+
<span class="ruby-ivar">@@mu_ip</span> = <span class="ruby-identifier">$3</span>
|
|
517
|
+
<span class="ruby-keyword kw">end</span>
|
|
518
|
+
<span class="ruby-keyword kw">next</span>
|
|
519
|
+
<span class="ruby-keyword kw">end</span>
|
|
520
|
+
|
|
521
|
+
<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>
|
|
522
|
+
<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>)
|
|
523
|
+
<span class="ruby-keyword kw">next</span>
|
|
524
|
+
<span class="ruby-keyword kw">end</span>
|
|
525
|
+
|
|
526
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-p'</span>, <span class="ruby-value str">'--options'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
|
527
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'options'</span>] = <span class="ruby-identifier">shift</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">argv</span>)
|
|
528
|
+
<span class="ruby-keyword kw">next</span>
|
|
529
|
+
<span class="ruby-keyword kw">end</span>
|
|
530
|
+
|
|
531
|
+
<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>
|
|
532
|
+
<span class="ruby-identifier">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>)
|
|
533
|
+
<span class="ruby-keyword kw">next</span>
|
|
534
|
+
<span class="ruby-keyword kw">end</span>
|
|
535
|
+
|
|
536
|
+
<span class="ruby-keyword kw">if</span> [ <span class="ruby-value str">'-t'</span>, <span class="ruby-value str">'--testset'</span> ].<span class="ruby-identifier">member?</span> <span class="ruby-identifier">k</span>
|
|
537
|
+
<span class="ruby-identifier">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>)
|
|
538
|
+
<span class="ruby-keyword kw">next</span>
|
|
539
|
+
<span class="ruby-keyword kw">end</span>
|
|
540
|
+
|
|
541
|
+
<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>
|
|
542
|
+
<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>
|
|
543
|
+
<span class="ruby-keyword kw">next</span>
|
|
544
|
+
<span class="ruby-keyword kw">end</span>
|
|
545
|
+
|
|
546
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Unknown option #{k}"</span>
|
|
547
|
+
<span class="ruby-keyword kw">end</span>
|
|
548
|
+
|
|
549
|
+
<span class="ruby-identifier">hash</span>
|
|
550
|
+
<span class="ruby-keyword kw">end</span>
|
|
551
|
+
</pre>
|
|
552
|
+
</div>
|
|
553
|
+
</div>
|
|
554
|
+
</div>
|
|
555
|
+
|
|
556
|
+
<div id="method-M000250" class="method-detail">
|
|
557
|
+
<a name="M000250"></a>
|
|
558
|
+
|
|
559
|
+
<div class="method-heading">
|
|
560
|
+
<a href="#M000250" class="method-signature">
|
|
561
|
+
<span class="method-name">setup</span><span class="method-args">()</span>
|
|
562
|
+
</a>
|
|
563
|
+
</div>
|
|
564
|
+
|
|
565
|
+
<div class="method-description">
|
|
566
|
+
<p><a class="source-toggle" href="#"
|
|
567
|
+
onclick="toggleCode('M000250-source');return false;">[Source]</a></p>
|
|
568
|
+
<div class="method-source-code" id="M000250-source">
|
|
569
|
+
<pre>
|
|
570
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 205</span>
|
|
571
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
|
|
572
|
+
<span class="ruby-ivar">@host</span> = (<span class="ruby-ivar">@@mu_ip</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"127.0.0.1"</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_ip</span>
|
|
573
|
+
<span class="ruby-ivar">@username</span> = (<span class="ruby-ivar">@@mu_admin_user</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"admin"</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_user</span>
|
|
574
|
+
<span class="ruby-ivar">@password</span> = (<span class="ruby-ivar">@@mu_admin_pass</span>.<span class="ruby-identifier">nil?</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">"admin"</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@mu_admin_pass</span>
|
|
575
|
+
<span class="ruby-ivar">@ddt_api</span> = <span class="ruby-constant">Ddt</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>)
|
|
576
|
+
<span class="ruby-ivar">@docroot</span> =<span class="ruby-value str">"/api/v3/"</span>
|
|
577
|
+
<span class="ruby-ivar">@http</span> = <span class="ruby-constant">HttpHelper</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>, <span class="ruby-ivar">@docroot</span>)
|
|
578
|
+
<span class="ruby-keyword kw">end</span>
|
|
579
|
+
</pre>
|
|
580
|
+
</div>
|
|
581
|
+
</div>
|
|
582
|
+
</div>
|
|
583
|
+
|
|
584
|
+
<div id="method-M000251" class="method-detail">
|
|
585
|
+
<a name="M000251"></a>
|
|
586
|
+
|
|
587
|
+
<div class="method-heading">
|
|
588
|
+
<a href="#M000251" class="method-signature">
|
|
589
|
+
<span class="method-name">teardown</span><span class="method-args">()</span>
|
|
590
|
+
</a>
|
|
591
|
+
</div>
|
|
592
|
+
|
|
593
|
+
<div class="method-description">
|
|
594
|
+
<p><a class="source-toggle" href="#"
|
|
595
|
+
onclick="toggleCode('M000251-source');return false;">[Source]</a></p>
|
|
596
|
+
<div class="method-source-code" id="M000251-source">
|
|
597
|
+
<pre>
|
|
598
|
+
<span class="ruby-comment cmt"># File lib/mu/command/cmd_runverify.rb, line 214</span>
|
|
599
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teardown</span>
|
|
600
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">nil?</span>
|
|
601
|
+
<span class="ruby-ivar">@ddt_api</span>.<span class="ruby-identifier">close_all_sessions</span>
|
|
602
|
+
<span class="ruby-keyword kw">end</span>
|
|
603
|
+
<span class="ruby-keyword kw">end</span>
|
|
604
|
+
</pre>
|
|
605
|
+
</div>
|
|
606
|
+
</div>
|
|
607
|
+
</div>
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
</div>
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
</div>
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
<div id="validator-badges">
|
|
617
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
618
|
+
</div>
|
|
619
|
+
|
|
620
|
+
</body>
|
|
621
|
+
</html>
|