Integration XML Format

From OpenNMS

Schema

The XML schema is in the source tree in opennms-config/src/main/castor/model-import.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xmlns.opennms.org/xsd/config/model-import" xmlns:this="http://xmlns.opennms.org/xsd/config/model-import">
  <element name="model-import">
    <annotation>
      <documentation>
        Use this configuration file as an import of nodes, interfaces, and services to OpenNMS by-passing several phases of discovery and capabilities polling.
      </documentation>
    </annotation>
    <complexType>
      <sequence>
        <element ref="this:node" minOccurs="1" maxOccurs="unbounded" />
      </sequence>
      <attribute name="date-stamp" type="dateTime" />
      <attribute name="foreign-source" type="string" use="optional" default="imported:" />
    </complexType>
  </element>
  <element name="node">
    <annotation>
      <documentation>A node in OpenNMS is a network entity that is used to contain network interfaces and those interface's services.</documentation>
    </annotation>
    <complexType>
      <sequence>
        <element ref="this:interface" minOccurs="1" maxOccurs="unbounded" />
        <element ref="this:category" minOccurs="0" maxOccurs="unbounded" />
      </sequence>
      <attribute name="node-label" use="required">
        <simpleType>
          <restriction base="string">
<!--             <pattern value="^[0-9A-Za-z][-0-9A-Za-z._]+$"></pattern> -->
            <pattern value=".*$"></pattern>
          </restriction>
        </simpleType>
      </attribute>
      <attribute name="foreign-id" type="string" use="required" >
        <annotation>
          <documentation>
          This optional attribute can be used to facilitate integration by making the key from the integrating DB available adjacent to the OpenNMS key.
          </documentation>
        </annotation>
      </attribute>
      <attribute name="parent-node-label" use="required" >
        <annotation>
          <documentation>This will be used to help define a node's path on the network.</documentation>
        </annotation>
        <simpleType>
          <restriction base="string">
<!--             <pattern value="^[0-9A-Za-z][-0-9A-Za-z._]+$"></pattern> -->
            <pattern value=".*$"></pattern>
          </restriction>
        </simpleType>
      </attribute>
    </complexType>
  </element>
  <element name="interface">
    <annotation>
      <documentation>A network interface.</documentation>
    </annotation>
    <complexType>
      <sequence>
        <element ref="this:monitored-service" minOccurs="0" maxOccurs="unbounded" />
        <element ref="this:category" minOccurs="0" maxOccurs="unbounded" />
      </sequence>
      <attribute name="ip-addr" type="string" use="required" />
      <attribute name="descr" use="optional" >
        <annotation>
          <documentation>This will be used to set a description field.  Currently a calculation of (ifDescr | ifName | ifAlias)</documentation>
        </annotation>
      </attribute>
      <attribute name="status" use="required" type="integer">
        <annotation>
          <documentation>Set this optional value to 3 to indicate "testing". Any other value is ignored.</documentation>
        </annotation>
      </attribute>
      <attribute name="managed" type="boolean" use="optional" default="true" />
      <attribute name="snmp-primary">
        <annotation>
          <documentation>
            This attribute is used by OpenNMS to control SNMP data collection. P - Primary interface. This is the "preferred interface used in data collection.
            S - Secondary interface. This interface meets all the qualifications to be a primary interface. C - Collectable interface. This is a manual setting
            controlled by the user. N - Not a collectable interface. This is a manual setting controlled by the user.

            If the snmpStorageFlag is set to "all", then all interfaces not set to 'N' will be collected. If the snmpStorageFlag is set to "select", then all
            interfaces with 'P|S|C' will be collected. If the snmpStorageFlag is set to "primary", then only the interfaces set to 'P' will be collected.
          </documentation>
        </annotation>
        <simpleType>
          <restriction base="string">
            <pattern value="(P|S|C|N)" />
            <length value="1" />
          </restriction>
        </simpleType>
      </attribute>
    </complexType>
  </element>
  <element name="monitored-service">
    <annotation>
      <documentation>
        This element is defined outside of the interface element for future use where it is expected that services on other network entities will be able to be
        defined (i.e. networks, nodes and applications)
      </documentation>
    </annotation>
    <complexType>
      <sequence>
        <element ref="this:category" minOccurs="0" maxOccurs="unbounded">
        </element>
      </sequence>
      <attribute name="service-name" type="string" use="required" />
    </complexType>
  </element>
  <element name="category">
    <annotation>
      <documentation>
        This element is used to specify OpenNMS specific categories.  Note: currently, these categories are defined in a separate configuration file and
        are related directly to monitored services. I have separated out this element so that it can be refereneced by other entities (nodes, interfaces, etc.)
        however, they will be ignored until the domain model is changed and the service layer is adapted for this behavior. 
      </documentation>
    </annotation>
    <complexType>
    	  <attribute name="name" type="string" use="required" />
    </complexType>
  </element>
</schema>

Example

From opennms-webapp/src/test/resources/tec_dump.xml:

<?xml version="1.0" encoding="utf-8"?>
  <!DOCTYPE myData [
    <!ENTITY auml    "ä" >
    <!ENTITY ouml    "ö" >
    <!ENTITY uuml    "ü" >
    <!ENTITY szlig   "ß" >
  ]>
<this:model-import xmlns:this="http://www.example.org/model-import" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalLocation="http://www.example.org/model-import model-import.xsd" date-stamp="2006-03-09T00:03:09" foreign-source="matt:">
        <this:node node-label="david" parent-node-label="apknd" foreign-id="4243">
                <this:interface ip-addr="172.20.1.204" status="1" snmp-primary="S" descr="VPN interface">
                        <this:monitored-service service-name="ICMP"/>
                        <this:monitored-service service-name="HTTP"/>
                </this:interface>
                <this:interface ip-addr="172.20.1.201" status="1" snmp-primary="P" descr="Management interface">
                        <this:monitored-service service-name="ICMP"/>
                        <this:monitored-service service-name="SNMP"/>
                </this:interface>
        <this:category name="AC"/>
        <this:category name="UK"/>
        <this:category name="low"/>
        </this:node>
        <this:node node-label="djgregor" parent-node-label="apknd" foreign-id="4243">
                <this:interface ip-addr="172.20.1.207" status="1" snmp-primary="S" descr="VPN interface">
                        <this:monitored-service service-name="ICMP"/>
                        <this:monitored-service service-name="HTTP"/>
                </this:interface>
                <this:interface ip-addr="172.20.1.208" status="1" snmp-primary="P" descr="Management interface">
                        <this:monitored-service service-name="ICMP"/>
                        <this:monitored-service service-name="SNMP"/>
                </this:interface>
        <this:category name="AC"/>
        <this:category name="UK"/>
        <this:category name="low"/>
        </this:node>
</this:model-import>
Personal tools
DevJam 2008 Sponsors
DevJam 2008 Sponsor: Google
DevJam 2008 Sponsor: Netregistry
DevJam 2008 Sponsor: Papa John's
NewEdge Networks
OpenNMS takes home the gold award!
Join the Free Software Foundation
Support This Project Commercial OpenNMS Support OpenNMS Italia Get OpenNMS at SourceForge.net. Fast, secure and Free Open Source software downloads Our Network Simulator Our Java Profiler