Webservice prepare: Difference between revisions

From MyLVS
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:


Webservice prepare
=Webservice prepare=




Line 41: Line 41:
     $result->faultstring;
     $result->faultstring;
  }
  }
==Functions==
*The LVS-WFE Webservice offers the following functions:
<br>
{| style="text-align:left; background:#eeeeee;" border="1"
|-style="background:#aaaaaa"
! Function !! Optional Paramter !! Description !! Return
|- style="color:black;"
|-
| REQUESTWEIGHTDOWN || String (a ip address like 192.168.1.1) || Request to set the host offline || String (Code(d{3}) Description
|-
| REQUESTWEIGHTUP || String (a ip address like 192.168.1.1) || Request to set the host online || String (Code(d{3}) Description
|-
| REQUESTWEIGHTSTATUS || String (a ip address like 192.168.1.1) || Request the current status || String (Code(d{3}) Description
|-
| REQUESTGROUPINFORMATION || String (a ip address like 192.168.1.1) || Request the current group configuration || String (Code(d{3}) Description
|-
|}
<br>
==Return Codes==
*The LVS-WFE Webservice retruns the following codes:
*Log Categories
**2nn = Success
**3nn = Logical Errors
**4nn = Functional Errors
**5nn = Access or Request Errors
<br>
{| style="text-align:left; background:#eeeeee;" border="1"
|-style="background:#aaaaaa"
! Code !! Description !! Return
|- style="color:black;"
|-
| '''200''' || '''Request accepted (function defined message)''' || '''True'''
|-
| 300 || WeigthDown in process || False
|-
| 301 || TurnOff in process || False
|-
| 302 || Another maintenance service is already running || False
|-
| 304 || Host has already maintenance running, please come back later || False
|-
| 305 || Host has already ip renew set, please come back later || False
|-
| 306 || Host has already ip renewed a few minutes ago, please come back later || False
|-
| 307 || Host not found in inventory || False
|-
| 407 || IP renew is not set (debugging only) || False
|-
| 408 || Function not supported (debugging only) || False
|-
| 500 || Access denied or Request Refused || False
|-
| 501 || Access denied - update failed, contact IT-Admin || False
|-
|}
<br>

Revision as of 18:20, 11 August 2015

Webservice prepare

INSERT INTO `tblMaintenance` (`mID`,`enabled`,`ip`,`hostname`,`groupID`,`requestUP`,`requestDOWN`,`WeightDownTime`,`WeightDownPending`,`TurnOffTime`,
`TurnOffPending`,`response`,`message`,`updatepending`,`requestDate`,`responseDate`,`receivedfrom`,`CurWeightDownTime`,`CurTurnOffTime`,`DSLMaintenance`,
`DSLRenewRequest`,`DSLDate`,`DSLEpoche`,`DSLIP`) VALUES 
(1,1,'192.168.2.221','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143609','0','0','0',0,0,'0',0,'0'),
(2,1,'192.168.2.222','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143230','0','0','0',0,0,'0',0,'0');


Installing Soap-Lite modules for Linux

  • apt-get install libsoap-lite-perl -s
  • Note: ActiveState Perl for Windows already includes Soap-Lite


root@mylvs01:/var/www/mylvs/ws/cgi-bin# chmod 777 lvs.cgi
root@mylvs01:/var/www/mylvs/ws/modules# chmod 777 lvs.pm


  • Note: The webservice requires mylvsmon to run


From the client:

#!/usr/bin/perl -w
use SOAP::Lite + qw/ trace /;
my $soap = SOAP::Lite
  -> uri('urn:lvs')
  -> proxy('http://ws.mylvs.foo/cgi-bin/lvs.cgi');
#my $result = $soap->REQUESTWEIGHTSTATUS ();
#my $result = $soap->WHATISMYIP ();
#my $result = $soap->REQUESTWEIGHTDOWN ();
my $result = $soap->REQUESTWEIGHTUP ();
unless ($result->fault) {
 print $result->result();
} else {
  print join ', ',
    $result->faultcode,
    $result->faultstring;
}



Functions

  • The LVS-WFE Webservice offers the following functions:


Function Optional Paramter Description Return
REQUESTWEIGHTDOWN String (a ip address like 192.168.1.1) Request to set the host offline String (Code(d{3}) Description
REQUESTWEIGHTUP String (a ip address like 192.168.1.1) Request to set the host online String (Code(d{3}) Description
REQUESTWEIGHTSTATUS String (a ip address like 192.168.1.1) Request the current status String (Code(d{3}) Description
REQUESTGROUPINFORMATION String (a ip address like 192.168.1.1) Request the current group configuration String (Code(d{3}) Description


Return Codes

  • The LVS-WFE Webservice retruns the following codes:
  • Log Categories
    • 2nn = Success
    • 3nn = Logical Errors
    • 4nn = Functional Errors
    • 5nn = Access or Request Errors


Code Description Return
200 Request accepted (function defined message) True
300 WeigthDown in process False
301 TurnOff in process False
302 Another maintenance service is already running False
304 Host has already maintenance running, please come back later False
305 Host has already ip renew set, please come back later False
306 Host has already ip renewed a few minutes ago, please come back later False
307 Host not found in inventory False
407 IP renew is not set (debugging only) False
408 Function not supported (debugging only) False
500 Access denied or Request Refused False
501 Access denied - update failed, contact IT-Admin False