mu 5.7.8 → 5.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/lib/mu.rb +1 -1
  2. data/lib/mu/command.rb +18 -2
  3. data/lib/mu/command/cmd_musl.rb +165 -0
  4. data/lib/mu/command/cmd_runscale.rb +12 -8
  5. data/lib/mu/command/help.rb +1 -0
  6. data/lib/mu/har.rb +449 -0
  7. data/lib/mu/libxml.rb +21 -0
  8. data/lib/mu/maker.rb +288 -0
  9. data/lib/mu/xmlizable.rb +559 -0
  10. metadata +78 -267
  11. data/rdoc/Gemfile.html +0 -194
  12. data/rdoc/LICENSE_txt.html +0 -201
  13. data/rdoc/Mu.html +0 -478
  14. data/rdoc/Mu/Client.html +0 -461
  15. data/rdoc/Mu/Command.html +0 -338
  16. data/rdoc/Mu/Command/API.html +0 -844
  17. data/rdoc/Mu/Command/Cmd_appid.html +0 -1341
  18. data/rdoc/Mu/Command/Cmd_cli.html +0 -800
  19. data/rdoc/Mu/Command/Cmd_ddt.html +0 -1612
  20. data/rdoc/Mu/Command/Cmd_homepage.html +0 -762
  21. data/rdoc/Mu/Command/Cmd_muapi.html +0 -1363
  22. data/rdoc/Mu/Command/Cmd_netconfig.html +0 -1077
  23. data/rdoc/Mu/Command/Cmd_runscale.html +0 -1441
  24. data/rdoc/Mu/Command/Cmd_runscenario.html +0 -787
  25. data/rdoc/Mu/Command/Cmd_runverify.html +0 -893
  26. data/rdoc/Mu/Command/Cmd_scale.html +0 -1323
  27. data/rdoc/Mu/Command/Cmd_system.html +0 -677
  28. data/rdoc/Mu/Command/Curl.html +0 -751
  29. data/rdoc/Mu/Command/Help.html +0 -305
  30. data/rdoc/Mu/Curl.html +0 -243
  31. data/rdoc/Mu/Curl/Error.html +0 -304
  32. data/rdoc/Mu/Curl/Error/Authorize.html +0 -355
  33. data/rdoc/Mu/Curl/Error/Connect.html +0 -286
  34. data/rdoc/Mu/Curl/Error/DNS.html +0 -236
  35. data/rdoc/Mu/Curl/Error/Region.html +0 -307
  36. data/rdoc/Mu/Curl/Error/Status.html +0 -286
  37. data/rdoc/Mu/Curl/Error/Timeout.html +0 -286
  38. data/rdoc/Mu/Curl/Verify.html +0 -472
  39. data/rdoc/Mu/Curl/Verify/Request.html +0 -424
  40. data/rdoc/Mu/Curl/Verify/Response.html +0 -372
  41. data/rdoc/Mu/Curl/Verify/Result.html +0 -373
  42. data/rdoc/Mu/Ddt.html +0 -1347
  43. data/rdoc/Mu/Helper.html +0 -517
  44. data/rdoc/Mu/Homepage.html +0 -719
  45. data/rdoc/Mu/HttpHelper.html +0 -890
  46. data/rdoc/Mu/Muapi.html +0 -1226
  47. data/rdoc/Mu/Netconfig.html +0 -1178
  48. data/rdoc/Mu/Scale.html +0 -1359
  49. data/rdoc/Mu/System.html +0 -504
  50. data/rdoc/Object.html +0 -285
  51. data/rdoc/README_rdoc.html +0 -892
  52. data/rdoc/Rakefile.html +0 -257
  53. data/rdoc/TCTestMu.html +0 -2583
  54. data/rdoc/Test.html +0 -235
  55. data/rdoc/Test/Unit.html +0 -235
  56. data/rdoc/Test/Unit/TestCase.html +0 -236
  57. data/rdoc/Test/helper_rb.html +0 -62
  58. data/rdoc/Test/tc_test_mu_rb.html +0 -60
  59. data/rdoc/VERSION.html +0 -179
  60. data/rdoc/bin/mu.html +0 -54
  61. data/rdoc/classes/Mu.html +0 -132
  62. data/rdoc/classes/Mu/Client.html +0 -214
  63. data/rdoc/classes/Mu/Command.html +0 -129
  64. data/rdoc/classes/Mu/Command/API.html +0 -362
  65. data/rdoc/classes/Mu/Command/Cmd_appid.html +0 -238
  66. data/rdoc/classes/Mu/Command/Cmd_cli.html +0 -273
  67. data/rdoc/classes/Mu/Command/Cmd_ddt.html +0 -639
  68. data/rdoc/classes/Mu/Command/Cmd_homepage.html +0 -276
  69. data/rdoc/classes/Mu/Command/Cmd_muapi.html +0 -527
  70. data/rdoc/classes/Mu/Command/Cmd_netconfig.html +0 -399
  71. data/rdoc/classes/Mu/Command/Cmd_runscale.html +0 -220
  72. data/rdoc/classes/Mu/Command/Cmd_runscenario.html +0 -197
  73. data/rdoc/classes/Mu/Command/Cmd_runverify.html +0 -196
  74. data/rdoc/classes/Mu/Command/Cmd_scale.html +0 -511
  75. data/rdoc/classes/Mu/Command/Cmd_system.html +0 -236
  76. data/rdoc/classes/Mu/Command/Curl.html +0 -182
  77. data/rdoc/classes/Mu/Command/Help.html +0 -137
  78. data/rdoc/classes/Mu/Curl.html +0 -116
  79. data/rdoc/classes/Mu/Curl/Error.html +0 -148
  80. data/rdoc/classes/Mu/Curl/Error/Authorize.html +0 -165
  81. data/rdoc/classes/Mu/Curl/Error/Connect.html +0 -139
  82. data/rdoc/classes/Mu/Curl/Error/DNS.html +0 -113
  83. data/rdoc/classes/Mu/Curl/Error/Region.html +0 -150
  84. data/rdoc/classes/Mu/Curl/Error/Status.html +0 -139
  85. data/rdoc/classes/Mu/Curl/Error/Timeout.html +0 -139
  86. data/rdoc/classes/Mu/Curl/Verify.html +0 -207
  87. data/rdoc/classes/Mu/Curl/Verify/Request.html +0 -187
  88. data/rdoc/classes/Mu/Curl/Verify/Response.html +0 -172
  89. data/rdoc/classes/Mu/Curl/Verify/Result.html +0 -172
  90. data/rdoc/classes/Mu/Ddt.html +0 -610
  91. data/rdoc/classes/Mu/Helper.html +0 -308
  92. data/rdoc/classes/Mu/Homepage.html +0 -306
  93. data/rdoc/classes/Mu/HttpHelper.html +0 -393
  94. data/rdoc/classes/Mu/Muapi.html +0 -549
  95. data/rdoc/classes/Mu/Netconfig.html +0 -478
  96. data/rdoc/classes/Mu/Scale.html +0 -580
  97. data/rdoc/classes/Mu/System.html +0 -232
  98. data/rdoc/classes/Object.html +0 -139
  99. data/rdoc/classes/TCTestMu.html +0 -948
  100. data/rdoc/classes/Test.html +0 -107
  101. data/rdoc/classes/Test/Unit.html +0 -107
  102. data/rdoc/classes/Test/Unit/TestCase.html +0 -113
  103. data/rdoc/created.rid +0 -36
  104. data/rdoc/files/lib/mu/api/ddt_rb.html +0 -101
  105. data/rdoc/files/lib/mu/api/homepage_rb.html +0 -101
  106. data/rdoc/files/lib/mu/api/muapi_rb.html +0 -101
  107. data/rdoc/files/lib/mu/api/netconfig_rb.html +0 -101
  108. data/rdoc/files/lib/mu/api/scale_rb.html +0 -101
  109. data/rdoc/files/lib/mu/api/system_rb.html +0 -101
  110. data/rdoc/files/lib/mu/client_rb.html +0 -101
  111. data/rdoc/files/lib/mu/command/api_rb.html +0 -101
  112. data/rdoc/files/lib/mu/command/cmd_appid_rb.html +0 -119
  113. data/rdoc/files/lib/mu/command/cmd_cli_rb.html +0 -108
  114. data/rdoc/files/lib/mu/command/cmd_ddt_rb.html +0 -116
  115. data/rdoc/files/lib/mu/command/cmd_homepage_rb.html +0 -115
  116. data/rdoc/files/lib/mu/command/cmd_muapi_rb.html +0 -115
  117. data/rdoc/files/lib/mu/command/cmd_netconfig_rb.html +0 -116
  118. data/rdoc/files/lib/mu/command/cmd_runscale_rb.html +0 -119
  119. data/rdoc/files/lib/mu/command/cmd_runscenario_rb.html +0 -115
  120. data/rdoc/files/lib/mu/command/cmd_runverify_rb.html +0 -118
  121. data/rdoc/files/lib/mu/command/cmd_scale_rb.html +0 -115
  122. data/rdoc/files/lib/mu/command/cmd_system_rb.html +0 -116
  123. data/rdoc/files/lib/mu/command/curl_rb.html +0 -101
  124. data/rdoc/files/lib/mu/command/help_rb.html +0 -101
  125. data/rdoc/files/lib/mu/command_rb.html +0 -107
  126. data/rdoc/files/lib/mu/curl/error_rb.html +0 -101
  127. data/rdoc/files/lib/mu/curl/verify_rb.html +0 -101
  128. data/rdoc/files/lib/mu/helper_rb.html +0 -101
  129. data/rdoc/files/lib/mu/http_helper_rb.html +0 -101
  130. data/rdoc/files/lib/mu_rb.html +0 -121
  131. data/rdoc/files/test/helper_rb.html +0 -112
  132. data/rdoc/files/test/tc_test_mu_rb.html +0 -111
  133. data/rdoc/fr_class_index.html +0 -34
  134. data/rdoc/fr_file_index.html +0 -31
  135. data/rdoc/fr_method_index.html +0 -112
  136. data/rdoc/images/brick.png +0 -0
  137. data/rdoc/images/brick_link.png +0 -0
  138. data/rdoc/images/bug.png +0 -0
  139. data/rdoc/images/bullet_black.png +0 -0
  140. data/rdoc/images/bullet_toggle_minus.png +0 -0
  141. data/rdoc/images/bullet_toggle_plus.png +0 -0
  142. data/rdoc/images/date.png +0 -0
  143. data/rdoc/images/find.png +0 -0
  144. data/rdoc/images/loadingAnimation.gif +0 -0
  145. data/rdoc/images/macFFBgHack.png +0 -0
  146. data/rdoc/images/package.png +0 -0
  147. data/rdoc/images/page_green.png +0 -0
  148. data/rdoc/images/page_white_text.png +0 -0
  149. data/rdoc/images/page_white_width.png +0 -0
  150. data/rdoc/images/plugin.png +0 -0
  151. data/rdoc/images/ruby.png +0 -0
  152. data/rdoc/images/tag_green.png +0 -0
  153. data/rdoc/images/wrench.png +0 -0
  154. data/rdoc/images/wrench_orange.png +0 -0
  155. data/rdoc/images/zoom.png +0 -0
  156. data/rdoc/index.html +0 -884
  157. data/rdoc/js/darkfish.js +0 -116
  158. data/rdoc/js/jquery.js +0 -32
  159. data/rdoc/js/quicksearch.js +0 -114
  160. data/rdoc/js/thickbox-compressed.js +0 -10
  161. data/rdoc/lib/mu/api/ddt_rb.html +0 -52
  162. data/rdoc/lib/mu/api/homepage_rb.html +0 -52
  163. data/rdoc/lib/mu/api/muapi_rb.html +0 -52
  164. data/rdoc/lib/mu/api/netconfig_rb.html +0 -52
  165. data/rdoc/lib/mu/api/scale_rb.html +0 -52
  166. data/rdoc/lib/mu/api/system_rb.html +0 -52
  167. data/rdoc/lib/mu/client_rb.html +0 -52
  168. data/rdoc/lib/mu/command/api_rb.html +0 -52
  169. data/rdoc/lib/mu/command/cmd_appid_rb.html +0 -62
  170. data/rdoc/lib/mu/command/cmd_cli_rb.html +0 -55
  171. data/rdoc/lib/mu/command/cmd_ddt_rb.html +0 -60
  172. data/rdoc/lib/mu/command/cmd_homepage_rb.html +0 -57
  173. data/rdoc/lib/mu/command/cmd_muapi_rb.html +0 -59
  174. data/rdoc/lib/mu/command/cmd_netconfig_rb.html +0 -58
  175. data/rdoc/lib/mu/command/cmd_runscale_rb.html +0 -62
  176. data/rdoc/lib/mu/command/cmd_runscenario_rb.html +0 -57
  177. data/rdoc/lib/mu/command/cmd_runverify_rb.html +0 -61
  178. data/rdoc/lib/mu/command/cmd_scale_rb.html +0 -58
  179. data/rdoc/lib/mu/command/cmd_system_rb.html +0 -59
  180. data/rdoc/lib/mu/command/curl_rb.html +0 -52
  181. data/rdoc/lib/mu/command/help_rb.html +0 -52
  182. data/rdoc/lib/mu/command_rb.html +0 -55
  183. data/rdoc/lib/mu/curl/error_rb.html +0 -52
  184. data/rdoc/lib/mu/curl/verify_rb.html +0 -52
  185. data/rdoc/lib/mu/helper_rb.html +0 -52
  186. data/rdoc/lib/mu/http_helper_rb.html +0 -52
  187. data/rdoc/lib/mu_rb.html +0 -80
  188. data/rdoc/rdoc-style.css +0 -208
  189. data/rdoc/rdoc.css +0 -706
  190. data/test/data/app_id_stats.csv +0 -1
  191. data/test/data/app_id_status.json +0 -156
  192. data/test/data/data_cgi.msl +0 -94
  193. data/test/data/data_cgi.xml +0 -322
  194. data/test/data/default_test.csv +0 -3
  195. data/test/data/ftp_with_channel.xml +0 -1643
  196. data/test/data/irc.xml +0 -3837
  197. data/test/data/scale.json +0 -25
  198. data/test/data/test_data_cgi_error.xml +0 -35
