Tivoli::Fwk - Perl Extension for Tivoli


Tivoli documentation Contained in the Tivoli distribution.

Index


Code Index:

NAME

Top

	Tivoli::Fwk - Perl Extension for Tivoli

SYNOPSIS

Top

	use Tivoli::Fwk;




VERSION

Top

	v0.04

LICENSE

Top

	Copyright (c) 2001 Robert Hase.
	All rights reserved.
	This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 

DESCRIPTION

Top

	This Package will handle about everything you may need for Framework.
	If anything has been left out, please contact me at
	tivoli.rhase@muc-net.de
	so it can be added.

DETAILS

	still in work

ROUTINES

	Description of Routines

ExecuteSys

* DESCRIPTION
	Execute Unix Command with system

* CALL
	$Var = &ExecuteSys(<Command>);

* SAMPLE
	$Var = &ExecuteSys('ls');
	$Var = returncode from the Command

CrtPR

* DESCRIPTION
	Create PolicyRegion

* CALL
	$Var = &CrtPR(<TopPolicyRegion, PolicyRegion>);

* SAMPLE
	$Var = &CrtPR("top-Company_Europe_pr", "all-Clients_Europe-pr");
	$Var = 1 = ok, 0 = Failure

CrtDatalessPM

* DESCRIPTION
	Create Dataless ProfileManager

* CALL
	$Var = &CrtDatalessPM(<PolicyRegion, ProfileManager>);

* SAMPLE
	$Var = &CrtDatalessPM("all-Sample-pr", "all-inv-SW-tmr-pm");
	$Var = 1 = ok, 0 = Failure

NoResource

* DESCRIPTION
	Check Tivoli Resource with wlookup

* CALL
	$Var = &NoResource(<Typ, Resource>);

* SAMPLE
	$Var = &NoResource("RIM", "inv40");
	$Var = 1 = ok, 0 = Failure

Wlookup_pm

* DESCRIPTION
	looks for ProfileManagers which includes the given String

* CALL
	$Var = &Wlookup_pm(<String>);

* SAMPLE
	@Arr = &Wlookup_pm("-New_EP-");
	@Arr = Array with ProfileManagers

Wlsendpts_SearchPms

* DESCRIPTION
	Lists all the endpoints directly or indirectly subscribed to the given ProfileManager

* CALL
	$Var = &Wlsendpts_SearchPms(<Name of the ProfileManager>);

* SAMPLE
	@Arr = &Wlsendpts_SearchPms("all-Server-pm");
	@Arr = Array with Endpoints

Wgetsub_pm

* DESCRIPTION
	gets the Subscribers of a given ProfileManager

* CALL
	$Var = &Wgetsub_pm(<ProfileManager>);

* SAMPLE
	@Arr = &Wgetsub_pm("all-Clients-pm");
	@Arr = Array with Subscribers

Plattforms and Requirements

	Supported Plattforms and Requirements

* Plattforms
	tested on:

	- aix4-r1 (AIX 4.3)

	requires Perl v5 or higher

HISTORY

	VERSION		DATE		AUTHOR		WORK
	----------------------------------------------------
	0.01		2001-07-06	RHase		created
	0.01		2001-07-06	RHase		Wlsendpts_SearchPms
	0.01		2001-07-06	RHase		Wlookup_pm
	0.02		2001-07-09	RMahner		NoResource
	0.02		2001-07-09	RMahner		CrtDatalessPM
	0.02		2001-07-09	RMahner		CrtPR
	0.02		2001-07-09	RMahner		ExecuteSys
	0.03		2001-07-13	RHase		Wgetsub_pm
	0.04		2001-08-04	RHase		POD-Doku added

AUTHOR

Top

	Robert Hase
	ID	: RHASE
	eMail	: Tivoli.RHase@Muc-Net.de
	Web	: http://www.Muc-Net.de

SEE ALSO

Top

	CPAN
	http://www.perl.com


Tivoli documentation Contained in the Tivoli distribution.
package Tivoli::Fwk;

our(@ISA, @EXPORT, $VERSION, $Fileparse_fstype, $Fileparse_igncase);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(ExecuteSys CrtPR CrtDatalessPM NoResource Wlookup_pm Wlsendpts_SearchPms Wgetsub_pm);

$VERSION = '0.04';

################################################################################################

sub ExecuteSys
{
        ($p_cmd)=@_;
        my ($rc) ;
        $command = "$p_cmd 2>>/dev/null";
        $rc=0xffff & system $command;
	return $rc;
}

sub CrtPR
{
        ($p_tpr, $p_pr)=@_;
        $l_cmd = "wcrtpr -s \@PolicyRegion:$p_tpr -m ProfileManager $p_pr";
        $l_rc=&ExecuteSys ($l_cmd);
        if ($l_rc) { return(1); }
	return(0);
}

sub CrtDatalessPM
{
        ($p_pr, $p_pm)=@_;
        $l_cmd = "wcrtprfmgr  \@PolicyRegion:$p_pr  $p_pm";
        $l_rc=&ExecuteSys ($l_cmd);
        if ($l_rc) { &Error ("Error executing $l_cmd")};
        $l_cmd = "wsetpm -d  \@ProfileManager:$p_pm";
        $l_rc=&ExecuteSys ($l_cmd);
        if ($l_rc) {return(1);}
	return(0);
}

sub NoResource
{
        ($p_typ, $p_res)=@_;
        $l_cmd="wlookup -r $p_typ $p_res >/dev/null 2>&1";
        $rc=0xffff & system $l_cmd;
        if ( $rc == 0 ) {return(1);}
	return(0);
}

sub Wlookup_pm
{
        my($l_searchstring) = $_[0];
        my(@l_pm, @l_pm_erg);
        my($l_cli);
        $l_cli = "wlookup -aLr ProfileManager |grep $l_searchstring";
        @l_pm = `$l_cli`;
        if($? != 0)
        {
                return(0);
        }
        foreach $l_dummy (@l_pm)
        {
                chomp($l_dummy);
                $l_dummy =~ s/\s.*$//;
                push(@l_pm_erg, $l_dummy);
        }
        return(@l_pm_erg);
}

sub Wlsendpts_SearchPms
{
        my($p_pm) = $_[0];
        my($l_dummy);
        my(@l_ep, @l_ep_result);
        $l_dummy = "wlsendpts \@${p_pm}";
        @l_ep = `$l_dummy`;

        if($? != 0)
        {
                return(0);
        }
        foreach $l_dummy (@l_ep)
        {
                chomp($l_dummy);
                $l_dummy =~ s/\s.*\)$//;
                push(@l_ep_result, $l_dummy);
        }
        return(@l_ep_result);
}

sub Wgetsub_pm
{
        my($l_pm) = $_[0];
        my($l_dummy);
        my(@l_subs, @l_subs_result);
        $l_dummy = "wgetsub \@ProfileManager:$l_pm";
        @l_subs = `$l_dummy 2>/dev/null`;
        chomp(@l_subs);
        return(@l_subs);
}

###############################################################################################

1;