nerdexam
CiscoCisco

300-435 · Question #124

300-435 Question #124: Real Exam Question with Answer & Explanation

The complete code block to construct the RESTCONF request is: ``python base_url = "https://10.10.20.40:443/restconf/data/" path_url = "cisco-ios-xe-native:native/vlan" url = base_url + path_url payload = { "Cisco-IOS-XE-vlan:vlan-list": [ { "id": 135, "name": "DATA" }, { "id": 25

Device-Level Network Automation

Question

Drag and Drop Question Drag and drop the code snippets from the bottom onto the boxes in the code to construct a RESTCONF request that creates two access VLANs on a Cisco IOS XE device. Not all options are used.

Explanation

The complete code block to construct the RESTCONF request is:

base_url = "https://10.10.20.40:443/restconf/data/"
path_url = "cisco-ios-xe-native:native/vlan"
url = base_url + path_url
payload = {
    "Cisco-IOS-XE-vlan:vlan-list": [
        {
            "id": 135,
            "name": "DATA"
        },
        {
            "id": 254,
            "name": "MGMT"
        }
    ]
}
headers = {
    'Accept': "application/yang-data+json, application/yang-data.errors+json",
    'Content-Type': "application/yang-data+json",
}
resp = requests.post(url, auth=("admin", "Admin_1234"), headers=headers, data = payload)
print(resp.status_code)

Explanation: payload is used to define the body of the RESTCONF request. This variable holds the VLAN configuration.

Topics

#RESTCONF#YANG data models#VLAN configuration#IOS XE automation

Community Discussion

No community discussion yet for this question.

Full 300-435 PracticeBrowse All 300-435 Questions