spectools 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +2 -0
- data/Manifest.txt +1 -1
- data/README.txt +367 -22
- data/lib/spectools.rb +33 -9
- data/lib/spectools/version.rb +1 -1
- data/lib/vnmsh.rb +84 -18
- data/test/test_spectools.rb +32 -7
- data/test/test_vnmsh.rb +16 -5
- data/test/testcmds/ack +0 -0
- data/test/testcmds/connect +0 -0
- data/test/testcmds/create +0 -0
- data/test/testcmds/destroy +0 -0
- data/test/testcmds/disconnect +0 -0
- data/test/testcmds/seek +0 -0
- data/test/testcmds/show +0 -0
- data/test/testcmds/update +0 -0
- metadata +12 -8
data/CHANGELOG.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -1,33 +1,378 @@
|
|
1
|
-
|
1
|
+
= spectools
|
2
2
|
|
3
|
-
|
3
|
+
* http://rubyforge.org/projects/spectools/
|
4
4
|
|
5
|
-
|
6
|
-
require 'spcetools'
|
5
|
+
== DESCRIPTION:
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
SpecTools is a library for accessing the data model for
|
8
|
+
CA SPECTRUM's data model.
|
10
9
|
|
11
|
-
All of the classes have good RDoc, so reference it to see what the structure looks like.
|
12
10
|
|
13
|
-
|
11
|
+
== FEATURES/PROBLEMS:
|
14
12
|
|
15
|
-
|
13
|
+
* Supplies basic data model classes.
|
14
|
+
* The VNMSH extension allows for data access via the CLI interface.
|
16
15
|
|
17
|
-
|
16
|
+
== SYNOPSIS:
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
require 'rubygems'
|
19
|
+
require 'spcetools'
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
require 'vnmsh'
|
21
|
+
model = SpecTools::Model.new
|
22
|
+
model.handle = 'test handle'
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
see README.spectools.txt for more details.
|
25
|
+
== REQUIREMENTS:
|
26
|
+
|
27
|
+
* Just rubygems!
|
28
|
+
|
29
|
+
== INSTALL:
|
30
|
+
|
31
|
+
* gem install spectools
|
32
|
+
|
33
|
+
== LICENSE:
|
34
|
+
|
35
|
+
GNU GENERAL PUBLIC LICENSE
|
36
|
+
Version 2, June 1991
|
37
|
+
|
38
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
39
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
40
|
+
Everyone is permitted to copy and distribute verbatim copies
|
41
|
+
of this license document, but changing it is not allowed.
|
42
|
+
|
43
|
+
Preamble
|
44
|
+
|
45
|
+
The licenses for most software are designed to take away your
|
46
|
+
freedom to share and change it. By contrast, the GNU General Public
|
47
|
+
License is intended to guarantee your freedom to share and change free
|
48
|
+
software--to make sure the software is free for all its users. This
|
49
|
+
General Public License applies to most of the Free Software
|
50
|
+
Foundation's software and to any other program whose authors commit to
|
51
|
+
using it. (Some other Free Software Foundation software is covered by
|
52
|
+
the GNU Library General Public License instead.) You can apply it to
|
53
|
+
your programs, too.
|
54
|
+
|
55
|
+
When we speak of free software, we are referring to freedom, not
|
56
|
+
price. Our General Public Licenses are designed to make sure that you
|
57
|
+
have the freedom to distribute copies of free software (and charge for
|
58
|
+
this service if you wish), that you receive source code or can get it
|
59
|
+
if you want it, that you can change the software or use pieces of it
|
60
|
+
in new free programs; and that you know you can do these things.
|
61
|
+
|
62
|
+
To protect your rights, we need to make restrictions that forbid
|
63
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
64
|
+
These restrictions translate to certain responsibilities for you if you
|
65
|
+
distribute copies of the software, or if you modify it.
|
66
|
+
|
67
|
+
For example, if you distribute copies of such a program, whether
|
68
|
+
gratis or for a fee, you must give the recipients all the rights that
|
69
|
+
you have. You must make sure that they, too, receive or can get the
|
70
|
+
source code. And you must show them these terms so they know their
|
71
|
+
rights.
|
72
|
+
|
73
|
+
We protect your rights with two steps: (1) copyright the software, and
|
74
|
+
(2) offer you this license which gives you legal permission to copy,
|
75
|
+
distribute and/or modify the software.
|
76
|
+
|
77
|
+
Also, for each author's protection and ours, we want to make certain
|
78
|
+
that everyone understands that there is no warranty for this free
|
79
|
+
software. If the software is modified by someone else and passed on, we
|
80
|
+
want its recipients to know that what they have is not the original, so
|
81
|
+
that any problems introduced by others will not reflect on the original
|
82
|
+
authors' reputations.
|
83
|
+
|
84
|
+
Finally, any free program is threatened constantly by software
|
85
|
+
patents. We wish to avoid the danger that redistributors of a free
|
86
|
+
program will individually obtain patent licenses, in effect making the
|
87
|
+
program proprietary. To prevent this, we have made it clear that any
|
88
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
89
|
+
|
90
|
+
The precise terms and conditions for copying, distribution and
|
91
|
+
modification follow.
|
92
|
+
|
93
|
+
GNU GENERAL PUBLIC LICENSE
|
94
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
95
|
+
|
96
|
+
0. This License applies to any program or other work which contains
|
97
|
+
a notice placed by the copyright holder saying it may be distributed
|
98
|
+
under the terms of this General Public License. The "Program", below,
|
99
|
+
refers to any such program or work, and a "work based on the Program"
|
100
|
+
means either the Program or any derivative work under copyright law:
|
101
|
+
that is to say, a work containing the Program or a portion of it,
|
102
|
+
either verbatim or with modifications and/or translated into another
|
103
|
+
language. (Hereinafter, translation is included without limitation in
|
104
|
+
the term "modification".) Each licensee is addressed as "you".
|
105
|
+
|
106
|
+
Activities other than copying, distribution and modification are not
|
107
|
+
covered by this License; they are outside its scope. The act of
|
108
|
+
running the Program is not restricted, and the output from the Program
|
109
|
+
is covered only if its contents constitute a work based on the
|
110
|
+
Program (independent of having been made by running the Program).
|
111
|
+
Whether that is true depends on what the Program does.
|
112
|
+
|
113
|
+
1. You may copy and distribute verbatim copies of the Program's
|
114
|
+
source code as you receive it, in any medium, provided that you
|
115
|
+
conspicuously and appropriately publish on each copy an appropriate
|
116
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
117
|
+
notices that refer to this License and to the absence of any warranty;
|
118
|
+
and give any other recipients of the Program a copy of this License
|
119
|
+
along with the Program.
|
120
|
+
|
121
|
+
You may charge a fee for the physical act of transferring a copy, and
|
122
|
+
you may at your option offer warranty protection in exchange for a fee.
|
123
|
+
|
124
|
+
2. You may modify your copy or copies of the Program or any portion
|
125
|
+
of it, thus forming a work based on the Program, and copy and
|
126
|
+
distribute such modifications or work under the terms of Section 1
|
127
|
+
above, provided that you also meet all of these conditions:
|
128
|
+
|
129
|
+
a) You must cause the modified files to carry prominent notices
|
130
|
+
stating that you changed the files and the date of any change.
|
131
|
+
|
132
|
+
b) You must cause any work that you distribute or publish, that in
|
133
|
+
whole or in part contains or is derived from the Program or any
|
134
|
+
part thereof, to be licensed as a whole at no charge to all third
|
135
|
+
parties under the terms of this License.
|
136
|
+
|
137
|
+
c) If the modified program normally reads commands interactively
|
138
|
+
when run, you must cause it, when started running for such
|
139
|
+
interactive use in the most ordinary way, to print or display an
|
140
|
+
announcement including an appropriate copyright notice and a
|
141
|
+
notice that there is no warranty (or else, saying that you provide
|
142
|
+
a warranty) and that users may redistribute the program under
|
143
|
+
these conditions, and telling the user how to view a copy of this
|
144
|
+
License. (Exception: if the Program itself is interactive but
|
145
|
+
does not normally print such an announcement, your work based on
|
146
|
+
the Program is not required to print an announcement.)
|
147
|
+
|
148
|
+
These requirements apply to the modified work as a whole. If
|
149
|
+
identifiable sections of that work are not derived from the Program,
|
150
|
+
and can be reasonably considered independent and separate works in
|
151
|
+
themselves, then this License, and its terms, do not apply to those
|
152
|
+
sections when you distribute them as separate works. But when you
|
153
|
+
distribute the same sections as part of a whole which is a work based
|
154
|
+
on the Program, the distribution of the whole must be on the terms of
|
155
|
+
this License, whose permissions for other licensees extend to the
|
156
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
157
|
+
|
158
|
+
Thus, it is not the intent of this section to claim rights or contest
|
159
|
+
your rights to work written entirely by you; rather, the intent is to
|
160
|
+
exercise the right to control the distribution of derivative or
|
161
|
+
collective works based on the Program.
|
162
|
+
|
163
|
+
In addition, mere aggregation of another work not based on the Program
|
164
|
+
with the Program (or with a work based on the Program) on a volume of
|
165
|
+
a storage or distribution medium does not bring the other work under
|
166
|
+
the scope of this License.
|
167
|
+
|
168
|
+
3. You may copy and distribute the Program (or a work based on it,
|
169
|
+
under Section 2) in object code or executable form under the terms of
|
170
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
171
|
+
|
172
|
+
a) Accompany it with the complete corresponding machine-readable
|
173
|
+
source code, which must be distributed under the terms of Sections
|
174
|
+
1 and 2 above on a medium customarily used for software
|
175
|
+
interchange; or,
|
176
|
+
|
177
|
+
b) Accompany it with a written offer, valid for at least three
|
178
|
+
years, to give any third party, for a charge no more than your
|
179
|
+
cost of physically performing source distribution, a complete
|
180
|
+
machine-readable copy of the corresponding source code, to be
|
181
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
182
|
+
customarily used for software interchange; or,
|
183
|
+
|
184
|
+
c) Accompany it with the information you received as to the offer
|
185
|
+
to distribute corresponding source code. (This alternative is
|
186
|
+
allowed only for noncommercial distribution and only if you
|
187
|
+
received the program in object code or executable form with such
|
188
|
+
an offer, in accord with Subsection b above.)
|
189
|
+
|
190
|
+
The source code for a work means the preferred form of the work for
|
191
|
+
making modifications to it. For an executable work, complete source
|
192
|
+
code means all the source code for all modules it contains, plus any
|
193
|
+
associated interface definition files, plus the scripts used to
|
194
|
+
control compilation and installation of the executable. However, as a
|
195
|
+
special exception, the source code distributed need not include
|
196
|
+
anything that is normally distributed (in either source or binary
|
197
|
+
form) with the major components (compiler, kernel, and so on) of the
|
198
|
+
operating system on which the executable runs, unless that component
|
199
|
+
itself accompanies the executable.
|
200
|
+
|
201
|
+
If distribution of executable or object code is made by offering
|
202
|
+
access to copy from a designated place, then offering equivalent
|
203
|
+
access to copy the source code from the same place counts as
|
204
|
+
distribution of the source code, even though third parties are not
|
205
|
+
compelled to copy the source along with the object code.
|
206
|
+
|
207
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
208
|
+
except as expressly provided under this License. Any attempt
|
209
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
210
|
+
void, and will automatically terminate your rights under this License.
|
211
|
+
However, parties who have received copies, or rights, from you under
|
212
|
+
this License will not have their licenses terminated so long as such
|
213
|
+
parties remain in full compliance.
|
214
|
+
|
215
|
+
5. You are not required to accept this License, since you have not
|
216
|
+
signed it. However, nothing else grants you permission to modify or
|
217
|
+
distribute the Program or its derivative works. These actions are
|
218
|
+
prohibited by law if you do not accept this License. Therefore, by
|
219
|
+
modifying or distributing the Program (or any work based on the
|
220
|
+
Program), you indicate your acceptance of this License to do so, and
|
221
|
+
all its terms and conditions for copying, distributing or modifying
|
222
|
+
the Program or works based on it.
|
223
|
+
|
224
|
+
6. Each time you redistribute the Program (or any work based on the
|
225
|
+
Program), the recipient automatically receives a license from the
|
226
|
+
original licensor to copy, distribute or modify the Program subject to
|
227
|
+
these terms and conditions. You may not impose any further
|
228
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
229
|
+
You are not responsible for enforcing compliance by third parties to
|
230
|
+
this License.
|
231
|
+
|
232
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
233
|
+
infringement or for any other reason (not limited to patent issues),
|
234
|
+
conditions are imposed on you (whether by court order, agreement or
|
235
|
+
otherwise) that contradict the conditions of this License, they do not
|
236
|
+
excuse you from the conditions of this License. If you cannot
|
237
|
+
distribute so as to satisfy simultaneously your obligations under this
|
238
|
+
License and any other pertinent obligations, then as a consequence you
|
239
|
+
may not distribute the Program at all. For example, if a patent
|
240
|
+
license would not permit royalty-free redistribution of the Program by
|
241
|
+
all those who receive copies directly or indirectly through you, then
|
242
|
+
the only way you could satisfy both it and this License would be to
|
243
|
+
refrain entirely from distribution of the Program.
|
244
|
+
|
245
|
+
If any portion of this section is held invalid or unenforceable under
|
246
|
+
any particular circumstance, the balance of the section is intended to
|
247
|
+
apply and the section as a whole is intended to apply in other
|
248
|
+
circumstances.
|
249
|
+
|
250
|
+
It is not the purpose of this section to induce you to infringe any
|
251
|
+
patents or other property right claims or to contest validity of any
|
252
|
+
such claims; this section has the sole purpose of protecting the
|
253
|
+
integrity of the free software distribution system, which is
|
254
|
+
implemented by public license practices. Many people have made
|
255
|
+
generous contributions to the wide range of software distributed
|
256
|
+
through that system in reliance on consistent application of that
|
257
|
+
system; it is up to the author/donor to decide if he or she is willing
|
258
|
+
to distribute software through any other system and a licensee cannot
|
259
|
+
impose that choice.
|
260
|
+
|
261
|
+
This section is intended to make thoroughly clear what is believed to
|
262
|
+
be a consequence of the rest of this License.
|
263
|
+
|
264
|
+
8. If the distribution and/or use of the Program is restricted in
|
265
|
+
certain countries either by patents or by copyrighted interfaces, the
|
266
|
+
original copyright holder who places the Program under this License
|
267
|
+
may add an explicit geographical distribution limitation excluding
|
268
|
+
those countries, so that distribution is permitted only in or among
|
269
|
+
countries not thus excluded. In such case, this License incorporates
|
270
|
+
the limitation as if written in the body of this License.
|
271
|
+
|
272
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
273
|
+
of the General Public License from time to time. Such new versions will
|
274
|
+
be similar in spirit to the present version, but may differ in detail to
|
275
|
+
address new problems or concerns.
|
276
|
+
|
277
|
+
Each version is given a distinguishing version number. If the Program
|
278
|
+
specifies a version number of this License which applies to it and
|
279
|
+
"any later version", you have the option of following the terms and
|
280
|
+
conditions either of that version or of any later version published by
|
281
|
+
the Free Software Foundation. If the Program does not specify a
|
282
|
+
version number of this License, you may choose any version ever
|
283
|
+
published by the Free Software Foundation.
|
284
|
+
|
285
|
+
10. If you wish to incorporate parts of the Program into other free
|
286
|
+
programs whose distribution conditions are different, write to the author
|
287
|
+
to ask for permission. For software which is copyrighted by the Free
|
288
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
289
|
+
make exceptions for this. Our decision will be guided by the two goals
|
290
|
+
of preserving the free status of all derivatives of our free software and
|
291
|
+
of promoting the sharing and reuse of software generally.
|
292
|
+
|
293
|
+
NO WARRANTY
|
294
|
+
|
295
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
|
296
|
+
WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
297
|
+
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
298
|
+
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
|
299
|
+
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
300
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
301
|
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
302
|
+
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
303
|
+
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
304
|
+
|
305
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
306
|
+
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
307
|
+
AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
|
308
|
+
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
309
|
+
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
310
|
+
PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
311
|
+
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
312
|
+
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
|
313
|
+
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
314
|
+
DAMAGES.
|
315
|
+
|
316
|
+
END OF TERMS AND CONDITIONS
|
317
|
+
|
318
|
+
How to Apply These Terms to Your New Programs
|
319
|
+
|
320
|
+
If you develop a new program, and you want it to be of the greatest
|
321
|
+
possible use to the public, the best way to achieve this is to make it
|
322
|
+
free software which everyone can redistribute and change under these
|
323
|
+
terms.
|
324
|
+
|
325
|
+
To do so, attach the following notices to the program. It is safest
|
326
|
+
to attach them to the start of each source file to most effectively
|
327
|
+
convey the exclusion of warranty; and each file should have at least
|
328
|
+
the "copyright" line and a pointer to where the full notice is found.
|
329
|
+
|
330
|
+
<one line to give the program's name and a brief idea of what it does.>
|
331
|
+
Copyright (C) <year> <name of author>
|
332
|
+
|
333
|
+
This program is free software; you can redistribute it and/or modify
|
334
|
+
it under the terms of the GNU General Public License as published by
|
335
|
+
the Free Software Foundation; either version 2 of the License, or
|
336
|
+
(at your option) any later version.
|
337
|
+
|
338
|
+
This program is distributed in the hope that it will be useful,
|
339
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
340
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
341
|
+
GNU General Public License for more details.
|
342
|
+
|
343
|
+
You should have received a copy of the GNU General Public License
|
344
|
+
along with this program; if not, write to the Free Software
|
345
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
346
|
+
|
347
|
+
|
348
|
+
Also add information on how to contact you by electronic and paper mail.
|
349
|
+
|
350
|
+
If the program is interactive, make it output a short notice like this
|
351
|
+
when it starts in an interactive mode:
|
352
|
+
|
353
|
+
Gnomovision version 69, Copyright (C) year name of author
|
354
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
355
|
+
This is free software, and you are welcome to redistribute it
|
356
|
+
under certain conditions; type `show c' for details.
|
357
|
+
|
358
|
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
359
|
+
parts of the General Public License. Of course, the commands you use may
|
360
|
+
be called something other than `show w' and `show c'; they could even be
|
361
|
+
mouse-clicks or menu items--whatever suits your program.
|
362
|
+
|
363
|
+
You should also get your employer (if you work as a programmer) or your
|
364
|
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
365
|
+
necessary. Here is a sample; alter the names:
|
366
|
+
|
367
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
368
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
369
|
+
|
370
|
+
<signature of Ty Coon>, 1 April 1989
|
371
|
+
Ty Coon, President of Vice
|
372
|
+
|
373
|
+
This General Public License does not permit incorporating your program into
|
374
|
+
proprietary programs. If your program is a subroutine library, you may
|
375
|
+
consider it more useful to permit linking proprietary applications with the
|
376
|
+
library. If this is what you want to do, use the GNU Library General
|
377
|
+
Public License instead of this License.
|
32
378
|
|
33
|
-
Currently, the only available extension is VNMSH. You can read more about it in README.vnmsh.
|
data/lib/spectools.rb
CHANGED
@@ -283,8 +283,10 @@ module SpecTools
|
|
283
283
|
attr_accessor :attrs
|
284
284
|
#The type of inheritance
|
285
285
|
attr_accessor :inheritance
|
286
|
+
#The landscape on which the MType exists.
|
287
|
+
attr_accessor :landscape
|
286
288
|
|
287
|
-
def initialize(handle = nil, name = nil, attrs=Hash.new, visible = false, instantiable = false, derivable = false, destroyable = true, unique = false, required = false,inheritance = nil)
|
289
|
+
def initialize(handle = nil, name = nil, attrs=Hash.new, visible = false, instantiable = false, derivable = false, destroyable = true, unique = false, required = false,inheritance = nil, landscape = Landscape.new)
|
288
290
|
if handle.nil? || handle.hex?
|
289
291
|
@handle = handle
|
290
292
|
else
|
@@ -299,6 +301,7 @@ module SpecTools
|
|
299
301
|
@required = required
|
300
302
|
@inheritance = inheritance
|
301
303
|
@attrs = populate(attrs)
|
304
|
+
@landscape = landscape
|
302
305
|
end
|
303
306
|
|
304
307
|
#define a custom setter for attrs that will automatically convert
|
@@ -344,8 +347,10 @@ module SpecTools
|
|
344
347
|
attr_accessor :type
|
345
348
|
#A hash of Attr objects for the model
|
346
349
|
attr_accessor :attrs
|
350
|
+
#The landscape on which the Model exists.
|
351
|
+
attr_accessor :landscape
|
347
352
|
|
348
|
-
def initialize(handle = nil, name = nil, type = MType.new,
|
353
|
+
def initialize(handle = nil, name = nil, type = MType.new, landscape = Landscape.new,*attrs)
|
349
354
|
if handle.nil? || handle.hex?
|
350
355
|
@handle = handle
|
351
356
|
else
|
@@ -354,6 +359,7 @@ module SpecTools
|
|
354
359
|
@name = name
|
355
360
|
@type = type
|
356
361
|
@attrs = Hash.new
|
362
|
+
@landscape = landscape
|
357
363
|
attrs.each do |specattr|
|
358
364
|
if specattr.nil? || specattr.instance_of?(Attr)
|
359
365
|
@attrs[specattr.id] = specattr
|
@@ -377,10 +383,13 @@ module SpecTools
|
|
377
383
|
attr_accessor :name
|
378
384
|
#This relation's type
|
379
385
|
attr_accessor :type
|
386
|
+
#The landscape on which the Relation exists.
|
387
|
+
attr_accessor :landscape
|
380
388
|
|
381
|
-
def initialize(name = nil, type = nil)
|
389
|
+
def initialize(name = nil, type = nil, landscape = Landscape.new)
|
382
390
|
@name = name
|
383
391
|
@type = type
|
392
|
+
@landscape = landscape
|
384
393
|
end
|
385
394
|
|
386
395
|
end
|
@@ -439,8 +448,14 @@ module SpecTools
|
|
439
448
|
attr_accessor :url
|
440
449
|
#The ticket number associated with this alarm
|
441
450
|
attr_accessor :ticket
|
442
|
-
|
443
|
-
|
451
|
+
#The landscape on which the alarm was thrown
|
452
|
+
attr_accessor :landscape
|
453
|
+
#Set to true if the alarm is clearable by a user.
|
454
|
+
attr_accessor :clearable
|
455
|
+
#The state of the alarm
|
456
|
+
attr_accessor :state
|
457
|
+
|
458
|
+
def initialize(id = nil, time = nil, causeid = nil, model = Model.new, severity = nil, ack = false, stale = false, assignment = nil, status = nil, message = nil, url = nil, ticket = nil, clearable = nil, state = nil, landscape = Landscape.new)
|
444
459
|
@id = id
|
445
460
|
@time = time
|
446
461
|
if causeid.nil? || causeid.hex?
|
@@ -461,6 +476,9 @@ module SpecTools
|
|
461
476
|
@message = message
|
462
477
|
@url = url
|
463
478
|
@ticket = ticket
|
479
|
+
@landscape = landscape
|
480
|
+
@clearable = clearable
|
481
|
+
@state = state
|
464
482
|
end
|
465
483
|
|
466
484
|
#Returns true if the alarm has been acknowledged
|
@@ -494,7 +512,7 @@ module SpecTools
|
|
494
512
|
#The landscape's handle
|
495
513
|
attr_accessor :handle
|
496
514
|
|
497
|
-
def initialize(handle = nil, ssname = nil, precedence = nil, port = nil, service = nil
|
515
|
+
def initialize(handle = nil, ssname = nil, precedence = nil, port = nil, service = nil)
|
498
516
|
@ss = ssname
|
499
517
|
@precedence = precedence
|
500
518
|
@port = port
|
@@ -522,9 +540,11 @@ module SpecTools
|
|
522
540
|
#The Model the event was asserted against
|
523
541
|
attr_accessor :model
|
524
542
|
#The event message
|
525
|
-
attr_accessor :message
|
543
|
+
attr_accessor :message
|
544
|
+
#The landscape on which the Event exists.
|
545
|
+
attr_accessor :landscape
|
526
546
|
|
527
|
-
def initialize(time = nil, type = nil, model = Model.new, message = '')
|
547
|
+
def initialize(time = nil, type = nil, model = Model.new, message = '',landscape = Landscape.new)
|
528
548
|
@time = time
|
529
549
|
if type.nil? || type.hex?
|
530
550
|
@type = type
|
@@ -533,6 +553,7 @@ module SpecTools
|
|
533
553
|
end
|
534
554
|
@model = model
|
535
555
|
@message = message
|
556
|
+
@landscape = landscape
|
536
557
|
end
|
537
558
|
|
538
559
|
end
|
@@ -548,10 +569,13 @@ module SpecTools
|
|
548
569
|
attr_accessor :left_mtype
|
549
570
|
#The MType on the right hand side of the rule
|
550
571
|
attr_accessor :right_mtype
|
572
|
+
#The landscape on which the Rule exists.
|
573
|
+
attr_accessor :landscape
|
551
574
|
|
552
|
-
def initialize(left_mtype = MType.new, right_mtype = MType.new)
|
575
|
+
def initialize(left_mtype = MType.new, right_mtype = MType.new, landscape = Landscape.new)
|
553
576
|
@left_mtype = left_mtype
|
554
577
|
@right_mtype = right_mtype
|
578
|
+
@landscape = landscape
|
555
579
|
end
|
556
580
|
|
557
581
|
end
|
data/lib/spectools/version.rb
CHANGED
data/lib/vnmsh.rb
CHANGED
@@ -176,7 +176,17 @@ if defined?(SpecTools::MType)
|
|
176
176
|
end
|
177
177
|
mtype_output = session.show_types(filter)
|
178
178
|
mtype_output.each do |line|
|
179
|
-
|
179
|
+
mtype = MType.parse(line)
|
180
|
+
if filter && filter[:landscape]
|
181
|
+
if filter[:landscape].kind_of?(Landscape)
|
182
|
+
mtype.landscape = filter[:landscape]
|
183
|
+
else
|
184
|
+
mtype.landscape = Landscape.new(filter[:landscape])
|
185
|
+
end
|
186
|
+
else
|
187
|
+
mtype.landscape = session.current_landscape
|
188
|
+
end
|
189
|
+
mtypes.push(mtype)
|
180
190
|
end
|
181
191
|
return mtypes
|
182
192
|
end
|
@@ -302,7 +312,17 @@ if defined?(SpecTools::Model)
|
|
302
312
|
model_output = session.show_models(filter)
|
303
313
|
end
|
304
314
|
model_output.each do |line|
|
305
|
-
|
315
|
+
model = Model.parse(line)
|
316
|
+
if filter && filter[:landscape]
|
317
|
+
if filter[:landscape].kind_of?(Landscape)
|
318
|
+
model.landscape = filter[:landscape]
|
319
|
+
else
|
320
|
+
model.landscape = Landscape.new(filter[:landscape])
|
321
|
+
end
|
322
|
+
else
|
323
|
+
model.landscape = session.current_landscape
|
324
|
+
end
|
325
|
+
models.push(model)
|
306
326
|
end
|
307
327
|
return models
|
308
328
|
end
|
@@ -521,7 +541,18 @@ if defined?(SpecTools::Relation)
|
|
521
541
|
session = VNMSH.get_session(session)
|
522
542
|
rel_output = session.show_relations(landscape)
|
523
543
|
rel_output.each do |line|
|
524
|
-
|
544
|
+
relation = Relation.parse(line)
|
545
|
+
if landscape
|
546
|
+
if landscape.kind_of?(Landscape)
|
547
|
+
relation.landscape = landscape
|
548
|
+
else
|
549
|
+
relation.landscape = Landscape.new(landscape)
|
550
|
+
end
|
551
|
+
else
|
552
|
+
relation.landscape = session.current_landscape
|
553
|
+
end
|
554
|
+
relations.push(relation)
|
555
|
+
|
525
556
|
end
|
526
557
|
return relations
|
527
558
|
end
|
@@ -535,7 +566,17 @@ if defined?(SpecTools::Relation)
|
|
535
566
|
rules = Array.new
|
536
567
|
rule_output = session.show_rules(self)
|
537
568
|
rule_output.each do |line|
|
538
|
-
|
569
|
+
rule = Rule.parse(line)
|
570
|
+
if landscape
|
571
|
+
if landscape.kind_of?(Landscape)
|
572
|
+
rule.landscape = landscape
|
573
|
+
else
|
574
|
+
rule.landscape = Landscape.new(landscape)
|
575
|
+
end
|
576
|
+
else
|
577
|
+
rule.landscape = session.current_landscape
|
578
|
+
end
|
579
|
+
rules.push(rule)
|
539
580
|
end
|
540
581
|
return rules
|
541
582
|
end
|
@@ -668,7 +709,17 @@ if defined?(SpecTools::Alarm)
|
|
668
709
|
causes = Hash.new
|
669
710
|
alarm_output.each do |line|
|
670
711
|
if line =~ /\d+\s+\d\d\/\d\d\/\d\d\d\d/
|
671
|
-
|
712
|
+
alarm = Alarm.parse(line)
|
713
|
+
if type == :landscape
|
714
|
+
if mh_or_lh.kind_of?(Landscape)
|
715
|
+
alarm.landscape = mh_or_lh
|
716
|
+
else
|
717
|
+
alarm.landscape = Landscape.new(mh_or_lh)
|
718
|
+
end
|
719
|
+
else
|
720
|
+
alarm.landscape = session.current_landscape
|
721
|
+
end
|
722
|
+
alarms.push(alarm)
|
672
723
|
elsif line =~ /^(0x[a-fA-F0-9]+)\s/
|
673
724
|
causeid = $1
|
674
725
|
causes[causeid] = line.sub(/^(0x[a-fA-F0-9]+)\s/,"")
|
@@ -742,7 +793,17 @@ if defined?(SpecTools::Event)
|
|
742
793
|
event_output = session.show_events(type,mh_or_lh,limit,evformat)
|
743
794
|
event_output.each do |line|
|
744
795
|
if line =~ /^\d\d\/\d\d\/\d\d\d\d/
|
745
|
-
|
796
|
+
event = Event.parse(line)
|
797
|
+
if type == :landscape
|
798
|
+
if mh_or_lh.kind_of?(Landscape)
|
799
|
+
event.landscape = mh_or_lh
|
800
|
+
else
|
801
|
+
event.landscape = Landscape.new(mh_or_lh)
|
802
|
+
end
|
803
|
+
else
|
804
|
+
event.landscape = session.current_landscape
|
805
|
+
end
|
806
|
+
events.push(event)
|
746
807
|
else
|
747
808
|
events.last.message = events.last.message + line
|
748
809
|
end
|
@@ -896,6 +957,7 @@ class VNMSH
|
|
896
957
|
disconnectcmd = @specroot + '/vnmsh/disconnect 2>&1'
|
897
958
|
output = StringIO.new(`#{disconnectcmd}`)
|
898
959
|
@connected = false
|
960
|
+
@current_landscape = nil
|
899
961
|
result = output.readline
|
900
962
|
if result =~ /^disconnect: successful/
|
901
963
|
return true
|
@@ -1042,11 +1104,11 @@ class VNMSH
|
|
1042
1104
|
when :type
|
1043
1105
|
showcmd += ' mth=' + get_handle(filter[option],MType)
|
1044
1106
|
when :name
|
1045
|
-
showcmd += ' mname=' + filter[option]
|
1107
|
+
showcmd += ' mname="' + filter[option] + '"'
|
1046
1108
|
when :landscape
|
1047
1109
|
showcmd += ' lh=' + get_handle(filter[option],Landscape)
|
1048
1110
|
else
|
1049
|
-
raise ArgumentError, 'Valid filter options are :range, :name, :
|
1111
|
+
raise ArgumentError, 'Valid filter options are :range, :name, :type, or :landscape'
|
1050
1112
|
end
|
1051
1113
|
end
|
1052
1114
|
end
|
@@ -1148,7 +1210,7 @@ class VNMSH
|
|
1148
1210
|
get_handle(filter[option][1],MType) if filter[option].kind_of?(Array)
|
1149
1211
|
|
1150
1212
|
when :name
|
1151
|
-
showcmd += ' mtname=' + filter[option]
|
1213
|
+
showcmd += ' mtname="' + filter[option] + '"'
|
1152
1214
|
when :flag
|
1153
1215
|
showcmd += ' flags=' + filter[option]
|
1154
1216
|
when :landscape
|
@@ -1594,7 +1656,7 @@ class VNMSH
|
|
1594
1656
|
createcmd += get_handle(mtype,MType)
|
1595
1657
|
createcmd += expand_attrs(attrs) if attrs
|
1596
1658
|
createcmd += ' lh=' + get_handle(landscape,Landscape) if landscape
|
1597
|
-
output = exec_cmd(createcmd)
|
1659
|
+
output = exec_cmd(expand_backslashes(createcmd))
|
1598
1660
|
result = output.readlines.last
|
1599
1661
|
if result =~ /created model handle\s+=\s+(0x[0-f]+)/
|
1600
1662
|
model = Model.new
|
@@ -1621,7 +1683,7 @@ class VNMSH
|
|
1621
1683
|
updatecmd = 'update mh='
|
1622
1684
|
updatecmd += get_handle(model,Model)
|
1623
1685
|
updatecmd += expand_attrs(attrs)
|
1624
|
-
output = exec_cmd(updatecmd)
|
1686
|
+
output = exec_cmd(expand_backslashes(updatecmd))
|
1625
1687
|
result = output.readlines.first
|
1626
1688
|
if result =~ /^Id/
|
1627
1689
|
return true
|
@@ -1670,7 +1732,7 @@ class VNMSH
|
|
1670
1732
|
updatecmd += process_alarm_action(key,action[key])
|
1671
1733
|
end
|
1672
1734
|
end
|
1673
|
-
result = exec_cmd(updatecmd)
|
1735
|
+
result = exec_cmd(expand_backslashes(updatecmd))
|
1674
1736
|
if $?.exitstatus == 0
|
1675
1737
|
return true
|
1676
1738
|
else
|
@@ -1730,11 +1792,11 @@ class VNMSH
|
|
1730
1792
|
createcmd = 'create alarm '
|
1731
1793
|
createcmd += '-nr ' if replace
|
1732
1794
|
if severity =~ /CRITICAL/i ||
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1795
|
+
severity =~ /MAJOR/i ||
|
1796
|
+
severity =~ /MINOR/i ||
|
1797
|
+
severity =~ /SUPPRESSED/i ||
|
1798
|
+
severity =~ /MAINTENANCE/i ||
|
1799
|
+
severity =~ /INITIAL/i
|
1738
1800
|
createcmd += "sev=#{severity} "
|
1739
1801
|
else
|
1740
1802
|
raise ArgumentError, 'Severity must be CRITICAL, MAJOR, MINOR, SUPPRESSED, MAINTENANCE, or INITIAL'
|
@@ -1776,7 +1838,7 @@ class VNMSH
|
|
1776
1838
|
raise ArgumentError, 'You must pass a valid Event Code'
|
1777
1839
|
end
|
1778
1840
|
createcmd += ' mh=' + get_handle(model,Model)
|
1779
|
-
output = exec_cmd(createcmd)
|
1841
|
+
output = exec_cmd(expand_backslashes(createcmd))
|
1780
1842
|
if $?.exitstatus > 0
|
1781
1843
|
raise CommandError, output.readlines.first
|
1782
1844
|
else
|
@@ -1794,6 +1856,10 @@ class VNMSH
|
|
1794
1856
|
|
1795
1857
|
private
|
1796
1858
|
|
1859
|
+
def expand_backslashes(cmd)
|
1860
|
+
return cmd.gsub(/\\/,'\\\\\\\\')
|
1861
|
+
end
|
1862
|
+
|
1797
1863
|
def valid_alarm_action?(action)
|
1798
1864
|
validactions = [ :ticket,
|
1799
1865
|
:assign,
|
data/test/test_spectools.rb
CHANGED
@@ -49,6 +49,8 @@ class TestSpectool < Test::Unit::TestCase
|
|
49
49
|
@alarmcause = "Test Cause"
|
50
50
|
@alarmurl = "http://www.test.com"
|
51
51
|
@alarmticket = "ticket12345"
|
52
|
+
@alarmclearable = true
|
53
|
+
@alarmstate = 'NEW'
|
52
54
|
@ssname = "test.ss.com"
|
53
55
|
@lscapeprecedence = 10
|
54
56
|
@lscapeport = "0xbeef"
|
@@ -187,13 +189,14 @@ class TestSpectool < Test::Unit::TestCase
|
|
187
189
|
assert_equal false, mtype.required
|
188
190
|
assert_nil mtype.inheritance
|
189
191
|
assert_instance_of Hash, mtype.attrs
|
190
|
-
|
192
|
+
assert_instance_of Landscape, mtype.landscape
|
191
193
|
end
|
192
194
|
|
193
195
|
def test_init_mtype_args
|
194
196
|
attr1 = SpecTools::Attr.new('0x01','test')
|
195
197
|
attr2 = SpecTools::Attr.new(@attrid,@attrname)
|
196
|
-
|
198
|
+
testlscape = SpecTools::Landscape.new('0x400000')
|
199
|
+
mtype = SpecTools::MType.new(@mthandle,@mtname,[attr1,attr2],@mtvisible,@mtinstantiable,@mtderivable,@mtdestroy,@mtunique,@mtrequired,@mtinheritance,testlscape)
|
197
200
|
assert_equal @mthandle, mtype.handle
|
198
201
|
assert_equal @mtname, mtype.name
|
199
202
|
assert_equal @mtvisible, mtype.visible
|
@@ -211,6 +214,7 @@ class TestSpectool < Test::Unit::TestCase
|
|
211
214
|
assert_raise ArgumentError do
|
212
215
|
SpecTools::MType.new(nil,nil,["notanattr"])
|
213
216
|
end
|
217
|
+
assert_same testlscape, mtype.landscape
|
214
218
|
end
|
215
219
|
|
216
220
|
def test_set_mtype_attrs
|
@@ -234,29 +238,35 @@ class TestSpectool < Test::Unit::TestCase
|
|
234
238
|
assert_nil smodel.handle
|
235
239
|
assert_instance_of SpecTools::MType, smodel.type
|
236
240
|
assert_equal Hash.new, smodel.attrs
|
241
|
+
assert_instance_of Landscape, smodel.landscape
|
237
242
|
end
|
238
243
|
|
239
244
|
def test_init_model_args
|
240
245
|
attr1 = SpecTools::Attr.new
|
241
246
|
attr2 = SpecTools::Attr.new(@attrid,@attrname)
|
242
247
|
mtype = SpecTools::MType.new(@mthandle,@mtname)
|
243
|
-
|
248
|
+
testlscape = SpecTools::Landscape.new('0x400000')
|
249
|
+
smodel = SpecTools::Model.new(@modelhandle, @modelname, mtype, testlscape,attr1, attr2)
|
244
250
|
assert_equal @modelhandle, smodel.handle
|
245
251
|
assert_same mtype, smodel.type
|
246
252
|
assert_same attr1, smodel.attrs[attr1.id]
|
247
253
|
assert_same attr2, smodel.attrs[attr2.id]
|
254
|
+
assert_same testlscape, smodel.landscape
|
248
255
|
end
|
249
256
|
|
250
257
|
def test_init_relation
|
251
258
|
relation = SpecTools::Relation.new
|
252
259
|
assert_nil relation.name
|
253
260
|
assert_nil relation.type
|
261
|
+
assert_instance_of Landscape, relation.landscape
|
254
262
|
end
|
255
263
|
|
256
264
|
def test_init_relation_args
|
257
|
-
|
265
|
+
testlscape = SpecTools::Landscape.new('0x400000')
|
266
|
+
relation = SpecTools::Relation.new(@relname,@reltype,testlscape)
|
258
267
|
assert_equal @relname, relation.name
|
259
268
|
assert_equal @reltype, relation.type
|
269
|
+
assert_same testlscape, relation.landscape
|
260
270
|
end
|
261
271
|
|
262
272
|
def test_init_association
|
@@ -290,11 +300,15 @@ class TestSpectool < Test::Unit::TestCase
|
|
290
300
|
assert_nil alarm.message
|
291
301
|
assert_nil alarm.url
|
292
302
|
assert_nil alarm.ticket
|
303
|
+
assert_nil alarm.clearable
|
304
|
+
assert_nil alarm.state
|
305
|
+
assert_instance_of SpecTools::Landscape, alarm.landscape
|
293
306
|
end
|
294
307
|
|
295
308
|
def test_init_alarm_args
|
296
309
|
testmodel = SpecTools::Model.new(@modelhandle, @modelname, SpecTools::MType.new(nil,@mtname))
|
297
|
-
|
310
|
+
testlscape = SpecTools::Landscape.new('0x400000')
|
311
|
+
alarm = SpecTools::Alarm.new(@alarmid, @alarmtime, @alarmcauseid, testmodel, @alarmseverity, @alarmack, @alarmstale, @alarmassign, @alarmstatus,@alarmcause,@alarmurl,@alarmticket,@alarmclearable,@alarmstate,testlscape)
|
298
312
|
assert_equal @alarmid, alarm.id
|
299
313
|
assert_equal @alarmtime, alarm.time
|
300
314
|
assert_equal @alarmcauseid, alarm.causeid
|
@@ -307,12 +321,16 @@ class TestSpectool < Test::Unit::TestCase
|
|
307
321
|
assert_equal @alarmcause, alarm.message
|
308
322
|
assert_equal @alarmurl, alarm.url
|
309
323
|
assert_equal @alarmticket, alarm.ticket
|
324
|
+
assert_equal @alarmclearable, alarm.clearable
|
325
|
+
assert_equal @alarmstate, alarm.state
|
326
|
+
|
310
327
|
assert_raise ArgumentError do
|
311
328
|
SpecTools::Alarm.new(nil,nil,"bogus")
|
312
329
|
end
|
313
330
|
assert_raise ArgumentError do
|
314
331
|
SpecTools::Alarm.new(nil,nil,nil,"bogus")
|
315
332
|
end
|
333
|
+
assert_same testlscape,alarm.landscape
|
316
334
|
end
|
317
335
|
|
318
336
|
def test_init_landscape
|
@@ -342,11 +360,13 @@ class TestSpectool < Test::Unit::TestCase
|
|
342
360
|
assert_nil event.type
|
343
361
|
assert_equal '', event.message
|
344
362
|
assert_instance_of SpecTools::Model, event.model
|
363
|
+
assert_instance_of SpecTools::Landscape, event.landscape
|
345
364
|
end
|
346
365
|
|
347
366
|
def test_init_event_args
|
348
367
|
model = SpecTools::Model.new(@modelhandle,@modelname)
|
349
|
-
|
368
|
+
testlscape = SpecTools::Landscape.new('0x400000')
|
369
|
+
event = SpecTools::Event.new(@eventtime,@eventtype,model,@eventmessage,testlscape)
|
350
370
|
assert_equal @eventtime, event.time
|
351
371
|
assert_equal @eventtype, event.type
|
352
372
|
assert_equal @eventmessage, event.message
|
@@ -354,20 +374,25 @@ class TestSpectool < Test::Unit::TestCase
|
|
354
374
|
assert_raise ArgumentError do
|
355
375
|
SpecTools::Event.new(nil,"bogus")
|
356
376
|
end
|
377
|
+
assert_same testlscape, event.landscape
|
378
|
+
|
357
379
|
end
|
358
380
|
|
359
381
|
def test_init_rule
|
360
382
|
rule = SpecTools::Rule.new
|
361
383
|
assert_instance_of SpecTools::MType, rule.left_mtype
|
362
384
|
assert_instance_of SpecTools::MType, rule.right_mtype
|
385
|
+
assert_instance_of Landscape, rule.landscape
|
363
386
|
end
|
364
387
|
|
365
388
|
def test_init_rule_args
|
366
389
|
mtype1 = SpecTools::MType.new
|
367
390
|
mtype2 = SpecTools::MType.new
|
368
|
-
|
391
|
+
testlscape = SpecTools::Landscape.new('0x400000')
|
392
|
+
rule = SpecTools::Rule.new(mtype1,mtype2,testlscape)
|
369
393
|
assert_same mtype1, rule.left_mtype
|
370
394
|
assert_same mtype2, rule.right_mtype
|
395
|
+
assert_same testlscape, rule.landscape
|
371
396
|
end
|
372
397
|
|
373
398
|
def test_watch_init
|
data/test/test_vnmsh.rb
CHANGED
@@ -114,6 +114,7 @@ class VNMSHConnectionTests < Test::Unit::TestCase
|
|
114
114
|
def test_vnmsh_connect
|
115
115
|
landscape = @session.connect
|
116
116
|
assert_instance_of SpecTools::Landscape, landscape
|
117
|
+
assert_same landscape, @session.current_landscape
|
117
118
|
end
|
118
119
|
|
119
120
|
def test_vnmsh_connect_args
|
@@ -126,6 +127,7 @@ class VNMSHConnectionTests < Test::Unit::TestCase
|
|
126
127
|
assert_instance_of SpecTools::Landscape, landscape
|
127
128
|
assert_equal 'testhost', landscape.ss
|
128
129
|
assert_equal '0x400000', landscape.handle
|
130
|
+
assert_same landscape, @session.current_landscape
|
129
131
|
|
130
132
|
(0..7).each do |i|
|
131
133
|
assert_raise VNMSH::ConnectError do
|
@@ -142,6 +144,7 @@ class VNMSHConnectionTests < Test::Unit::TestCase
|
|
142
144
|
@session.disconnect
|
143
145
|
end
|
144
146
|
assert_equal false, @session.connected?
|
147
|
+
assert_nil @session.current_landscape
|
145
148
|
end
|
146
149
|
|
147
150
|
def test_vnmsh_exec_cmd
|
@@ -1133,6 +1136,7 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1133
1136
|
end
|
1134
1137
|
models = SpecTools::Model.cli_find(nil,nil,@session)
|
1135
1138
|
assert_equal 2251, models.size
|
1139
|
+
assert_same @session.current_landscape, models.first.landscape
|
1136
1140
|
|
1137
1141
|
|
1138
1142
|
end
|
@@ -1159,6 +1163,7 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1159
1163
|
end
|
1160
1164
|
mtypes = SpecTools::MType.cli_find(nil,@session)
|
1161
1165
|
assert_equal 4209, mtypes.size
|
1166
|
+
assert_same @session.current_landscape, mtypes.first.landscape
|
1162
1167
|
|
1163
1168
|
end
|
1164
1169
|
|
@@ -1188,7 +1193,9 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1188
1193
|
assert_raise ArgumentError do
|
1189
1194
|
SpecTools::Alarm.cli_find(:all)
|
1190
1195
|
end
|
1191
|
-
|
1196
|
+
alarms = SpecTools::Alarm.cli_find(:all,nil,nil,@session)
|
1197
|
+
assert_equal 10, alarms.size
|
1198
|
+
assert_same @session.current_landscape, alarms.first.landscape
|
1192
1199
|
end
|
1193
1200
|
|
1194
1201
|
def test_event_cli_find_all
|
@@ -1211,6 +1218,7 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1211
1218
|
end
|
1212
1219
|
events = SpecTools::Event.cli_find(:all,nil,nil,nil,@session)
|
1213
1220
|
assert_equal 2000,events.size
|
1221
|
+
assert_same @session.current_landscape, events.first.landscape
|
1214
1222
|
|
1215
1223
|
end
|
1216
1224
|
|
@@ -1255,6 +1263,7 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1255
1263
|
relations = nil
|
1256
1264
|
relations = SpecTools::Relation.cli_find(nil,@session)
|
1257
1265
|
assert_equal 150, relations.size
|
1266
|
+
assert_same @session.current_landscape, relations.first.landscape
|
1258
1267
|
|
1259
1268
|
end
|
1260
1269
|
|
@@ -1328,7 +1337,9 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1328
1337
|
end
|
1329
1338
|
|
1330
1339
|
def test_relation_find_all
|
1331
|
-
|
1340
|
+
relations = SpecTools::Relation.find(nil,@session)
|
1341
|
+
assert_equal 150, relations.size
|
1342
|
+
assert_same @session.current_landscape, relations.first.landscape
|
1332
1343
|
end
|
1333
1344
|
|
1334
1345
|
def test_cli_attr_get
|
@@ -1430,9 +1441,7 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1430
1441
|
model = SpecTools::Model.new('0x400005cb')
|
1431
1442
|
|
1432
1443
|
assert_equal 46, model.cli_get_children.size
|
1433
|
-
|
1434
1444
|
assert_equal 46, model.get_children.size
|
1435
|
-
|
1436
1445
|
assert_equal 13, model.get_children('PossPrimApp').size
|
1437
1446
|
|
1438
1447
|
rel = SpecTools::Relation.new('PossPrimApp')
|
@@ -1484,7 +1493,9 @@ class VNMSHCommandTests < Test::Unit::TestCase
|
|
1484
1493
|
def test_cli_rules_find
|
1485
1494
|
relation = SpecTools::Relation.new('Collects')
|
1486
1495
|
assert_equal 5837, relation.cli_get_rules.size
|
1487
|
-
|
1496
|
+
rules = relation.get_rules(nil,@session)
|
1497
|
+
assert_equal 5837, rules.size
|
1498
|
+
assert_same @session.current_landscape, rules.first.landscape
|
1488
1499
|
end
|
1489
1500
|
|
1490
1501
|
def test_cli_watch_find
|
data/test/testcmds/ack
CHANGED
File without changes
|
data/test/testcmds/connect
CHANGED
File without changes
|
data/test/testcmds/create
CHANGED
File without changes
|
data/test/testcmds/destroy
CHANGED
File without changes
|
data/test/testcmds/disconnect
CHANGED
File without changes
|
data/test/testcmds/seek
CHANGED
File without changes
|
data/test/testcmds/show
CHANGED
File without changes
|
data/test/testcmds/update
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donavan Pantke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-04-24 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -19,11 +19,14 @@ executables: []
|
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files:
|
23
|
+
- CHANGELOG.txt
|
24
|
+
- Manifest.txt
|
25
|
+
- README.txt
|
26
|
+
- README.vnmsh.txt
|
24
27
|
files:
|
25
|
-
- TODO
|
26
28
|
- CHANGELOG.txt
|
29
|
+
- TODO
|
27
30
|
- Manifest.txt
|
28
31
|
- README.txt
|
29
32
|
- README.vnmsh.txt
|
@@ -105,8 +108,9 @@ files:
|
|
105
108
|
has_rdoc: true
|
106
109
|
homepage: http://spectools.rubyforge.org
|
107
110
|
post_install_message:
|
108
|
-
rdoc_options:
|
109
|
-
|
111
|
+
rdoc_options:
|
112
|
+
- --main
|
113
|
+
- README.txt
|
110
114
|
require_paths:
|
111
115
|
- lib
|
112
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -124,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
128
|
requirements: []
|
125
129
|
|
126
130
|
rubyforge_project: spectools
|
127
|
-
rubygems_version: 1.
|
131
|
+
rubygems_version: 1.1.1
|
128
132
|
signing_key:
|
129
133
|
specification_version: 2
|
130
134
|
summary: A utility suite for CA's SPECTRUM Network Fault Manager
|