Skip to content

RESTCONF DELETE¤

Use restconf_delete to delete configuration from selected network devices through RESTCONF. It sends an HTTP DELETE request to the specified resource path, allowing you to remove configuration such as interfaces or individual settings supported by the device's YANG models.

Output¤

Each host's reply appears under delete. JSON responses become structured data; other responses remain text. Successful operations may return an empty string. Connection and device errors mark hosts failed. add_details=True includes execution details; to_dict=False returns list records.

Examples¤

The example deletes Loopback100. Paths and payload fields must match the device's supported YANG models.

nf# nornir restconf delete FL ceos-spine-1 url openconfig-interfaces:interfaces/interface=Loopback100
result = client.run_job(
    "nornir",
    "restconf_delete",
    workers="nornir-worker-1",
    kwargs={
        "FL": ["ceos-spine-1"],
        "url": "openconfig-interfaces:interfaces/interface=Loopback100",
    },
)

Replace the address and token with those of your FastAPI service.

Python requests

import requests

response = requests.post(
    "http://localhost:8000/api/nornir/restconf_delete/",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
    json={
        "workers": "nornir-worker-1",
        "FL": ["ceos-spine-1"],
        "url": "openconfig-interfaces:interfaces/interface=Loopback100",
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())

curl

curl -X POST 'http://localhost:8000/api/nornir/restconf_delete/' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
  "workers": "nornir-worker-1",
  "FL": [
    "ceos-spine-1"
  ],
  "url": "openconfig-interfaces:interfaces/interface=Loopback100"
}'
Use the NorFab Nornir RESTCONF delete tool to remove Loopback100 from ceos-spine-1.
Report whether the operation succeeded.

Notes¤

Configure the device endpoint, credentials, TLS verification, HTTP timeout and default headers in HTTP inventory. Relative resource paths use its RESTCONF base URL. Use params for query parameters and headers when a request needs different headers; supplied headers replace the inventory mapping.

The CLI timeout controls waiting for the NorFab job. Device requests use the configured Nornir runner, including its retry settings. Review those settings before configuration changes.

Task Command Shell Reference¤

nf# man tree nornir.restconf.delete

Python API Reference¤

Delete a RESTCONF resource.

Parameters:

Name Type Description Default
job Job

NorFab job metadata.

required
url str

Literal resource relative to inventory base_url, or absolute URL.

None
params dict[str, Any]

HTTP query parameters.

None
headers dict[str, str]

HTTP headers replacing inventory headers when supplied.

None
**kwargs Any

Common Nornir host filters, processors, runner and result options.

{}

Returns:

Name Type Description
Result Result

Per-host response payloads keyed by the HTTP verb, or list records. HTTP failures remain failed host results; no_match means no selected hosts.

Source code in norfab\workers\nornir_worker\restconf_task.py
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
@Task(
    input=RestconfDeleteInput,
    output=NornirSerializedResult,
    fastapi={"methods": ["POST"]},
    mcp={
        "annotations": {
            "title": "RESTCONF Delete",
            "readOnlyHint": False,
            "destructiveHint": True,
            "idempotentHint": True,
            "openWorldHint": True,
        }
    },
)
def restconf_delete(
    self,
    job: Job,
    url: str = None,
    params: dict[str, Any] = None,
    headers: dict[str, str] = None,
    **kwargs: Any,
) -> Result:
    """Delete a RESTCONF resource.

    Args:
        job: NorFab job metadata.
        url: Literal resource relative to inventory base_url, or absolute URL.
        params: HTTP query parameters.
        headers: HTTP headers replacing inventory headers when supplied.
        **kwargs: Common Nornir host filters, processors, runner and result options.

    Returns:
        Result: Per-host response payloads keyed by the HTTP verb, or list records.
            HTTP failures remain failed host results; no_match means no selected hosts.
    """
    return self._run_restconf(
        job, "delete", url=url, params=params, headers=headers, **kwargs
    )