[PERL] Create instance

View: New views
16 Messages — Rating Filter:   Alert me  

[PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I'm trying to use the "create" method of client class. According the documentation, this method is defined as:

=======================================================================================
WsXmlDocH create( client_opt_t *options, char *resource_uri, char *data, size_t size, char *encoding)
=======================================================================================

My code is:
=======================================================================================
    # Establishing data
    # (key, value)
    my $data = new openwsman::XmlDoc::("data");
    my $root = $data->root();
    for(my $i=0 ; $i<scalar(@$selectors) ; $i++) {
        $root->add('n1', $selectors->[$i][0], $selectors->[$i][1]);
    }

    # Create instance.
    # (options, resource uri, data, size, encoding)
    $result = $self->{CLIENT}->create($locOptions, $uri, $data->string(), length($data->string()),"utf-8");
    unless($result) {
        print "[ERROR] Could not create instance.";
        return 1;
    }
=======================================================================================

and this is the "print $data->string()" output:
=======================================================================================
<?xml version="1.0"?>
<data xmlns:n1="Linux_NextHopIPRoute">
<n1:AddressType>1</n1:AddressType>
<n1:AdminDistance>1</n1:AdminDistance>
<n1:Caption>NextHop IPv4 route.</n1:Caption>
<n1:Description>dfasfdasf da fa </n1:Description>
<n1:DestinationAddress>192.168.0.0</n1:DestinationAddress>
<n1:DestinationMask>24</n1:DestinationMask>
<n1:ElementName>IPv4-192.168.0.0/24</n1:ElementName>
<n1:InstanceID>localhost|192.168.0.0|24|254|2|0|</n1:InstanceID>
<n1:IsStatic>1</n1:IsStatic>
<n1:OtherDerivation></n1:OtherDerivation>
<n1:PrefixLength></n1:PrefixLength>
<n1:RouteDerivation>3</n1:RouteDerivation>
<n1:RouteMetric>1</n1:RouteMetric>
<n1:TypeOfRoute>2</n1:TypeOfRoute>
</data>
=======================================================================================

this the server log:
=======================================================================================
Aug  8 16:23:29 [7043] Sock 6 accepted                                                                              
Aug  8 16:23:29 [7043] Active sockets: 0                                                                            
Aug  8 16:23:29 [7043] 127.0.0.1:8889 connected (socket 6)                                                          
Aug  8 16:23:30 [7043] Conn 6: parsing request: [POST /wsman HTTP/1.1                                               
Authorization: Basic d3NtYW46c2VjcmV0                                                                               
Host: localhost:8889                                                                                                
Accept: */*                                                                                                         
Content-Type: application/soap+xml;charset=UTF-8                                                                    
User-Agent: WS-Management for all                                                                                   
Content-Length: 1428                                                                                                
Expect: 100-continue                                                                                                

]
Aug  8 16:23:30 [7043] parsing headers (len 205): [Authorization: Basic d3NtYW46c2VjcmV0
Host: localhost:8889                                                                   
Accept: */*                                                                            
Content-Type: application/soap+xml;charset=UTF-8                                       
User-Agent: WS-Management for all                                                      
Content-Length: 1428                                                                   
Expect: 100-continue                                                                   

]
Aug  8 16:23:30 [7043] decide_what_to_do: [/wsman]
Aug  8 16:23:30 [7043] is_alias: aliases []      
Aug  8 16:23:30 [7043] Checking basic for user: wsman; password XXXXX
Aug  8 16:23:30 [7043] user: wsman,  passwd: XXXX                   
Aug  8 16:23:30 [7043] user: wsman,  passwd: XXXXX                  
Aug  8 16:23:30 [7043] Done reading request                         
Aug  8 16:23:30 [7043] Inbound call...                              
Aug  8 16:23:30 [7043] uri: http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_NextHopIPRoute, action: http://schemas.xmlsoap.org/ws/2004/09/transfer/Create
Aug  8 16:23:30 [7043] namespace: http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd                                                           
Aug  8 16:23:30 [7043] namespace: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2
Aug  8 16:23:30 [7043] namespace: http://schemas.dmtf.org/wbem/wscim/1
Aug  8 16:23:30 [7043] namespace: http://schema.omc-project.org/wbem/wscim/1/cim-schema/2
Aug  8 16:23:30 [7043] namespace: http://schema.openpegasus.org/wbem/wscim/1/cim-schema/2
Aug  8 16:23:30 [7043] namespace: http://sblim.sf.net/wbem/wscim/1/cim-schema/2
Aug  8 16:23:30 [7043] Processing Filters: inbound
Aug  8 16:23:30 [7043] Checking Message ID: uuid:49ae7441-70a6-10a6-8002-cb11fcfc1b00
Aug  8 16:23:30 [7043] Create Endpoint Called
Aug  8 16:23:30 [7043] username: wsman, password: XXXXX
Aug  8 16:23:30 [7043] Connecting using sfcc XML frontend
Aug  8 16:23:30 [7043] new cimclient: 0xc800b660
Aug  8 16:23:30 [7043] new cimclient: 1
Aug  8 16:23:30 [7043] no SelectorSet defined
Aug  8 16:23:30 [7043] method or action: Create
Aug  8 16:23:30 [7043] wsman_get_method_args
Aug  8 16:23:30 [7043] method or action: Create
Aug  8 16:23:30 [7043] Requested Class: Linux_NextHopIPRoute
Aug  8 16:23:30 [7043] cimclient destroyed
Aug  8 16:23:30 [7043] Processing Filters: outbound
Aug  8 16:23:30 [7043] destroy op
Aug  8 16:23:30 [7043] Inbound call completed
Aug  8 16:23:30 [7043] Response status=400 (Bad request)
Aug  8 16:23:30 [7043] 6 (null) stopped. 1125 of content data, 1125 now in a buffer
Aug  8 16:23:30 [7043] Disconnecting 6 ()
=======================================================================================

openwsman is not sending anything to sfcbd. I try putting all data as selectors... and both at same time, but nothing.

Am I missing something?

regards.

--
WARPTROSSE {The knowledge of a man belongs to all the humanity}


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* warptrosse <warptrosse@...> [Aug 08. 2009 21:27]:
> Hi, I'm trying to use the "create" method of client class. According the
> documentation, this method is defined as:
>
[...]
>
> openwsman is not sending anything to sfcbd. I try putting all data as
> selectors... and both at same time, but nothing.
>
> Am I missing something?

Don't know ;-) Your code snippets don't give the full picture.

Call
  $self->{CLIENT_OPTIONS}->set_dump_request();

which will dump the request in raw xml to stdout.

My suspicion is a malformed request (uri missing or not assigned to
sfcb), the dump will show this.

Hth,

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* warptrosse <warptrosse@...> [Aug 08. 2009 21:27]:
> Hi, I'm trying to use the "create" method of client class.

So I tried myself and looked a bit closer at your logs


> Aug  8 16:23:30 [7043] Create Endpoint Called
> Aug  8 16:23:30 [7043] username: wsman, password: XXXXX
> Aug  8 16:23:30 [7043] Connecting using sfcc XML frontend
> Aug  8 16:23:30 [7043] new cimclient: 0xc800b660
> Aug  8 16:23:30 [7043] new cimclient: 1

openwsman has successfully connected to the CIMOM.

> Aug  8 16:23:30 [7043] no SelectorSet defined
> Aug  8 16:23:30 [7043] method or action: Create
> Aug  8 16:23:30 [7043] wsman_get_method_args
> Aug  8 16:23:30 [7043] method or action: Create

Its calling the 'Create' function

> Aug  8 16:23:30 [7043] Requested Class: Linux_NextHopIPRoute

for this class

> Aug  8 16:23:30 [7043] cimclient destroyed

But the CIMOM doesn't like it

> Aug  8 16:23:30 [7043] Processing Filters: outbound
> Aug  8 16:23:30 [7043] destroy op
> Aug  8 16:23:30 [7043] Inbound call completed
> Aug  8 16:23:30 [7043] Response status=400 (Bad request)

so it ends as bad request.

Somehow the CIMOM fails to understand the request. Try to do the same
operation using command line (i.e. wbemcli from the sblim project) and
see if it succeeds. If it does succeed, its an openwsman bug.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Wed, Aug 12, 2009 at 8:50 AM, Klaus Kaempf <kkaempf@...> wrote:
* warptrosse <warptrosse@...> [Aug 08. 2009 21:27]:
> Hi, I'm trying to use the "create" method of client class.

So I tried myself and looked a bit closer at your logs


> Aug  8 16:23:30 [7043] Create Endpoint Called
> Aug  8 16:23:30 [7043] username: wsman, password: XXXXX
> Aug  8 16:23:30 [7043] Connecting using sfcc XML frontend
> Aug  8 16:23:30 [7043] new cimclient: 0xc800b660
> Aug  8 16:23:30 [7043] new cimclient: 1

openwsman has successfully connected to the CIMOM.

> Aug  8 16:23:30 [7043] no SelectorSet defined
> Aug  8 16:23:30 [7043] method or action: Create
> Aug  8 16:23:30 [7043] wsman_get_method_args
> Aug  8 16:23:30 [7043] method or action: Create

Its calling the 'Create' function

> Aug  8 16:23:30 [7043] Requested Class: Linux_NextHopIPRoute

for this class

> Aug  8 16:23:30 [7043] cimclient destroyed

But the CIMOM doesn't like it

> Aug  8 16:23:30 [7043] Processing Filters: outbound
> Aug  8 16:23:30 [7043] destroy op
> Aug  8 16:23:30 [7043] Inbound call completed
> Aug  8 16:23:30 [7043] Response status=400 (Bad request)

so it ends as bad request.

Somehow the CIMOM fails to understand the request. Try to do the same
operation using command line (i.e. wbemcli from the sblim project) and
see if it succeeds. If it does succeed, its an openwsman bug.

I use the attached XML with xmltest from sfcb and it works fine.
I will try with wbemcli today.

regards
 

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)




