HP MSA2324sa HP StorageWorks 2300 Family Modular Smart Array CLI reference gui - Page 14

Scripting guidelines, XML API examples, XML API DTD content

Page 14 highlights

Table 3 XML API elements (continued) Element Description and attributes PROPERTY A PROPERTY element provides detail about the attributes of an OBJECT. A property has these attributes: • name. The unique name for the property within the object. • type. The type of data represented by the element data. • size. Typically the maximum size of the output. Usually only important if the console output is displayed in rows. • draw. Whether to show or hide this data in console format. • sort. The type of sorting that can be applied to this property. • key. Indicates whether this property is a key value to identify this object. • display-name. The label for this data to show in user interfaces. COMP ASC A COMP (composition) element associates nested objects, such as a task object within a schedule object. A composition element has these attributes: • P. The oid of the part component. • G. The oid of the group component. An alternative to using COMP elements is described in XML API optimization. The association element provides a simple association description between two objects in the response. • A. First object. • B. Second object. Scripting guidelines When writing scripts to parse XML API output, use an XML library to parse the data. For parsing, a script should not rely on ordering, spacing, or column position. To find a specific property, a script should compare property names as it searches through the data. This allows the script to be compatible with future versions that could potentially add new fields to the output. The output of show commands is intended for monitoring or obtaining the current configuration. Other commands provide configuration data and display one or more status objects that specify the status of command processing. The last status object specifies the overall status of the command; other status objects indicate intermediate processing status. The following example shows the XML API status object: Success 0 Command completed successfully. 0 XML API examples This section provides example output from the XML API. The XML API is available through the CLI interface, which can be accessed via Telnet or SSH. The command input is in standard CLI format as defined in this guide. The output is in XML which conforms to the DTD described in XML API DTD content. 14 Using the CLI

  • 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
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196

14
Using the CLI
Scripting guidelines
When writing scripts to parse XML API output, use an XML library to parse the data. For parsing, a script
should
not
rely on ordering, spacing, or column position. To find a specific property, a script should
compare property names as it searches through the data. This allows the script to be compatible with future
versions that could potentially add new fields to the output.
The output of
show
commands is intended for monitoring or obtaining the current configuration. Other
commands provide configuration data and display one or more status objects that specify the status of
command processing. The last status object specifies the overall status of the command; other status objects
indicate intermediate processing status.
The following example shows the XML API status object:
<OBJECT basetype="status" name="status" oid="5">
<PROPERTY name="response-type" type="enumeration" size="12" draw="false"
sort="nosort" display-name="Response Type">Success</PROPERTY>
<PROPERTY name="response-type-numeric" type="enumeration" size="12"
draw="false" sort="nosort" display-name="Response">0</PROPERTY>
<PROPERTY name="response" type="string" size="180" draw="true" sort="nosort"
display-name="Response">Command completed successfully.</PROPERTY>
<PROPERTY name="return-code" type="int32" size="5" draw="false" sort="nosort"
display-name="Return Code">0</PROPERTY>
<PROPERTY name="component-id" type="string" size="80" draw="false"
sort="nosort" display-name="Component ID"></PROPERTY>
</OBJECT>
XML API examples
This section provides example output from the XML API.
The XML API is available through the CLI interface, which can be accessed via Telnet or SSH. The
command input is in standard CLI format as defined in this guide. The output is in XML which conforms to
the DTD described in
XML API DTD content
.
PROPERTY
A
PROPERTY
element provides detail about the attributes of an
OBJECT
. A property has these
attributes:
name
. The unique name for the property within the object.
type
. The type of data represented by the element data.
size
. Typically the maximum size of the output. Usually only important if the
console
output is
displayed in rows.
draw
.
Whether to show or hide this data in console format.
sort
.
The type of sorting that can be applied to this property.
key
. Indicates whether this property is a key value to identify this object.
display-name
. The label for this data to show in user interfaces.
COMP
A
COMP
(composition) element associates nested objects, such as a task object within a schedule
object. A composition element has these attributes:
P
. The oid of the part component.
G
. The oid of the group component.
An alternative to using
COMP
elements is described in
XML API optimization
.
ASC
The association element provides a simple association description between two objects in the response.
A
. First object.
B
. Second object.
Table 3
XML API elements (continued)
Element
Description and attributes