(file) Return to StressTestController.h CVS log (file) (dir) Up to [Pegasus] / pegasus / test / StressTestController

  1 j.alex 1.1.2.1 //%2006////////////////////////////////////////////////////////////////////////
  2                //
  3                // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4                // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5                // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6                // IBM Corp.; EMC Corporation, The Open Group.
  7                // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8                // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9                // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10                // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11                // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12                // EMC Corporation; Symantec Corporation; The Open Group.
 13                //
 14                // Permission is hereby granted, free of charge, to any person obtaining a copy
 15                // of this software and associated documentation files (the "Software"), to
 16                // deal in the Software without restriction, including without limitation the
 17                // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18                // sell copies of the Software, and to permit persons to whom the Software is
 19                // furnished to do so, subject to the following conditions:
 20                //
 21                // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 j.alex 1.1.2.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23                // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24                // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25                // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26                // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27                // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28                // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29                //
 30                //==============================================================================
 31                //
 32                // Author: John Alex (IBM)
 33                //
 34                // Modified By:
 35                //
 36                //%/////////////////////////////////////////////////////////////////////////////
 37                
 38                #ifndef Pegasus_StressTestControllerCommand_h
 39                #define Pegasus_StressTestControllerCommand_h
 40                
 41                #include <Pegasus/Common/String.h>
 42                #include <Pegasus/Common/HashTable.h>
 43 j.alex 1.1.2.1 #include <Clients/cliutils/Command.h>
 44                #include <Clients/cliutils/CommandException.h>
 45                
 46 j.alex 1.1.2.2 struct tm getCurrentActualTime();
 47 j.alex 1.1.2.1 
 48                PEGASUS_NAMESPACE_BEGIN
 49                
 50                ////////////////////////////////////////////////////////////////////////////////
 51                // ConfigTable to contain the stressTest configurations
 52                ////////////////////////////////////////////////////////////////////////////////
 53                typedef HashTable<String, String, EqualFunc<String>, HashFunc<String> > Table;
 54                
 55                /**
 56 j.alex 1.1.2.2     This constant signifies that an operation option has not been recorded.
 57 j.alex 1.1.2.1 */
 58 j.alex 1.1.2.2 static const Uint32 OPERATION_TYPE_UNINITIALIZED = 0;
 59 j.alex 1.1.2.1 
 60                /**
 61 j.alex 1.1.2.2     This constant represents a help operation.
 62 j.alex 1.1.2.1 */
 63 j.alex 1.1.2.2 static const Uint32 OPERATION_TYPE_HELP = 1;
 64 j.alex 1.1.2.1 
 65                /**
 66 j.alex 1.1.2.2     This constant represents a version display operation.
 67 j.alex 1.1.2.1 */
 68 j.alex 1.1.2.2 static const Uint32 OPERATION_TYPE_VERSION = 2;
 69 j.alex 1.1.2.1 
 70                
 71 j.alex 1.1.2.2 static Boolean verboseEnabled = false;
 72 j.alex 1.1.2.1 
 73                
 74                /**
 75                   The StressTestController command requires CIM Server to be
 76                   installed and running on the target host.
 77                
 78                 */
 79                class StressTestControllerCommand : public Command
 80                {
 81                public:
 82                
 83                    enum { DEFAULT_TIMEOUT_MILLISECONDS = 200000 };
 84                
 85                    /**
 86                
 87                        Constructs an StressTestControllerCommand and initializes 
 88                        instance variables.
 89                
 90                     */
 91                
 92                    StressTestControllerCommand ();
 93 j.alex 1.1.2.1     /**
 94                
 95                        Parses the command line, validates the options, and sets instance
 96                        variables based on the option arguments.
 97                
 98                        @param   argc  the number of command line arguments
 99                        @param   argv  the string vector of command line arguments
100                
101                        @exception  CommandFormatException  if an error is encountered in
102                                                            parsing the command line
103                
104                     */
105                
106                    void setCommand (Uint32 argc, char* argv []);
107                
108                    /**
109                
110                        Executes the command and writes the results to the PrintWriters.
111                
112                        @param   outPrintWriter     the ostream to which output should be
113                                                    written
114 j.alex 1.1.2.1         @param   errPrintWriter     the ostream to which error output should be
115                                                    written
116                
117                        @return  0                  if the command is successful
118                                 1                  if an error occurs in executing the command
119                
120                     */
121 j.alex 1.1.2.2     Uint32 execute(ostream& outPrintWriter, ostream& errPrintWriter);
122 j.alex 1.1.2.1 
123                    /**
124                
125                        Generates the actual commands for each of the test clients.
126                
127                        @return  true               if the commands are generated successfully
128                                 false              if unsuccessful in generating commands.
129                
130                     */
131                    Boolean generateClientCommands(ostream& log_file);
132                
133                    /**
134                        Retrieves the config information from the stressController configuration
135                        file.
136                
137                        @param   filePath     the filename itself may or may not include an 
138                                              absolute path.
139                        @return  
140                     */
141                    Boolean getFileContent (String filePath,ostream& log_file);
142                
143 j.alex 1.1.2.1     /**
144                        Retrieves the config file path name
145                
146                        @return _configFilePath  The pathname is returned.
147                 
148                     */
149                    String getConfigFilePath(){ return _configFilePath;}
150                
151                    /**
152                        Checks to verify if new pathname was opted.
153                
154                        @return true   A path name was set.
155                                false  Use the default pathname.
156                 
157                     */
158                    Boolean IsConfigFilePathSpecified(){return _configFilePathSpecified;}
159                
160                    /**
161                        Retrieves the command operation type 
162                
163                        @return _operationType  The operation type is returned.
164 j.alex 1.1.2.1  
165                     */
166                    Uint32 getOperationType(){return _operationType;}
167                
168                    /**
169                        Populate test with default configuration values if default configuration file
170                        is not found.
171                
172                        @return 
173                               
174                     */
175                    void getDefaultClients(ostream& log_file);
176                
177                    /**
178                        The command name.
179                     */
180                    static const char   COMMAND_NAME [];
181                
182                
183                    /**
184                       Will generate or create all the required files for the tests.
185 j.alex 1.1.2.1        Required log files, pid files etc are created here.
186                       
187                       @parm    strTime         The time stamp for the tests.
188                
189                       @return  
190                
191                    */
192                    Boolean generateRequiredFileNames(char *strTime);
193                
194                    /**
195                       Will remove all the unused files for the tests.
196                       - Unused log files & pid files are removed here.
197                
198                    */
199 j.alex 1.1.2.2     void removeUnusedFiles();
200 j.alex 1.1.2.1 
201                    /**
202 j.alex 1.1.2.2         Retrieves the stress Test log file path name.
203 j.alex 1.1.2.1 
204                        @return StressTestLogFile  The log filename is returned.
205                 
206                     */
207 j.alex 1.1.2.2     String getStressTestLogFile(){ return _stressTestLogFile;}
208                    String getStressClientLogFile(){ return _stressTestClientLogFile;}
209 j.alex 1.1.2.1 
210 j.alex 1.1.2.3     /**
211                      Stress Test directories and files.
212                     */  
213                    static char FILENAME[];
214 j.alex 1.1.2.1     static char TESTDIR[];
215                    static char STRESSTESTDIR[];
216                    static char LOGDIR[];
217                    static char BINDIR[];
218                    static char DEFAULT_DIR[];
219                    static char DEFAULT_CFGDIR[];
220                    static char DEFAULT_LOGDIR[];
221                    static char DEFAULT_TMPDIR[];
222                
223 j.alex 1.1.2.3     //
224                    // Environment variable:
225 j.alex 1.1.2.1     //
226                    char* pegasusHome;
227                
228                private:
229                
230                    /**
231 j.alex 1.1.2.2         Parses each line in the stressController config file.
232 j.alex 1.1.2.1 
233                        @return true   Parse was successful.
234                                false  Parsing resulted in a failure or invalid config.
235                     */
236 j.alex 1.1.2.2     Boolean _parseLine(
237                        const String & string,
238                        int line,
239                        String & name,
240                        String & value,
241                        ostream& log_file);
242 j.alex 1.1.2.1 
243                    /**
244 j.alex 1.1.2.2         Stores client details from config file.
245 j.alex 1.1.2.1 
246                        @return true   Successfully retrieved and stored the details.
247                                false  Un-successfull.
248                     */
249 j.alex 1.1.2.2     Boolean _storeClientDetails(String name, String value);
250 j.alex 1.1.2.1 
251                    /**
252 j.alex 1.1.2.2         Validate StressTest configuration properties & clients.
253 j.alex 1.1.2.1 
254                        @return true   Successfully validated.
255                                false  Un-successfull.
256                     */
257 j.alex 1.1.2.2     Boolean _validateConfiguration(
258                        String & var,
259                        const String & value,
260                        ostream& log_file);
261 j.alex 1.1.2.1     
262                    /**
263 j.alex 1.1.2.2         parse and save all the options for each client. 
264 j.alex 1.1.2.1 
265                        @return 
266                 
267                     */
268 j.alex 1.1.2.2     void _getClientOptions(const Char16* p,ostream& log_file);
269 j.alex 1.1.2.1 
270                    /**
271                        Checks if the actual tolerance level of the current tests
272                        are within expected tolerances.
273                
274                        @return true   Within tolerance level
275                                false  Failed tolerance expectations.
276                 
277                     */
278 j.alex 1.1.2.2     Boolean _checkToleranceLevel(
279                        int act_clients,
280                        Uint64 nowMilliseconds,
281                        ostream& log_file);
282 j.alex 1.1.2.1 
283                    /**
284 j.alex 1.1.2.2         Retrieves and stores client details from client pid file.
285 j.alex 1.1.2.1 
286                        @return true   Successfully retrieved and stored the details.
287                                false  Un-successfull.
288                     */
289 j.alex 1.1.2.2     Boolean _getClientPIDs(int clients,ostream& log_file);
290 j.alex 1.1.2.1 
291                
292                    /**
293                        The host on which the command is to be executed.  A CIM Server must be
294                        running on this host when the command is executed.  The default host is
295                        the local host.
296                     */
297                    String _hostName;
298                
299                    /**
300                        A Boolean indicating whether a hostname was specified on the command
301                        line.  The default host is the local host.
302                     */
303                    Boolean _hostNameSpecified;
304                
305                    /**
306                        The timeout value to be used, in milliseconds.
307                        The default timeout value is DEFAULT_TIMEOUT_MILLISECONDS.
308                     */
309                    Uint32 _timeout;
310                
311 j.alex 1.1.2.1 
312                    /**
313                
314                        The port to be used when the command is executed. The
315                        port number must be the port number on which the
316                        target CIM Server is running.
317                
318                        If no port is specified, StressTestController will attempt to locate 
319                        the port associated with the service "wbem-http" for non-SSL connections
320                        and "wbem-https" for SSL connections. If not found, the DMTF
321                        recommended default port number will be used.
322                
323                        _portNumberStr and _portNumber are not used with
324                        connectLocal().
325                
326                        The default port for non-SSL 5988 and 5989 for SSL.
327                
328                     */
329                    String _portNumberStr;
330                    Uint32 _portNumber;
331 j.alex 1.1.2.2     Uint32 _port;  // JA not sure..if needed
332 j.alex 1.1.2.1 
333                    /**
334                        A Boolean indicating whether a port number was specified on the
335                	command line.
336                     */
337                    Boolean _portNumberSpecified;
338                
339                    /**
340                        The username to be used for authentication and
341                        authorization of the operation.
342                     */
343                    String _userName;
344                
345                    /**
346                        Indicates that the user name is set.
347                     */
348                    Boolean _userNameSpecified;
349                
350                    /**
351                        The password to be used for authentication.
352                     */
353 j.alex 1.1.2.1     String _password;
354                
355                    /**
356                        Indicates that the password is set.
357                     */
358                    Boolean _passwordSpecified;
359                
360                    /**
361                        A Boolean indicating whether an SSL connection was specified on the
362                        command line.
363                     */
364                    Boolean _useSSL;
365                
366                    /**
367                        The duration of the stress tests
368                     */
369                    static double _duration;
370                
371                    /**
372                        Indicates that the duration is set.
373                     */
374 j.alex 1.1.2.1     Boolean _durationSpecified;
375                
376                    /**
377                        The ToleranceLevel used for the stress tests
378                     */
379                    Uint32 _toleranceLevel;
380                
381                    /**
382                        Indicates that the toleranceLevel is set.
383                     */
384                    Boolean _toleranceLevelSpecified;
385                
386                    /**
387                        The NameSpace that may be used by the clients
388                     */
389                    String _nameSpace;
390                
391                    /**
392                        Indicates that the Name Space is set.
393                     */
394                    Boolean _nameSpaceSpecified;
395 j.alex 1.1.2.1 
396                    /**
397                        The Class Name that may be used by the clients
398                     */
399                    String _className;
400                
401                    /**
402                        Indicates that the Class Name is set.
403                     */
404                    Boolean _ClassNameSpecified;
405                
406                
407                    /**
408                        The option character used to specify the hostname.
409                     */
410                    static const char   _OPTION_HOSTNAME;
411                
412                    /**
413                        The option character used to specify the port number.
414                     */
415                    static const char   _OPTION_PORTNUMBER;
416 j.alex 1.1.2.1 
417                    /**
418                        The option character used to specify the timeout value.
419                     */
420                    static const char   _OPTION_TIMEOUT;
421                
422                    /**
423                        The option character used to specify the username.
424                     */
425                    static const char   _OPTION_USERNAME;
426                
427                    /**
428                        The option character used to specify the password.
429                     */
430                    static const char   _OPTION_PASSWORD;
431                
432                    /**
433                        The option character used to specify whether SSL should be used.
434                     */
435                    static const char   _OPTION_SSL;
436                
437 j.alex 1.1.2.1     /**
438                        Label for the usage string for this command.
439                     */
440                    static const char   _USAGE [];
441                
442                    /**
443                        The minimum valid portnumber.
444                     */
445                    static const Uint32 _MIN_PORTNUMBER;
446                
447                    /**
448                        The maximum valid portnumber.
449                     */
450                    static const Uint32 _MAX_PORTNUMBER;
451                
452                    /**
453                        The minimum valid duration level.
454                     */
455                    static const Uint32 _MIN_DURATION;
456                
457                    /**
458 j.alex 1.1.2.1         The minimum valid tolerance level.
459                     */
460                    static const Uint32 _MIN_TOLERANCE;
461                
462                    /**
463                        The maximum valid tolerance level.
464                     */
465                    static const Uint32 _MAX_TOLERANCE;
466                
467                    /**
468                        The path of the config file containing the configuration info.
469                     */
470                    String _configFilePath;
471                
472                    /**
473                        A Boolean indicating whether a config file path was specified on the
474                        command line.
475                     */
476                    Boolean _configFilePathSpecified;
477                
478                    /**
479 j.alex 1.1.2.1         A String containing the usage information for the command.
480                     */
481 j.alex 1.1.2.2     String _usage;
482 j.alex 1.1.2.1 
483                    /**
484                        The type of operation specified on the command line.
485                     */
486 j.alex 1.1.2.2     Uint32 _operationType;
487 j.alex 1.1.2.1 
488 j.alex 1.1.2.2     /**
489                        Property table that stores the properties
490                     */
491 j.alex 1.1.2.1     Table* _propertyTable;
492 j.alex 1.1.2.2 
493                    /**
494                        Client table that stores the client specific properties
495                     */
496 j.alex 1.1.2.1     Table* _clientTable;
497 j.alex 1.1.2.2 
498                    /**
499                        Client commands
500                     */
501 j.alex 1.1.2.1     String* _clientCommands;
502 j.alex 1.1.2.2 
503                    /**
504                        Client specific durations
505                     */
506 j.alex 1.1.2.1     Uint64* _clientDurations;
507 j.alex 1.1.2.2 
508                    /**
509                        Client specific delays
510                     */
511 j.alex 1.1.2.1     Uint64* _clientDelays;
512                
513                    /**
514                        The total number of clients for this test
515                     */
516                    Uint32 _clientCount;
517 j.alex 1.1.2.2 
518                    /**
519                        current client name 
520                     */
521 j.alex 1.1.2.1     String _currClient;
522 j.alex 1.1.2.2 
523                    /**
524                        current client count 
525                     */
526 j.alex 1.1.2.1     Uint32 _currClientCount;
527 j.alex 1.1.2.2 
528 j.alex 1.1.2.1     /**
529                      Stress Controller Log file.
530                    */
531 j.alex 1.1.2.2     String _stressTestLogFile;
532 j.alex 1.1.2.1 
533                    /**
534                      StressTest Client PID file
535                    */
536 j.alex 1.1.2.2     String _stressTestClientPIDFile;
537 j.alex 1.1.2.1 
538                    /**
539                      StressTest Client Log file
540                    */
541 j.alex 1.1.2.2     String _stressTestClientLogFile;
542 j.alex 1.1.2.1 
543                    /**
544                      StressTest temporary Client PID file
545                    */
546 j.alex 1.1.2.2     String _tmpStressTestClientPIDFile;
547 j.alex 1.1.2.1 };
548                
549                PEGASUS_NAMESPACE_END
550                
551                #endif /* Pegasus_StressTestControllerCommand_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2