--
WARPTROSSE {The knowledge of a man belongs to all the humanity}

<?xml version="1.0" encoding="utf-8" ?>
<CIM CIMVERSION="2.0" DTDVERSION="2.0">
  <MESSAGE ID="4700" PROTOCOLVERSION="1.0">
    <SIMPLEREQ>
      <IMETHODCALL NAME="CreateInstance">
        <LOCALNAMESPACEPATH>
          <NAMESPACE NAME="root"/>
          <NAMESPACE NAME="cimv2"/>
        </LOCALNAMESPACEPATH>
        <IPARAMVALUE NAME="NewInstance">
          <INSTANCE CLASSNAME="Linux_NextHopIPRoute">
            <PROPERTY NAME="DestinationAddress" TYPE="string">
              <VALUE>192.168.0.0</VALUE>
            </PROPERTY>
            <PROPERTY NAME="DestinationMask" TYPE="string">
              <VALUE>24</VALUE>
            </PROPERTY>
            <PROPERTY NAME="RouteDerivation" TYPE="uint16">
              <VALUE>3</VALUE>
            </PROPERTY>
            <PROPERTY NAME="RouteMetric" TYPE="uint16">
              <VALUE>1</VALUE>
            </PROPERTY>
         </INSTANCE>
        </IPARAMVALUE>
      </IMETHODCALL>
    </SIMPLEREQ>
  </MESSAGE>
</CIM>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* warptrosse <warptrosse@...> [Aug 12. 2009 16:38]:
>
> I use the attached XML with xmltest from sfcb and it works fine.

So its a bug in getting the data from the ws-management layer to the
cim/xml layer.

Run sfcbd with "-t 4096", this dumps the received XML to stderr. Then
we can see how the ws-man request gets translated to cim/xml.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Klaus Kaempf <kkaempf@...> [Aug 12. 2009 16:45]:
> * warptrosse <warptrosse@...> [Aug 12. 2009 16:38]:
> >
> > I use the attached XML with xmltest from sfcb and it works fine.
>
> So its a bug in getting the data from the ws-management layer to the
> cim/xml layer.

Yeah, almost.

Create requires the data (XmlDoc) being passed to have a root node
with a correct namespace and name.

The main fix is in creating the resource root node. It must have the
resource uri as namespace and the classname as name:

  my $data = new openwsman::XmlDoc::("Linux_NextHopIPRoute");
  my $root = $data->root();
  $root->set_ns($uri);

Then the attributes are added to this node

  for(my $i=0 ; $i<scalar(@dataInfo) ; $i++) {
     $root->add($uri, $dataInfo[$i][0], $dataInfo[$i][1]);
  }

