QuestionQ247

Cisco Platforms and Development

Question Image

Refer to the exhibit. Create a new loopback34 on a Cisco IOS XE router with IP address 10.34.1.2/24. Drag the code options into the missing boxes to complete the Python script that configures the interface IP address according to the ietf-interfaces YANG data model. Not all options are used.

Drag & Drop
loopback
interface
ietf-interfaces
ipv4
address
netmask
subnet
int_url = f'https://router01.dev.net/restconf/data/ietf-interfaces:interfaces/'
data = json.dumps({
    "" : { "" : [{
        "name": "Loopback34",
        "type": "iana-if-type:softwareLoopback",
        "ietf-ip:ipv4": {
            "" : [{'ip': '10.34.1.2',
                              "" : '255.255.255.0'}]
        }}}]})
response = requests.post(
    int_url, headers=restconf_headers, data=data, auth=(username,password))
Explanation

The RESTCONF JSON payload for creating a loopback follows the ietf-interfaces/ietf-ip YANG structure exactly: the top key is the module-qualified 'ietf-interfaces:interface', which contains 'name' and 'type', then the 'ietf-ip:ipv4' container, whose 'address' list holds each entry's 'ip' and 'netmask' leaves. So the four missing tokens are ietf-interfaces (module), interface (list), address (the ipv4 address list), and netmask (the mask leaf, matching the /24). 'ietf-ip:ipv4' is pre-printed in the scaffold, so 'ipv4' is a distractor; 'subnet' is the YANG choice-node name (not the JSON key used, which is 'netmask') and 'loopback' is only the interface name value, so both are unused. The blind solver's 'ipv4' for the third box double-fills a key that is already present in the script.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!