The dummy handler allows you to add a virtual power distribution unit (PDU) to the platform. Using a virtual device can be useful for testing the platform.

Features of work


Handler capabilities:

  • creating a PDU with the required number of ports;
  • port polling;
  • enabling and disabling ports;
  • collection of power consumption statistics — random values are generated for statistics.

Handler features:

  • when periodically polling the device, the status of the manually disabled ports changes to "On";
  • adding a PDU and editing its parameters is available only through the API.

Adding the handler into the platform


  1. Download the archive with the handler from the ISPsystem repository. For more information about the structure of the handler, see the article Creating a PDU handler.

  2. Log in to DCImanager 6 with administrator permissions:

    curl -o- -k https://domain.com/api/auth/v4/public/token \
        -H "isp-box-instance: true" \
        -d '{
            "email": "<admin_email>",
            "password": "<admin_pass>"
        }'
    
    BASH

    domain.com — domain name of the server with DCImanager 6

    <admin_email> — email of the DCImanager 6 administrator

    <admin_pass> — password of the DCImanager 6 administrator

    A response message in the format below will be received:

    {"id":"24","token":"24-cee181d2-ccaa-4b64-a229-234aa7a25db6"}
    YML

     Save the value of the token parameter from the received response.

  3. Create a description for the handler:

    curl -o- -k https://domain.com/api/eservice/v3/custom_equipment \
        -H "isp-box-instance: true" \
        -H "x-xsrf-token: <token>" \
        -d '{
            "device_type": "pdu",
            "handler": "<internal_handler_name>",
            "name": "<handler_name>",
            "protocol": ["custom"],
            "features": []
        }'
    BASH

    domain.com — domain name of the server with DCImanager 6

    <token> — authorization token

    <internal_handler_name> — unique internal name of the handler. For example, "dummy_pdu"

    <handler_name> — the name of the handler to be displayed in the platform interface. For example, "Dummy PDU"

    The response will contain the id of the created handler. Save this value.

    Example of reply

    {"id": 1}
    CODE
  4. Upload the archive with the handler into the platform:

    curl -o- -k https://domain.com/api/eservice/v3/custom_equipment/<handler_id>/content \
        -H "isp-box-instance: true" \
        -H "x-xsrf-token: <token>" \
        -F "data=@dummy_pdu_handler.tar.gz" \
        -F "handler_import=dummy_handler.dummy_pdu"
    BASH

    domain.com — domain name of the server with DCImanager 6

    <handler_id> — handler id

    <token> — authorization token

    dummy_pdu_handler.tar.gz — handler archive name

  5. Add a virtual PDU using the uploaded handler:

    curl -o- -k https://domain.com/api/dci/v3/pdu \
        -H "isp-box-instance: true" \
        -H "x-xsrf-token: <token>" \
        -d '{
             "device":"<internal_handler_name>",
             "ip":"<ip_address>",
             "name":"<pdu_name>",
             "note":"<comments>",
             "rack":<rack_id>,
             "size":<device_size>,
             "unit":<unit_id>,
             "custom_params": {
                               "port_count":<port_number>,
                               "port_name_template":"<port_template>"
                              }
        }'
    BASH

    domain.com — domain name of the server with DCImanager 6

    <token> — authorization token

    <internal_handler_name> — internal handler name

    <ip_address> — discretionary IP address

    <pdu_name> — virtual PDU name

    <comments> — discretionary comment

    <rack_id> — id of the rack where the PDU will be placed

    <device_size> — number of units occupied by the PDU in the rack

    <unit_id> — id of the first unit occupied by the unit

    <port_number> — number of PDU ports

    <port_template> — port name template. For example, if you specify "Port #{id}", the ports of the device will be named Port #1, Port #2, etc. Optional parameter. The default value is "Port {id}"

    You can add a virtual PDU through the platform interface. For more information, see the Adding a PDU article. When adding:

    1. In the Handler field, select the internal name of the handler.
    2. Specify an arbitrary IP address for the PDU.
    3. In the Handler settings section:
      1. Specify the port_count Key and a Value equal to the number of PDU ports.
      2. To specify a port name template:
        1. Click the Add settings button.
        2. Specify the port_name_template Key and the Value that corresponds to the port name template. For example, if you specify "Port #{id}", the ports of the device will be named Port #1, Port #2, etc. Optional parameter. The default value is "Port {id}"