Guest

Preview Tool

Cisco Bug: CSCum24907 - Multiple XMP Entity updates via the NBI not possible due to locking

Last Modified

Jan 07, 2014

Products (1)

  • Cisco Prime Infrastructure

Known Affected Releases

1.1(0.56)

Description (partial)

Symptom:
STEPS TO SIMULATE:


### So, this is what we are going to create in the XMP inventory

[dave@davwebst-lnx ] > cat Card.xml 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<managementRequest requestType="createEntities">
  <cardDTO id="1" displayName="card01">
    <macaddress>00:0C:29:98:FC:BB</macaddress>
    <type>ABC</type>
  </cardDTO>
</managementRequest>

### Create a single Entity called ?Card?

[dave@davwebst-lnx ] > curl --user admin:Password123  -H 'Content-type:text/xml' -d @Card.xml POST http://localhost:8080/xmp_rest_nbi/model/data/Card
<managementResponse entityType="Card" requestType="createEntities">
    <entityId url="http://localhost:8080/xmp_rest_nbi/model//Card/22022" type="Card">22022</entityId>
</managementResponse>

### Confirm it is there

[dave@davwebst-lnx ] > curl --user admin:Password123  -H 'Content-type:text/xml' -X GET http://localhost:8080/xmp_rest_nbi/model/data/Card/22022?.full=true
<queryResponse type="Card" rootUrl="http://localhost:8080/xmp_rest_nbi/model/data" requestUrl="http://localhost:8080/xmp_rest_nbi/model/data/Card/22022?.full=true" responseType="getEntity">
    <entity url="http://localhost:8080/xmp_rest_nbi/model/data/Card/22022" type="Card" dtoType="cardDTO">
        <cardDTO id="22022" displayName="22022">
            <macaddress>00:0C:29:98:FC:BB</macaddress>
            <type>ABC</type>
        </cardDTO>
    </entity>
</queryResponse>

### This is the file to be used to update the Card details ? am I missing an XML attribute setting of some sort?

[dave@davwebst-lnx ] > cat UpdateCard.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<managementRequest requestType="updateEntities">
  <cardDTO id="22022">
    <macaddress>N/A</macaddress>
    <type>DEF</type>
  </cardDTO>
</managementRequest>

### Do the update

[dave@davwebst-lnx ] > curl --user admin:Password123  -H 'Content-type:text/xml' -d @UpdateCard.xml -X PUT http://localhost:8080/xmp_rest_nbi/model/data/Card
<managementResponse entityType="Card" requestType="updateEntities">
    <entityId url="http://localhost:8080/xmp_rest_nbi/model//Card/22022" type="Card">22022</entityId>
</managementResponse>

### Success!, check that the updates worked by re-selecting the existing Card

[dave@davwebst-lnx ] > curl --user admin:Password123  -H 'Content-type:text/xml' -X GET http://localhost:8080/xmp_rest_nbi/model/data/Card/22022?.full=true
<queryResponse type="Card" rootUrl="http://localhost:8080/xmp_rest_nbi/model/data" requestUrl="http://localhost:8080/xmp_rest_nbi/model/data/Card/22022?.full=true" responseType="getEntity">
    <entity url="http://localhost:8080/xmp_rest_nbi/model/data/Card/22022" type="Card" dtoType="cardDTO">
        <cardDTO id="22022" displayName="22022">
            <macaddress>N/A</macaddress>
            <type>DEF</type>
        </cardDTO>
    </entity>
</queryResponse>

### Yep, the previous update worked.  Now try the same update again (i.e. should have no change)

[dave@davwebst-lnx ] > curl --user admin:Password123  -H 'Content-type:text/xml' -d @UpdateCard.xml -X PUT http://localhost:8080/xmp_rest_nbi/model/data/Card

### Get a long stack trace, but the only vaguely interesting points are:
. . .

</pre></p><p>root cause <pre>org.apache.cxf.interceptor.Fault: Object of class [com.cisco.xmp.Card] with identifier [22022]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.cisco.xmp.Card#22022]

. . .
</pre></p><p>root cause <pre>org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.cisco.xmp.Card#22022]
. . .

Conditions:
Normal
Bug details contain sensitive information and therefore require a Cisco.com account to be viewed.

Bug Details Include

  • Full Description (including symptoms, conditions and workarounds)
  • Status
  • Severity
  • Known Fixed Releases
  • Related Community Discussions
  • Number of Related Support Cases
Bug information is viewable for customers and partners who have a service contract. Registered users can view up to 200 bugs per month without a service contract.