Business Objects and Data Sources > States > Defining States in XML > SNMP States

The class IltSNMPObjectStateSAXInfo is the XML serialization class that allows you to read and write SNMP object states in the XML format.

The following table describes the XML elements that can be used.

Table 12.8 XML Elements in the SNMP State System 
XML Element 
Attributes 
Possible Values 
Description 
<state> 
None 
Down, Failed, Shutdown, Testing, Up 
SNMP primary state 
<interface> 
state 
InOctets, InUcastPkts, InDiscards, InErrors, InUnknownProtos, OutOctets,OutUcastPkts, OutNUcastPkts, OutDiscards, OutErrors 
This attribute is mandatory. It defines the secondary state that will be set. 

 
isArray 
true or false 
This attribute is optional. It defines whether the state value is an array or not. 

 
value 
java.lang.Float 
This attribute is optional. When describing array values, each value in the array is enclosed in a <value> element. 

 
javaClass 

 
This attribute is optional. It defines the value of the state. The default value is java.lang.Float

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<ip> 
state 
InReceives, InHdrErrors,InAddrError, ForwDatagrams, InUnknownProtos, InDiscards, InDelivers, OutRequests, OutDiscards, OutNoRoutes, Forwarding 

 
isArray 
true or false 

 
value 
java.lang.Float 

 
javaClass 

 

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<icmp> 
state 
InMsgs, InErrors, OutMsgs, OutErrors 

 
isArray 
true or false 

 
value 
java.lang.Float 

 
javaClass 

 

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<tcp> 
state 
CurrentEstablished, InSegs, OutSegs, InErrors, RetranSegs 

 
isArray 
true or false 

 
value 
java.lang.Float 

 
javaClass 

 

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<udp> 
state 
InDatagrams, InErrors, OutDatagrams 

 
isArray 
true or false 

 
value 
java.lang.Float 

 
javaClass 

 

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<egp> 
state 
InMsgs, InErrors, OutMsgs, OutErrors 

 
isArray 
true or false 

 
value 
java.lang.Float 

 
javaClass 

 

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<snmp> 
state 
InPkts, OutPkts 

 
isArray 
true or false 

 
value 
java.lang.Float 

 
javaClass 

 

 
operation 
add, remove 
This attribute is optional. It specifies whether the state should be added to/removed from the object state. The default value is add indicating that the state will be set in the object state. This attribute is used within an <updateState> element. 
<system> 
None 

 
Defines the system information for the object. It can be used to define the system attributes, such as location, description, contact

How to Add a Group with SNMP States defined in XML
<addObject id="RectGroup">
  <class>ilog.tgo.model.IltRectGroup</class>
  <attribute name="name">RectGroup</attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpRect">
     <x>489</x>  <y>356</y>   <width>80</width>  <height>60</height>
  </attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSNMPObjectState">
    <state>Down</state>
    <ip state="InDiscards">50</ip>
    <ip state="Forwarding" javaClass="java.lang.Boolean">true</ip>
    <interface state="InOctets" isArray="true" javaClass="java.lang.Integer">
      <value>50</value>
      <value>70</value>
      <value>58</value>
      <value>60</value>
      <value>58</value>
      <value>62</value>
    </interface>
  </attribute>
</addObject>
How to Set SNMP States to an Existing Object using XML

The following example shows how to set SNMP states to an object that already exists in the data source. You can achieve this by using the XML tag <updateObject> to modify the attribute objectState:

<updateObject id="NE1">
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSNMPObjectState">
    <state>Up</state>
    <interface state="InOctets">100</interface>
    <ip state="InDiscards">50</ip>
    <system>
      <attribute name="location">San Francisco</attribute>
      <attribute name="description">Test machine</attribute>
    </system>
  </attribute>
</updateObject>
How to Update SNMP States Incrementally using XML
<updateObject id="NE1">
  <updateState>
    <state>Up</state>
    <interface state="InOctets">80</interface>
    <ip state="InDiscards" operation="remove"/>
    <system>
      <attribute name="location">Los Angeles</attribute>
      <attribute name="description" null="true"/>
    </system>
  </updateState>
</updateObject>