OpUtils API - IP地址管理



概述

 

IP地址管理模块(IPAM)的API可以帮助您从OpUtils的数据库中获取IP相关的信息:

操作

 

API为您提供以下操作:

下表列出了这些操作所对应的URL中,使用的操作名称及参数的详细信息:

 

操作名称 操作参数

GET_SUBNET_SUMMARY

subnetAddress

GET_ALL_SUBNETS_SUMMARY

-

GET_SUBNET_DETAILS

subnetAddress

GET_IPADDRESS_DETAILS

ipAddress

GET_IP_RANGE_DETAILS

startAddress, endAddress

 

 

 

GET_SUBNET_SUMMARY

 

输入示例

 

operation

: GET_SUBNET_SUMMARY
key : 60dc9d77-288c-490c-bf38-eae82f8730e0
subnetAddress : 192.168.110.0
format : xml

 

URL格式

 

http://oputils-test:7080/oputilsapi/v1/ipam?operation=GET_SUBNET_SUMMARY&subnetAddress=192.168.110.0&key=60dc9d77-288c-490c-bf38-eae82f8730e0&format=xml

 

 

输出示例 - 成功

 

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>success</status>
    <input>
        <operation>GET_SUBNET_SUMMARY</operation>
        <subnet-address>192.168.110.0</subnet-address>
    </input>
    <output>
        <subnets >
            <subnet>
                <subnet-address>192.168.110.0</subnet-address>
                <subnet-mask>255.255.255.0</subnet-mask>
                <subnet-name>Oputils_test_LAB</subnet-name>
              <subnet-description>My Test Lab</subnet-description>                                 
              <broadcast-address>192.168.110.255</broadcast-address>

                <subnet-size>254</subnet-size>
                <available>100</available>
                <used>100</used>
                <transient>54</transient>
                <not-scanned>0</not-scanned>
                <used-percentage>40</used-percentage>

                <reserved-count>50</reserved-count>
                <reserved-available>20</reserved-available>
                <reserved-used>20</reserved-used>
                <reserved-transient>10</reserved-transient>
                <reserved-not-scanned>40</reserved-not-scanned>

                <ip-in-active-directory>40</ip-in-active-directory>
                <reverse-lookup-failed-count>40</reverse-lookup-failed-count>
                <forward-lookup-failed-count>40</forward-lookup-failed-count>
                <ip-mismatch-count>40</ip-mismatch-count>

                <created-by>admin</created-by>
                <added-time>16 Sep 2011, 06:49 PM</added-time>
                <last-scan-time>16 Sep 2011, 06:49 PM</last-scan-time>
                <vlan-name>test1</vlan-name>
                <location>test2</location>
                <customfield-2>test2</customfield-2>
                <customfield-2>test2</customfield-2>
            </subnet >
        </subnets>
    </output>
</response>

 

输出示例: 失败

 

 <?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>Failure</status>
    <message>The given subnet is not available</message>
    <input>
        <operation>GET_SUBNET_SUMMARY</operation>
        <subnet-address>192.168.110.0</subnet-address>
    </input>
</response>

 

GET_ALL_SUBNETS_SUMMARY

 

输入示例

 

operation                  :           GET_ALL_SUBNETS_SUMMARY
key                        :           60dc9d77-288c-490c-bf38-eae82f8730e0
format                     :           xml
  

URL格式

 

http://oputils-test:7080/oputilsapi/v1/ipam?operation=GET_ALL_SUBNETS_SUMMARY&key=60dc9d77-299c-490c-bf38-eae82f8730e0&format=xml

 

 