With these changes (I'll submit to svn in a moment), the request gets
passed to the CIMOM.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I use your changes and now... openwsman is sending the request to sfcbd, but

- Openwsman is sending only two properties (you can see this in sfcbd log output), so enters to create method with 2 params (checked in code too).
- You will see in the Openwsman log that Openwsman only takes 9 properties.... why? Linux_NextHopIPRoute have 14 props.... Linux_NextHopRoute have only 9
(Linux_NextHopIPRoute extends Linux_NextHopRoute).
- Is there a way to add more detailed log to openwsman ? I'm using /usr/sbin/openwsmand --syslog=6 --debug

I'm finishing the provider, soon I will send it to sblim developers.

regards.

PERL OUTPUT
===================================================================================
[root@etacarinae tests]# perl Linux_NextHopIPRoute_CreateInstance.pl
<?xml version="1.0"?>                                               
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:n1="http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_NextHopIPRoute">                                                                                                             
  <s:Header>                                                                                                                                                                             
    <wsa:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</wsa:Action>                                                                               
    <wsa:To s:mustUnderstand="true">http://localhost:8889/wsman</wsa:To>                                                                                                                 
    <wsman:ResourceURI s:mustUnderstand="true">http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_NextHopIPRoute</wsman:ResourceURI>                                                    
    <wsa:MessageID s:mustUnderstand="true">uuid:cb5ec78d-70fb-10fb-8002-cb11fcfc1b00</wsa:MessageID>
    <wsa:ReplyTo>
      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
  </s:Header>
  <s:Body>
    <n1:Linux_NextHopIPRoute>
      <n1:AddressType>1</n1:AddressType>
      <n1:AdminDistance>1</n1:AdminDistance>
      <n1:Caption>NextHop IPv4 route.</n1:Caption>
      <n1:Description>NextHop IPv4 route.</n1:Description>
      <n1:DestinationAddress>192.168.0.0</n1:DestinationAddress>
      <n1:DestinationMask>24</n1:DestinationMask>
      <n1:ElementName>IPv4-192.168.0.0/24</n1:ElementName>
      <n1:InstanceID>localhost|192.168.0.0|24|254|2|0|</n1:InstanceID>
      <n1:IsStatic>1</n1:IsStatic>
      <n1:OtherDerivation></n1:OtherDerivation>
      <n1:PrefixLength></n1:PrefixLength>
      <n1:RouteDerivation>3</n1:RouteDerivation>
      <n1:RouteMetric>1</n1:RouteMetric>
      <n1:TypeOfRoute>2</n1:TypeOfRoute>
    </n1:Linux_NextHopIPRoute>
  </s:Body>
</s:Envelope>
===================================================================================


OPENWSMAN OUTPUT
===================================================================================
Aug 12 22:24:18 [15943] 127.0.0.1:8889 connected (socket 6)                    
Aug 12 22:24:18 [15943] Conn 6: parsing request: [POST /wsman HTTP/1.1         
Authorization: Basic d3NtYW46c2VjcmV0                                          
Host: localhost:8889                                                           
Accept: */*                                                                    
Content-Type: application/soap+xml;charset=UTF-8                               
User-Agent: WS-Management for all                                              
Content-Length: 1515                                                           
Expect: 100-continue                                                           

]
Aug 12 22:24:18 [15943] parsing headers (len 205): [Authorization: Basic d3NtYW46c2VjcmV0
Host: localhost:8889                                                                    
Accept: */*                                                                             
Content-Type: application/soap+xml;charset=UTF-8                                        
User-Agent: WS-Management for all                                                       
Content-Length: 1515                                                                    
Expect: 100-continue                                                                    

]
Aug 12 22:24:18 [15943] decide_what_to_do: [/wsman]
Aug 12 22:24:18 [15943] is_alias: aliases []      
Aug 12 22:24:18 [15943] Checking basic for user: wsman; password XXXXX
Aug 12 22:24:18 [15943] user: wsman,  passwd: XXXX                   
Aug 12 22:24:18 [15943] user: wsman,  passwd: XXXXX                  
Aug 12 22:24:19 [15943] Done reading request                         
Aug 12 22:24:19 [15943] Inbound call...                              
Aug 12 22:24:19 [15943] uri: http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_NextHopIPRoute, action: http://schemas.xmlsoap.org/ws/2004/09/transfer/Create
Aug 12 22:24:19 [15943] namespace: http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd                                                           
Aug 12 22:24:19 [15943] namespace: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2                                                                         
Aug 12 22:24:19 [15943] namespace: http://schemas.dmtf.org/wbem/wscim/1                                                                                      
Aug 12 22:24:19 [15943] namespace: http://schema.omc-project.org/wbem/wscim/1/cim-schema/2                                                                   
Aug 12 22:24:19 [15943] namespace: http://schema.openpegasus.org/wbem/wscim/1/cim-schema/2                                                                   
Aug 12 22:24:19 [15943] namespace: http://sblim.sf.net/wbem/wscim/1/cim-schema/2                                                                             
Aug 12 22:24:19 [15943] Processing Filters: inbound                                                                                                          
Aug 12 22:24:19 [15943] Checking Message ID: uuid:cb5ec78d-70fb-10fb-8002-cb11fcfc1b00                                                                       
Aug 12 22:24:19 [15943] Create Endpoint Called                                                                                                               
Aug 12 22:24:19 [15943] username: wsman, password: XXXXX                                                                                                     
Aug 12 22:24:19 [15943] Connecting using sfcc XML frontend                                                                                                   
Aug 12 22:24:19 [15943] new cimclient: 0x8c00c300                                                                                                            
Aug 12 22:24:19 [15943] new cimclient: 1                                                                                                                     
Aug 12 22:24:19 [15943] no SelectorSet defined                                                                                                               
Aug 12 22:24:19 [15943] method or action: Create                                                                                                             
Aug 12 22:24:19 [15943] wsman_get_method_args                                                                                                                
Aug 12 22:24:19 [15943] method or action: Create                                                                                                             
Aug 12 22:24:19 [15943] Requested Class: Linux_NextHopIPRoute                                                                                                
Aug 12 22:24:19 [15943] getClass() rc=0, msg=(null)                                                                                                          
Aug 12 22:24:19 [15943] working on property: TypeOfRoute                                                                                                     
Aug 12 22:24:19 [15943] working on property: IsStatic                                                                                                        
Aug 12 22:24:19 [15943] working on property: RouteMetric                                                                                                     
Aug 12 22:24:19 [15943] working on property: AdminDistance                                                                                                   
Aug 12 22:24:19 [15943] working on property: DestinationAddress                                                                                              
Aug 12 22:24:19 [15943] working on property: InstanceID                                                                                                      
Aug 12 22:24:19 [15943] working on property: Caption                                                                                                         
Aug 12 22:24:19 [15943] working on property: Description                                                                                                     
Aug 12 22:24:19 [15943] working on property: ElementName                                                                                                     
Aug 12 22:24:19 [15943] num props=9                                                                                                                          
Aug 12 22:24:19 [15943] working on property: TypeOfRoute                                                                                                     
Aug 12 22:24:19 [15943] prop value: 2                                                                                                                        
Aug 12 22:24:19 [15943] working on property: IsStatic
Aug 12 22:24:19 [15943] prop value: 1
Aug 12 22:24:19 [15943] working on property: RouteMetric
Aug 12 22:24:19 [15943] prop value: 1
Aug 12 22:24:19 [15943] working on property: AdminDistance
Aug 12 22:24:19 [15943] prop value: 1
Aug 12 22:24:19 [15943] working on property: DestinationAddress
Aug 12 22:24:19 [15943] prop value: 192.168.0.0
Aug 12 22:24:19 [15943] working on property: InstanceID
Aug 12 22:24:19 [15943] prop value: localhost|192.168.0.0|24|254|2|0|
Aug 12 22:24:19 [15943] working on property: Caption
Aug 12 22:24:19 [15943] prop value: NextHop IPv4 route.
Aug 12 22:24:19 [15943] working on property: Description
Aug 12 22:24:19 [15943] prop value: NextHop IPv4 route.
Aug 12 22:24:19 [15943] working on property: ElementName
Aug 12 22:24:19 [15943] prop value: IPv4-192.168.0.0/24
Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot determine DestinationAddress
Aug 12 22:24:20 [15943] cimclient destroyed
Aug 12 22:24:20 [15943] Processing Filters: outbound
Aug 12 22:24:20 [15943] destroy op
Aug 12 22:24:20 [15943] Inbound call completed
Aug 12 22:24:20 [15943] Response status=200 (OK)
Aug 12 22:24:20 [15943] 6 (null) stopped. 709 of content data, 709 now in a buffer
Aug 12 22:24:20 [15943] Disconnecting 6 ()
===================================================================================


SFCBD
===================================================================================
[root@etacarinae /]# sfcbd -t 4096
--- sfcbd V1.3.5preview started - 15936
--- Using /usr/local/etc/sfcb/sfcb.cfg
--- SSL not configured                
--- User authentication disabled      
--- Max provider procs: 32            
--- initSocketPairs: 64               
--- localConnectServer started        
--- Max Http procs: 8                 
--- Keep-alive timeout: 15 seconds    
--- Maximum requests per connection: 10
--- Caching ClassProvider for /usr/local/var/lib/sfcb/registration/repository/root/cimv2/classSchemas (1.0-3) using 3472 bytes
--- Caching ClassProvider for /usr/local/var/lib/sfcb/registration/repository/root/interop/classSchemas (1.0-3) using 1624 bytes
[1] [08/12/2009 22:24:19] 15979/0x7f8b49e6d7b0 --- httpAdapter.c(987) : -#- xmlIn 621 bytes:                                   
<?xml version="1.0" encoding="utf-8" ?>                                                                                        
<CIM CIMVERSION="2.0" DTDVERSION="2.0">                                                                                        
<MESSAGE ID="4711" PROTOCOLVERSION="1.0">                                                                                      
<SIMPLEREQ>                                                                                                                    
<IMETHODCALL NAME="GetClass"><LOCALNAMESPACEPATH>                                                                              
<NAMESPACE NAME="root"></NAMESPACE>                                                                                            
<NAMESPACE NAME="cimv2"></NAMESPACE>                                                                                           
</LOCALNAMESPACEPATH>                                                                                                          
<IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE>                                                               
<IPARAMVALUE NAME="IncludeClassOrigin"><VALUE>FALSE</VALUE></IPARAMVALUE>                                                      
<IPARAMVALUE NAME="IncludeQualifiers"><VALUE>TRUE</VALUE></IPARAMVALUE>                                                        
<IPARAMVALUE NAME="ClassName"><CLASSNAME NAME="Linux_NextHopIPRoute"/></IPARAMVALUE>                                           
</IMETHODCALL>                                                                                                                 
</SIMPLEREQ>                                                                                                                   
</MESSAGE>                                                                                                                     
</CIM>                                                                                                                         

[1] [08/12/2009 22:24:19] 15979/0x7f8b49e6d7b0 --- httpAdapter.c(990) : -#- xmlIn end

[1] [08/12/2009 22:24:19] 15979/0x7f8b49e6d7b0 --- httpAdapter.c(987) : -#- xmlIn 612 bytes:
<?xml version="1.0" encoding="utf-8" ?>                                                    
<CIM CIMVERSION="2.0" DTDVERSION="2.0">                                                    
<MESSAGE ID="4711" PROTOCOLVERSION="1.0">                                                  
<SIMPLEREQ>
<IMETHODCALL NAME="CreateInstance"><LOCALNAMESPACEPATH>
<NAMESPACE NAME="root"></NAMESPACE>
<NAMESPACE NAME="cimv2"></NAMESPACE>
</LOCALNAMESPACEPATH>
<IPARAMVALUE NAME="NewInstance">
<INSTANCE CLASSNAME="Linux_NextHopIPRoute">
<PROPERTY NAME="InstanceID" TYPE="string">
<VALUE>localhost|192.168.0.0|24|254|2|0|</VALUE>
</PROPERTY>
<PROPERTY NAME="TypeOfRoute" TYPE="uint16">
<VALUE>2</VALUE>
</PROPERTY>
</INSTANCE>
</IPARAMVALUE>
</IMETHODCALL>
</SIMPLEREQ>
</MESSAGE>
</CIM>

[1] [08/12/2009 22:24:19] 15979/0x7f8b49e6d7b0 --- httpAdapter.c(990) : -#- xmlIn end
===================================================================================



On Wed, Aug 12, 2009 at 4:40 PM, Klaus Kaempf <kkaempf@...> wrote:
* Klaus Kaempf <kkaempf@...> [Aug 12. 2009 16:45]:
> * warptrosse <warptrosse@...> [Aug 12. 2009 16:38]:
> >
> > I use the attached XML with xmltest from sfcb and it works fine.
>
> So its a bug in getting the data from the ws-management layer to the
> cim/xml layer.

Yeah, almost.

Create requires the data (XmlDoc) being passed to have a root node
with a correct namespace and name.

The main fix is in creating the resource root node. It must have the
resource uri as namespace and the classname as name:

 my $data = new openwsman::XmlDoc::("Linux_NextHopIPRoute");
 my $root = $data->root();
 $root->set_ns($uri);

Then the attributes are added to this node

 for(my $i=0 ; $i<scalar(@dataInfo) ; $i++) {
    $root->add($uri, $dataInfo[$i][0], $dataInfo[$i][1]);
 }

With these changes (I'll submit to svn in a moment), the request gets
passed to the CIMOM.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)




--
WARPTROSSE {The knowledge of a man belongs to all the humanity}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this message is produced by the provider because it don't receive DestinationAddress property

I will take a look to openwsman source code, to try to find where is genenrating the final xml

regards

On Wed, Aug 12, 2009 at 10:36 PM, warptrosse <warptrosse@...> wrote:
Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot determine DestinationAddress



--
WARPTROSSE {The knowledge of a man belongs to all the humanity}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found that in create_instance_from_xml function from sfcc-interface.c, openwsman is getting all properties type as CMPI_instance (exept for TypeOfRoute = CMPI_uint16), so in xml2property function it is adding only TypeOfRoute to CMPIInstance.

Maybe Openwsman is getting a wrong class info from mof... I will check that

regards

=====================================================================================
void
create_instance_from_xml(CMPIInstance * instance,
        CMPIConstClass * class,
        WsXmlNodeH resource, char *fragstr,
        char *resource_uri, WsmanStatus * status)
{
    int i;
    int fragment_flag;
    char *element;
    int index;
    WsXmlNodeH child = NULL;
    char *value = NULL;
    CMPIData data;
    CMPIObjectPath *objectpath =
        instance->ft->getObjectPath(instance, NULL);
    CMPIString *classname =
        objectpath->ft->getClassName(objectpath, NULL);

    int numproperties = 0;
    numproperties = class->ft->getPropertyCount(class, NULL);

    wsman_get_fragment_type(fragstr, &fragment_flag, &element, &index);
    debug("num props=%d", numproperties);
    for (i = 0; i < numproperties; i++) {
        CMPIString *propertyname;
////////////////////// HERE GET THE PROPERTY data.type IS THE TYPE
        data = class->ft->getPropertyAt(class,
                i, &propertyname,
                NULL);
        debug("working on property: %s", (char *) propertyname->hdl );
        if(fragment_flag == 0) {
            child = ws_xml_get_child(resource, 0, resource_uri,
                    (char *) propertyname->hdl);
            if (child) {
                value = ws_xml_get_node_text(child);

                WsXmlAttrH attr =
                    ws_xml_find_node_attr(child,
                            XML_NS_SCHEMA_INSTANCE,
                            XML_NS_SCHEMA_INSTANCE_NIL);
                char *attr_val = ws_xml_get_attr_value(attr);
                if (attr && attr_val && (strcmp(attr_val, "true") == 0)) {
                    continue;
                }
                debug("prop value: %s", value );
                if (value) {
/////////////////// HERE CALLS xml2property TO ADD PROPERTIES TO CMPIInstance
                    xml2property(instance, data,
                            (char *) propertyname->hdl,
                            value);
                }
            } else if (data.type != CMPI_null
                    && data.state != CMPI_nullValue) {
                status->fault_code = WXF_INVALID_REPRESENTATION;
                status->fault_detail_code =
                    WSMAN_DETAIL_MISSING_VALUES;
                CMRelease(propertyname);
                break;
            } else {
                warning("cannot handle property");
            }
        }
        else {
            if(strcmp(element, (char *) propertyname->hdl ) == 0) {
                CMRelease(propertyname);
                break;
            }
        }
        CMRelease(propertyname);
    }
....................
=====================================================================================


On Wed, Aug 12, 2009 at 10:42 PM, warptrosse <warptrosse@...> wrote:
this message is produced by the provider because it don't receive DestinationAddress property

I will take a look to openwsman source code, to try to find where is genenrating the final xml

regards


On Wed, Aug 12, 2009 at 10:36 PM, warptrosse <warptrosse@...> wrote:
Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot determine DestinationAddress



--
WARPTROSSE {The knowledge of a man belongs to all the humanity}



--
WARPTROSSE {The knowledge of a man belongs to all the humanity}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* warptrosse <warptrosse@...> [Aug 13. 2009 03:36]:
> I use your changes and now... openwsman is sending the request to sfcbd, but
>
> - Openwsman is sending only two properties (you can see this in sfcbd log
> output), so enters to create method with 2 params (checked in code too).

Look at src/plugins/cim/sfcc-interface.c in openwsman source. Function
cim_create_instance(), lines starting at 1673.

'class' contains the class definition and the code loops through the
properties of the class and extracts the corresponding child nodes
from the xml instance passed to create.

If the wrong number of properties is passed, then the class
information might be incomplete.

> - You will see in the Openwsman log that Openwsman only takes 9
> properties.... why? Linux_NextHopIPRoute have 14 props....
> Linux_NextHopRoute have only 9
> (Linux_NextHopIPRoute extends Linux_NextHopRoute).
> - Is there a way to add more detailed log to openwsman ? I'm using
> /usr/sbin/openwsmand --syslog=6 --debug

No. I usually sprinkle more debug() statements over the code and
recompile.

What puzzles me is that cim_create_instance gets the property count
right while create_instance_from_xml fails.

I'd need at least the .mof file of your class to debug further.


Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Klaus Kaempf <kkaempf@...> [Aug 13. 2009 10:44]:

> * warptrosse <warptrosse@...> [Aug 13. 2009 03:36]:
> > I use your changes and now... openwsman is sending the request to sfcbd, but
> >
> > - Openwsman is sending only two properties (you can see this in sfcbd log
> > output), so enters to create method with 2 params (checked in code too).
>
> Look at src/plugins/cim/sfcc-interface.c in openwsman source. Function
> cim_create_instance(), lines starting at 1673.
>
> 'class' contains the class definition and the code loops through the
> properties of the class and extracts the corresponding child nodes
> from the xml instance passed to create.
>
> If the wrong number of properties is passed, then the class
> information might be incomplete.

So I can confirm now, its a bug on openwsman's cim_create_instance()
function.

It wrongly assumes that all keys in the objectpath are of type
CMPI_chars and thus calls CMAddKey accordingly, without passing the
correct type.

I have now introduced a 'xml2objectpath' subroutine which passes keys
with correct type to CMAddKey in svn rev 3171.

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Suresh Sundriyal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi warptrosse/Klaus,

I know Klaus checked in a change to fix this problem, however I was
wondering whether the fix actually solved warptrosse's problem?

I'm trying out Put operation and from what I can see, it seems the
getClass operation is returning most of the property types as
CMPI_instance in the cim_put_instance(sfcc-interface.c) operation. The
Put operation fails because of this. The message is forwarded to the
CIMOM but since in xml2property(sfcc-interface.c), CMPI_Instance breaks
witout adding any value in xml2property function, those values are not
added to the request.

I'm working off of Openwsman v2.1.0 and SFCC 2.1.0, so I don't have
Klaus' patch but looking through the fix, I don't think it is going to
solve my problem. This seems like another SFCC bug where the property
type is being incorrectly reported. In my case, CMPI_sint32 is
incorrectly being reported as CMPI_Instance.

Does anyone have any clue whether this is a known SFCC bug and whether
versions later than v2.1.0 have a fix for this?

--
Suresh

warptrosse wrote:

> I found that in *create_instance_from_xml* function from
> *sfcc-interface.c*, openwsman is getting all properties type as
> *CMPI_instance* (exept for TypeOfRoute = CMPI_uint16), so in
> *xml2property* function it is adding only *TypeOfRoute* to *CMPIInstance*.
>
> Maybe Openwsman is getting a wrong class info from mof... I will check
> that
>
> regards
>
> =====================================================================================
> void
> create_instance_from_xml(CMPIInstance * instance,
>         CMPIConstClass * class,
>         WsXmlNodeH resource, char *fragstr,
>         char *resource_uri, WsmanStatus * status)
> {
>     int i;
>     int fragment_flag;
>     char *element;
>     int index;
>     WsXmlNodeH child = NULL;
>     char *value = NULL;
>     CMPIData data;
>     CMPIObjectPath *objectpath =
>         instance->ft->getObjectPath(instance, NULL);
>     CMPIString *classname =
>         objectpath->ft->getClassName(objectpath, NULL);
>
>     int numproperties = 0;
>     numproperties = class->ft->getPropertyCount(class, NULL);
>
>     wsman_get_fragment_type(fragstr, &fragment_flag, &element, &index);
>     debug("num props=%d", numproperties);
>     for (i = 0; i < numproperties; i++) {
>         CMPIString *propertyname;
> ////////////////////// HERE GET THE PROPERTY data.type IS THE TYPE
> *        data = class->ft->getPropertyAt(class,
>                 i, &propertyname,
>                 NULL);
> *        debug("working on property: %s", (char *) propertyname->hdl );
>         if(fragment_flag == 0) {
>             child = ws_xml_get_child(resource, 0, resource_uri,
>                     (char *) propertyname->hdl);
>             if (child) {
>                 value = ws_xml_get_node_text(child);
>
>                 WsXmlAttrH attr =
>                     ws_xml_find_node_attr(child,
>                             XML_NS_SCHEMA_INSTANCE,
>                             XML_NS_SCHEMA_INSTANCE_NIL);
>                 char *attr_val = ws_xml_get_attr_value(attr);
>                 if (attr && attr_val && (strcmp(attr_val, "true") == 0)) {
>                     continue;
>                 }
>                 debug("prop value: %s", value );
>                 if (value) {
> /////////////////// HERE CALLS xml2property TO ADD PROPERTIES TO
> CMPIInstance
> *                    xml2property(instance, data,
>                             (char *) propertyname->hdl,
>                             value);
> *                }
>             } else if (data.type != CMPI_null
>                     && data.state != CMPI_nullValue) {
>                 status->fault_code = WXF_INVALID_REPRESENTATION;
>                 status->fault_detail_code =
>                     WSMAN_DETAIL_MISSING_VALUES;
>                 CMRelease(propertyname);
>                 break;
>             } else {
>                 warning("cannot handle property");
>             }
>         }
>         else {
>             if(strcmp(element, (char *) propertyname->hdl ) == 0) {
>                 CMRelease(propertyname);
>                 break;
>             }
>         }
>         CMRelease(propertyname);
>     }
> ....................
> =====================================================================================
>
>
> On Wed, Aug 12, 2009 at 10:42 PM, warptrosse <warptrosse@...
> <mailto:warptrosse@...>> wrote:
>
>     this message is produced by the provider because it don't receive
>     DestinationAddress property
>
>     I will take a look to openwsman source code, to try to find where
>     is genenrating the final xml
>
>     regards
>
>
>     On Wed, Aug 12, 2009 at 10:36 PM, warptrosse <warptrosse@...
>     <mailto:warptrosse@...>> wrote:
>
>         Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot
>         determine DestinationAddress
>
>
>
>
>     --
>     WARPTROSSE {The knowledge of a man belongs to all the humanity}
>
>
>
>
> --
> WARPTROSSE {The knowledge of a man belongs to all the humanity}


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I found the error and maybe I solve it, but I sent all emails only to Klaus... my bad, maybe I pressed "reply" instead of "reply all"

I'm fowarding the last mail, and the bug reported to sfcc:

http://sourceforge.net/tracker/?func=detail&aid=2840722&group_id=128809&atid=712784

regards

---------- Forwarded message ----------
From: warptrosse <warptrosse@...>
Date: Tue, Aug 18, 2009 at 12:43 PM
Subject: Re: [Openwsman-devel] [PERL] Create instance
To: Klaus Kaempf <kkaempf@...>

I think I found the error...

in sfcc code, sfcc/backend/cimxl/grammar.c file, function "static void genProperty(ParserControl *parm, parseUnion *stateUnion)"
just comment the lines that force the property type to be cmpi_instance... and works...

i will try to understand why those lines are there...

regards

==================================================================
static void genProperty(ParserControl *parm, parseUnion *stateUnion)
{
    parseUnion lvalp;
    ct = localLex((parseUnion*)&stateUnion->xtokProperty, parm);
    if(ct == XTOK_PROPERTY) {
        dontLex = 1;
        property(parm, (parseUnion*)&stateUnion->xtokProperty.val);

// COMMENT THIS
        // if(stateUnion->xtokProperty.val.value.type == typeValue_Instance) {
        //     stateUnion->xtokProperty.valueType = CMPI_instance;
        // }
    }
    else if(ct == XTOK_PROPERTYARRAY) {
        dontLex = 1;
        propertyArray(parm, (parseUnion*)&stateUnion->xtokProperty.val);
    }
    else if(ct == XTOK_PROPERTYREFERENCE) {
        dontLex = 1;
        propertyReference(parm, (parseUnion*)&stateUnion->xtokProperty.val);
    }
    else {
        parseError("XTOK_PROPERTY or XTOK_PROPERTYARRAY or XTOK_PROPERTYREFERENCE", ct, parm);
    }
}
==================================================================


On Tue, Sep 1, 2009 at 11:28 PM, Suresh Sundriyal <ssundriy@...> wrote:
Hi warptrosse/Klaus,

I know Klaus checked in a change to fix this problem, however I was wondering whether the fix actually solved warptrosse's problem?

I'm trying out Put operation and from what I can see, it seems the getClass operation is returning most of the property types as CMPI_instance in the cim_put_instance(sfcc-interface.c) operation. The Put operation fails because of this. The message is forwarded to the CIMOM but since in xml2property(sfcc-interface.c), CMPI_Instance breaks witout adding any value in xml2property function, those values are not added to the request.

I'm working off of Openwsman v2.1.0 and SFCC 2.1.0, so I don't have Klaus' patch but looking through the fix, I don't think it is going to solve my problem. This seems like another SFCC bug where the property type is being incorrectly reported. In my case, CMPI_sint32 is incorrectly being reported as CMPI_Instance.

Does anyone have any clue whether this is a known SFCC bug and whether versions later than v2.1.0 have a fix for this?

--
Suresh

warptrosse wrote:
I found that in *create_instance_from_xml* function from *sfcc-interface.c*, openwsman is getting all properties type as *CMPI_instance* (exept for TypeOfRoute = CMPI_uint16), so in *xml2property* function it is adding only *TypeOfRoute* to *CMPIInstance*.

Maybe Openwsman is getting a wrong class info from mof... I will check that

regards

=====================================================================================
void
create_instance_from_xml(CMPIInstance * instance,
       CMPIConstClass * class,
       WsXmlNodeH resource, char *fragstr,
       char *resource_uri, WsmanStatus * status)
{
   int i;
   int fragment_flag;
   char *element;
   int index;
   WsXmlNodeH child = NULL;
   char *value = NULL;
   CMPIData data;
   CMPIObjectPath *objectpath =
       instance->ft->getObjectPath(instance, NULL);
   CMPIString *classname =
       objectpath->ft->getClassName(objectpath, NULL);

   int numproperties = 0;
   numproperties = class->ft->getPropertyCount(class, NULL);

   wsman_get_fragment_type(fragstr, &fragment_flag, &element, &index);
   debug("num props=%d", numproperties);
   for (i = 0; i < numproperties; i++) {
       CMPIString *propertyname;
////////////////////// HERE GET THE PROPERTY data.type IS THE TYPE
*        data = class->ft->getPropertyAt(class,
               i, &propertyname,
               NULL);
*        debug("working on property: %s", (char *) propertyname->hdl );
       if(fragment_flag == 0) {
           child = ws_xml_get_child(resource, 0, resource_uri,
                   (char *) propertyname->hdl);
           if (child) {
               value = ws_xml_get_node_text(child);

               WsXmlAttrH attr =
                   ws_xml_find_node_attr(child,
                           XML_NS_SCHEMA_INSTANCE,
                           XML_NS_SCHEMA_INSTANCE_NIL);
               char *attr_val = ws_xml_get_attr_value(attr);
               if (attr && attr_val && (strcmp(attr_val, "true") == 0)) {
                   continue;
               }
               debug("prop value: %s", value );
               if (value) {
/////////////////// HERE CALLS xml2property TO ADD PROPERTIES TO CMPIInstance
*                    xml2property(instance, data,
                           (char *) propertyname->hdl,
                           value);
*                }
           } else if (data.type != CMPI_null
                   && data.state != CMPI_nullValue) {
               status->fault_code = WXF_INVALID_REPRESENTATION;
               status->fault_detail_code =
                   WSMAN_DETAIL_MISSING_VALUES;
               CMRelease(propertyname);
               break;
           } else {
               warning("cannot handle property");
           }
       }
       else {
           if(strcmp(element, (char *) propertyname->hdl ) == 0) {
               CMRelease(propertyname);
               break;
           }
       }
       CMRelease(propertyname);
   }
....................
=====================================================================================


On Wed, Aug 12, 2009 at 10:42 PM, warptrosse <warptrosse@... <mailto:warptrosse@...>> wrote:

   this message is produced by the provider because it don't receive
   DestinationAddress property

   I will take a look to openwsman source code, to try to find where
   is genenrating the final xml

   regards


   On Wed, Aug 12, 2009 at 10:36 PM, warptrosse <warptrosse@...
   <mailto:warptrosse@...>> wrote:

       Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot
       determine DestinationAddress




   --    WARPTROSSE {The knowledge of a man belongs to all the humanity}




--
WARPTROSSE {The knowledge of a man belongs to all the humanity}




--
WARPTROSSE {The knowledge of a man belongs to all the humanity}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by warptrosse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Sep 1, 2009 at 11:28 PM, Suresh Sundriyal <ssundriy@...> wrote:
Hi warptrosse/Klaus,

I know Klaus checked in a change to fix this problem, however I was wondering whether the fix actually solved warptrosse's problem?

I'm trying out Put operation and from what I can see, it seems the getClass operation is returning most of the property types as CMPI_instance in the cim_put_instance(sfcc-interface.c) operation. The Put operation fails because of this. The message is forwarded to the CIMOM but since in xml2property(sfcc-interface.c), CMPI_Instance breaks witout adding any value in xml2property function, those values are not added to the request.

I dont check the getClass issue, I will do it soon... my fix is for "createInstance"

regards

I'm working off of Openwsman v2.1.0 and SFCC 2.1.0, so I don't have Klaus' patch but looking through the fix, I don't think it is going to solve my problem. This seems like another SFCC bug where the property type is being incorrectly reported. In my case, CMPI_sint32 is incorrectly being reported as CMPI_Instance.

Does anyone have any clue whether this is a known SFCC bug and whether versions later than v2.1.0 have a fix for this?

--
Suresh

warptrosse wrote:
I found that in *create_instance_from_xml* function from *sfcc-interface.c*, openwsman is getting all properties type as *CMPI_instance* (exept for TypeOfRoute = CMPI_uint16), so in *xml2property* function it is adding only *TypeOfRoute* to *CMPIInstance*.

Maybe Openwsman is getting a wrong class info from mof... I will check that

regards

=====================================================================================
void
create_instance_from_xml(CMPIInstance * instance,
       CMPIConstClass * class,
       WsXmlNodeH resource, char *fragstr,
       char *resource_uri, WsmanStatus * status)
{
   int i;
   int fragment_flag;
   char *element;
   int index;
   WsXmlNodeH child = NULL;
   char *value = NULL;
   CMPIData data;
   CMPIObjectPath *objectpath =
       instance->ft->getObjectPath(instance, NULL);
   CMPIString *classname =
       objectpath->ft->getClassName(objectpath, NULL);

   int numproperties = 0;
   numproperties = class->ft->getPropertyCount(class, NULL);

   wsman_get_fragment_type(fragstr, &fragment_flag, &element, &index);
   debug("num props=%d", numproperties);
   for (i = 0; i < numproperties; i++) {
       CMPIString *propertyname;
////////////////////// HERE GET THE PROPERTY data.type IS THE TYPE
*        data = class->ft->getPropertyAt(class,
               i, &propertyname,
               NULL);
*        debug("working on property: %s", (char *) propertyname->hdl );
       if(fragment_flag == 0) {
           child = ws_xml_get_child(resource, 0, resource_uri,
                   (char *) propertyname->hdl);
           if (child) {
               value = ws_xml_get_node_text(child);

               WsXmlAttrH attr =
                   ws_xml_find_node_attr(child,
                           XML_NS_SCHEMA_INSTANCE,
                           XML_NS_SCHEMA_INSTANCE_NIL);
               char *attr_val = ws_xml_get_attr_value(attr);
               if (attr && attr_val && (strcmp(attr_val, "true") == 0)) {
                   continue;
               }
               debug("prop value: %s", value );
               if (value) {
/////////////////// HERE CALLS xml2property TO ADD PROPERTIES TO CMPIInstance
*                    xml2property(instance, data,
                           (char *) propertyname->hdl,
                           value);
*                }
           } else if (data.type != CMPI_null
                   && data.state != CMPI_nullValue) {
               status->fault_code = WXF_INVALID_REPRESENTATION;
               status->fault_detail_code =
                   WSMAN_DETAIL_MISSING_VALUES;
               CMRelease(propertyname);
               break;
           } else {
               warning("cannot handle property");
           }
       }
       else {
           if(strcmp(element, (char *) propertyname->hdl ) == 0) {
               CMRelease(propertyname);
               break;
           }
       }
       CMRelease(propertyname);
   }
....................
=====================================================================================


On Wed, Aug 12, 2009 at 10:42 PM, warptrosse <warptrosse@... <mailto:warptrosse@...>> wrote:

   this message is produced by the provider because it don't receive
   DestinationAddress property

   I will take a look to openwsman source code, to try to find where
   is genenrating the final xml

   regards


   On Wed, Aug 12, 2009 at 10:36 PM, warptrosse <warptrosse@...
   <mailto:warptrosse@...>> wrote:

       Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot
       determine DestinationAddress




   --    WARPTROSSE {The knowledge of a man belongs to all the humanity}




--
WARPTROSSE {The knowledge of a man belongs to all the humanity}




--
WARPTROSSE {The knowledge of a man belongs to all the humanity}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Suresh Sundriyal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi warptrosse,

I just looked at your analysis which you posted in the bug report to
SFCC. I commented out the following lines in backend/cimxml/grammar.c in
SFCC and the put method worked for me as well:

if(stateUnion->xtokProperty.val.value.type == typeValue_Instance) {
            stateUnion->xtokProperty.valueType = CMPI_instance;
        }

It does seem like a bug in SFCC and the getClass operation does seem to
be incorrectly reporting most of the parameterTypes as CMPI_instance and
just like you, I have no idea what that particular piece of code is
doing. :)

I hope somebody more knowledgeable takes a look at the SFCC grammar file.

--
Regards,
Suresh

warptrosse wrote:

> Hi, I found the error and maybe I solve it, but I sent all emails only
> to Klaus... my bad, maybe I pressed "reply" instead of "reply all"
>
> I'm fowarding the last mail, and the bug reported to sfcc:
>
> http://sourceforge.net/tracker/?func=detail&aid=2840722&group_id=128809&atid=712784 
> <http://sourceforge.net/tracker/?func=detail&aid=2840722&group_id=128809&atid=712784>
>
> regards
>
> ---------- Forwarded message ----------
> From: *warptrosse* <warptrosse@... <mailto:warptrosse@...>>
> Date: Tue, Aug 18, 2009 at 12:43 PM
> Subject: Re: [Openwsman-devel] [PERL] Create instance
> To: Klaus Kaempf <kkaempf@... <mailto:kkaempf@...>>
>
> I think I found the error...
>
> in sfcc code, sfcc/backend/cimxl/grammar.c file, function "static void
> genProperty(ParserControl *parm, parseUnion *stateUnion)"
> just comment the lines that force the property type to be
> cmpi_instance... and works...
>
> i will try to understand why those lines are there...
>
> regards
>
> ==================================================================
> static void genProperty(ParserControl *parm, parseUnion *stateUnion)
> {
>     parseUnion lvalp;
>     ct = localLex((parseUnion*)&stateUnion->xtokProperty, parm);
>     if(ct == XTOK_PROPERTY) {
>         dontLex = 1;
>         property(parm, (parseUnion*)&stateUnion->xtokProperty.val);
>
> // COMMENT THIS
>         // if(stateUnion->xtokProperty.val.value.type ==
> typeValue_Instance) {
>         //     stateUnion->xtokProperty.valueType = CMPI_instance;
>         // }
>     }
>     else if(ct == XTOK_PROPERTYARRAY) {
>         dontLex = 1;
>         propertyArray(parm, (parseUnion*)&stateUnion->xtokProperty.val);
>     }
>     else if(ct == XTOK_PROPERTYREFERENCE) {
>         dontLex = 1;
>         propertyReference(parm,
> (parseUnion*)&stateUnion->xtokProperty.val);
>     }
>     else {
>         parseError("XTOK_PROPERTY or XTOK_PROPERTYARRAY or
> XTOK_PROPERTYREFERENCE", ct, parm);
>     }
> }
> ==================================================================
>
>
> On Tue, Sep 1, 2009 at 11:28 PM, Suresh Sundriyal <ssundriy@...
> <mailto:ssundriy@...>> wrote:
>
>     Hi warptrosse/Klaus,
>
>     I know Klaus checked in a change to fix this problem, however I
>     was wondering whether the fix actually solved warptrosse's problem?
>
>     I'm trying out Put operation and from what I can see, it seems the
>     getClass operation is returning most of the property types as
>     CMPI_instance in the cim_put_instance(sfcc-interface.c) operation.
>     The Put operation fails because of this. The message is forwarded
>     to the CIMOM but since in xml2property(sfcc-interface.c),
>     CMPI_Instance breaks witout adding any value in xml2property
>     function, those values are not added to the request.
>
>     I'm working off of Openwsman v2.1.0 and SFCC 2.1.0, so I don't
>     have Klaus' patch but looking through the fix, I don't think it is
>     going to solve my problem. This seems like another SFCC bug where
>     the property type is being incorrectly reported. In my case,
>     CMPI_sint32 is incorrectly being reported as CMPI_Instance.
>
>     Does anyone have any clue whether this is a known SFCC bug and
>     whether versions later than v2.1.0 have a fix for this?
>
>     --
>     Suresh
>
>     warptrosse wrote:
>
>         I found that in *create_instance_from_xml* function from
>         *sfcc-interface.c*, openwsman is getting all properties type
>         as *CMPI_instance* (exept for TypeOfRoute = CMPI_uint16), so
>         in *xml2property* function it is adding only *TypeOfRoute* to
>         *CMPIInstance*.
>
>         Maybe Openwsman is getting a wrong class info from mof... I
>         will check that
>
>         regards
>
>         =====================================================================================
>         void
>         create_instance_from_xml(CMPIInstance * instance,
>                CMPIConstClass * class,
>                WsXmlNodeH resource, char *fragstr,
>                char *resource_uri, WsmanStatus * status)
>         {
>            int i;
>            int fragment_flag;
>            char *element;
>            int index;
>            WsXmlNodeH child = NULL;
>            char *value = NULL;
>            CMPIData data;
>            CMPIObjectPath *objectpath =
>                instance->ft->getObjectPath(instance, NULL);
>            CMPIString *classname =
>                objectpath->ft->getClassName(objectpath, NULL);
>
>            int numproperties = 0;
>            numproperties = class->ft->getPropertyCount(class, NULL);
>
>            wsman_get_fragment_type(fragstr, &fragment_flag, &element,
>         &index);
>            debug("num props=%d", numproperties);
>            for (i = 0; i < numproperties; i++) {
>                CMPIString *propertyname;
>         ////////////////////// HERE GET THE PROPERTY data.type IS THE TYPE
>         *        data = class->ft->getPropertyAt(class,
>                        i, &propertyname,
>                        NULL);
>         *        debug("working on property: %s", (char *)
>         propertyname->hdl );
>                if(fragment_flag == 0) {
>                    child = ws_xml_get_child(resource, 0, resource_uri,
>                            (char *) propertyname->hdl);
>                    if (child) {
>                        value = ws_xml_get_node_text(child);
>
>                        WsXmlAttrH attr =
>                            ws_xml_find_node_attr(child,
>                                    XML_NS_SCHEMA_INSTANCE,
>                                    XML_NS_SCHEMA_INSTANCE_NIL);
>                        char *attr_val = ws_xml_get_attr_value(attr);
>                        if (attr && attr_val && (strcmp(attr_val,
>         "true") == 0)) {
>                            continue;
>                        }
>                        debug("prop value: %s", value );
>                        if (value) {
>         /////////////////// HERE CALLS xml2property TO ADD PROPERTIES
>         TO CMPIInstance
>         *                    xml2property(instance, data,
>                                    (char *) propertyname->hdl,
>                                    value);
>         *                }
>                    } else if (data.type != CMPI_null
>                            && data.state != CMPI_nullValue) {
>                        status->fault_code = WXF_INVALID_REPRESENTATION;
>                        status->fault_detail_code =
>                            WSMAN_DETAIL_MISSING_VALUES;
>                        CMRelease(propertyname);
>                        break;
>                    } else {
>                        warning("cannot handle property");
>                    }
>                }
>                else {
>                    if(strcmp(element, (char *) propertyname->hdl ) == 0) {
>                        CMRelease(propertyname);
>                        break;
>                    }
>                }
>                CMRelease(propertyname);
>            }
>         ....................
>         =====================================================================================
>
>
>         On Wed, Aug 12, 2009 at 10:42 PM, warptrosse
>         <warptrosse@... <mailto:warptrosse@...>
>         <mailto:warptrosse@... <mailto:warptrosse@...>>>
>         wrote:
>
>            this message is produced by the provider because it don't
>         receive
>            DestinationAddress property
>
>            I will take a look to openwsman source code, to try to find
>         where
>            is genenrating the final xml
>
>            regards
>
>
>            On Wed, Aug 12, 2009 at 10:36 PM, warptrosse
>         <warptrosse@... <mailto:warptrosse@...>
>            <mailto:warptrosse@...
>         <mailto:warptrosse@...>>> wrote:
>
>                Aug 12 22:24:20 [15943] createInstance() rc=12, msg=Cannot
>                determine DestinationAddress
>
>
>
>
>            --    WARPTROSSE {The knowledge of a man belongs to all the
>         humanity}
>
>
>
>
>         --
>         WARPTROSSE {The knowledge of a man belongs to all the humanity}
>
>
>
>
>
> --
> WARPTROSSE {The knowledge of a man belongs to all the humanity}


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

Re: [PERL] Create instance

by Klaus Kaempf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Suresh Sundriyal <ssundriy@...> [Sep 03. 2009 01:47]:

> Hi warptrosse,
>
> I just looked at your analysis which you posted in the bug report to SFCC.
> I commented out the following lines in backend/cimxml/grammar.c in SFCC and
> the put method worked for me as well:
>
> if(stateUnion->xtokProperty.val.value.type == typeValue_Instance) {
>            stateUnion->xtokProperty.valueType = CMPI_instance;
>        }
>
> It does seem like a bug in SFCC and the getClass operation does seem to be
> incorrectly reporting most of the parameterTypes as CMPI_instance and just
> like you, I have no idea what that particular piece of code is doing. :)
I can confirm now, its an SFCC bug.

>
> I hope somebody more knowledgeable takes a look at the SFCC grammar file.

So I tried. The core of the problem is sfcc looking at uninitialized
(well, zeroed) data and the test above (== typeValue_Instance) happens
to test for zero.

The simplest fix I can currently come up with is extending the 'enum'
definitions to always include an 'unknown' element with value zero.

I'll submit a bug report upstream (#2849853).


Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)



Index: backend/cimxml/cimXmlParser.h
===================================================================
RCS file: /cvsroot/sblim/sfcc/backend/cimxml/cimXmlParser.h,v
retrieving revision 1.4
diff -u -w -r1.4 cimXmlParser.h
--- backend/cimxml/cimXmlParser.h 26 Mar 2008 18:56:51 -0000 1.4
+++ backend/cimxml/cimXmlParser.h 3 Sep 2009 10:40:00 -0000
@@ -38,18 +38,21 @@
 #endif
 
 typedef enum typeValRef {
+   typeValRef_Unknown,
    typeValRef_InstanceName,
    typeValRef_InstancePath,
    typeValRef_LocalInstancePath
 } TypeValRef;
 
 typedef enum typeProperty {
+   typeProperty_Unknown,
    typeProperty_Value,
    typeProperty_Reference,
    typeProperty_Array
 } TypeProperty;
 
 typedef enum typeValue {
+   typeValue_Unknown,
    typeValue_Instance,
    typeValue_Class,
    typeValue_charP


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel