Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Forwarding Notifications to the Management Server and Other Network Devices

    When the regional server interacts with the remote device, the regional server sends webhooks—HTTP or HTTPS messages that trigger actions on a receiving device—to notify the management server of the interaction. The management server may use the webhook to trigger another activity.

    When you add a new remote device to the network, you must modify the default webhook to enable forwarding to the management server of notifications between the regional server and the remote device. You can also add extra webhooks to forward these notifications to other network components. Each webhook must have a unique name. Complete this task on the central server.

    This procedure uses the following Activation Service API:
    https://server-IP-address/activation-service-central/activation-info

    Table 1 shows the fields that you must use for this procedure.

    Table 1: Required Fields for Forwarding Notifications

    Field

    Description

    Example

    unique_id

    Unique identifier that the Device Management Service API generates for the device when you specify information about the device. The value is equal to the serial number of the device.

    device-sn-4

    web_hook: name

    Unique name of webhook

    example_web_hook

    web_hook: url

    URL of webhook

    www.example.com/webhook

    web_hook: accept

    Format of file that webhook accepts:

    • application/json—json file
    • application/xml—XML file

    Select one of the preceding formats and use it consistently for all operations.

    application/json

    web_hook: opaque_data

    Description of the webhook in XML format

    <Webhook for example-device at example-customer./>

    web_hook: basic_auth: username

    Username that the regional server uses when it executes this webhook

    user1

    web_hook: basic_auth: password

    Password that the regional server uses when it executes the webhook

    pwd123

    To add a webhook for a device:

    1. Issue a REST call to obtain the specific activation information for the device.

      The API returns the activation information for the device.
      For example:

      user@host:~$ curl -k -i -H "X-AUTH-TOKEN:$OS_TOKEN" https://10.155.90.203/activation-service-central
      /activation-info?filters=unique_id=="device-sn-4"
      {
        "total": 1,
        "activation-info": [
          {
            "href": "https://10.155.90.203/activation-service-central/activation-info/baa84ae8-222d-4cdc-b743-7fc3e4ab66e0",
            "fq_name": [
              "default-domain",
              "default-project",
              "activation-info-device-sn-4"
            ],
            "uuid": "baa84ae8-222d-4cdc-b743-7fc3e4ab66e0"
          }
        ]
      }
      
    2. Issue a REST call to create the webhook that the device uses for initial provisioning.

      The API returns the URL of the webhook and the UUID of the device.
      For example:

      user@host:~$ curl -k HT-H "Content-Type: application/json" -X PUT -d '{"activation-info":{"web_hooks": {"web_hook": [{"name": "test_web_hook","url": "www.example.com/web_hook","accept": "application/json","opaque_data": "<< Webhook for example-device at example-customer./>/>","basic_auth": {"username": "user1","password": "pwd123"}}]}} }' -H "X-AUTH-TOKEN:$OS_TOKEN" https://10.155.90.203/activation-service-central/activation-info/baa84ae8-222d-4cdc-b743-7fc3e4ab66e0

      {
      "activation-info": { "href": "https://10.155.90.203/activation-service-central/activation-info/baa84ae8-222d-4cdc-b743-7fc3e4ab66e0",
      "uuid": "baa84ae8-222d-4cdc-b743-7fc3e4ab66e0"}
      }
      

    The preceding example uses the JSON format. The format for XML is:

    module juniper-bootstrap-server-webhook {
        namespace "https://juniper.net/bootstrap-server";
        prefix "jbswhs";
    
        import ietf-inet-types { prefix inet; }
    
        organization "Juniper Networks, Inc.";
    
        revision "2015-04-09" {
            description "Initial version.";
        }
    
        rpc notification {
            input {
                leaf unique-id {
                    type string;
                    mandatory true;
                    description
                        "The unique identifier (e.g., serial-number) for the
                        device that originated this notification.";
                }
                leaf source-address {
                    type inet:ip-address;
                    description
                        "The source address of the HTTPS connection that sent the
                        notification to the bootstrap-server. If the device was
                        behind a NAT, this value is expected to be the NAT-ed
                        address, not the device’s actual address.";
                }
                leaf notification-type {
                    type string;
                    mandatory true;
                    description
                        "The notification-type value from the device, as enumerated
                        in the southbound YANG API.";
                }
                leaf message {
                    type string;
                    mandatory false;
                    description
                        "Optional human-readable message from device.";
                }
                container ssh-host-keys {
                    presence "Only present for bootstrap-complete messages.";
                    list ssh-host-key {
                        leaf format {
                            type string;
                            mandatory true;
                            description
                                "The format as sent by the device. The values are
                                enumerated in the southbound API's YANG file.";
                        }
                        leaf key-data {
                            type string;
                            mandatory true;
                        }
                    }
                }
                anyxml opaque-data {
                    mandatory false;
                    description
                        "The opaque-data configured for this web-hook on the
                        bootstrap server at the time this web-hook was called.";
                }
            }
        } // end rpc notification
    }
    
    

    Modified: 2016-10-19