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

Andreas Maier <[email protected]> Tue, 28 Aug 2012 12:38:38 +0200
Newsgroups gmane.network.open-pegasus.general
Message-ID <OF28004331.BE6E7A79-ONC1257A68.00391831-C1257A68.003A77FC@de.ibm.com>
Hi Paul,
great stuff!

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).

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.

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.

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";
  }