xcat-core/xCAT-test/xmlapi
2014-09-22 10:28:08 -04:00
..
delEntriesreq add xmlapi test cases, they do not need to ship with rpm 2014-09-22 10:28:08 -04:00
delEntriesreq2
delEntriesreq3
deltblreq
getAllEntries
getAllEntries.save1
getAllEntriesreq
getAllEntriesreq.save
getAllEntriesreq.save1
getAttribsreq
getAttribsreq2
getAttribsreq.old
getNodeAttribs
getNodeAttribs1
getNodesAttribsreq
getNodesAttribsreq1
getNodesAttribsreq2
getTablesAllNodeAttribsreq
getTablesAllNodeAttribsreq1
getTablesAllNodeAttribsreq2
getTablesAllNodeAttribsreq3
getTablesAllRowAttribsreq
getTablesNodesAttribsreq
getTablesNodesAttribsreq1
getTablesNodesAttribsreq2
noderange
noderangereq
noderangereq.save
noderangereq.save1
README
readtblreq
readtblreq.node
setAttribs
setAttribsreq
setAttribsreq1
setAttribsreq2
setNodeAttribs
setNodesAttribsreq
setNodesAttribsreq1
setNodesAttribsreq1.1
setNodesAttribsreq1.new
setNodesAttribsreq2
setNodesAttribsreq3
Table.pm.routines
xmldriver
xmldriver.old
xmldriver.org
xmlrequest.org
xmlresponse

xCAT has an XML input interface to the xCAT tables.  The routines are in tabutils.pm and map to the
Table.pm routines by the same name. These routines were written for PCM but are also used in the restapi.  They are not a documented api.  
For the restapi, check the following for how and which routines are used.
xCAT-server/xCAT-wsapi/xcatws.cgi at all the functions between tablenodehdl() and tablerowdelhdl().

            getAllEntries    => "tabutils",
            getNodesAttribs  => "tabutils",
            getTablesAllNodeAttribs  => "tabutils",
            getTablesNodesAttribs  => "tabutils",
            getTablesAllRowAttribs  => "tabutils",
            setNodesAttribs  => "tabutils",
            delEntries       => "tabutils",
            getAttribs       => "tabutils",
            setAttribs       => "tabutils",
            NodeRange       => "tabutils",

If you vi /opt/xcat/lib/perl/xCAT_plugin/tabutils.pm,  and search for example "sub getAllEntries", you will see documented in the routines comments to  input XML format requried and the output XML sent.

To test these routines,  I put together a driver program pcmdriver, that generates the test XML and sends it  and displays the returned output. 


For example:
vi xmldriver in this directory

You will see 

 $ENV{'XCATXMLTRACE'}=1;
my $XML=`cat /.../xmlapi/getTablesAllRowAttribsreq`;
my $data=$XML;

$ENV{'XCATSHOWXML'}=1;

xCAT::Client::submit_request($data, \&xCAT::Client::handle_response);
exit $xCAT::Client::EXITCODE;

If you vi getTablesAllRowAttribsreq, you will see the following. This is an XML request to get the all rows from the passwd table the attributes username and rack. These is one of these  XML request files for all
possible input to the routines in the directory. 

XCATXMLTRACE is exported to show the XML that is being sent to xcatd. XCATSHOWXML is exported  to display the XML returned to the client. 

To get the XML request you must not be running in XCATBYPASS mode,  you can get the reponse in XCATBYPASS mode. 

<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllRowAttribs</command>
<table>
<tablename>passwd</tablename>
<attr>username</attr>
</table>
<table>
<tablename>rack</tablename>
<attr>rackname</attr>
</table>
</xcatrequest>