--- /dev/null
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+#===Variable Declarations====
+
+my $home = "~teuthworker";
+my $teuthology = "~teuthology/teuthology/virtualenv/bin/teuthology";
+my $archivedir = "$home/qa/archive";
+my $config_yaml = "fixed-3.yaml";
+#my $test_name = qq/rbd_api_tests.pl/;
+my $test_name = qq/[% script %]/;
+my $get_script_name = &get_value($test_name,0,'\.');
+my $targetyaml = "$home/qa/targets.yaml";
+
+=head1
+************Function Definition*************************************************************************
+Name of Function: get_value
+Description: get_value() function splits the given command output with the delimiter passed to it
+ and returns the desired index of the array
+Arguments: $cmd_output, $index, $delimiter
+Argument Description:
+$cmd_output = String that holds the command output from which required value has to be extracted.
+$index = Index of the array
+$delimiter = Delimiter used in split()
+********************************************************************************************************
+=cut
+
+sub get_value
+{
+ my ($cmd_output, $index,$delimiter) = @_;
+ my $var = qq/$delimiter/;
+ my @split_cmd_output = split($var,$cmd_output);
+ my $return_val = $split_cmd_output[$index];
+ return $return_val;
+}
+
+=head1
+************Function Definition*************************************************************************
+Name of Function: locate_file
+Description: locate_file() function locates the input file passed to it and passes the command
+ output to get_value() file.
+Arguments: $get_yaml
+Argument Description:
+$get_yaml = Name of yaml file to be located
+********************************************************************************************************
+=cut
+
+sub locate_file
+{
+ my ($get_yaml) = @_;
+ my $loc_yaml = `locate $get_yaml`;
+ my $taskyaml = &get_value($loc_yaml,0,"\\n");
+ return $taskyaml;
+}
+
+
+=head1
+************Function Definition*************************************************************************
+Name of Function: generate_logfile
+Description: Generates a path for log file in the name of test with embedded time stamp under
+ archivedir.
+Arguments: None
+Argument Description: NA
+********************************************************************************************************
+=cut
+
+sub generate_log_path
+{
+ my @time = split(/ /, localtime());
+ my $stamp = $time[1] . "-" . $time[2] . "-" . $time[4] . "-" . $time[3];
+ my $log_file = "$archivedir/$get_script_name-$stamp";
+ return $log_file;
+}
+
+# Main starts here
+
+my $task_yaml = "$get_script_name"."."."yaml";
+my $configyaml = &locate_file($config_yaml);
+my $taskyaml = &locate_file($task_yaml);
+my $logfile_loc = &generate_log_path();
+my $tcommand = "$teuthology $configyaml $taskyaml $targetyaml --archive $logfile_loc";
+
+print "$tcommand\n";
+
+system ($tcommand);
+
+if ($? != 0) {
+ printf ("Failure $?\n");
+ open (TCOMP, '>>test_completed.txt');
+ close (TCOMP);
+ open (TCOMP, '>>log.txt');
+
+ print TCOMP "[Failure]\n";
+ close (TCOMP);
+ exit 1;
+} else {
+ printf ("Success $?\n");
+
+ open (TCOMP, '>>test_completed.txt');
+ close (TCOMP);
+ open (TCOMP, '>>log.txt');
+ print TCOMP "[Success]\n";
+ close (TCOMP);
+ exit 0;
+}
+
--- /dev/null
+#!/usr/bin/perl
+
+=head1 NAME
+
+script_gen.pl - create a perl wrapper for the teuthology scripts
+
+=head1 SYNOPSIS
+
+Use:
+ perl script_gen.pl --script_name <script_name> [--help]
+
+Examples:
+ perl script_gen.pl --script_name abc.pl or
+ perl script_gen.pl --help
+
+=head1 DESCRIPTION
+
+This script creates a perl wrapper in the name of script_name passed to it.
+The task yaml file name and log file name
+within the wrapper are modified accordingly.
+
+=head1 ARGUMENTS
+
+script_gen.pl takes the following arguments:
+
+ --help
+ (optional.) Displays the usage message.
+
+ --script_name script_name
+ (Required.) script name same as the name of the teuthology task for
+ which perl wrapper is needed.
+
+=cut
+
+use strict;
+use warnings;
+use Template;
+
+use Pod::Usage();
+use Getopt::Long();
+
+my ($help, $script_name);
+
+Getopt::Long::GetOptions(
+ 'help' => \$help,
+ 'script_name=s' => \$script_name);
+
+ Pod::Usage::pod2usage( -verbose=>1 ) if ($help);
+
+unless (defined($script_name)){
+ Pod::Usage::pod2usage( -exitstatus =>2 );
+}
+my $sample_script = "sample.pl";
+my $template = Template->new;
+my $variables = {
+ script => $script_name,
+};
+$template->process($sample_script,$variables,$script_name);
+