Why does the python...
 
Notifications
Clear all

Why does the python code for Cisco NX-API print an error message?

1 Posts
1 Users
0 Likes
69 Views
(@hevesywilber)
Posts: 682
Noble Member
Topic starter
 

Refer to the exhibit.

Why does the python code for Cisco NX-API print an error message?

  • A . The “type” is wrong in the header of the request and should be “cli_ conf”.
    B. NX-API does not allow configuration for features via the requests module.
    C. The “type” is wrong is the body of the request and should be “cli_ conf”.
    D. The JSON is not a supported format for the NX-API.

Show Answer Hide Answer

Suggested Answer: C

Explanation:

"Commands that belong to different message types should not be mixed. For example, show commands are cli_show message type and are not supported in cli_conf mode."

https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus7000/sw/programmability/guide/cisco_nexus7000_programmability_guide_8x/b-cisco-nexus7000-programmability-guide-8x_chapter_011.html

the payload "type" value is wrong in the body of the request.

For the request to be successful, it should be changes to "cli_conf".

For example, if we run the same request with the updated payload:

{

"ins_api": {

"version": "1.0",

"type": "cli_conf",

"chunk": "0",

"sid": "1",

"input": "configure terminal ;feature hsrp",

"output_format": "json"

}

}

We get a 200 response:

{

"ins_api": {

"sid": "eoc",

"type": "cli_conf",

"version": "1.0",

"outputs": {

"output": [

{

"code": "200",

"msg": "Success",

"body": {}

},

{

"code": "200",

"msg": "Success",

"body": {}

}

]

}

}

}

CLI verification:

nxos9kv# sh run | inc hsrp

feature hsrp
 
Posted : 23/11/2022 1:43 am

Latest Cisco 350-601 Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: