| 1 | package LabmanSoap; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use SOAP::Lite ( maptype => {} ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | =head1 NAME | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | VMWare::LabmanSoap - access Vmware Labmanager SOAP API | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 VERSION | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | Version 1.0 | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =cut | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | our $VERSION = '1.0'; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | This module has been tested using Labmanger 4.0 (4.0.1.1233). | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | Code to checkout, deploy, undeploy and delete a configuration: | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | use LabmanSoapInternal; | ||||||||||||||||||||||||||||
| 26 | $libraryConfigName = "lib_config_name"; | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | $mySoapObj = LabmanSoapInternal->new('LM_Username','LM_Password','LM_Hostname','Organization_Name','WorkSpace_Name'); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | #Get the id of the config you are going to check out | ||||||||||||||||||||||||||||
| 31 | @lib_config_id = $mySoapObj->GetSingleConfigurationByName("${libraryConfigName}","id"); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | #Checkout the config | ||||||||||||||||||||||||||||
| 34 | $checked_out_config_id = $mySoapObj->ConfigurationCheckout($lib_config_id[0],"NEW_WORKSPACE_NAME"); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | #Deploy the config | ||||||||||||||||||||||||||||
| 37 | $mySoapObj->ConfigurationDeploy($checked_out_config_id,4); # The 4 is for the fencemode | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | #Deploy the config to DVS | ||||||||||||||||||||||||||||
| 40 | $mySoapObj->ConfigurationDeployEx2($checked_out_config_id,2); # 2 is the id of the network | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | #Undeploy the config | ||||||||||||||||||||||||||||
| 43 | $mySoapObj->ConfigurationUndeploy($chkd_out_id); | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | #Delete the config | ||||||||||||||||||||||||||||
| 46 | $mySoapObj->ConfigurationDelete($chkd_out_id); | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | #Check for last SOAP error | ||||||||||||||||||||||||||||
| 49 | if ($mySoapObj->{'LASTERROR'}->{'detail'}->{'message'}->{'format'}) { print }; | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | This module provides a Perl interface to VMWare's Labmanager SOAP interface. It has a one-to-one mapping for most of the commands exposed in the external API as well as a few commands exposed in the internal API. The most useful Internal API command is ConfigurationDeployEx2 which allows you to deploy to distributed virtual switches. | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | Using this module you can checkout, deploy, undeploy and delete configurations. You can also get lists of configurations and guest information as well. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | Lab Manager is a product created by VMWare that provides development and test teams with a virtual environment to deploy systems and networks of systems in a short period of a time. | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head1 METHODS | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head2 new | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | This method creates the Labmanager object. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =head3 Arguments | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =over 4 | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =item * username | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =item * password | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =item * hostname | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =item * organization | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =item * workspace | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =back | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =cut | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | sub new | ||||||||||||||||||||||||||||
| 84 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 85 | 0 | my($class) = shift; | |||||||||||||||||||||||||||
| 86 | 0 | my($self) = {}; | |||||||||||||||||||||||||||
| 87 | 0 | my($username) = shift; | |||||||||||||||||||||||||||
| 88 | 0 | my($password) = shift; | |||||||||||||||||||||||||||
| 89 | 0 | my($hostname) = shift; | |||||||||||||||||||||||||||
| 90 | 0 | my($orgname) = shift; | |||||||||||||||||||||||||||
| 91 | 0 | my($workspace) = shift; | |||||||||||||||||||||||||||
| 92 | $self->{'soap'} = SOAP::Lite | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | -> on_action(sub { return "http://vmware.com/labmanager/" . $_[1]; } ) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 94 | 0 | -> default_ns('http://vmware.com/labmanager') | |||||||||||||||||||||||||||
| 95 | -> proxy('https://' . $hostname . '/LabManager/SOAP/LabManagerInternal.asmx'); | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | $self->{'soap'}->readable(1); | |||||||||||||||||||||||||||
| 98 | 0 | $self->{'auth_header'} = SOAP::Header->new( | |||||||||||||||||||||||||||
| 99 | name => 'AuthenticationHeader', | ||||||||||||||||||||||||||||
| 100 | attr => { xmlns => "http://vmware.com/labmanager" }, | ||||||||||||||||||||||||||||
| 101 | value => { username => $username, password => $password, organizationname => $orgname, workspacename => $workspace }, | ||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | if ($self->{'soap'}->fault){ $self->{'LASTERROR'} = $self->{'soap'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | bless($self, $class); | |||||||||||||||||||||||||||
| 107 | 0 | return($self) | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =head2 ConfigurationCapture | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | This method captures a Workspace configuration and saves it to a specified Lab Manager storage server with a name. | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =head3 Arguments | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =over 4 | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | =item * New library name - The name that you want the captured config to be. | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | =back | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | =cut | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | sub ConfigurationCapture | ||||||||||||||||||||||||||||
| 129 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationCapture: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 130 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 131 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 132 | 0 | my($newLibName) = shift; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | $self->{'ConfigurationCapture'} = | ||||||||||||||||||||||||||||
| 135 | $self->{'soap'}->ConfigurationCapture( | ||||||||||||||||||||||||||||
| 136 | 0 | $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 137 | SOAP::Data->name('configurationId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 138 | SOAP::Data->name('newLibraryName' => "${newLibName}")->type('s:string') | ||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if ($self->{'ConfigurationCapture'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationCapture'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 0 | return $self->{'ConfigurationCapture'}->result; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =head2 ConfigurationCheckout | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | This method checks out a configuration from the configuration library and moves it to the Workspace under a different name. It returns the ID of the checked out configuration in the WorkSpace. | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | =head3 Arguments | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =over 4 | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | =item * New workspace name - The name you want the new config in the workspace to be. | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =back | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | =cut | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | sub ConfigurationCheckout | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationCheckout: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 165 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 166 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 167 | 0 | my($configName) = shift; | |||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | $self->{'ConfigurationCheckout'} = | ||||||||||||||||||||||||||||
| 171 | $self->{'soap'}->ConfigurationCheckout( | ||||||||||||||||||||||||||||
| 172 | 0 | $self->{'auth_header'}, SOAP::Data->name('configurationId' => $configID )->type('s:int'), | |||||||||||||||||||||||||||
| 173 | SOAP::Data->name('workspaceName' => ${configName} )->type('s:string') | ||||||||||||||||||||||||||||
| 174 | ); | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ($self->{'ConfigurationCheckout'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationCheckout'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 0 | return $self->{'ConfigurationCheckout'}->result; | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | =head2 ConfigurationClone | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | This method clones a Workspace configuration, saves it in a storage server, and makes it visible in the Workspace under the new name. Arguements: | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =head3 Arguments | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | =over 4 | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | =item * New workspace name - The name of the clone that is being created. | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =back | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =cut | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | sub ConfigurationClone | ||||||||||||||||||||||||||||
| 197 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationClone: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 198 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 199 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 200 | 0 | my($newWSName) = shift; | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | $self->{'ConfigurationClone'} = | ||||||||||||||||||||||||||||
| 203 | 0 | $self->{'soap'}->ConfigurationClone($self->{'auth_header'}, | |||||||||||||||||||||||||||
| 204 | SOAP::Data->name('configurationId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 205 | SOAP::Data->name('newWorkspaceName' => "${newWSName}" )->type('s:string') ); | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if ($self->{'ConfigurationClone'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationClone'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 0 | return $self->{'ConfigurationClone'}->result; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =head2 ConfigurationDelete | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | This method deletes a configuration from the Workspace. You cannot delete a deployed configuration. Doesn't return anything. Arguments: | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | =head3 Arguments | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | =over 4 | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | =back | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | =cut | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | sub ConfigurationDelete | ||||||||||||||||||||||||||||
| 227 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationDelete: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 228 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 229 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | $self->{'ConfigurationDelete'} = | ||||||||||||||||||||||||||||
| 232 | 0 | $self->{'soap'}->ConfigurationDelete( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 233 | SOAP::Data->name('configurationId' => $configID)->type('s:int') ); | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if ($self->{'ConfigurationDelete'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationDelete'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | ▶ | $self->{'ConfigurationDelete'}->result ? return $self->{'ConfigurationDelete'}->result : return $self->{'LASTERROR'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | =head2 ConfigurationDeploy | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | This method allows you to deploy an undeployed configuration which resides in the Workspace. | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | =head3 Arguments | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | =over 4 | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =item * Fencemode - 1 = not fenced; 2 = block traffic in and out; 3 = allow out ; 4 allow in and out | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | =back | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =cut | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | sub ConfigurationDeploy | ||||||||||||||||||||||||||||
| 257 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationDeploy: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 258 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 259 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 260 | 0 | my($fencemode) = shift; # 1 = not fenced; 2 = block traffic in and out; 3 = allow out ; 4 allow in and out | |||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | $self->{'ConfigurationDeploy'} = | ||||||||||||||||||||||||||||
| 263 | 0 | $self->{'soap'}->ConfigurationDeploy( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 264 | SOAP::Data->name('configurationId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 265 | SOAP::Data->name('isCached' => "false")->type('s:boolean'), | ||||||||||||||||||||||||||||
| 266 | SOAP::Data->name('fenceMode' => "${fencemode}")->type('s:int') ); | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | if ($self->{'ConfigurationDeploy'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationDeploy'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 0 | return $self->{'ConfigurationDeploy'}->result; | |||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | =head2 ConfigurationDeployEx2 | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | This method allows you to deploy an undeployed configuration which resides in the Workspace to a Distributed Virtual Switch. Arguments: | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | =head3 Arguments | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | =over 4 | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | =item * Network ID | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =item * Fencemode(string) - Choices: Nonfenced or FenceBlockInAndOut or FenceAllowOutOnly or FenceAllowInAndOut | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =back | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =cut | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | sub ConfigurationDeployEx2 | ||||||||||||||||||||||||||||
| 292 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationDeployEx2: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 293 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 294 | 0 | my $configID = shift; | |||||||||||||||||||||||||||
| 295 | 0 | my $networkId = shift; | |||||||||||||||||||||||||||
| 296 | 0 | my $fenceMode = 'FenceAllowInAndOut'; | |||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | my $net_elem = SOAP::Data->name( 'FenceNetworkOption' => \SOAP::Data->value( | |||||||||||||||||||||||||||
| 299 | SOAP::Data->name('configuredNetID' => ${networkId})->type('s:int'), | ||||||||||||||||||||||||||||
| 300 | SOAP::Data->name('DeployFenceMode'=> ${fenceMode})->type('tns:SOAPFenceMode') | ||||||||||||||||||||||||||||
| 301 | ) | ||||||||||||||||||||||||||||
| 302 | ); | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 0 | my $bridge_elem = SOAP::Data->name( 'BridgeNetworkOption' => \SOAP::Data->value( | |||||||||||||||||||||||||||
| 305 | SOAP::Data->name('externalNetId' => "${networkId}")->type('s:int') | ||||||||||||||||||||||||||||
| 306 | ) | ||||||||||||||||||||||||||||
| 307 | ); | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 0 | my @net_array; | |||||||||||||||||||||||||||
| 310 | my @bridge_array; | ||||||||||||||||||||||||||||
| 311 | 0 | push(@net_array,$net_elem); | |||||||||||||||||||||||||||
| 312 | 0 | push(@bridge_array,$bridge_elem); | |||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | $self->{'ConfigurationDeployEx2'} = | ||||||||||||||||||||||||||||
| 315 | 0 | $self->{'soap'}->ConfigurationDeployEx2( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 316 | SOAP::Data->name('configurationId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 317 | SOAP::Data->name('honorBootOrders' => 1)->type('s:boolean'), | ||||||||||||||||||||||||||||
| 318 | SOAP::Data->name('startAfterDeploy' => 1)->type('s:boolean'), | ||||||||||||||||||||||||||||
| 319 | SOAP::Data->name('fenceNetworkOptions' => \SOAP::Data->value( @net_array )->type('tns:ArrayOfFenceNetworkOption')), | ||||||||||||||||||||||||||||
| 320 | #Do not uncomment unless you know how to make it work: | ||||||||||||||||||||||||||||
| 321 | #SOAP::Data->name('bridgeNetworkOptions' =>\SOAP::Data->value( @bridge_array )->type('tns:ArrayOfBridgeNetworkOption')), | ||||||||||||||||||||||||||||
| 322 | SOAP::Data->name('isCrossHost' => 1)->type('s:boolean') | ||||||||||||||||||||||||||||
| 323 | ); | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if ($self->{'ConfigurationDeployEx2'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationDeployEx2'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | 0 | return $self->{'ConfigurationDeployEx2'}->result; | |||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =head2 ConfigurationPerformAction | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | This method performs one of the following configuration actions as indicated by the action identifier: | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =over 4 | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | =item 1 Power On. Turns on a configuration. | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | =item 2 Power Off. Turns off a configuration. Nothing is saved. | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | =item 3 Suspend. Freezes the CPU and state of a configuration. | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | =item 4 Resume. Resumes a suspended configuration. | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | =item 5 Reset. Reboots a configuration. | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | =item 6 Snapshot. Saves a configuration state at a specific point in time. | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | =back | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | =head3 Arguments | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | =over 4 | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =item * Action - use a numerical value from the list above. | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | =back | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | =cut | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | sub ConfigurationPerformAction | ||||||||||||||||||||||||||||
| 363 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationPerformAction: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 364 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 365 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 366 | 0 | my($action) = shift; # 1-Pwr On, 2-Pwr off, 3-Suspend, 4-Resume, 5-Reset, 6-Snapshot | |||||||||||||||||||||||||||
| 367 | $self->{'ConfigurationPerformAction'} = | ||||||||||||||||||||||||||||
| 368 | 0 | $self->{'soap'}->ConfigurationPerformAction( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 369 | SOAP::Data->name('configurationId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 370 | SOAP::Data->name('action' => $action )->type('s:int') ); | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | 0 | ▶ | if ($self->{'ConfigurationPerformAction'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationPerformAction'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | =head2 ConfigurationSetPublicPrivate | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | Use this call to set the state of a configuration to public” or private.” If the configuration state is public, others are able to access this configuration. If the configuration is private, only its owner can view it. | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | =head3 Arguments | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | =over 4 | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =item * True or False (boolean) - Accepts true | false | 1 | 0 | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | =back | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | sub ConfigurationSetPublicPrivate | ||||||||||||||||||||||||||||
| 392 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationSetPublicPrivate: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 395 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 396 | 0 | my($trueOrFalse) =shift; | |||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | $self->{'ConfigurationSetPublicPrivate'} = | ||||||||||||||||||||||||||||
| 399 | 0 | $self->{'soap'}->ConfigurationSetPublicPrivate( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 400 | SOAP::Data->name('configurationId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 401 | SOAP::Data->name('isPublic' => $trueOrFalse)->type('s:boolean') ); | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | 0 | ▶ | if ($self->{'ConfigurationSetPublicPrivate'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationSetPublicPrivate'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | =head2 ConfigurationUndeploy | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | Undeploys a configuration in the Workspace. Nothing is returned. | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | =head3 Arguments | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | =over 4 | ||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | =item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | =back | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | =cut | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | sub ConfigurationUndeploy | ||||||||||||||||||||||||||||
| 421 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ConfigurationUndeploy: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 422 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 423 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | $self->{'ConfigurationUndeploy'} = | ||||||||||||||||||||||||||||
| 426 | 0 | $self->{'soap'}->ConfigurationUndeploy( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 427 | SOAP::Data->name('configurationId' => $configID )->type('s:int')); | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | 0 | ▶ | if ($self->{'ConfigurationUndeploy'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationUndeploy'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | =head2 GetConfiguration | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | This method prints a list of attributes of a Configuration matching the configuration ID passed. It will return an array if you specify which attributes you would like to access | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | =head3 Arguments | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | =over 4 | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | =item * Config Name | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | =item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | =back | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =head3 Attributes | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | =over 4 | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | =item * mustBeFenced | ||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||
| 452 | =item * autoDeleteDateTime | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | =item * bucketName | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | =item * name | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | =item * autoDeleteInMilliSeconds | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | =item * description | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | =item * isDeployed | ||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | =item * fenceMode | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | =item * id | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | =item * type | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | =item * isPublic | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | =item * dateCreated | ||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | =back | ||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | =cut | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | sub GetConfiguration | ||||||||||||||||||||||||||||
| 480 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
GetConfiguration: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 481 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 482 | 0 | my($config) = shift; | |||||||||||||||||||||||||||
| 483 | 0 | push(my(@attribs), @_); | |||||||||||||||||||||||||||
| 484 | 0 | my @myattribs; | |||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||
| 486 | $self->{'GetConfiguration'} = | ||||||||||||||||||||||||||||
| 487 | 0 | $self->{'soap'}->GetConfiguration( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 488 | SOAP::Data->name('id' => ${config})->type('s:int')); | ||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if ($self->{'GetConfiguration'}->fault){ $self->{'LASTERROR'} = $self->{'GetConfiguration'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||
| 492 | 0 | my($r) = $self->{'GetConfiguration'}->result; | |||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | 0 | ▶ | if (!@attribs) #If nothing is passed to this method, print everything | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 495 | { | ||||||||||||||||||||||||||||
| 496 | 0 | foreach my $key ( keys(%$r) ) | |||||||||||||||||||||||||||
| 497 | { | ||||||||||||||||||||||||||||
| 498 | 0 | print "$key: $$r{$key}\n "; | |||||||||||||||||||||||||||
| 499 | 0 | push(@myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||
| 502 | else | ||||||||||||||||||||||||||||
| 503 | { | ||||||||||||||||||||||||||||
| 504 | 0 | foreach my $key ( @attribs ) | |||||||||||||||||||||||||||
| 505 | { | ||||||||||||||||||||||||||||
| 506 | 0 | push(@myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||
| 508 | 0 | return (@myattribs); | |||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | =head2 GetMachine | ||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||
| 514 | This call takes the numeric identifier of a machine and returns its corresponding Machine object. | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | =head3 Arguments | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | =over 4 | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | =item * Machine ID - Use GetMachineByName to retrieve this | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | =item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | =back | ||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||
| 526 | =head3 Attributes | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | =over 4 | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | =item * configID | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | =item * macAddress | ||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||
| 534 | =item * status | ||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | =item * OwnerFullName | ||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||
| 538 | =item * name | ||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||
| 540 | =item * description | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | =item * isDeployed | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | =item * internalIP | ||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | =item * memory | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | =item * DatastoreNameResidesOn | ||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||
| 550 | =item * id | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | =back | ||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | =cut | ||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||
| 556 | sub GetMachine | ||||||||||||||||||||||||||||
| 557 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
GetMachine: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 558 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 559 | 0 | my($config) = shift; | |||||||||||||||||||||||||||
| 560 | 0 | push(my(@attribs), @_); | |||||||||||||||||||||||||||
| 561 | 0 | my @myattribs; | |||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | $self->{'GetMachine'} = | ||||||||||||||||||||||||||||
| 564 | 0 | $self->{'soap'}->GetMachine( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 565 | SOAP::Data->name('machineId' => ${config})->type('s:int')); | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | 0 | ▶ | if ($self->{'GetMachine'}->fault){ $self->{'LASTERROR'} = $self->{'GetMachine'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 568 | 0 | my($r) = $self->{'GetMachine'}->result; | |||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||
| 570 | 0 | ▶ | if (!@attribs) #If nothing is passed to this method, print everything | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 571 | { | ||||||||||||||||||||||||||||
| 572 | 0 | foreach my $key ( keys(%$r) ) | |||||||||||||||||||||||||||
| 573 | { | ||||||||||||||||||||||||||||
| 574 | 0 | print "$key: $$r{$key}\n "; | |||||||||||||||||||||||||||
| 575 | 0 | push(@myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||
| 578 | else | ||||||||||||||||||||||||||||
| 579 | { | ||||||||||||||||||||||||||||
| 580 | 0 | foreach my $key ( @attribs ) | |||||||||||||||||||||||||||
| 581 | { | ||||||||||||||||||||||||||||
| 582 | 0 | push(@myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||
| 584 | 0 | return (@myattribs); | |||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||
| 589 | =head2 GetMachineByName | ||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||
| 591 | This call takes a configuration identifier and a machine name and returns the matching Machine object. | ||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | =head3 Arguments | ||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||
| 595 | =over 4 | ||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||
| 597 | =item * Configuration ID - Config where Guest VM lives | ||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||
| 599 | =item * Name of guest | ||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||
| 601 | =item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. | ||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | =back | ||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||
| 605 | =head3 Attributes | ||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||
| 607 | =over 4 | ||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | =item * configID | ||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||
| 611 | =item * macAddress | ||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||
| 613 | =item * status | ||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||
| 615 | =item * OwnerFullName | ||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||
| 617 | =item * name | ||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||
| 619 | =item * description | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | =item * isDeployed | ||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | =item * internalIP | ||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||
| 625 | =item * memory | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | =item * DatastoreNameResidesOn | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | =item * id | ||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||
| 631 | =back | ||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||
| 633 | =cut | ||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||
| 635 | sub GetMachineByName | ||||||||||||||||||||||||||||
| 636 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
GetMachineByName: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 637 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 638 | 0 | my($config) = shift; | |||||||||||||||||||||||||||
| 639 | 0 | my($name) = shift; | |||||||||||||||||||||||||||
| 640 | 0 | push(my(@attribs), @_); | |||||||||||||||||||||||||||
| 641 | 0 | my @myattribs; | |||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||
| 643 | $self->{'GetMachineByName'} = | ||||||||||||||||||||||||||||
| 644 | 0 | $self->{'soap'}->GetMachineByName( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 645 | SOAP::Data->name('configurationId' => ${config})->type('s:int'), | ||||||||||||||||||||||||||||
| 646 | SOAP::Data->name('name' => ${name})->type('s:string')); | ||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||
| 648 | 0 | ▶ | if ($self->{'GetMachineByName'}->fault){ $self->{'LASTERROR'} = $self->{'GetMachineByName'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||
| 650 | 0 | my($r) = $self->{'GetMachineByName'}->result; | |||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||
| 653 | 0 | ▶ | if (!@attribs) #If nothing is passed to this method, print everything | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 654 | { | ||||||||||||||||||||||||||||
| 655 | 0 | foreach my $key ( keys(%$r) ) | |||||||||||||||||||||||||||
| 656 | { | ||||||||||||||||||||||||||||
| 657 | 0 | print "$key: $$r{$key}\n "; | |||||||||||||||||||||||||||
| 658 | 0 | push(@myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||
| 661 | else | ||||||||||||||||||||||||||||
| 662 | { | ||||||||||||||||||||||||||||
| 663 | 0 | foreach my $key ( @attribs ) | |||||||||||||||||||||||||||
| 664 | { | ||||||||||||||||||||||||||||
| 665 | 0 | push(@myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||
| 667 | 0 | return (@myattribs); | |||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||
| 671 | =head2 GetSingleConfigurationByName | ||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||
| 673 | This call takes a configuration name, searches for it in both the configuration library and workspace and returns its corresponding Configuration object. Returns an array of attributes or one or more specified attributes. | ||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||
| 675 | =head3 Arguments | ||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||
| 677 | =over 4 | ||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | =item * Configuration name | ||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||
| 681 | =item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. | ||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||
| 683 | =back | ||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||
| 685 | =head3 Attributes | ||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||
| 687 | =over 4 | ||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||
| 689 | =item * mustBeFenced | ||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||
| 691 | =item * autoDeleteDateTime | ||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||
| 693 | =item * bucketName (aka workspace) | ||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||
| 695 | =item * name | ||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||
| 697 | =item * autoDeleteInMilliSeconds | ||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||
| 699 | =item * description | ||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||
| 701 | =item * isDeployed | ||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||
| 703 | =item * fenceMode | ||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||
| 705 | =item * id | ||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||
| 707 | =item * type | ||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||
| 709 | =item * isPublic | ||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||
| 711 | =item * dateCreated | ||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||
| 713 | =back | ||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||
| 715 | =cut | ||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||
| 718 | sub GetSingleConfigurationByName | ||||||||||||||||||||||||||||
| 719 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
GetSingleConfigurationByName: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 720 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 721 | 0 | my($config) = shift; | |||||||||||||||||||||||||||
| 722 | 0 | push(my(@attribs), @_); | |||||||||||||||||||||||||||
| 723 | 0 | my @myattribs; | |||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||
| 725 | $self->{'GetSingleConfigurationByName'} = | ||||||||||||||||||||||||||||
| 726 | 0 | $self->{'soap'}->GetSingleConfigurationByName( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 727 | SOAP::Data->name('name' => ${config})->type('s:string')); | ||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||
| 729 | 0 | ▶ | if ($self->{'GetSingleConfigurationByName'}->fault){ $self->{'LASTERROR'} = $self->{'GetSingleConfigurationByName'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||
| 733 | 0 | my($r) = $self->{'GetSingleConfigurationByName'}->result; | |||||||||||||||||||||||||||
| 734 | 0 | getLastSOAPError(); | |||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||
| 736 | 0 | ▶ | if (!@attribs) #If nothing is passed to this method, print all the info for the config | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 737 | { | ||||||||||||||||||||||||||||
| 738 | 0 | foreach my $key ( keys(%$r) ) | |||||||||||||||||||||||||||
| 739 | { | ||||||||||||||||||||||||||||
| 740 | 0 | print "$key: $$r{$key}\n "; | |||||||||||||||||||||||||||
| 741 | 0 | push( @myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||
| 744 | else | ||||||||||||||||||||||||||||
| 745 | { | ||||||||||||||||||||||||||||
| 746 | 0 | foreach my $key ( @attribs ) | |||||||||||||||||||||||||||
| 747 | { | ||||||||||||||||||||||||||||
| 748 | 0 | push( @myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||
| 750 | 0 | return ( @myattribs); | |||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||
| 754 | =head2 ListConfigurations | ||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||
| 756 | This method prints a list of Type Configuration. Depending on configuration type requested, one object is returned for each configuration in the configuration library or each configuration in the workspace. | ||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||
| 758 | =head3 Arguments | ||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||
| 760 | =over 4 | ||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||
| 762 | =item * configurationType (Configuration Type must be either 1 for Workspace or 2 for Library) | ||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||
| 764 | =back | ||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||
| 766 | =cut | ||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||
| 769 | sub ListConfigurations | ||||||||||||||||||||||||||||
| 770 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ListConfigurations: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 771 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 772 | 0 | my($configType) = shift; #1 =WorkSpace, 2=Library | |||||||||||||||||||||||||||
| 773 | 0 | ▶ | unless($configType == 1 || $configType == 2 ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$configType == 1 or $configType == 2
MC/DC0%0/2
$configType == 1 or $configType == 2
$configType == 1
$configType == 2
Truth table0%0/3
A or B
A= $configType == 1B= $configType == 2
| |||||||||||||||||||||||||||||
| 774 | { | ||||||||||||||||||||||||||||
| 775 | 0 | $self->{'LASTERROR'} = "Configuration Type must be either 1 for Workspace or 2 for Library"; | |||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||
| 777 | 0 | $self->{'ListConfigurations'} = $self->{'soap'}->ListConfigurations( $self->{'auth_header'}, SOAP::Data->name('configurationType' => $configType)->type('s:int')); | |||||||||||||||||||||||||||
| 778 | 0 | ▶ | if ($self->{'ListConfigurations'}->fault){ $self->{'LASTERROR'} = $self->{'ListConfigurations'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 779 | 0 | my($r) = $self->{'ListConfigurations'}->result; | |||||||||||||||||||||||||||
| 780 | 0 | my($array) = $$r{'Configuration'}; # returns a reference to an array | |||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||
| 782 | 0 | ▶ | if ( $array ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 783 | 0 | ▶ | for (my $i=0;$i<scalar(@$array);$i++) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 784 | { | ||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||
| 786 | 0 | my $hash = $$array[$i]; #returns a reference to a hash | |||||||||||||||||||||||||||
| 787 | 0 | foreach my $k (keys(%$hash)) | |||||||||||||||||||||||||||
| 788 | { | ||||||||||||||||||||||||||||
| 789 | 0 | print "\n$k: $$hash{$k}"; | |||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||
| 791 | 0 | print "\n*********************\n"; | |||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||
| 797 | =head2 ListMachines | ||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | This method returns an array of type Machine. The method returns one Machine object for each virtual machine in a configuration. | ||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||
| 801 | =head3 Arguments | ||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||
| 803 | =over 4 | ||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | =item * Configuration ID | ||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||
| 807 | =back | ||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||
| 809 | =cut | ||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||
| 812 | sub ListMachines # Works but Not completely. Need to test with a config with more than one VM | ||||||||||||||||||||||||||||
| 813 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ListMachines: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 814 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 815 | 0 | my($config) = shift; | |||||||||||||||||||||||||||
| 816 | $self->{'ListMachines'} = | ||||||||||||||||||||||||||||
| 817 | 0 | $self->{'soap'}->ListMachines( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 818 | SOAP::Data->name('configurationId' => $config)->type('s:int')); | ||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||
| 820 | 0 | ▶ | if ($self->{'ListMachines'}->fault){ $self->{'LASTERROR'} = $self->{'ListMachines'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||
| 822 | 0 | my($r) = $self->{'ListMachines'}->result; | |||||||||||||||||||||||||||
| 823 | #print keys %{$$r{'Machine'}}; | ||||||||||||||||||||||||||||
| 824 | #print $$r{'Machine'}{'configID'}; | ||||||||||||||||||||||||||||
| 825 | 0 | my($attribs) = $$r{'Machine'}; # returns a hash | |||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||
| 828 | 0 | foreach my $k (keys(%$attribs)) | |||||||||||||||||||||||||||
| 829 | { | ||||||||||||||||||||||||||||
| 830 | 0 | print "\n$k: $$attribs{$k}"; | |||||||||||||||||||||||||||
| 831 | } | ||||||||||||||||||||||||||||
| 832 | 0 | print "\n*********************\n"; | |||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | 0 | return %$attribs; | |||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||
| 837 | } | ||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||
| 839 | # Not Supported, but works (I believe) | ||||||||||||||||||||||||||||
| 840 | sub GetConsoleAccessInfo | ||||||||||||||||||||||||||||
| 841 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
GetConsoleAccessInfo: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 842 | # Attribs: ServerAddress, ServerPort,VmxLocation,Ticket | ||||||||||||||||||||||||||||
| 843 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 844 | 0 | my($machineId) = shift; | |||||||||||||||||||||||||||
| 845 | 0 | push(my(@attribs), @_); | |||||||||||||||||||||||||||
| 846 | 0 | my @myattribs; | |||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||
| 848 | $self->{'GetConsoleAccessInfo'} = | ||||||||||||||||||||||||||||
| 849 | 0 | $self->{'soap'}->GetConsoleAccessInfo( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 850 | SOAP::Data->name('machineId' => $machineId)->type('s:int')); | ||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||
| 852 | 0 | ▶ | if ($self->{'GetConsoleAccessInfo'}->fault){ $self->{'LASTERROR'} = $self->{'GetConsoleAccessInfo'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 853 | 0 | my($r) = $self->{'GetConsoleAccessInfo'}->result; | |||||||||||||||||||||||||||
| 854 | 0 | my($attribs) = $r; # returns a hash | |||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||
| 856 | 0 | ▶ | if (!@attribs) #If nothing is passed to this method, print all the info for the config | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 857 | { | ||||||||||||||||||||||||||||
| 858 | 0 | foreach my $key ( keys(%$r) ) | |||||||||||||||||||||||||||
| 859 | { | ||||||||||||||||||||||||||||
| 860 | 0 | print "$key: $$r{$key}\n "; | |||||||||||||||||||||||||||
| 861 | } | ||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||
| 863 | else | ||||||||||||||||||||||||||||
| 864 | { | ||||||||||||||||||||||||||||
| 865 | 0 | foreach my $key ( @attribs ) | |||||||||||||||||||||||||||
| 866 | { | ||||||||||||||||||||||||||||
| 867 | 0 | push( @myattribs,$$r{$key}); | |||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||
| 869 | 0 | return ( @myattribs); | |||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||
| 874 | =head2 LiveLink | ||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||
| 876 | This method allows you to create a LiveLink URL to a library configuration. Responds with a livelink URL | ||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||
| 878 | =head3 Arguments | ||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||
| 880 | =over 4 | ||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||
| 882 | =item * config Name | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | =back | ||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||
| 886 | =cut | ||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||
| 888 | sub LiveLink | ||||||||||||||||||||||||||||
| 889 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
LiveLink: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 890 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 891 | 0 | my($configName) = shift; | |||||||||||||||||||||||||||
| 892 | $self->{'LiveLink'} = | ||||||||||||||||||||||||||||
| 893 | 0 | $self->{'soap'}->LiveLink( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 894 | SOAP::Data->name('configName' => $configName)->type('s:string')); | ||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||
| 896 | 0 | ▶ | if ($self->{'LiveLink'}->fault){ $self->{'LASTERROR'} = $self->{'LiveLink'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 897 | 0 | my($r) = $self->{'LiveLink'}->result; | |||||||||||||||||||||||||||
| 898 | 0 | return $r; | |||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||
| 901 | =head2 MachinePerformAction | ||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||
| 903 | This method performs one of the following machine actions as indicated by the action identifier: | ||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||
| 905 | =over 4 | ||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||
| 907 | =item 1 Power on. Turns on a machine. | ||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||
| 909 | =item 2 Power off. Turns off a machine. Nothing is saved. | ||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||
| 911 | =item 3 Suspend. Freezes a machine CPU and state. | ||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||
| 913 | =item 4 Resume. Resumes a suspended machine. | ||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||
| 915 | =item 5 Reset. Reboots a machine. | ||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||
| 917 | =item 6 Snapshot. Save a machine state at a specific point in time. | ||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||
| 919 | =item 7 Revert. Returns a machine to a snapshot state. | ||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||
| 921 | =item 8 Shutdown. Shuts down a machine before turning off. | ||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||
| 923 | =back | ||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||
| 925 | =head3 Arguments | ||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||
| 927 | =over 4 | ||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||
| 929 | =item * Action (use numeral from list aboive) | ||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||
| 931 | =item * Machine ID | ||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||
| 933 | =back | ||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||
| 935 | =cut | ||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||
| 937 | sub MachinePerformAction | ||||||||||||||||||||||||||||
| 938 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
MachinePerformAction: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||
| 940 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 941 | 0 | my($configID) = shift; | |||||||||||||||||||||||||||
| 942 | # Actions: 1-Pwr On, 2-Pwr off, 3-Suspend, 4-Resume, 5-Reset, 6-Snapshot , 7-Revert, 8-Shutdown | ||||||||||||||||||||||||||||
| 943 | 0 | my($action) = shift; | |||||||||||||||||||||||||||
| 944 | $self->{'MachinePerformAction'} = | ||||||||||||||||||||||||||||
| 945 | 0 | $self->{'soap'}->MachinePerformAction( $self->{'auth_header'}, | |||||||||||||||||||||||||||
| 946 | SOAP::Data->name('machineId' => $configID )->type('s:int'), | ||||||||||||||||||||||||||||
| 947 | SOAP::Data->name('action' => $action )->type('s:int') ); | ||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||
| 949 | 0 | ▶ | if ( $self->{'MachinePerformAction'}->fault ){ $self->{'LASTERROR'} = $self->{'MachinePerformAction'}->fault } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||
| 952 | =head3 getLastSOAPError | ||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||
| 954 | Returns last error reported by SOAP service. | ||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||
| 956 | =cut | ||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||
| 958 | sub getLastSOAPError | ||||||||||||||||||||||||||||
| 959 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
getLastSOAPError: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 960 | 0 | my($self) = shift; | |||||||||||||||||||||||||||
| 961 | 0 | ▶ | if ( $self->{'LASTERROR'} ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 962 | { | ||||||||||||||||||||||||||||
| 963 | return join(': ', 'LabManager SOAP error', | ||||||||||||||||||||||||||||
| 964 | $self->{'LASTERROR'}->faultcode, | ||||||||||||||||||||||||||||
| 965 | $self->{'LASTERROR'}->faultstring, | ||||||||||||||||||||||||||||
| 966 | 0 | $self->{'LASTERROR'}->faultdetail | |||||||||||||||||||||||||||
| 967 | ) . "\n"; | ||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | 2 | return(1); | |||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||
| 977 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||
| 979 | David F. Kinder, Jr, dkinder@davidkinder.net | ||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||
| 981 | =head1 DEPENDENCIES | ||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||
| 983 | SOAP::Lite; | ||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||
| 985 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||
| 987 | VMWare Labamanger L<http://www.vmware.com/products/labmanager/> | ||||||||||||||||||||||||||||
| 988 | VMWare Labmanager SOAP API Guide http://www.vmware.com/pdf/lm40_soap_api_guide.pdf | ||||||||||||||||||||||||||||
| 989 | VMWare Lab Manager: Automated Reconfiguration of Transiently Used Infrastructure http://www.vmware.com/files/pdf/lm_whitepaper.pdf | ||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||
| 991 | =cut | ||||||||||||||||||||||||||||