Cisco EnergyWise IOS Configuration Guide, EnergyWise Version 2.8
XML Schema Example
Downloads: This chapterpdf (PDF - 100.0KB) The complete bookPDF (PDF - 1.66MB) | Feedback

XML Schema for SNMP Endpoint Proxy

Table Of Contents

XML Schema for SNMP Endpoint Proxy

XML Schema

Sample XML File


XML Schema for SNMP Endpoint Proxy


This appendix provides the XML schema and a sample XML file created from the schema.

Use the rules of the schema to create an XML file. The XML file that you create maps MIB Object Identifiers (MIB OIDs) to the EnergyWise attributes. We recommend that you have one XML file for each MIB.

XML Schema

Sample XML File

For information about how the XML file is used in SNMP endpoint proxy, see SNMP Endpoint Proxy.

XML Schema

To use SNMP Endpoint proxy, you have to implement the following schema:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
   
    <!-- Definition of Simple Elements -->
    <xs:element name="description" type="xs:string" />
 
   
    <!-- Definiton of Attributes -->
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="datatype" type="xs:string" />
    <xs:attribute name="value" type="xs:string" />
    <xs:attribute name="default" type="xs:string" />
    <xs:attribute name="invalue" type="xs:integer" />
    <xs:attribute name="outvalue" type="xs:integer" />
    <xs:attribute name="lowerrange" type="xs:integer" />
    <xs:attribute name="upperrange" type="xs:integer" />
 
   
    <!-- Definition of Complex Elements -->
    <xs:element name="mapping" >
        <xs:complexType>
            <xs:attribute ref="invalue" />
            <xs:attribute ref="outvalue" />
            <xs:attribute ref="lowerrange" />
            <xs:attribute ref="upperrange" />
        </xs:complexType>
    </xs:element>
 
   
    <xs:element name="oid" >
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="mapping" maxOccurs="unbounded" minOccurs="0" />
            </xs:sequence>
            <xs:attribute ref="name" />
            <xs:attribute name="action" >
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="get" />
                        <xs:enumeration value="set" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute ref="datatype" />
            <xs:attribute ref="value" />
        </xs:complexType>
    </xs:element>
 
   
    <xs:element name="constant" >
        <xs:complexType>
            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="level" />
                        <xs:enumeration value="importance" />
                        <xs:enumeration value="string" />
                        <xs:enumeration value="watts" />
                        <xs:enumeration value="integer" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute ref="value" />
        </xs:complexType>
    </xs:element>
 
   
    <xs:element name="method">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="description" minOccurs="0" maxOccurs="1" />
                <xs:choice minOccurs="0">
                    <xs:element ref="oid" />
                    <xs:element ref="constant" />
                </xs:choice>
            </xs:sequence>
            <xs:attribute name="name" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="fn_get_usage" />
                        <xs:enumeration value="fn_get_keywords" />
                        <xs:enumeration value="fn_set_keywords" />
                        <xs:enumeration value="fn_get_importance" />
                        <xs:enumeration value="fn_set_importance" />
                        <xs:enumeration value="fn_get_name" />
                        <xs:enumeration value="fn_set_name" />
                        <xs:enumeration value="fn_get_role" />
                        <xs:enumeration value="fn_set_role" />
                        <xs:enumeration value="fn_get_level" />
                        <xs:enumeration value="fn_set_level" />
                        <xs:enumeration value="fn_get_deviceType" />
                        <xs:enumeration value="fn_get_units" />
                        <xs:enumeration value="fn_get_usageCaliber" />
                        <xs:enumeration value="fn_get_entityCategory" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="action" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="cache" />
                        <xs:enumeration value="constant" />
                        <xs:enumeration value="nack" />
                        <xs:enumeration value="oid" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute ref="value" />
            <xs:attribute ref="default" />
        </xs:complexType>
    </xs:element>
 
   
    <xs:element name="interface">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="method" maxOccurs="unbounded" minOccurs="0" />
            </xs:sequence>
            <xs:attribute name="protocol">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="snmp" />
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>
 
   
    <xs:element name="CiscoEnergyWise">
        <xs:complexType>
            <xs:all>
                <xs:element ref="interface" />
            </xs:all>
            <xs:attribute name="version" default="1.0" />
        </xs:complexType>
    </xs:element>	
 
   