输出示例 - 成功

 

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>success</status>
    <input>
        <operation>GET_ALL_SUBNETS_SUMMARY</operation>
    </input>
    <output>
        <subnets >
            
            <subnet>
                <subnet-address>192.168.110.0</subnet-address>
                <subnet-mask>255.255.255.0</subnet-mask>
                <subnet-name>Oputils_test_LAB</subnet-name>
                <subnet-description>My Test Lab<subnet-description> 
             <broadcast-address>192.168.110.255</broadcast-address>

                <subnet-size>254</subnet-size>
                <available>100</available>
                <used>100</used>
                <transient>54</transient>
                <not-scanned>0</not-scanned>
                <used-percentage>40</used-percentage>

                <reserved-count>50</reserved-count>
                <reserved-available>20</reserved-available>
                <reserved-used>20</reserved-used>
                <reserved-transient>10</reserved-transient>
                <reserved-not-scanned>40</reserved-not-scanned>

                <ip-in-active-directory>40</ip-in-active-directory>
                <reverse-lookup-failed-count>40</reverse-lookup-failed-count>
                <forward-lookup-failed-count>40</forward-lookup-failed-count>
                <ip-mismatch-count>40</ip-mismatch-count>

                <created-by>admin</created-by>
                <added-time>16 Sep 2011, 06:49 PM</added-time>
                <last-scan-time>16 Sep 2011, 06:49 PM</last-scan-time>
                <vlan-name>test1</vlan-name>
                <location>test2</location>
                <customfield-2>test2</customfield-2>
                <customfield-2>test2</customfield-2>
            </subnet >

            <subnet>
                <subnet-address>192.168.111.0</subnet-address>
                <subnet-mask>255.255.255.0</subnet-mask>
                <subnet-name>Oputils_test_LAB</subnet-name>
             <subnet-description>My Test Lab<subnet-description>                                 
             <broadcast-address>192.168.110.255</broadcast-address>

                <subnet-size>254</subnet-size>
                <available>100</available>
                <used>100</used>
                <transient>54</transient>
                <not-scanned>0</not-scanned>
                <used-percentage>40</used-percentage>

                <reserved-count>50</reserved-count>
                <reserved-available>20</reserved-available>
                <reserved-used>20</reserved-used>
                <reserved-transient>10</reserved-transient>
                <reserved-not-scanned>40</reserved-not-scanned>

                <ip-in-active-directory>40</ip-in-active-directory>
                <reverse-lookup-failed-count>40</reverse-lookup-failed-count>
                <forward-lookup-failed-count>40</forward-lookup-failed-count>
                <ip-mismatch-count>40</ip-mismatch-count>

                <created-by>admin</created-by>
                <added-time>16 Sep 2011, 06:49 PM</added-time>
                <last-scan-time>16 Sep 2011, 06:49 PM</last-scan-time>
                <vlan-name>test1</vlan-name>
                <location>test2</location>
                <customfield-2>test2</customfield-2>
                <customfield-2>test2</customfield-2>
            </subnet > 
        </subnets>
    </output>
</response>

 

输出示例:失败

 

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>Failure</status>
    <message>No subnets are available </message>
    <input>
        <operation>GET_ALL_SUBNETS_SUMMARY</operation>
    </input>
</response>

 

 

GET_SUBNET_DETAILS

 

输入示例

 

operation              :           GET_SUBNET_DETAILS
key                    :           yNSoZNSiVET0qocKUbZaPQ==
subnetAddress          :           192.168.110.0  
format                 :           xml      

 

URL格式
 http://<hostname>:<Port>/oputilsapi/v1/ipam?operation=GET_SUBNET_DETAILS&subnetAddress=192.168.110.0&key=yNSoZNSiVET0qocKUbZaPQ&format=xml  

 

 

输出示例 - 成功

 

