Hc_gateway_port_info

Команда предназначена для просмотра информации по определенным портам шлюзов.

Аналог команды в CoCon:

/gateway/port/info

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/gateway_port_info

Код HTTP-ответа:

  • 200 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-файла запроса/ответа:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="gatewayType">
        <xs:attribute name="domain" type="xs:string" use="required"/>
        <xs:attribute  name="name" type="xs:string" use="required"/>
        <xs:attribute  name="port" type="xs:string" use="optional"/>
    </xs:complexType>
    <xs:complexType name="gatewayOutType">
        <xs:sequence>
            <xs:element name="property" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="value" type="xs:string" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="port" type="xs:string" use="optional"/>
    </xs:complexType>
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="gateway" type="gatewayType" minOccurs="0" maxOccurs="1"/>
            </xs:all>
        </xs:complexType>
    </xs:element>
    <xs:element name="out">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="gateway" type="gatewayOutType" minOccurs="0" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример 1:

Запрос: http://192.168.23.34:9999/commands/gateway_port_info

<?xml version="1.0" encoding="UTF-8" ?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="gateway_port_info.xsd">
    <gateway domain="p.city" name="gw3" port="p/3" />
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="gateway_port_info.xsd">
    <gateway name="gw3" port="p/3">
        <property name="key1" value="val1"/>
        <property name="key2" value="val2"/>
    </gateway>
</out>
CODE

Пример 2:

Запрос: http://192.168.23.34:9999/commands/gateway_port_info

<?xml version="1.0" encoding="UTF-8" ?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="gateway_port_info.xsd" >
    <gateway domain="p.city" />
</in>
CODE

Ответ:

<?xml version="1.0"?>
<out xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="gateway_port_info.xsd">
    <gateway name="gw1" port="p/9@sorm_megaco"/>
    <gateway name="gw1" port="p/14@sorm_megaco"/>
    <gateway name="gw1" port="p/13@sorm_megaco"/>
    <gateway name="gw3" port="p/4">
        <property name="key1" value="val1"/>
        <property name="key2" value="val2"/>
    </gateway>
    <gateway name="gw1" port="p/4@sorm_megaco"/>
    <gateway name="gw3" port="p/2"/>
    <gateway name="gw1" port="p/8@sorm_megaco"/>
    <gateway name="gw1" port="p/2@sorm_megaco"/>
    <gateway name="gw1" port="p/15@sorm_megaco"/>
    <gateway name="gw1" port="p/16@sorm_megaco"/>
    <gateway name="gw1" port="p/12@sorm_megaco"/>
    <gateway name="gw1" port="p/11@sorm_megaco"/>
    <gateway name="gw1" port="p/7@sorm_megaco"/>
    <gateway name="gw1" port="p/1@sorm_megaco"/>
    <gateway name="gw1" port="p/5@sorm_megaco"/>
    <gateway name="gw1" port="p/3@sorm_megaco"/>
    <gateway name="gw3" port="p/3">
        <property name="key1" value="val1"/>
        <property name="key2" value="val2"/>
    </gateway>
    <gateway name="gw1" port="p/10@sorm_megaco"/>
    <gateway name="gw1" port="p/6@sorm_megaco"/>
    <gateway name="gw1" port="p/0@sorm_megaco"/>
</out>
CODE

Hc_ gateway_port_set

Команда предназначена для установки свойств портов шлюзов.

Аналог команды в CoCon:

/gateway/port/set

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/gateway_port_set

Код HTTP-ответа:

  • 201 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-файла запроса/ответа:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="gatewayType">
        <xs:sequence>
            <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="value" type="xs:string" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="domain" type="xs:string" use="required"/>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="port" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:element name="in">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="gateway" type="gatewayType" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример:

Запрос: http://192.168.23.34:9999/commands/gateway_port_set

<?xml version="1.0" encoding="UTF-8" ?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="gateway_port_set.xsd">
    <gateway domain="p.city" name="gw2" port="p/1">
        <property name="k1" value="12223" />
        <property name="k2" value="[1, 4, 3]" />
    </gateway>
</in>
CODE

Hc_ gateway_port_clean

Команда предназначена для удаления свойств портов шлюзов.

Аналог команды в CoCon:

/gateway/port/clean

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/commands/gateway_port_clean

Код HTTP-ответа:

  • 204 – в случае успеха;
  • 404 – в случае ошибки.

XSD-схема XML-файла запроса/ответа:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="gatewayType">
        <xs:sequence>
            <xs:element name="property" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="domain" type="xs:string" use="required"/>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="port" type="xs:string" use="required"/>
    </xs:complexType>
    <xs:element name="in">
        <xs:complexType>
            <xs:all>
                <xs:element name="gateway" type="gatewayType" minOccurs="1" />
            </xs:all>
        </xs:complexType>
    </xs:element>
</xs:schema>
CODE

Пример:

Запрос: http://192.168.23.34:9999/commands/gateway_port_clean

<?xml version="1.0" encoding="UTF-8" ?>
<in xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="../priv/xsd/gateway_port_clean.xsd">
    <gateway domain="p.city" name="gw2" port="p/1">
        <property name="k1"/>
    </gateway>
</in>
CODE