</xs:schema> 
 
   

Sample XML File

The following sample XML code uses the EnergyWise MIB.

<?xml version="1.0" ?> 
- <CiscoEnergyWise version="1.0"> 
- <interface protocol="snmp" version="v2c"> 
- <method name="fn_get_usage" action="oid"> 
<oid name="cewEntEnergyUsage" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.8.1001" /> 
</method> 
- <method name="fn_get_units" action="oid"> 
<oid name="cewEntEnergyUnits" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.7.1001" /> 
</method> 
- <method name="fn_set_keywords" action="oid"> 
<oid name="cewEntKeyword" action="set" datatype="string" 
value="1.3.6.1.4.1.9.9.683.1.6.1.3.1001" /> 
</method> 
- <method name="fn_get_keywords" action="oid"> 
<oid name="cewEntKeyword" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.3.1001" /> 
</method> 
- <method name="fn_set_importance" action="oid"> 
<oid name="cewEntImportanceInt" action="set" datatype="unsigned32" 
value="1.3.6.1.4.1.9.9.683.1.6.1.12.1001" /> 
</method> 
- <method name="fn_get_importance" action="oid"> 
<oid name="cewEntImportanceInt" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.12.1001" /> 
</method> 
- <method name="fn_set_name" action="oid"> 
<oid name="cewEntName" action="set" datatype="string" 
value="1.3.6.1.4.1.9.9.683.1.6.1.4.1001" /> 
</method> 
- <method name="fn_get_name" action="oid"> 
<oid name="cewEntName" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.4.1001" /> 
</method> 
- <method name="fn_set_role" action="oid"> 
<oid name="cewEntRoleDescription" action="set" datatype="string" 
value="1.3.6.1.4.1.9.9.683.1.6.1.5.1001" /> 
</method> 
- <method name="fn_get_role" action="oid"> 
<oid name="cewEntRoleDescription" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.5.1001" /> 
</method> 
- <method name="fn_set_level" action="oid"> 
- <oid name="cewEntEnergyLevel" action="set" datatype="integer" 
value="1.3.6.1.4.1.9.9.683.1.6.1.10.1001"> 
<mapping invalue="0" outvalue="1" /> 
<mapping invalue="1" outvalue="2" /> 
<mapping invalue="2" outvalue="3" /> 
<mapping invalue="3" outvalue="4" /> 
<mapping invalue="4" outvalue="5" /> 
<mapping invalue="5" outvalue="6" /> 
<mapping invalue="6" outvalue="7" /> 
<mapping invalue="7" outvalue="8" /> 
<mapping invalue="8" outvalue="9" /> 
<mapping invalue="9" outvalue="10" /> 
<mapping invalue="10" outvalue="11" /> 
</oid> 
</method> 
- <method name="fn_get_level" action="oid"> 
- <oid name="cewEntEnergyLevel" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.10.1001"> 
<mapping invalue="1" outvalue="0" /> 
<mapping invalue="2" outvalue="1" /> 
<mapping invalue="3" outvalue="2" /> 
<mapping invalue="4" outvalue="3" /> 
<mapping invalue="5" outvalue="4" /> 
<mapping invalue="6" outvalue="5" /> 
<mapping invalue="7" outvalue="6" /> 
<mapping invalue="8" outvalue="7" /> 
<mapping invalue="9" outvalue="8" /> 
<mapping invalue="10" outvalue="9" /> 
<mapping invalue="11" outvalue="10" /> 
</oid> 
</method> 
- <method name="fn_get_usageCaliber" action="oid"> 
<oid name="cewEntEnergyUsageCaliber" action="get" value="1.3.6.1.4.1.9.9.683.1.6.1.9.1001" 
/> 
</method> 
- <method name="fn_get_entityCategory" action="cache"> 
<description>Let the switch return cache the consumer category for this 
device.</description> 
</method> 
- <method name="fn_get_deviceType" action="constant"> 
<constant type="string" value="Printer" /> 
</method> 
</interface> 
</CiscoEnergyWise>