<response>
    <status>success</status>
    <input>
        <operation>GET_SUBNET_DETAILS</operation>
        <subnet-address>192.168.110.0</subnet-address>
    </input>
    <output>
        <ips>
            <ip>
                <ip-address>192.168.110.1</ip-address>
                <mac-address>aa:aa:aa:aa:aa:aa</mac-address>
                <ip-to-dns>karuppannan</ip-to-dns>
                <dns-to-ip>192.168.110.1</dns-to-ip>
                <dns-status>success</dns-status>
                <status>used</status>
                <reserved-status>Not Reserved</reserved-status>
                <device-type>windows</device-type>
                <authenticity>trusted</authenticity>
                <active-directory-name>csez.zohocorp.com</active-directory-name>
 
                <alias-name>test</alias-name>
                <system-name>karuppannan</system-name>
                <system-description>karuppannan</system-description>
                <location>II-EF-24</location>
                <owner>testine</owner>
                <phone-number>7892</phone-number>
                <nic-type>Microsoft</nic-type>

                <connected-switch>catalyst2900</connected-switch>
                <connected-switch-port>117</connected-switch-port>
                <connected-port-ifalias>Fast Ethernet</connected-port-ifalias>
                <connected-port-ifname>Fast Ethernet</connected-port-ifname>
                <connected-port-ifindex>117</connected-port-ifindex>
                <connected-port-speed>1 GBPS</connected-port-speed>
 
                <ip-status-time>21 Oct 2011, 02:41 PM</ip-status-time>
                <ip-alive-time>21 Oct 2011, 02:41 PM</ip-alive-time>
                <last-scan-time>21 Oct 2011, 02:41 PM</last-scan-time>
                <asset-tag>2H5VTQ1</asset-tag>
            </ip>
         <ip>
                <ip-address>192.168.110.2</ip-address>
                <mac-address>aa:aa:aa:aa:aa:ab</mac-address>
                <ip-to-dns>karuppannan</ip-to-dns>
                <dns-to-ip>192.168.110.2</dns-to-ip>
                <dns-status>success</dns-status>
                <status>used</status>
                <reserved-status>Not Reserved</reserved-status>
                <device-type>windows</device-type>
                <authenticity>trusted</authenticity>
                <active-directory-name>csez.zohocorp.com</active-directory-name>
 
                <alias-name>test</alias-name>
                <system-name>oputils</system-name>
                <system-description>oputils</system-description>
                <location>II-EF-24</location>
                <owner>testine</owner>
                <phone-number>7892</phone-number>
                <nic-type>Microsoft</nic-type>

                <connected-switch>catalyst2900</connected-switch>
                <connected-switch-port>117</connected-switch-port>
                <connected-port-ifalias>Fast Ethernet</connected-port-ifalias>
                <connected-port-ifname>Fast Ethernet</connected-port-ifname>
                <connected-port-ifindex>117</connected-port-ifindex>
                <connected-port-speed>1 GBPS</connected-port-speed>
 
                <ip-status-time>21 Oct 2011, 02:41 PM</ip-status-time>
                <ip-alive-time>21 Oct 2011, 02:41 PM</ip-alive-time>
                <last-scan-time>21 Oct 2011, 02:41 PM</last-scan-time>
                <asset-tag>2H5VTQ1</asset-tag>
            </ip >
        </ips>
    </output>
</response>

 

输出示例:失败

 

<response>
    <status>Failure</status>
    <message>The given subnet is not available</message>
    <input>
        <operation>GET_SUBNET_DETAIL</operation>
        <subnetAddress>192.168.110.0</subnetAddress>
    </input>
</response>

 

 

 

GET_IPADDRESS_DETAILS

 

 

输入示例

 

operation             :           GET_IPADDRESS_DETAILS
key                   :           yNSoZNSiVET0qocKUbZaPQ==
subnetAddress         :           192.168.110.0  
format                :           xml

URL格式
 http://<hostname>:<Port>/oputilsapi/v1/ipam?operation=GET_IPADDRESS_DETAILS&ipAddress=192.168.110.1&key=yNSoZNSiVET0qocKUbZaPQ&format=xml

 

 

输出示例 - 成功

 

<response>
    <status>success</status>
    <input>
        <operation>GET_IPADDRESS_DETAILS</operation>
        <ip-address>192.168.110.0</ip-address>
    </input>
    <output>
          <ips> 
         <ip>
                <ip-address>192.168.110.1</ip-address>
                <mac-address>aa:aa:aa:aa:aa:aa</mac-address>
                <ip-to-dns>karuppannan</ip-to-dns>
                <dns-to-ip>192.168.110.1</dns-to-ip>
                <dns-status>success</dns-status>
                <status>used</status>
                <reserved-status>Not Reserved</reserved-status>
                <device-type>windows</device-type>
                <Authenticity>trusted</Authenticity>
                <active-directory-name>csez.zohocorp.com</active-directory-name> 
                <alias-name>test</alias-name>
                <system-name>karuppannan</system-name>
                <system-description>karuppannan</system-description>
                <location>II-EF-24</location>
                <owner>testine</owner>
                <phone-number>7892</phone-number>
                <nic-type>Microsoft</nic-type>
                <connected-switch>catalyst2900</connected-switch>
                <connected-switch-port>117</connected-switch-port>
                <connected-port-ifalias>Fast Ethernet</connected-port-ifalias>
                <connected-port-ifname>Fast Ethernet</connected-port-ifname>
                <connected-port-ifindex>117</connected-port-ifindex>
                <connected-port-speed>1 GBPS</connected-port-speed> 
                <ip-status-time>21 Oct 2011, 02:41 PM</ip-status-time>
                <ip-alive-time>21 Oct 2011, 02:41 PM</ip-alive-time>
                <last-scan-time>21 Oct 2011, 02:41 PM</last-scan-time>
                <asset-tag>2H5VTQ1</asset-tag>
            </ip>
     <ips> 
</output> 
</response> 

 

输出示例:失败

 

<response>
    <status>Failure</status>
    <message>The given IP is not available</message>
    <input>
        <operation>GET_IPADDRESS_DETAILS</operation>
        <ip-address>192.168.110.1</ip-address>
    </input>