@@ -1,1178 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: Mu::Netconfig</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/mu/api/netconfig_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/mu/api/netconfig.rb">lib/mu/api/netconfig.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link"><a href="../Object.html">Object</a></p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
- <div id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
- <ul class="link-list">
71
-
72
- <li><a href="#method-c-new">::new</a></li>
73
-
74
- <li><a href="#method-i-clear_hosts">#clear_hosts</a></li>
75
-
76
- <li><a href="#method-i-clear_interface">#clear_interface</a></li>
77
-
78
- <li><a href="#method-i-clear_routes">#clear_routes</a></li>
79
-
80
- <li><a href="#method-i-clear_vlans">#clear_vlans</a></li>
81
-
82
- <li><a href="#method-i-create">#create</a></li>
83
-
84
- <li><a href="#method-i-delete">#delete</a></li>
85
-
86
- <li><a href="#method-i-do_modify">#do_modify</a></li>
87
-
88
- <li><a href="#method-i-get">#get</a></li>
89
-
90
- <li><a href="#method-i-http_request">#http_request</a></li>
91
-
92
- <li><a href="#method-i-modify">#modify</a></li>
93
-
94
- <li><a href="#method-i-resolve_hosts">#resolve_hosts</a></li>
95
-
96
- <li><a href="#method-i-restore">#restore</a></li>
97
-
98
- <li><a href="#method-i-restore_hosts">#restore_hosts</a></li>
99
-
100
- <li><a href="#method-i-restore_interfaces">#restore_interfaces</a></li>
101
-
102
- <li><a href="#method-i-restore_routes">#restore_routes</a></li>
103
-
104
- <li><a href="#method-i-save">#save</a></li>
105
-
106
- </ul>
107
- </div>
108
-
109
-
110
- <!-- Included Modules -->
111
-
112
- <div id="includes-section" class="section">
113
- <h3 class="section-header">Included Modules</h3>
114
- <ul class="link-list">
115
-
116
-
117
- <li><span class="include">Helper</span></li>
118
-
119
-
120
- </ul>
121
- </div>
122
-
123
- </div>
124
-
125
- <div id="project-metadata">
126
-
127
-
128
- <div id="fileindex-section" class="section project-section">
129
- <h3 class="section-header">Files</h3>
130
- <ul>
131
-
132
- <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
133
-
134
- <li class="file"><a href="../LICENSE_txt.html">LICENSE.txt</a></li>
135
-
136
- <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
137
-
138
- <li class="file"><a href="../Rakefile.html">Rakefile</a></li>
139
-
140
- <li class="file"><a href="../VERSION.html">VERSION</a></li>
141
-
142
- </ul>
143
- </div>
144
-
145
-
146
- <div id="classindex-section" class="section project-section">
147
- <h3 class="section-header">Class Index
148
- <span class="search-toggle"><img src="../images/find.png"
149
- height="16" width="16" alt="[+]"
150
- title="show/hide quicksearch" /></span></h3>
151
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
152
- <fieldset>
153
- <legend>Quicksearch</legend>
154
- <input type="text" name="quicksearch" value=""
155
- class="quicksearch-field" />
156
- </fieldset>
157
- </form>
158
-
159
- <ul class="link-list">
160
-
161
- <li><a href="../Mu.html">Mu</a></li>
162
-
163
- <li><a href="../Mu/Client.html">Mu::Client</a></li>
164
-
165
- <li><a href="../Mu/Command.html">Mu::Command</a></li>
166
-
167
- <li><a href="../Mu/Command/API.html">Mu::Command::API</a></li>
168
-
169
- <li><a href="../Mu/Command/API.html">Mu::Command::API</a></li>
170
-
171
- <li><a href="../Mu/Command/Cmd_appid.html">Mu::Command::Cmd_appid</a></li>
172
-
173
- <li><a href="../Mu/Command/Cmd_cli.html">Mu::Command::Cmd_cli</a></li>
174
-
175
- <li><a href="../Mu/Command/Cmd_ddt.html">Mu::Command::Cmd_ddt</a></li>
176
-
177
- <li><a href="../Mu/Command/Cmd_homepage.html">Mu::Command::Cmd_homepage</a></li>
178
-
179
- <li><a href="../Mu/Command/Cmd_muapi.html">Mu::Command::Cmd_muapi</a></li>
180
-
181
- <li><a href="../Mu/Command/Cmd_netconfig.html">Mu::Command::Cmd_netconfig</a></li>
182
-
183
- <li><a href="../Mu/Command/Cmd_runscale.html">Mu::Command::Cmd_runscale</a></li>
184
-
185
- <li><a href="../Mu/Command/Cmd_runscenario.html">Mu::Command::Cmd_runscenario</a></li>
186
-
187
- <li><a href="../Mu/Command/Cmd_runverify.html">Mu::Command::Cmd_runverify</a></li>
188
-
189
- <li><a href="../Mu/Command/Cmd_scale.html">Mu::Command::Cmd_scale</a></li>
190
-
191
- <li><a href="../Mu/Command/Cmd_system.html">Mu::Command::Cmd_system</a></li>
192
-
193
- <li><a href="../Mu/Command/Curl.html">Mu::Command::Curl</a></li>
194
-
195
- <li><a href="../Mu/Command/Help.html">Mu::Command::Help</a></li>
196
-
197
- <li><a href="../Mu/Curl.html">Mu::Curl</a></li>
198
-
199
- <li><a href="../Mu/Curl/Error.html">Mu::Curl::Error</a></li>
200
-
201
- <li><a href="../Mu/Curl/Error/Authorize.html">Mu::Curl::Error::Authorize</a></li>
202
-
203
- <li><a href="../Mu/Curl/Error/Connect.html">Mu::Curl::Error::Connect</a></li>
204
-
205
- <li><a href="../Mu/Curl/Error/DNS.html">Mu::Curl::Error::DNS</a></li>
206
-
207
- <li><a href="../Mu/Curl/Error/Region.html">Mu::Curl::Error::Region</a></li>
208
-
209
- <li><a href="../Mu/Curl/Error/Status.html">Mu::Curl::Error::Status</a></li>
210
-
211
- <li><a href="../Mu/Curl/Error/Timeout.html">Mu::Curl::Error::Timeout</a></li>
212
-
213
- <li><a href="../Mu/Curl/Verify.html">Mu::Curl::Verify</a></li>
214
-
215
- <li><a href="../Mu/Curl/Verify/Request.html">Mu::Curl::Verify::Request</a></li>
216
-
217
- <li><a href="../Mu/Curl/Verify/Response.html">Mu::Curl::Verify::Response</a></li>
218
-
219
- <li><a href="../Mu/Curl/Verify/Result.html">Mu::Curl::Verify::Result</a></li>
220
-
221
- <li><a href="../Mu/Ddt.html">Mu::Ddt</a></li>
222
-
223
- <li><a href="../Mu/Helper.html">Mu::Helper</a></li>
224
-
225
- <li><a href="../Mu/Homepage.html">Mu::Homepage</a></li>
226
-
227
- <li><a href="../Mu/HttpHelper.html">Mu::HttpHelper</a></li>
228
-
229
- <li><a href="../Mu/Muapi.html">Mu::Muapi</a></li>
230
-
231
- <li><a href="../Mu/Netconfig.html">Mu::Netconfig</a></li>
232
-
233
- <li><a href="../Mu/Scale.html">Mu::Scale</a></li>
234
-
235
- <li><a href="../Mu/System.html">Mu::System</a></li>
236
-
237
- <li><a href="../Test.html">Test</a></li>
238
-
239
- <li><a href="../Test/Unit.html">Test::Unit</a></li>
240
-
241
- <li><a href="../Test/Unit/TestCase.html">Test::Unit::TestCase</a></li>
242
-
243
- <li><a href="../Object.html">Object</a></li>
244
-
245
- <li><a href="../TCTestMu.html">TCTestMu</a></li>
246
-
247
- </ul>
248
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
249
- </div>
250
-
251
-
252
- </div>
253
- </div>
254
-
255
- <div id="documentation">
256
- <h1 class="class">Mu::Netconfig</h1>
257
-
258
- <div id="description">
259
-
260
- </div>
261
-
262
- <!-- Constants -->
263
-
264
-
265
- <!-- Attributes -->
266
-
267
- <div id="attribute-method-details" class="method-section section">
268
- <h3 class="section-header">Attributes</h3>
269
-
270
-
271
- <div id="host-attribute-method" class="method-detail">
272
- <a name="host"></a>
273
-
274
- <a name="host="></a>
275
-
276
- <div class="method-heading attribute-method-heading">
277
- <span class="method-name">host</span><span
278
- class="attribute-access-type">[RW]</span>
279
- </div>
280
-
281
- <div class="method-description">
282
-
283
-
284
-
285
- </div>
286
- </div>
287
-
288
- <div id="username-attribute-method" class="method-detail">
289
- <a name="username"></a>
290
-
291
- <a name="username="></a>
292
-
293
- <div class="method-heading attribute-method-heading">
294
- <span class="method-name">username</span><span
295
- class="attribute-access-type">[RW]</span>
296
- </div>
297
-
298
- <div class="method-description">
299
-
300
-
301
-
302
- </div>
303
- </div>
304
-
305
- <div id="password-attribute-method" class="method-detail">
306
- <a name="password"></a>
307
-
308
- <a name="password="></a>
309
-
310
- <div class="method-heading attribute-method-heading">
311
- <span class="method-name">password</span><span
312
- class="attribute-access-type">[RW]</span>
313
- </div>
314
-
315
- <div class="method-description">
316
-
317
-
318
-
319
- </div>
320
- </div>
321
-
322
- <div id="docroot-attribute-method" class="method-detail">
323
- <a name="docroot"></a>
324
-
325
- <a name="docroot="></a>
326
-
327
- <div class="method-heading attribute-method-heading">
328
- <span class="method-name">docroot</span><span
329
- class="attribute-access-type">[RW]</span>
330
- </div>
331
-
332
- <div class="method-description">
333
-
334
-
335
-
336
- </div>
337
- </div>
338
-
339
- <div id="element-attribute-method" class="method-detail">
340
- <a name="element"></a>
341
-
342
- <a name="element="></a>
343
-
344
- <div class="method-heading attribute-method-heading">
345
- <span class="method-name">element</span><span
346
- class="attribute-access-type">[RW]</span>
347
- </div>
348
-
349
- <div class="method-description">
350
-
351
-
352
-
353
- </div>
354
- </div>
355
-
356
- <div id="response-attribute-method" class="method-detail">
357
- <a name="response"></a>
358
-
359
- <a name="response="></a>
360
-
361
- <div class="method-heading attribute-method-heading">
362
- <span class="method-name">response</span><span
363
- class="attribute-access-type">[RW]</span>
364
- </div>
365
-
366
- <div class="method-description">
367
-
368
-
369
-
370
- </div>
371
- </div>
372
-
373
- <div id="config-attribute-method" class="method-detail">
374
- <a name="config"></a>
375
-
376
- <a name="config="></a>
377
-
378
- <div class="method-heading attribute-method-heading">
379
- <span class="method-name">config</span><span
380
- class="attribute-access-type">[RW]</span>
381
- </div>
382
-
383
- <div class="method-description">
384
-
385
-
386
-
387
- </div>
388
- </div>
389
-
390
- </div>
391
-
392
-
393
- <!-- Methods -->
394
-
395
- <div id="public-class-method-details" class="method-section section">
396
- <h3 class="section-header">Public Class Methods</h3>
397
-
398
-
399
- <div id="new-method" class="method-detail ">
400
- <a name="method-c-new"></a>
401
-
402
- <div class="method-heading">
403
-
404
- <span class="method-name">new</span><span
405
- class="method-args">(host=ENV['MU_IP'], username=ENV['MU_ADMIN_USER'], password=ENV['MU_ADMIN_PASS'])</span>
406
- <span class="method-click-advice">click to toggle source</span>
407
-
408
- </div>
409
-
410
- <div class="method-description">
411
-
412
-
413
-
414
-
415
-
416
- <div class="method-source-code"
417
- id="new-source">
418
- <pre>
419
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 7</span>
420
- 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>=<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'MU_IP'</span>], <span class="ruby-identifier">username</span>=<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'MU_ADMIN_USER'</span>], <span class="ruby-identifier">password</span>=<span class="ruby-constant">ENV</span>[<span class="ruby-value str">'MU_ADMIN_PASS'</span>])
421
- 8: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
422
- 9: <span class="ruby-ivar">@username</span> = <span class="ruby-identifier">username</span>
423
- 10: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">password</span>
424
- 11: <span class="ruby-ivar">@docroot</span> = <span class="ruby-value str">&quot;/restlet/netconfig/&quot;</span>
425
- 12: <span class="ruby-ivar">@response</span> = <span class="ruby-keyword kw">nil</span>
426
- 13: <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>)
427
- 14: <span class="ruby-ivar">@element</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-comment cmt"># sticky variable will hold a default element, the last element specified</span>
428
- 15: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;Created Netconfig API object to :#{@host}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
429
- 16: <span class="ruby-keyword kw">end</span></pre>
430
- </div>
431
-
432
- </div>
433
-
434
-
435
-
436
-
437
- </div>
438
-
439
-
440
- </div>
441
-
442
- <div id="public-instance-method-details" class="method-section section">
443
- <h3 class="section-header">Public Instance Methods</h3>
444
-
445
-
446
- <div id="clear-hosts-method" class="method-detail ">
447
- <a name="method-i-clear_hosts"></a>
448
-
449
- <div class="method-heading">
450
-
451
- <span class="method-name">clear_hosts</span><span
452
- class="method-args">()</span>
453
- <span class="method-click-advice">click to toggle source</span>
454
-
455
- </div>
456
-
457
- <div class="method-description">
458
-
459
- <p>
460
- clears the network hosts
461
- </p>
462
-
463
-
464
-
465
- <div class="method-source-code"
466
- id="clear-hosts-source">
467
- <pre>
468
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 92</span>
469
- 92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_hosts</span>
470
- 93: <span class="ruby-identifier">h</span> = <span class="ruby-identifier">get</span>(<span class="ruby-value str">&quot;hosts&quot;</span>)
471
- 94: <span class="ruby-identifier">h</span>[<span class="ruby-value str">&quot;hosts&quot;</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>
472
- 95: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;Clear host: #{h['name']}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
473
- 96: <span class="ruby-identifier">delete</span>(<span class="ruby-node">&quot;hosts/#{h['name']}&quot;</span>)
474
- 97: <span class="ruby-keyword kw">end</span>
475
- 98: <span class="ruby-keyword kw">end</span></pre>
476
- </div>
477
-
478
- </div>
479
-
480
-
481
-
482
-
483
- </div>
484
-
485
-
486
- <div id="clear-interface-method" class="method-detail ">
487
- <a name="method-i-clear_interface"></a>
488
-
489
- <div class="method-heading">
490
-
491
- <span class="method-name">clear_interface</span><span
492
- class="method-args">(interface)</span>
493
- <span class="method-click-advice">click to toggle source</span>
494
-
495
- </div>
496
-
497
- <div class="method-description">
498
-
499
- <p>
500
- clears a network interface
501
- </p>
502
- <pre>
503
- * interface = the name of the interface to clear</pre>
504
-
505
-
506
-
507
- <div class="method-source-code"
508
- id="clear-interface-source">
509
- <pre>
510
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 139</span>
511
- 139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_interface</span>(<span class="ruby-identifier">interface</span>)
512
- 140: <span class="ruby-identifier">interface</span> = <span class="ruby-identifier">interface</span>
513
- 141: <span class="ruby-identifier">json</span> = { <span class="ruby-value str">&quot;v4_addrs&quot;</span>=<span class="ruby-operator">&gt;</span>[], <span class="ruby-value str">&quot;v4_mask&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-value str">&quot;v4_dhcp&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-keyword kw">false</span>,
514
- 142: <span class="ruby-value str">&quot;v6_global_addrs&quot;</span>=<span class="ruby-operator">&gt;</span>[], <span class="ruby-value str">&quot;v6_global_mask&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;&quot;</span>}
515
- 143: <span class="ruby-identifier">modify</span> <span class="ruby-identifier">json</span>,<span class="ruby-node">&quot;interfaces/#{interface}&quot;</span>
516
- 144: <span class="ruby-keyword kw">end</span></pre>
517
- </div>
518
-
519
- </div>
520
-
521
-
522
-
523
-
524
- </div>
525
-
526
-
527
- <div id="clear-routes-method" class="method-detail ">
528
- <a name="method-i-clear_routes"></a>
529
-
530
- <div class="method-heading">
531
-
532
- <span class="method-name">clear_routes</span><span
533
- class="method-args">()</span>
534
- <span class="method-click-advice">click to toggle source</span>
535
-
536
- </div>
537
-
538
- <div class="method-description">
539
-
540
- <p>
541
- clears network routes
542
- </p>
543
-
544
-
545
-
546
- <div class="method-source-code"
547
- id="clear-routes-source">
548
- <pre>
549
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 171</span>
550
- 171: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_routes</span>
551
- 172: <span class="ruby-identifier">routes</span> = <span class="ruby-identifier">get</span> <span class="ruby-value str">&quot;routes&quot;</span>
552
- 173: <span class="ruby-identifier">routes</span>[<span class="ruby-value str">&quot;routes&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
553
- 174: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>[<span class="ruby-value str">'readonly'</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
554
- 175: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;Clear route: #{r['dst']}-#{r['gateway']}-#{r['interface_display_name'].downcase}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
555
- 176: <span class="ruby-identifier">delete</span> <span class="ruby-node">&quot;routes/#{r['dst']}-#{r['gateway']}-#{r['interface_display_name'].downcase}&quot;</span>
556
- 177: <span class="ruby-keyword kw">end</span>
557
- 178: <span class="ruby-keyword kw">end</span></pre>
558
- </div>
559
-
560
- </div>
561
-
562
-
563
-
564
-
565
- </div>
566
-
567
-
568
- <div id="clear-vlans-method" class="method-detail ">
569
- <a name="method-i-clear_vlans"></a>
570
-
571
- <div class="method-heading">
572
-
573
- <span class="method-name">clear_vlans</span><span
574
- class="method-args">()</span>
575
- <span class="method-click-advice">click to toggle source</span>
576
-
577
- </div>
578
-
579
- <div class="method-description">
580
-
581
- <p>
582
- clears all network vlans
583
- </p>
584
-
585
-
586
-
587
- <div class="method-source-code"
588
- id="clear-vlans-source">
589
- <pre>
590
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 147</span>
591
- 147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear_vlans</span>
592
- 148: <span class="ruby-identifier">i</span> = <span class="ruby-identifier">get</span> <span class="ruby-value str">&quot;interfaces&quot;</span>
593
- 149: <span class="ruby-identifier">i</span>[<span class="ruby-value str">&quot;interfaces&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
594
- 150: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>[<span class="ruby-value str">'vlan'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
595
- 151: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;Clear vlan: #{i['name']}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
596
- 152: <span class="ruby-identifier">delete</span> <span class="ruby-node">&quot;interfaces/#{i['name']}&quot;</span>
597
- 153: <span class="ruby-keyword kw">end</span>
598
- 154: <span class="ruby-keyword kw">end</span></pre>
599
- </div>
600
-
601
- </div>
602
-
603
-
604
-
605
-
606
- </div>
607
-
608
-
609
- <div id="create-method" class="method-detail ">
610
- <a name="method-i-create"></a>
611
-
612
- <div class="method-heading">
613
-
614
- <span class="method-name">create</span><span
615
- class="method-args">(json, e)</span>
616
- <span class="method-click-advice">click to toggle source</span>
617
-
618
- </div>
619
-
620
- <div class="method-description">
621
-
622
- <p>
623
- POST method to add a network element
624
- </p>
625
- <pre>
626
- * json = the json string containing the element values
627
- * e = the element to create (interfaces|hosts|routes)</pre>
628
-
629
-
630
-
631
- <div class="method-source-code"
632
- id="create-source">
633
- <pre>
634
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 48</span>
635
- 48: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">json</span>, <span class="ruby-identifier">e</span>)
636
- 49: <span class="ruby-identifier">jstring</span> = <span class="ruby-identifier">json</span>
637
- 50: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">json</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
638
- 51: <span class="ruby-identifier">jstring</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">generate</span> <span class="ruby-identifier">json</span>
639
- 52: <span class="ruby-keyword kw">end</span>
640
- 53: <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">post_json</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">jstring</span>)
641
- 54: <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>
642
- 55: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
643
- 56: <span class="ruby-keyword kw">end</span></pre>
644
- </div>
645
-
646
- </div>
647
-
648
-
649
-
650
-
651
- </div>
652
-
653
-
654
- <div id="delete-method" class="method-detail ">
655
- <a name="method-i-delete"></a>
656
-
657
- <div class="method-heading">
658
-
659
- <span class="method-name">delete</span><span
660
- class="method-args">(e)</span>
661
- <span class="method-click-advice">click to toggle source</span>
662
-
663
- </div>
664
-
665
- <div class="method-description">
666
-
667
- <p>
668
- deletes the specified element
669
- </p>
670
- <pre>
671
- * e = the element to delete</pre>
672
-
673
-
674
-
675
- <div class="method-source-code"
676
- id="delete-source">
677
- <pre>
678
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 60</span>
679
- 60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">e</span>)
680
- 61: <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">e</span>)
681
- 62: <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>
682
- 63: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
683
- 64: <span class="ruby-keyword kw">end</span></pre>
684
- </div>
685
-
686
- </div>
687
-
688
-
689
-
690
-
691
- </div>
692
-
693
-
694
- <div id="get-method" class="method-detail ">
695
- <a name="method-i-get"></a>
696
-
697
- <div class="method-heading">
698
-
699
- <span class="method-name">get</span><span
700
- class="method-args">(e)</span>
701
- <span class="method-click-advice">click to toggle source</span>
702
-
703
- </div>
704
-
705
- <div class="method-description">
706
-
707
- <p>
708
- get - with no params, returns the entire netconfig json object
709
- </p>
710
- <pre>
711
- * e = the element to retrieve (interfaces|hosts|routes, interfaces/a1 ...)</pre>
712
-
713
-
714
-
715
- <div class="method-source-code"
716
- id="get-source">
717
- <pre>
718
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 20</span>
719
- 20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">e</span>)
720
- 21: <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">get_json</span>(<span class="ruby-identifier">e</span>)
721
- 22: <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>
722
- 23: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
723
- 24: <span class="ruby-keyword kw">end</span></pre>
724
- </div>
725
-
726
- </div>
727
-
728
-
729
-
730
-
731
- </div>
732
-
733
-
734
- <div id="modify-method" class="method-detail ">
735
- <a name="method-i-modify"></a>
736
-
737
- <div class="method-heading">
738
-
739
- <span class="method-name">modify</span><span
740
- class="method-args">(json, e)</span>
741
- <span class="method-click-advice">click to toggle source</span>
742
-
743
- </div>
744
-
745
- <div class="method-description">
746
-
747
- <p>
748
- PUT to modify netconfig element(s) to json values
749
- </p>
750
- <pre>
751
- * json = the json string containing the modified values
752
- * e = the element to modify (interfaces|hosts|routes)</pre>
753
-
754
-
755
-
756
- <div class="method-source-code"
757
- id="modify-source">
758
- <pre>
759
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 29</span>
760
- 29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modify</span>(<span class="ruby-identifier">json</span>, <span class="ruby-identifier">e</span>)
761
- 30: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">do_modify</span>(<span class="ruby-identifier">json</span>, <span class="ruby-identifier">e</span>)
762
- 31: <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>
763
- 32: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
764
- 33: jstring = json @element = e unless json.is_a? String jstring = JSON.generate json end response = @http.put_json(e, jstring) msg response, Logger::DEBUG return response=end
765
- 34: <span class="ruby-keyword kw">end</span></pre>
766
- </div>
767
-
768
- </div>
769
-
770
-
771
-
772
-
773
- </div>
774
-
775
-
776
- <div id="resolve-hosts-method" class="method-detail ">
777
- <a name="method-i-resolve_hosts"></a>
778
-
779
- <div class="method-heading">
780
-
781
- <span class="method-name">resolve_hosts</span><span
782
- class="method-args">(name=nil)</span>
783
- <span class="method-click-advice">click to toggle source</span>
784
-
785
- </div>
786
-
787
- <div class="method-description">
788
-
789
- <p>
790
- use Dns to update host ip addresses. A new Host is added if not present
791
- when the name is provided as argument
792
- </p>
793
- <pre>
794
- * name = the name of the host to resolve</pre>
795
-
796
-
797
-
798
- <div class="method-source-code"
799
- id="resolve-hosts-source">
800
- <pre>
801
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 112</span>
802
- 112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">resolve_hosts</span>(<span class="ruby-identifier">name</span>=<span class="ruby-keyword kw">nil</span>)
803
- 113: <span class="ruby-identifier">response</span> = <span class="ruby-value str">&quot;&quot;</span>
804
- 114: <span class="ruby-identifier">hosts</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
805
- 115: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">nil?</span>
806
- 116: <span class="ruby-identifier">hst</span> = <span class="ruby-identifier">get</span> <span class="ruby-value str">&quot;hosts&quot;</span>
807
- 117: <span class="ruby-identifier">hst</span>[<span class="ruby-value str">&quot;hosts&quot;</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hosts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">h</span>[<span class="ruby-value str">&quot;name&quot;</span>]}
808
- 118: <span class="ruby-keyword kw">else</span>
809
- 119: <span class="ruby-identifier">hosts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">name</span>
810
- 120: <span class="ruby-keyword kw">end</span>
811
- 121: <span class="ruby-identifier">hosts</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>
812
- 122: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;resolve host: #{h}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
813
- 123: <span class="ruby-identifier">v4_addr</span> = <span class="ruby-constant">Socket</span><span class="ruby-operator">::</span><span class="ruby-identifier">gethostbyname</span>(<span class="ruby-identifier">h</span>)[<span class="ruby-value">3</span>].<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;CCCC&quot;</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;.&quot;</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
814
- 124: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v4_addr</span>.<span class="ruby-identifier">nil?</span>
815
- 125: <span class="ruby-identifier">json</span> = <span class="ruby-identifier">get</span> <span class="ruby-node">&quot;hosts/#{h}&quot;</span>
816
- 126: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;name&quot;</span>].<span class="ruby-identifier">nil?</span>
817
- 127: <span class="ruby-identifier">json</span> = {<span class="ruby-value str">&quot;name&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">h</span>, <span class="ruby-value str">&quot;v4_addr&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">v4_addr</span>}
818
- 128: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">create</span> <span class="ruby-identifier">json</span>, <span class="ruby-value str">&quot;hosts&quot;</span>
819
- 129: <span class="ruby-keyword kw">else</span>
820
- 130: <span class="ruby-identifier">json</span>[<span class="ruby-value str">&quot;v4_addr&quot;</span>] = <span class="ruby-identifier">v4_addr</span>
821
- 131: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">modify</span> <span class="ruby-identifier">json</span>, <span class="ruby-node">&quot;hosts/#{h}&quot;</span>
822
- 132: <span class="ruby-keyword kw">end</span>
823
- 133: <span class="ruby-keyword kw">end</span>
824
- 134: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
825
- 135: <span class="ruby-keyword kw">end</span></pre>
826
- </div>
827
-
828
- </div>
829
-
830
-
831
-
832
-
833
- </div>
834
-
835
-
836
- <div id="restore-method" class="method-detail ">
837
- <a name="method-i-restore"></a>
838
-
839
- <div class="method-heading">
840
-
841
- <span class="method-name">restore</span><span
842
- class="method-args">(filepath=nil,clear_existing=false)</span>
843
- <span class="method-click-advice">click to toggle source</span>
844
-
845
- </div>
846
-
847
- <div class="method-description">
848
-
849
- <p>
850
- updates a network configuration from file
851
- </p>
852
- <pre>
853
- * filepath = the path to the json file
854
- * clear_existing - boolean determining whether or not existing elements should be cleared</pre>
855
-
856
-
857
-
858
- <div class="method-source-code"
859
- id="restore-source">
860
- <pre>
861
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 69</span>
862
- 69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore</span>(<span class="ruby-identifier">filepath</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">clear_existing</span>=<span class="ruby-keyword kw">false</span>)
863
- 70: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">nil?</span>
864
- 71: <span class="ruby-ivar">@config</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">filepath</span>))
865
- 72: <span class="ruby-keyword kw">end</span>
866
- 73: <span class="ruby-ivar">@config</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>
867
- 74: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]
868
- 75: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;hosts&quot;</span>
869
- 76: <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;RESTORE HOSTS&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
870
- 77: <span class="ruby-identifier">clear_existing</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">clear_hosts</span>
871
- 78: <span class="ruby-identifier">restore_hosts</span> <span class="ruby-identifier">c</span>[<span class="ruby-value str">&quot;hosts&quot;</span>]
872
- 79: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;routes&quot;</span>
873
- 80: <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;RESTORE ROUTES&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
874
- 81: <span class="ruby-identifier">clear_existing</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">clear_routes</span>
875
- 82: <span class="ruby-identifier">restore_routes</span> <span class="ruby-identifier">c</span>[<span class="ruby-value str">&quot;routes&quot;</span>]
876
- 83: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;interfaces&quot;</span>
877
- 84: <span class="ruby-identifier">clear_existing</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">clear_vlans</span>
878
- 85: <span class="ruby-identifier">msg</span> <span class="ruby-value str">&quot;RESTORE INTERFACES&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
879
- 86: <span class="ruby-identifier">restore_interfaces</span> <span class="ruby-identifier">c</span>[<span class="ruby-value str">&quot;interfaces&quot;</span>]
880
- 87: <span class="ruby-keyword kw">end</span>
881
- 88: <span class="ruby-keyword kw">end</span>
882
- 89: <span class="ruby-keyword kw">end</span></pre>
883
- </div>
884
-
885
- </div>
886
-
887
-
888
-
889
-
890
- </div>
891
-
892
-
893
- <div id="restore-hosts-method" class="method-detail ">
894
- <a name="method-i-restore_hosts"></a>
895
-
896
- <div class="method-heading">
897
-
898
- <span class="method-name">restore_hosts</span><span
899
- class="method-args">(hosts)</span>
900
- <span class="method-click-advice">click to toggle source</span>
901
-
902
- </div>
903
-
904
- <div class="method-description">
905
-
906
- <p>
907
- restores the network hosts to the initial system states
908
- </p>
909
-
910
-
911
-
912
- <div class="method-source-code"
913
- id="restore-hosts-source">
914
- <pre>
915
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 101</span>
916
- 101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore_hosts</span>(<span class="ruby-identifier">hosts</span>)
917
- 102: <span class="ruby-identifier">hosts</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>
918
- 103: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;create host: #{h['name']}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
919
- 104: <span class="ruby-identifier">delete</span> <span class="ruby-node">&quot;hosts/#{h['name']}&quot;</span> <span class="ruby-comment cmt"># harmlessly fails when host does not exist</span>
920
- 105: <span class="ruby-identifier">create</span>(<span class="ruby-identifier">h</span>,<span class="ruby-value str">&quot;hosts&quot;</span>)
921
- 106: <span class="ruby-keyword kw">end</span>
922
- 107: <span class="ruby-keyword kw">end</span></pre>
923
- </div>
924
-
925
- </div>
926
-
927
-
928
-
929
-
930
- </div>
931
-
932
-
933
- <div id="restore-interfaces-method" class="method-detail ">
934
- <a name="method-i-restore_interfaces"></a>
935
-
936
- <div class="method-heading">
937
-
938
- <span class="method-name">restore_interfaces</span><span
939
- class="method-args">(interfaces)</span>
940
- <span class="method-click-advice">click to toggle source</span>
941
-
942
- </div>
943
-
944
- <div class="method-description">
945
-
946
- <p>
947
- restores network interfaces to system initial settings
948
- </p>
949
- <pre>
950
- * interfaces - the names of the interfaces to restore</pre>
951
-
952
-
953
-
954
- <div class="method-source-code"
955
- id="restore-interfaces-source">
956
- <pre>
957
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 158</span>
958
- 158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore_interfaces</span>(<span class="ruby-identifier">interfaces</span>)
959
- 159: <span class="ruby-identifier">interfaces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
960
- 160: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>[<span class="ruby-value str">'name'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-value str">&quot;eth&quot;</span> <span class="ruby-comment cmt"># don't do eth0 or eth1</span>
961
- 161: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;configure interface: #{i['name']}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
962
- 162: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">i</span>[<span class="ruby-value str">'vlan'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
963
- 163: <span class="ruby-identifier">interface</span>,<span class="ruby-identifier">vlan</span> = <span class="ruby-identifier">i</span>[<span class="ruby-value str">'name'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;.&quot;</span>)
964
- 164: <span class="ruby-identifier">create</span> [{<span class="ruby-value str">&quot;name&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-identifier">interface</span>,<span class="ruby-value str">&quot;vlan&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-identifier">vlan</span>},<span class="ruby-value str">&quot;interfaces&quot;</span>]
965
- 165: <span class="ruby-keyword kw">end</span>
966
- 166: <span class="ruby-identifier">modify</span> [<span class="ruby-identifier">i</span>,<span class="ruby-node">&quot;interfaces/#{i['name']}&quot;</span>]
967
- 167: <span class="ruby-keyword kw">end</span>
968
- 168: <span class="ruby-keyword kw">end</span></pre>
969
- </div>
970
-
971
- </div>
972
-
973
-
974
-
975
-
976
- </div>
977
-
978
-
979
- <div id="restore-routes-method" class="method-detail ">
980
- <a name="method-i-restore_routes"></a>
981
-
982
- <div class="method-heading">
983
-
984
- <span class="method-name">restore_routes</span><span
985
- class="method-args">(routes)</span>
986
- <span class="method-click-advice">click to toggle source</span>
987
-
988
- </div>
989
-
990
- <div class="method-description">
991
-
992
- <p>
993
- restores network routes to system initial settings
994
- </p>
995
-
996
-
997
-
998
- <div class="method-source-code"
999
- id="restore-routes-source">
1000
- <pre>
1001
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 181</span>
1002
- 181: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">restore_routes</span>(<span class="ruby-identifier">routes</span>)
1003
- 182: <span class="ruby-identifier">routes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
1004
- 183: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>[<span class="ruby-value str">'readonly'</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
1005
- 184: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;configure route: #{r['dst']}-#{r['gateway']}-#{r['interface_display_name'].downcase}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
1006
- 185: <span class="ruby-identifier">create</span> <span class="ruby-identifier">r</span>,<span class="ruby-value str">&quot;routes&quot;</span>
1007
- 186: <span class="ruby-keyword kw">end</span>
1008
- 187: <span class="ruby-keyword kw">end</span></pre>
1009
- </div>
1010
-
1011
- </div>
1012
-
1013
-
1014
-
1015
-
1016
- </div>
1017
-
1018
-
1019
- <div id="save-method" class="method-detail ">
1020
- <a name="method-i-save"></a>
1021
-
1022
- <div class="method-heading">
1023
-
1024
- <span class="method-name">save</span><span
1025
- class="method-args">(e="all", filepath="config.json")</span>
1026
- <span class="method-click-advice">click to toggle source</span>
1027
-
1028
- </div>
1029
-
1030
- <div class="method-description">
1031
-
1032
- <p>
1033
- writes the json config to filepath
1034
- </p>
1035
- <pre>
1036
- * e = the element to save, or 'all'
1037
- * filepath - the fully qualified name of the file to save to</pre>
1038
-
1039
-
1040
-
1041
- <div class="method-source-code"
1042
- id="save-source">
1043
- <pre>
1044
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 192</span>
1045
- 192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">e</span>=<span class="ruby-value str">&quot;all&quot;</span>, <span class="ruby-identifier">filepath</span>=<span class="ruby-value str">&quot;config.json&quot;</span>)
1046
- 193: <span class="ruby-identifier">json</span> = <span class="ruby-identifier">get</span> <span class="ruby-identifier">e</span>
1047
- 194: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filepath</span>,<span class="ruby-value str">'w'</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-constant">JSON</span>.<span class="ruby-identifier">pretty_generate</span>(<span class="ruby-identifier">json</span>))}
1048
- 195: <span class="ruby-keyword kw">end</span></pre>
1049
- </div>
1050
-
1051
- </div>
1052
-
1053
-
1054
-
1055
-
1056
- </div>
1057
-
1058
-
1059
- </div>
1060
-
1061
- <div id="private-instance-method-details" class="method-section section">
1062
- <h3 class="section-header">Private Instance Methods</h3>
1063
-
1064
-
1065
- <div id="do-modify-method" class="method-detail ">
1066
- <a name="method-i-do_modify"></a>
1067
-
1068
- <div class="method-heading">
1069
-
1070
- <span class="method-name">do_modify</span><span
1071
- class="method-args">(json, e)</span>
1072
- <span class="method-click-advice">click to toggle source</span>
1073
-
1074
- </div>
1075
-
1076
- <div class="method-description">
1077
-
1078
- <p>
1079
- restclient put was not recgonized as json PUT to modify netconfig
1080
- element(s) to json values
1081
- </p>
1082
-
1083
-
1084
-
1085
- <div class="method-source-code"
1086
- id="do-modify-source">
1087
- <pre>
1088
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 201</span>
1089
- 201: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_modify</span>(<span class="ruby-identifier">json</span>, <span class="ruby-identifier">e</span>)
1090
- 202: <span class="ruby-identifier">jstring</span> = <span class="ruby-identifier">json</span>
1091
- 203: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">json</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">String</span>
1092
- 204: <span class="ruby-identifier">jstring</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">generate</span> <span class="ruby-identifier">json</span>
1093
- 205: <span class="ruby-keyword kw">end</span>
1094
- 206: <span class="ruby-identifier">msg</span> <span class="ruby-identifier">jstring</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
1095
- 207: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;https://#{@host}&quot;</span>)
1096
- 208: <span class="ruby-identifier">escaped</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-node">&quot;#{@docroot}#{e}&quot;</span>)
1097
- 209: <span class="ruby-identifier">msg</span> <span class="ruby-node">&quot;Put: #{uri}#{escaped}&quot;</span>, <span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">DEBUG</span>
1098
- 210: <span class="ruby-identifier">http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>)
1099
- 211: <span class="ruby-identifier">http</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword kw">true</span>
1100
- 212: <span class="ruby-identifier">http</span>.<span class="ruby-identifier">verify_mode</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">SSL</span><span class="ruby-operator">::</span><span class="ruby-constant">VERIFY_NONE</span>
1101
- 213: <span class="ruby-identifier">http</span>.<span class="ruby-identifier">start</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
1102
- 214: <span class="ruby-identifier">req</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Put</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{escaped}&quot;</span>,<span class="ruby-identifier">initheader</span> = {<span class="ruby-value str">&quot;User-Agent&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@username</span>, <span class="ruby-value str">'Content-Type'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'application/json; charset=utf-8'</span>})
1103
- 215: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">body</span> = <span class="ruby-identifier">jstring</span>
1104
- 216: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">http_request</span>(<span class="ruby-identifier">http</span>, <span class="ruby-identifier">req</span>)
1105
- 217: <span class="ruby-keyword kw">end</span>
1106
- 218: <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>
1107
- 219: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>
1108
- 220: <span class="ruby-keyword kw">end</span></pre>
1109
- </div>
1110
-
1111
- </div>
1112
-
1113
-
1114
-
1115
-
1116
- </div>
1117
-
1118
-
1119
- <div id="http-request-method" class="method-detail ">
1120
- <a name="method-i-http_request"></a>
1121
-
1122
- <div class="method-heading">
1123
-
1124
- <span class="method-name">http_request</span><span
1125
- class="method-args">(http, req)</span>
1126
- <span class="method-click-advice">click to toggle source</span>
1127
-
1128
- </div>
1129
-
1130
- <div class="method-description">
1131
-
1132
-
1133
-
1134
-
1135
-
1136
- <div class="method-source-code"
1137
- id="http-request-source">
1138
- <pre>
1139
- <span class="ruby-comment cmt"># File lib/mu/api/netconfig.rb, line 222</span>
1140
- 222: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_request</span>(<span class="ruby-identifier">http</span>, <span class="ruby-identifier">req</span>)
1141
- 223: <span class="ruby-identifier">req</span>.<span class="ruby-identifier">basic_auth</span>(<span class="ruby-ivar">@username</span>, <span class="ruby-ivar">@password</span>)
1142
- 224: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">req</span>)
1143
- 225: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;200&quot;</span>
1144
- 226: <span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;Error status code #{response.code}\n#{response.body}&quot;</span>
1145
- 227: <span class="ruby-keyword kw">end</span>
1146
- 228: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>
1147
- 229: <span class="ruby-keyword kw">end</span></pre>
1148
- </div>
1149
-
1150
- </div>
1151
-
1152
-
1153
-
1154
-
1155
- </div>
1156
-
1157
-
1158
- </div>
1159
-
1160
-
1161
- </div>
1162
-
1163
-
1164
- <div id="rdoc-debugging-section-dump" class="debugging-section">
1165
-
1166
- <p>Disabled; run with --debug to generate this.</p>
1167
-
1168
- </div>
1169
-
1170
- <div id="validator-badges">
1171
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
1172
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
1173
- Rdoc Generator</a> 1.1.6</small>.</p>
1174
- </div>
1175
-
1176
- </body>
1177
- </html>
1178
-