Re: I've released a Perl API for CIM over http(s)

Paul Robert Marino <[email protected]> Tue, 28 Aug 2012 15:49:00 -0400
Newsgroups gmane.network.open-pegasus.general
Message-ID <CAPJdpdBXG_JGUgRM4t_eZbW=NgaYP5Lqss0CP68xN-who4tfTw@mail.gmail.com>
On Tue, Aug 28, 2012 at 6:38 AM, Andreas Maier <[email protected]> wrote:
>
> Hi Paul,
> great stuff!
Thank You
>
> Some comments:
>
> Please make sure the latest DMTF specs are used. For example, DSP0200 is at
> version 1.3.1 at the moment, with clarifications and new operations (pulled
> enumerations, not yet supported in OpenPegasus).

If you look at the pod documentation in  LCP::Query it explicitly
references version 1.3.1 of DSP0200
although I haven't even gotten to look into the pulled operations yet
I will eventually but right now this is still just in its early
development stages

>
> At this point, DSP0200 and DSP0201 do not describe how to encode nested
> embedded instances in CIM-XML. The upcoming versions 1.4 and 2.4,
> respectively, will clarify that, both when using CDATA sections and XML
> escaping. As a client, you will need to support both CDATA sections and XML
> escaping for embedded instances. For example, OpenPegasus uses XML
> escaping, while SFCB uses CDATA sections. Also, some more clarifications
> around white space handling and PARMTYPE handling will be in these
> versions. A Work in Progress release of these versions should be out in
> 2..3 months or so

Thanks for the heads up
CDATA fields are easy, XML escaping shouldn't be too difficult to deal
with i just haven't played with it and XML::Twig yet.

>
> From your examples below, it seems the API provided by your Perl client
> operates at a pretty 'direct' level. For me, the bar in terms of a
> comfortable client API is still set by pywbem. I guess any step closer to
> that would be good.

Interesting I wasn't aware pywbem existed I know some people involved
in the openstack storage management development community that would
be very interested in it, Ill have to point it out to them.
as for my implementation it is purposely a direct match to DSP0200 and
latter I intend to develop wrapper modules and or encourage others to
write simplified wrappers latter once the API fully stabilizes, right
now there is still a lot to do with the LCP::Agent, LCP::Session, and
LCP::Post Classes. mostly they just need things added like the ability
to control the time outs and detect the wbem servers capabilities and
work around any missing features in the WBEM servers when possible.
there is also an error handling still needs vast improvement some of
which is simple but there is one particular problem that causes LWP to
crash namely I've seen instances where OpenPegasus returns a failed
result code but no matching XML containing the error and the
underlying LWP modules don't handle that behavior gracefully.

by the way one thing I need to clarify that wasn't in my example code
and also needs to be clarified in the pod documentation is multirecs
are automatically created when a multiple methods are called in one
instance of the query class.
so doing
"
my $query=LCP::Query->new();
$query->EnumerateClasses('root/cimv2');
$query->GetInstance
(''root/lsiarray13','LSISSI_PowerSupply','00A00100601',{},['OperationalStatus','HealtState']);
"
will create a multireq that will do execute both operations in the two
different name spaces, when it posts. I intend to eventually get the
API to detect if the server is capable of MultiRecs the first time a
user tries to execute one in a session and it it doesn't implement a
split query work around but I'm still a long way off from that,




>
> Andy
>
> Andreas Maier
> IBM Senior Technical Staff Member, Systems Management Architecture & Design
> IBM Research & Development Laboratory Boeblingen, Germany
> [email protected], +49-7031-16-3654
> ________________________________________________________________________
> IBM Deutschland Research & Development GmbH
> Vorsitzende des Aufsichtsrats: Martina Koederitz
> Geschaeftsfuehrung: Dirk Wittkopp
> Sitz der Gesellschaft: Boeblingen
> Registergericht: Amtsgericht Stuttgart, HRB 243294
>
> ----- Forwarded by Andreas Maier/Germany/IBM on 2012-08-28 12:23 -----
> ----- Forwarded by Marc Siegel/Raleigh/Contr/IBM on 08/27/2012 09:51 AM
> -----
>
> From:   Paul Robert Marino <[email protected]>
> To:     [email protected]
> Date:   08/24/2012 12:14 AM
> Subject:        I've released a Perl API for CIM over http(s)
>
>
>
> Hello every one
>
> I've been promising it for a long time and I've finally done it. I've
> posted the first publicly available alpha version of LCP ( Lib CIM
> Perl ).
> its available on git hub here https://github.com/prmarino1/Lib-CIM-Perl
>
> The current version implements the following methods from DSP0200
>
> GetClass
> GetInstance
> DeleteClass
> EnumerateClasses
> EnumerateClassNames
> EnumerateInstances
> EnumerateInstanceNames
> Associators
> AssociatorNames
> GetProperty
>
> Eventually all other methods from DSP0200 will be implemented before
> 1.0 is completed.
>
> It is capable of generating both simple and multirec queries, however
> multirec queries have not been thoroughly tested beyond validation of
> the XML against the XML schema due to the fact that the OpenPegasus
> versions I've tested with don't support them.
>
> it can post via POST or M-POST over http or https.
>
> has incrementing sequence numbers for each post it sends.
>
> last but not least has a quick and easy to use simple result parser.
>
> Lib CIM Perl is built completely on top of LWP (Lib WWW Perl ) and
> XML::Twig there are no additional libraries other than their
> dependencies required.
> Lib CIM Perl its self is written in pure Perl so there is no need to
> install any C based CIM client libraries to use it.
>
> Most of the testing so far has been against OpenPegasus
>
> keep in mind this is an alpha version and the list of things to do
> with it is as long as my arm, and some of the API will change soon,
> however the API will stabilize shortly once I release  version 0.01.
> I would appreciate any constructive feedback people are willing to
> give prior to working on the next release
>
>
>
> here is a little code sample for any one who is interested to get
> started using it
>
>
> use LCP;
>   use Data::Dumper;
>   my $options={
>         'username'=>'username',
>         'password'=>'passwd',
>         'protocol'=>'http',
>         'Method'=>'POST'
>   };
>   my $post_counter=0;
>   print "setting up the agent\n";
>   my $agent=LCP::Agent->new('localhost',$options);
>   print "setting up the session\n";
>   my $session=LCP::Session->new($agent);
>   print "constructing the query\n";
>   my $test=LCP::Query->new();
>   $test->EnumerateClasses('root/cimv2');
>   print "posting the query\n";
>   my $post=LCP::Post->new($session,$test);
>   if (defined $post and $post->{'Result'}->is_success){
>         print "post executed\n";
>         print "@{[$post->{'Result'}->decoded_content]}\n";
>         my $parser=LCP::SimpleParser->new($post->get_raw_xml);
>         my $tree=$parser->buildtree;
>         print Dumper($tree) . "\n";
>   }
>