</response>

 

 

 

GET_IP_RANGE_DETAILS

 

 

输入示例

 

operation          :  GET_IP_RANGE_DETAILS
Authkey            :  yNSoZNSiVET0qocKUbZaPQ==
startAddress     :  192.168.110.1  
endAddress     :  192.168.110.2 

URL格式
 http://<hostname>:<Port>/oputilsapi/v1/ipam?operation=GET_IP_RANGE_DETAILS&startAddress=192.168.110.1&endAddress=192.168.110.2&key=yNSoZNSiVET0qocKUbZaPQ&format=xml

 

 

输出示例 - 成功

 

<response>
    <status>success</status>
    <input>
        <operation>GET_IP_RANGE_DETAILS</operation>
        <startAddress>192.168.110.1</startAddress>
        <endAddress>192.168.110.2</endAddress>
    </input>
    <output>
        <ips>
            <ip>
                <ipaddress>192.168.110.1</ipaddress>
                <mac-address>aa:aa:aa:aa:aa:aa</mac-address>
                <ip-to-dns>karuppannan</ip-to-dns>
                <dns-to-ip>192.168.110.1</dns-to-ip>
                <dns-status>success</dns-status>
                <status>used</status>
                <reserved-status>Not Reserved</reserved-status>
                <device-type>windows</device-type>
                <Authenticity>trusted</Authenticity>
                <active-directory-name>csez.zohocorp.com</active-directory-name>
 
                <alias-name>test</alias-name>
                <system-name>karuppannan</system-name>
                <system-description>karuppannan</system-description>
                <location>II-EF-24</location>
                <owner>testine</owner>
                <phone-number>7892</phone-number>
                <nic-type>Microsoft</nic-type>

                <connected-switch>catalyst2900</connected-switch>
                <connected-switch-port>117</connected-switch-port>
                <connected-port-ifalias>Fast Ethernet</connected-port-ifalias>
                <connected-port-ifname>Fast Ethernet</connected-port-ifname>
                <connected-port-ifindex>117</connected-port-ifindex>
                <connected-port-speed>1 GBPS</connected-port-speed>
 
                <ip-status-time>21 Oct 2011, 02:41 PM</ip-status-time>
                <ip-alive-time>21 Oct 2011, 02:41 PM</ip-alive-time>
                <last-scan-time>21 Oct 2011, 02:41 PM</last-scan-time>
                <asset-tag>2H5VTQ1</asset-tag>
            </ip>
         <ip>
                <ipaddress>192.168.110.2</ipaddress>
                <mac-address>aa:aa:aa:aa:aa:ab</mac-address>
                <ip-to-dns>karuppannan</ip-to-dns>
                <dns-to-ip>192.168.110.2</dns-to-ip>
                <dns-status>success</dns-status>
                <status>used</status>
                <reserved-status>Not Reserved</reserved-status>
                <device-type>windows</device-type>
                <Authenticity>trusted</Authenticity>
                <active-directory-name>csez.zohocorp.com</active-directory-name>
 
                <alias-name>test</alias-name>
                <system-name>oputils</system-name>
                <system-description>oputils</system-description>
                <location>II-EF-24</location>
                <owner>testine</owner>
                <phone-number>7892</phone-number>
                <nic-type>Microsoft</nic-type>

                <connected-switch>catalyst2900</connected-switch>
                <connected-switch-port>117</connected-switch-port>
                <connected-port-ifalias>Fast Ethernet</connected-port-ifalias>
                <connected-port-ifname>Fast Ethernet</connected-port-ifname>
                <connected-port-ifindex>117</connected-port-ifindex>
                <connected-port-speed>1 GBPS</connected-port-speed>
 
                <ip-status-time>21 Oct 2011, 02:41 PM</ip-status-time>
                <ip-alive-time>21 Oct 2011, 02:41 PM</ip-alive-time>
                <last-scan-time>21 Oct 2011, 02:41 PM</last-scan-time>
                <asset-tag>2H5VTQ1</asset-tag>
            </ip>
        </ips>
    </output>
</response>

 

输出示例:失败

 

<response>
    <status>Failure</status>
    <message>The given IP range is not available</message>
    <input>
        <operation>GET_IP_RANGE_DETAILS</operation>
        <startAddress>192.168.110.1</startAddress>
        <endAddress>192.168.110.2</endAddress>
    </input>
</response>

 

 

 

Copyright © 2004-2012, ZOHO Corp. All Rights Reserved.
ManageEngine