commit bbcc9985fc6935b319571c967438ba457082da75 Author: Jan Safranek Date: Wed Dec 4 08:49:18 2013 +0100 [v3] Fixed deserialization of EmbeddedInstances diff --git a/src/Pegasus/Common/SCMOStreamer.cpp b/src/Pegasus/Common/SCMOStreamer.cpp index 811dbb4..7b8c906 100644 --- a/src/Pegasus/Common/SCMOStreamer.cpp +++ b/src/Pegasus/Common/SCMOStreamer.cpp @@ -418,7 +418,6 @@ bool SCMOStreamer::_getInstances() // Instance references resolution table SCMOResolutionTable *extRefArray = new SCMOResolutionTable[numExtRefs]; - Uint32 extRefIndex=0; if (numExtRefs > 0) { if(!_buf.getBytes(extRefArray, numExtRefs*sizeof(SCMOResolutionTable))) @@ -465,23 +464,6 @@ bool SCMOStreamer::_getInstances() SCMOInstance* scmoInstPtr = new SCMOInstance(scmbInstPtr); - if (numExtRefs > 0) - { - // Handle the external references to other SCMOInstances - Uint32 numExtRefs = scmoInstPtr->numberExtRef(); - for (Uint32 i=0; i < numExtRefs; i++) - { - Uint32 extRefPos = extRefArray[extRefIndex].index; - SCMOInstance* extRefPtr = instArray[extRefPos].scmbptr.scmoInst; - scmoInstPtr->putExtRef(i,extRefPtr); - - // Mark instance as already consumed - instArray[extRefPos].scmbptr.uint64 = 0; - - extRefIndex++; - } - } - instArray[x].scmbptr.scmoInst = scmoInstPtr; #ifdef PEGASUS_DEBUG @@ -489,6 +471,32 @@ bool SCMOStreamer::_getInstances() #endif } + // resolve all references in all instances + if (numExtRefs > 0) + { + for (Uint32 x = 0; x < numInst; x++) + { + SCMOInstance* inst = (SCMOInstance*)instArray[x].scmbptr.scmoInst; + // resolve all references in this instance + for (Uint32 ref = 0; ref < inst->numberExtRef(); ref++) + { + SCMOInstance* oldPtr = inst->getExtRef(ref); + /* find the instance for given reference*/ + for (Uint32 y = 0; y < numExtRefs; y++) + { + if (extRefArray[y].scmbptr.scmoInst == oldPtr) { + Uint64 index = extRefArray[y].index; + SCMOInstance *newPtr = instArray[index].scmbptr.scmoInst; + inst->putExtRef(ref, newPtr); + // consume the instance + instArray[index].scmbptr.uint64 = 0; + break; + } + } + } + } + } + // Append all non-referenced instances to output array for (Uint32 x=0; x < numInst; x++) { diff --git a/src/Pegasus/Common/tests/Makefile b/src/Pegasus/Common/tests/Makefile index 8318bf9..43ac8db 100644 --- a/src/Pegasus/Common/tests/Makefile +++ b/src/Pegasus/Common/tests/Makefile @@ -78,6 +78,7 @@ DIRS = \ Resolve \ Scope \ SCMO \ + SCMOStreamer \ SpinLock \ Stack \ StrToInstName \ diff --git a/src/Pegasus/Common/tests/SCMOStreamer/CIM_Error.xml b/src/Pegasus/Common/tests/SCMOStreamer/CIM_Error.xml new file mode 100644 index 0000000..671ac43 --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/CIM_Error.xml @@ -0,0 +1,557 @@ + + +TRUE + + +2.30.0 + + +TRUE + + +CIM::Interop + + +CIM_Error is a specialized class that contains information about the severity, cause, recommended actions and other data related to the failure of a CIM Operation. Instances of this type MAY be included as part of the response to a CIM Operation. + + + +Primary classification of the error. The following values are defined: 2 - Communications Error. Errors of this type are principally associated with the procedures and/or processes required to convey information from one point to another. 3 - Quality of Service Error. Errors of this type are principally associated with failures that result in reduced functionality or performance. 4 - Software Error. Error of this type are principally associated with a software or processing fault. 5 - Hardware Error. Errors of this type are principally associated with an equipment or hardware failure. 6 - Environmental Error. Errors of this type are principally associated with a failure condition relating the to facility, or other environmental considerations. 7 - Security Error. Errors of this type are associated with security violations, detection of viruses, and similar issues. 8 - Oversubscription Error. Errors of this type are principally associated with the failure to allocate sufficient resources to complete the operation. 9 - Unavailable Resource Error. Errors of this type are principally associated with the failure to access a required resource. 10 -Unsupported Operation Error. Errors of this type are principally associated with requests that are not supported. + + + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +.. + + + + +Unknown +Other +Communications Error +Quality of Service Error +Software Error +Hardware Error +Environmental Error +Security Error +Oversubscription Error +Unavailable Resource Error +Unsupported Operation Error +DMTF Reserved + + + + +CIM_Error.OtherErrorType + + + + + +A free-form string describing the ErrorType when 1, "Other", is specified as the ErrorType. + + + +CIM_Error.ErrorType + + + + + +An enumerated value that describes the severity of the Indication from the notifier's point of view: 0 - the Perceived Severity of the indication is unknown or indeterminate. 1 - Other, by CIM convention, is used to indicate that the Severity's value can be found in the OtherSeverity property. 2 - Information should be used when providing an informative response. 3 - Degraded/Warning should be used when its appropriate to let the user decide if action is needed. 4 - Minor should be used to indicate action is needed, but the situation is not serious at this time. 5 - Major should be used to indicate action is needed NOW. 6 - Critical should be used to indicate action is needed NOW and the scope is broad (perhaps an imminent outage to a critical resource will result). 7 - Fatal/NonRecoverable should be used to indicate an error occurred, but it's too late to take remedial action. 2 and 0 - Information and Unknown (respectively) follow common usage. Literally, the Error is purely informational or its severity is simply unknown. + + + +0 +1 +2 +3 +4 +5 +6 +7 +.. + + + + +Unknown +Other +Information +Degraded/Warning +Minor +Major +Critical +Fatal/NonRecoverable +DMTF Reserved + + + + +Recommendation.ITU|X733.Perceived severity + + + + + +An enumerated value that describes the probable cause of the error. + + + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +.. + + + + +Unknown +Other +Adapter/Card Error +Application Subsystem Failure +Bandwidth Reduced +Connection Establishment Error +Communications Protocol Error +Communications Subsystem Failure +Configuration/Customization Error +Congestion +Corrupt Data +CPU Cycles Limit Exceeded +Dataset/Modem Error +Degraded Signal +DTE-DCE Interface Error +Enclosure Door Open +Equipment Malfunction +Excessive Vibration +File Format Error +Fire Detected +Flood Detected +Framing Error +HVAC Problem +Humidity Unacceptable +I/O Device Error +Input Device Error +LAN Error +Non-Toxic Leak Detected +Local Node Transmission Error +Loss of Frame +Loss of Signal +Material Supply Exhausted +Multiplexer Problem +Out of Memory +Output Device Error +Performance Degraded +Power Problem +Pressure Unacceptable +Processor Problem (Internal Machine Error) +Pump Failure +Queue Size Exceeded +Receive Failure +Receiver Failure +Remote Node Transmission Error +Resource at or Nearing Capacity +Response Time Excessive +Retransmission Rate Excessive +Software Error +Software Program Abnormally Terminated +Software Program Error (Incorrect Results) +Storage Capacity Problem +Temperature Unacceptable +Threshold Crossed +Timing Problem +Toxic Leak Detected +Transmit Failure +Transmitter Failure +Underlying Resource Unavailable +Version Mismatch +Previous Alert Cleared +Login Attempts Failed +Software Virus Detected +Hardware Security Breached +Denial of Service Detected +Security Credential Mismatch +Unauthorized Access +Alarm Received +Loss of Pointer +Payload Mismatch +Transmission Error +Excessive Error Rate +Trace Problem +Element Unavailable +Element Missing +Loss of Multi Frame +Broadcast Channel Failure +Invalid Message Received +Routing Failure +Backplane Failure +Identifier Duplication +Protection Path Failure +Sync Loss or Mismatch +Terminal Problem +Real Time Clock Failure +Antenna Failure +Battery Charging Failure +Disk Failure +Frequency Hopping Failure +Loss of Redundancy +Power Supply Failure +Signal Quality Problem +Battery Discharging +Battery Failure +Commercial Power Problem +Fan Failure +Engine Failure +Sensor Failure +Fuse Failure +Generator Failure +Low Battery +Low Fuel +Low Water +Explosive Gas +High Winds +Ice Buildup +Smoke +Memory Mismatch +Out of CPU Cycles +Software Environment Problem +Software Download Failure +Element Reinitialized +Timeout +Logging Problems +Leak Detected +Protection Mechanism Failure +Protecting Resource Failure +Database Inconsistency +Authentication Failure +Breach of Confidentiality +Cable Tamper +Delayed Information +Duplicate Information +Information Missing +Information Modification +Information Out of Sequence +Key Expired +Non-Repudiation Failure +Out of Hours Activity +Out of Service +Procedural Error +Unexpected Information +DMTF Reserved + + + + +Recommendation.ITU|X733.Probable cause +Recommendation.ITU|M3100.probableCause +ITU-IANA-ALARM-TC + + + + +CIM_Error.ProbableCauseDescription + + + + + +A free-form string describing the probable cause of the error. + + + +CIM_Error.ProbableCause + + + + + +A free-form string describing recommended actions to take to resolve the error. + + + + +The identifying information of the entity (i.e., the instance) generating the error. If this entity is modeled in the CIM Schema, this property contains the path of the instance encoded as a string parameter. If not modeled, the property contains some identifying string that names the entity that generated the error. The path or identifying string is formatted per the ErrorSourceFormat property. + + + +CIM_Error.ErrorSourceFormat + + + + + +The format of the ErrorSource property is interpretable based on the value of this property. Values are defined as: 0 - Unknown. The format is unknown or not meaningfully interpretable by a CIM client application. 1 - Other. The format is defined by the value of the OtherErrorSourceFormat property.2 - CIMObjectPath. A CIM Object Path as defined in the CIM Infrastructure specification. Note: CIM 2.5 and earlier used the term object names. + + + +0 +1 +2 +.. + + + + +Unknown +Other +CIMObjectPath +DMTF Reserved + + + + +CIM_Error.ErrorSource +CIM_Error.OtherErrorSourceFormat + + +0 + + + +A string defining "Other" values for ErrorSourceFormat. This value MUST be set to a non NULL value when ErrorSourceFormat is set to a value of 1 ("Other"). For all other values of ErrorSourceFormat, the value of this string must be set to NULL. + + + +CIM_Error.ErrorSourceFormat + + + + + +The CIM status code that characterizes this instance. This property defines the status codes that MAY be return by a conforming CIM Server or Listener. Note that not all status codes are valid for each operation. The specification for each operation SHOULD define the status codes that may be returned by that operation. The following values for CIM status code are defined: 1 - CIM_ERR_FAILED. A general error occurred that is not covered by a more specific error code. 2 - CIM_ERR_ACCESS_DENIED. Access to a CIM resource was not available to the client. 3 - CIM_ERR_INVALID_NAMESPACE. The target namespace does not exist. 4 - CIM_ERR_INVALID_PARAMETER. One or more parameter values passed to the method were invalid. 5 - CIM_ERR_INVALID_CLASS. The specified Class does not exist. 6 - CIM_ERR_NOT_FOUND. The requested object could not be found. 7 - CIM_ERR_NOT_SUPPORTED. The requested operation is not supported. 8 - CIM_ERR_CLASS_HAS_CHILDREN. Operation cannot be carried out on this class since it has instances. 9 - CIM_ERR_CLASS_HAS_INSTANCES. Operation cannot be carried out on this class since it has instances. 10 - CIM_ERR_INVALID_SUPERCLASS. Operation cannot be carried out since the specified superclass does not exist. 11 - CIM_ERR_ALREADY_EXISTS. Operation cannot be carried out because an object already exists. 12 - CIM_ERR_NO_SUCH_PROPERTY. The specified Property does not exist. 13 - CIM_ERR_TYPE_MISMATCH. The value supplied is incompatible with the type. 14 - CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED. The query language is not recognized or supported. 15 - CIM_ERR_INVALID_QUERY. The query is not valid for the specified query language. 16 - CIM_ERR_METHOD_NOT_AVAILABLE. The extrinsic Method could not be executed. 17 - CIM_ERR_METHOD_NOT_FOUND. The specified extrinsic Method does not exist. 18 - CIM_ERR_UNEXPECTED_RESPONSE. The returned response to the asynchronous operation was not expected. 19 - CIM_ERR_INVALID_RESPONSE_DESTINATION. The specified destination for the asynchronous response is not valid. 20 - CIM_ERR_NAMESPACE_NOT_EMPTY. The specified Namespace is not empty. 21 - CIM_ERR_INVALID_ENUMERATION_CONTEXT. The enumeration context supplied is not valid. 22 - CIM_ERR_INVALID_OPERATION_TIMEOUT. The specified Namespace is not empty. 23 - CIM_ERR_PULL_HAS_BEEN_ABANDONED. The specified Namespace is not empty. 24 - CIM_ERR_PULL_CANNOT_BE_ABANDONED. The attempt to abandon a pull operation has failed. 25 - CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED. Filtered Enumeratrions are not supported. 26 - CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED. Continue on error is not supported. 27 - CIM_ERR_SERVER_LIMITS_EXCEEDED. The WBEM Server limits have been exceeded (e.g. memory, connections, ...). 28 - CIM_ERR_SERVER_IS_SHUTTING_DOWN. The WBEM Server is shutting down. 29 - CIM_ERR_QUERY_FEATURE_NOT_SUPPORTED. The specified Query Feature is not supported. + + + +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +.. + + + + +CIM_ERR_FAILED +CIM_ERR_ACCESS_DENIED +CIM_ERR_INVALID_NAMESPACE +CIM_ERR_INVALID_PARAMETER +CIM_ERR_INVALID_CLASS +CIM_ERR_NOT_FOUND +CIM_ERR_NOT_SUPPORTED +CIM_ERR_CLASS_HAS_CHILDREN +CIM_ERR_CLASS_HAS_INSTANCES +CIM_ERR_INVALID_SUPERCLASS +CIM_ERR_ALREADY_EXISTS +CIM_ERR_NO_SUCH_PROPERTY +CIM_ERR_TYPE_MISMATCH +CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED +CIM_ERR_INVALID_QUERY +CIM_ERR_METHOD_NOT_AVAILABLE +CIM_ERR_METHOD_NOT_FOUND +CIM_ERR_UNEXPECTED_RESPONSE +CIM_ERR_INVALID_RESPONSE_DESTINATION +CIM_ERR_NAMESPACE_NOT_EMPTY +CIM_ERR_INVALID_ENUMERATION_CONTEXT +CIM_ERR_INVALID_OPERATION_TIMEOUT +CIM_ERR_PULL_HAS_BEEN_ABANDONED +CIM_ERR_PULL_CANNOT_BE_ABANDONED +CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED +CIM_ERR_CONTINUATION_ON_ERROR_NOT_SUPPORTED +CIM_ERR_SERVER_LIMITS_EXCEEDED +CIM_ERR_SERVER_IS_SHUTTING_DOWN +CIM_ERR_QUERY_FEATURE_NOT_SUPPORTED +DMTF Reserved + + + + +DSP0201.DMTF|ERROR.CODE|2.3 +DSP0200.DMTF|CIMError|1.3 + + + + +CIM_Error.CIMStatusCodeDescription + + + + + +A free-form string containing a human-readable description of CIMStatusCode. This description MAY extend, but MUST be consistent with, the definition of CIMStatusCode. + + + +DSP0201.DMTF|ERROR.DESCRIPTION|2.3 +DSP0200.DMTF|CIMError|1.3 + + + + +CIM_Error.CIMStatusCode + + + + diff --git a/src/Pegasus/Common/tests/SCMOStreamer/CIM_Indication.xml b/src/Pegasus/Common/tests/SCMOStreamer/CIM_Indication.xml new file mode 100644 index 0000000..18d5777 --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/CIM_Indication.xml @@ -0,0 +1,123 @@ + + +TRUE + + +TRUE + + +2.24.0 + + +CIM::Event + + +CIM_Indication is the abstract root class for all notifications about changes in schema, objects and their data, and about events detected by providers and instrumentation. Subclasses represent specific types of notifications. To receive an Indication, a consumer (or subscriber) must create an instance of CIM_IndicationFilter describing the criteria of the notification, an instance of CIM_ListenerDestination describing the delivery of the notification, and an instance of CIM_IndicationSubscription associating the Filter and Handler. + + + +An identifier for the Indication. This property is similar to a key value in that it can be used for identification, when correlating Indications (see the CorrelatedIndications array). Its value SHOULD be unique as long as correlations are reported, but MAY be reused or left NULL if no future Indications will reference it in their CorrelatedIndications array.To ensure uniqueness, the value of IndicationIdentifier should be constructed using the following "preferred" algorithm: <OrgID>:<LocalID> Where <OrgID> and <LocalID> are separated by a colon (:), and where <OrgID> must include a copyrighted, trademarked, or otherwise unique name that is owned by the business entity that is creating or defining the IndicationIdentifier or that is a recognized ID that is assigned to the business entity by a recognized global authority. (This requirement is similar to the <Schema Name>_<Class Name> structure of Schema class names.) In addition, to ensure uniqueness <OrgID> must not contain a colon (:). When using this algorithm, the first colon to appear in IndicationIdentifier must appear between <OrgID> and <LocalID>. <LocalID> is chosen by the business entity and should not be re-used to identify different underlying (real-world) elements. If the above "preferred" algorithm is not used, the defining entity should assure that the resulting IndicationIdentifier is not re-used across any IndicationIdentifiers that are produced by this or other providers for the NameSpace of this instance. For DMTF-defined instances, the "preferred" algorithm should be used with the <OrgID> set to CIM. + + + +Recommendation.ITU|X733.Notification identifier + + + + + +A list of IndicationIdentifiers whose notifications are correlated with (related to) this one. + + + +Recommendation.ITU|X733.Correlated notifications + + + + +CIM_Indication.IndicationIdentifier + + + + + +The time and date of creation of the Indication. The property may be set to NULL if the entity creating the Indication is not capable of determining this information. Note that IndicationTime may be the same for two Indications that are generated in rapid succession. + + + + +An enumerated value that describes the severity of the Indication from the notifier's point of view: 1 - Other, by CIM convention, is used to indicate that the Severity's value can be found in the OtherSeverity property. 3 - Degraded/Warning should be used when its appropriate to let the user decide if action is needed. 4 - Minor should be used to indicate action is needed, but the situation is not serious at this time. 5 - Major should be used to indicate action is needed NOW. 6 - Critical should be used to indicate action is needed NOW and the scope is broad (perhaps an imminent outage to a critical resource will result). 7 - Fatal/NonRecoverable should be used to indicate an error occurred, but it's too late to take remedial action. 2 and 0 - Information and Unknown (respectively) follow common usage. Literally, the Indication is purely informational or its severity is simply unknown. + + + +0 +1 +2 +3 +4 +5 +6 +7 +.. + + + + +Unknown +Other +Information +Degraded/Warning +Minor +Major +Critical +Fatal/NonRecoverable +DMTF Reserved + + + + +Recommendation.ITU|X733.Perceived severity + + + + + +Holds the value of the user defined severity value when 'PerceivedSeverity' is 1 ("Other"). + + + +CIM_AlertIndication.PerceivedSeverity + + + + + +An identifier for the indication filter that selects this indication and causes it to be sent. This property is to be filled out by the indication sending service. The value shall be correlatable with the Name property of the instance of CIM_IndicationFilter describing the criteria of the indication. The value of the IndicationFilterName should be formatted using the following algorithm: < OrgID > : < LocalID >, where < OrgID > and < LocalID > are separated by a colon (:) and < OrgID > shall include a copyrighted, trademarked, or otherwise unique name that is owned by the business entity that is creating or defining the value or that is a registered ID assigned to the business entity by a recognized global authority. In addition, to ensure uniqueness, < OrgID > shall not contain a colon (:).When using this algorithm, the first colon to appear in the value shall appear between < OrgID > and < LocalID >. < LocalID > is chosen by the business entity and shall be used uniquely. + + + +CIM_IndicationFilter.Name + + + + + +The sequence context portion of a sequence identifier for the indication. The sequence number portion of the sequence identifier is provided by the SequenceNumber property. The combination of both property values represents the sequence identifier for the indication. The sequence identifier for the indication enables a CIM listener to identify duplicate indications when the CIM service attempts the delivery retry of indications, to reorder indications that arrive out-of-order, and to detect lost indications. If a CIM service does not support sequence identifiers for indications, this property shall be NULL. If a CIM service supports sequence identifiers for indications, this property shall be maintained by the CIM service for each registered listener destination, and its value shall uniquely identify the CIM service and the indication service within the CIM service such that restarts of the CIM service and deregistration of listener destinations to the CIM service cause the value to change, without reusing earlier values for a sufficiently long time. When retrying the delivery of an indication, this property shall have the same value as in the original delivery. To guarantee this uniqueness, the property value should be constructed using the following format (defined in ABNF): sequence-context = indication-service-name "#" cim-service-start-id "#" listener-destination-creation-time Where: indication-service-name is the value of the Name property of the CIM_IndicationService instance responsible for delivering the indication. cim-service-start-id is an identifier that uniquely identifies the CIM service start, for example via a timestamp of the start time, or via a counter that increases for each start or restart. listener-destination-creation-time is a timestamp of the creation time of the CIM_ListenerDestination instance representing the listener destination. Since this format is only a recommendation, CIM clients shall treat the value as an opaque identifier for the sequence context and shall not rely on this format. + + + +CIM_Indication.SequenceNumber + + + + + +The sequence number portion of a sequence identifier for the indication. The sequence context portion of the sequence identifier is provided by the SequenceContext property. The combination of both property values represents the sequence identifier for the indication. The sequence identifier for the indication enables a CIM listener to identify duplicate indications when the CIM service attempts the delivery retry of indications, to reorder indications that arrive out-of-order, and to detect lost indications. If a CIM service does not support sequence identifiers for indications, this property shall be NULL. If a CIM service supports sequence identifiers for indications, this property shall be maintained by the CIM service for each registered listener destination, and its value shall uniquely identify the indication within the sequence context provided by SequenceContext. It shall start at 0 whenever the sequence context string changes. Otherwise, it shall be increased by 1 for every new indication to that listener destination, and it shall wrap to 0 when the value range is exceeded. When retrying the delivery of an indication, this property shall have the same value as in the original delivery. + + + +CIM_Indication.SequenceContext + + + + diff --git a/src/Pegasus/Common/tests/SCMOStreamer/CIM_InstIndication.xml b/src/Pegasus/Common/tests/SCMOStreamer/CIM_InstIndication.xml new file mode 100644 index 0000000..64efa96 --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/CIM_InstIndication.xml @@ -0,0 +1,48 @@ + + +TRUE + + +TRUE + + +2.29.0 + + +CIM::Event + + +CIM_InstIndication is an abstract superclass describing changes to instances. Subclasses represent specific types of change notifications, such as instance creation, deletion and modification. + + + +TRUE + + +A copy of the instance that changed to generate the Indication. SourceInstance contains the current values of the properties selected by the Indication Filter's Query. In the case of CIM_InstDeletion, the property values are copied before the instance is deleted. + + +TRUE + + + + +The Model Path of the SourceInstance. The following format MUST be used to encode the Model Path: <NamespacePath>:<ClassName>.<Prop1>="<Value1>", <Prop2>="<Value2>", ... + + + +CIM_InstIndication.SourceInstance + + + + + +The host name or IP address of the SourceInstance. + + + +CIM_InstIndication.SourceInstance + + + + diff --git a/src/Pegasus/Common/tests/SCMOStreamer/CIM_InstMethodCall.xml b/src/Pegasus/Common/tests/SCMOStreamer/CIM_InstMethodCall.xml new file mode 100644 index 0000000..f27d00a --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/CIM_InstMethodCall.xml @@ -0,0 +1,120 @@ + + +TRUE + + +2.8.1000 + + +CIM::Event + + +CIM_InstMethodCall notifies when an instance's method is invoked. + + + +TRUE + + +The name of the method invoked. + + + + +The parameters of the method, formatted as an EmbeddedObject (with a predefined class name of "__MethodParameters". + + +TRUE + + + + +ReturnValue's data is dependent on the PreCall property. When PreCall is TRUE, this property is NULL describing that there is no method return value (since the method has not yet executed). When PreCall is FALSE, ReturnValue contains a string representation of the method's return value. + + + +CIM_InstMethodCall.PreCall +CIM_InstMethodCall.ReturnValueType +CIM_InstMethodCall.Error + + + + + +TRUE + + +The type of the method return value. + + + +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +.. + + + + +boolean +string +char16 +uint8 +sint8 +uint16 +sint16 +uint32 +sint32 +uint64 +sint64 +datetime +real32 +real64 +reference +DMTF Reserved + + + + +CIM_InstMethodCall.ReturnValue + + + + + +TRUE + + +Error's data is dependent on the PreCall property. When PreCall is TRUE, this property is NULL describing that there is no method Error instances (since the method has not yet executed). When PreCall is FALSE, Error contains an array of zero or more entries containing CIM_ERROR instances represented as an array of Embedded Instances. + + +CIM_Error + + + +CIM_InstMethodCall.PreCall +CIM_InstMethodCall.ReturnValue + + + + + +TRUE + + +Boolean indicating whether the Indication is sent before the method begins executing (TRUE) or when the method completes (FALSE). When TRUE, the inherited property SourceInstance contains the value of the instance (the properties defined by the Filter's Query clause), before execution of the method. When PreCall is FALSE, SourceInstance embeds the instance as it appears after the completion of the method. + + + diff --git a/src/Pegasus/Common/tests/SCMOStreamer/CIM_Message.xml b/src/Pegasus/Common/tests/SCMOStreamer/CIM_Message.xml new file mode 100644 index 0000000..d966c53 --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/CIM_Message.xml @@ -0,0 +1,82 @@ + + +TRUE + + +TRUE + + +2.30.0 + + +TRUE + + +CIM::Interop + + +CIM_Message instances represent DMTF standard messages that contain identification of the message, dynamic message arguments and the expanded message text. They can be used for returning detailed information from methods. + + + +CIM_Error + + + + +TRUE + + +A string that uniquely identifies the entity that owns the definition of the message. OwningEntity shall include a copyrighted, trademarked or otherwise unique name that is owned by the business entity or standards body defining the message. + + + +CIM_Message.MessageID + + + + + +TRUE + + +An opaque string that uniquely identifies, within the scope of the OwningEntity, the format of the Message. + + + +CIM_Message.OwningEntity + + + + + +An indicator that allows combining multiple messages into one logical message. The messages being combined need to be consecutive messages in an ordered sequence of messages (e.g. an indexed array of embedded instances of CIM_Message). A value of True indicates that the logical message continues with the next message after this message. A value of False or Null indicates that the logical message ends at this message. For instances of CIM_Message that are not part of an ordered sequence of messages, this property is meaningless and shall be Null. + + + + +TRUE + + +The message text, with all dynamic elements expanded. The property value shall constructed by combining all static and dynamic message elements defined in the message definition in the order defined, using the values specified in the MessageArguments array property for the dynamic elements, in the order of the array. + + + +CIM_Message.MessageArguments + + + + + +An array containing the values of the dynamic elements of the message, in the order in which the dynamic elements are defined in the message definition. + + +Indexed + + + +CIM_Message.Message + + + + diff --git a/src/Pegasus/Common/tests/SCMOStreamer/CIM_MethodResult.xml b/src/Pegasus/Common/tests/SCMOStreamer/CIM_MethodResult.xml new file mode 100644 index 0000000..32aa910 --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/CIM_MethodResult.xml @@ -0,0 +1,38 @@ + + +2.31.0 + + +CIM::System::Processing + + +Jobs are sometimes used to represent extrinsic method invocations that execute for times longer than the length of time is reasonable to require a client to wait. The method executing continues beyond the method return to the client. The class provides the result of the execution of a Job that was itself started by the side-effect of this extrinsic method invocation. The indication instances embedded an instance of this class shall be the same indications delivered to listening clients or recorded, all or in part, to logs. Basically, this approach is a corollary to the functionality provided by an instance of ListenerDestinationLog (as defined in the Interop Model). The latter provides a comprehensive, persistent mechanism for recording Job results, but is also more resource-intensive and requires supporting logging functionality. Both the extra resources and logging may not be available in all environments (for example, embedded environments). Therefore, this instance-based approach is also provided. The MethodResult instances shall not exist after the associated ConcreteJob is deleted. + + + +TRUE + + +InstanceID + + +Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies an instance of this class. In order to ensure uniqueness within the NameSpace, the value of InstanceID SHOULD be constructed using the following 'preferred' algorithm: <OrgID>:<LocalID> Where <OrgID> and <LocalID> are separated by a colon ':', and where <OrgID> MUST include a copyrighted, trademarked or otherwise unique name that is owned by the business entity creating/defining the InstanceID, or is a registered ID that is assigned to the business entity by a recognized global authority (This is similar to the <Schema Name>_<Class Name> structure of Schema class names.) In addition, to ensure uniqueness <OrgID> MUST NOT contain a colon (':'). When using this algorithm, the first colon to appear in InstanceID MUST appear between <OrgID> and <LocalID>. <LocalID> is chosen by the business entity and SHOULD not be re-used to identify different underlying (real-world) elements. If the above 'preferred' algorithm is not used, the defining entity MUST assure that the resultant InstanceID is not re-used across any InstanceIDs produced by this or other providers for this instance's NameSpace. For DMTF defined instances, the 'preferred' algorithm MUST be used with the <OrgID> set to 'CIM'. + + + + +This property contains a CIM_InstMethodCall Indication that describes the pre-execution values of the extrinisic method invocation. + + +CIM_InstMethodCall + + + + +This property contains a CIM_InstMethodCall Indication that describes the post-execution values of the extrinisic method invocation. + + +CIM_InstMethodCall + + + diff --git a/src/Pegasus/Common/tests/SCMOStreamer/Makefile b/src/Pegasus/Common/tests/SCMOStreamer/Makefile new file mode 100644 index 0000000..3b905c9 --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/Makefile @@ -0,0 +1,45 @@ +#//%LICENSE//////////////////////////////////////////////////////////////// +#// +#// Licensed to The Open Group (TOG) under one or more contributor license +#// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with +#// this work for additional information regarding copyright ownership. +#// Each contributor licenses this file to you under the OpenPegasus Open +#// Source License; you may not use this file except in compliance with the +#// License. +#// +#// Permission is hereby granted, free of charge, to any person obtaining a +#// copy of this software and associated documentation files (the "Software"), +#// to deal in the Software without restriction, including without limitation +#// the rights to use, copy, modify, merge, publish, distribute, sublicense, +#// and/or sell copies of the Software, and to permit persons to whom the +#// Software is furnished to do so, subject to the following conditions: +#// +#// The above copyright notice and this permission notice shall be included +#// in all copies or substantial portions of the Software. +#// +#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +#// +#////////////////////////////////////////////////////////////////////////// +ROOT = ../../../../.. +DIR = Pegasus/Common/tests/SCMO +include $(ROOT)/mak/config.mak +include ../libraries.mak + +LOCAL_DEFINES = -DPEGASUS_INTERNALONLY + +PROGRAM = TestSCMOStreamer + +SOURCES = TestSCMOStreamer.cpp + +include $(ROOT)/mak/program.mak + +tests: + $(PROGRAM) + +poststarttests: diff --git a/src/Pegasus/Common/tests/SCMOStreamer/TestSCMOStreamer.cpp b/src/Pegasus/Common/tests/SCMOStreamer/TestSCMOStreamer.cpp new file mode 100644 index 0000000..50da41e --- /dev/null +++ b/src/Pegasus/Common/tests/SCMOStreamer/TestSCMOStreamer.cpp @@ -0,0 +1,239 @@ +//%LICENSE//////////////////////////////////////////////////////////////// +// +// Licensed to The Open Group (TOG) under one or more contributor license +// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with +// this work for additional information regarding copyright ownership. +// Each contributor licenses this file to you under the OpenPegasus Open +// Source License; you may not use this file except in compliance with the +// License. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +////////////////////////////////////////////////////////////////////////// +// +//%///////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include + + +PEGASUS_USING_PEGASUS; +PEGASUS_USING_STD; + +#define VCOUT if (verbose) cout + +static Boolean verbose; +static Boolean loadClassOnce; + +const String TESTSCMO2XML("/src/Pegasus/Common/tests/SCMOStreamer/"); + +#define TEST_INSTANCE_ID "my_instance_id" +#define TEST_ERROR_SOURCE "my_error_source" +#define TEST_PRE_METHOD_NAME "my_pre_method_name" +#define TEST_POST_METHOD_NAME "my_post_method_name" + +SCMOClass _scmoClassCache_GetClass( + const CIMNamespaceName& nameSpace, + const CIMName& className) +{ + CIMClass cl; + Buffer text; + + VCOUT << endl << "Loading class " << className.getString() << endl; + + String filename (getenv("PEGASUS_ROOT")); + filename.append(TESTSCMO2XML); + filename.append(className.getString()); + filename.append(".xml"); + + FileSystem::loadFileToMemory(text,(const char*)filename.getCString()); + + XmlParser theParser((char*)text.getData()); + XmlReader::getObject(theParser,cl); + + // The class was loaded. + loadClassOnce = true; + + VCOUT << endl << "Done." << endl; + + return SCMOClass( + cl, (const char*)nameSpace.getString().getCString()); +} + + +void SCMOInstanceConverterTest() +{ + + CIMClass CIM_CSClass; + CIMInstance CIM_CSInstance; + Buffer text; + CIMNamespaceName nm("root/cimv2"); + + VCOUT << endl << "SCMOStreamer Test.." << endl; + + VCOUT << endl << "Loading classes" << endl; + CIMName CIM_MethodResultName("CIM_MethodResult"); + SCMOClass CIM_MethodResult = _scmoClassCache_GetClass(nm, CIM_MethodResultName); + + CIMName CIM_InstMethodCallName("CIM_InstMethodCall"); + SCMOClass CIM_InstMethodCall = _scmoClassCache_GetClass(nm, CIM_InstMethodCallName); + + CIMName CIM_ErrorName("CIM_Error"); + SCMOClass CIM_Error = _scmoClassCache_GetClass(nm, CIM_ErrorName); + + VCOUT << endl << "Creating CIM_Error instance" << endl; + SCMOInstance error = SCMOInstance(CIM_Error); + SCMBUnion val; + val.extString.pchar = TEST_ERROR_SOURCE; + val.extString.length = strlen(val.extString.pchar); + error.setPropertyWithOrigin("ErrorSource", CIMTYPE_STRING, &val); + + VCOUT << endl << "Creating PreCall instance" << endl; + SCMOInstance preCall = SCMOInstance(CIM_InstMethodCall); + val.extString.pchar = TEST_PRE_METHOD_NAME; + val.extString.length = strlen(val.extString.pchar); + preCall.setPropertyWithOrigin("MethodName", CIMTYPE_STRING, &val); + + VCOUT << endl << "Creating PostCall instance" << endl; + SCMOInstance postCall = SCMOInstance(CIM_InstMethodCall); + val.extString.pchar = TEST_POST_METHOD_NAME; + val.extString.length = strlen(val.extString.pchar); + postCall.setPropertyWithOrigin("MethodName", CIMTYPE_STRING, &val); + val.extRefPtr = &error; + postCall.setPropertyWithOrigin("Error", CIMTYPE_INSTANCE, &val, true, 1); + + VCOUT << endl << "Creating MethodResult instance" << endl; + SCMOInstance methodResult = SCMOInstance(CIM_MethodResult); + val.extString.pchar = TEST_INSTANCE_ID; + val.extString.length = strlen(val.extString.pchar); + methodResult.setPropertyWithOrigin("InstanceID", CIMTYPE_STRING, &val); + val.extRefPtr = &preCall; + methodResult.setPropertyWithOrigin("PreCallIndication", CIMTYPE_INSTANCE, &val); + val.extRefPtr = &postCall; + methodResult.setPropertyWithOrigin("PostCallIndication", CIMTYPE_INSTANCE, &val); + + VCOUT << "serialize" << endl; + + Array in; + in.append(methodResult); + + CIMBuffer buf(4096); + buf.putSCMOInstanceA(in); + VCOUT << "serialize took " << buf.size() << endl; + + VCOUT << "deserialize" << endl; + Array out; + buf.rewind(); + bool ret = buf.getSCMOInstanceA(out); + VCOUT << "deserialize returned " << ret << endl; + VCOUT << "out size " << out.size() << endl; + + SCMOInstance &methodResult2 = out[0]; + + CIMType type; + const SCMBUnion *pval; + Boolean isArray; + Uint32 size; + + // + methodResult2.getProperty("InstanceID", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + VCOUT << "Got Instance ID: " << pval->extString.pchar << endl; + PEGASUS_TEST_ASSERT(strcmp(pval->extString.pchar, TEST_INSTANCE_ID) == 0); + + // check PreCallIndication + methodResult2.getProperty("PreCallIndication", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + SCMOInstance *preCall2 = pval->extRefPtr; + + preCall2->getProperty("MethodName", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + VCOUT << "Got PreCallIndication.MethodName: " << pval->extString.pchar << endl; + PEGASUS_TEST_ASSERT(strcmp(pval->extString.pchar, TEST_PRE_METHOD_NAME) == 0); + + // check PostCallIndication + methodResult2.getProperty("PostCallIndication", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + SCMOInstance *postCall2 = pval->extRefPtr; + + postCall2->getProperty("MethodName", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + VCOUT << "Got PostCallIndication.MethodName: " << pval->extString.pchar << endl; + PEGASUS_TEST_ASSERT(strcmp(pval->extString.pchar, TEST_POST_METHOD_NAME) == 0); + + // check error + postCall2->getProperty("Error", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + SCMOInstance *error2 = pval->extRefPtr; + + error2->getProperty("ErrorSource", type, &pval, isArray, size); + PEGASUS_TEST_ASSERT(pval != NULL); + VCOUT << "Got Error[0].ErrorSource: " << pval->extString.pchar << endl; + PEGASUS_TEST_ASSERT(strcmp(pval->extString.pchar, TEST_ERROR_SOURCE) == 0); + + VCOUT << endl << "Done." << endl << endl; +} + + +int main (int argc, char *argv[]) +{ + + CIMClass CIM_TESTClass2; + + verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false; + + try + { + // init the cache. + SCMOClassCache* _thecache = SCMOClassCache::getInstance(); + _thecache->setCallBack(_scmoClassCache_GetClass); + + SCMOInstanceConverterTest(); + + //destroy the cache. + _thecache->destroy(); + } + catch (CIMException& e) + { + cout << endl << "CIMException: " ; + cout << e.getMessage() << endl << endl ; + exit(-1); + } + + catch (Exception& e) + { + cout << endl << "Exception: " ; + cout << e.getMessage() << endl << endl ; + exit(-1); + } + catch (...) + { + cout << endl << "Unkown exception!" << endl << endl; + exit(-1); + } + + cout << argv[0] << " +++++ passed all tests" << endl; + return 0; + +}