# RPC disconnect-node

This RPC closes connection to a device. If a node is associated with multiple transactions, it will be removed from all of them.

The disconnect-node RPC also supports disconnecting stream nodes.

# RPC parameters

  • node-id (mandatory) - ID of a node. In case of a stream node, the node consists of a device node and a stream name (<device node>_<stream name>, for example R1_NETCONF).

# UniConfig shell

The disconnect-node RPC is also included in UniConfig shell. As it takes node-id as input, the shell only suggests nodes that are relevant to this RPC (nodes that are already connected).

# RPC examples

For all examples, assume that the install RPC request included the following parameters:

{
    "input": {
        "nodes": [
            {
                "node-id": "R1",
                "netconf": {
                    "...":  "...",
                    "stream": [
                        {
                            "stream-name": "NETCONF"
                        }
                    ]
                }
            }
        ]
    }
}

# Successful example - Request for a device node

RPC Request
curl --location --request POST 'http://localhost:8181/rests/operations/connection-manager:disconnect-node' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Cookie: Cookie_1=value' \
--data-raw '{
    "input": {
        "node-id": "R1"
    }
}'
RPC Response, Status: 200

# Successful example - Request for a stream node

RPC Request
curl --location --request POST 'http://localhost:8181/rests/operations/connection-manager:disconnect-node' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Cookie: Cookie_1=value' \
--data-raw '{
    "input": {
        "node-id": "R1_NETCONF"
    }
}'
RPC Response, Status: 200

# Failed example - Node not connected

The specified node is not connected or does not exist in the database.

RPC Response, Status: 502
{
    "errors": {
        "error": [
            {
                "error-tag": "southbound-no-connection",
                "error-type": "application",
                "error-message": "Node vnf20_NETCONF isn't connected"
            }
        ]
    }
}

# Failed example - Node does not exist

{
    "errors": {
        "error": [
            {
                "error-tag": "data-missing",
                "error-type": "application",
                "error-message": "Node R1 doesn't exist in database"
            }
        ]
    }
}