nerdexam
Cisco

300-435 · Question #152

Refer to the exhibit. A Cisco Catalyst SD-WAN Fabric Policy must be created in a non-production environment. To implement this, a Python script that pulls the existing policy and updates the…

The correct answer is A. response = requests.request( "PUT", url, headers=headers, data=json.dumps(policy), verify=False ) if response.ok. Updating an existing SD-WAN Fabric Policy requires a PUT request with SSL verification disabled (verify=False) for a non-production environment script.

Controller-Based Network Automation

Question

Refer to the exhibit. A Cisco Catalyst SD-WAN Fabric Policy must be created in a non-production environment. To implement this, a Python script that pulls the existing policy and updates the preferred route to be over MPLS must be run during the Scripting window. Which code snippet must be added to the box in the code to complete the Python script? The initial part of the Python script is not shown.

Exhibit

300-435 question #152 exhibit

Options

  • Aresponse = requests.request( "PUT", url, headers=headers, data=json.dumps(policy), verify=False ) if response.ok:
  • Bresponse = requests.request( "POST", url, headers=headers, data=json.dumps(policy), verify=False ) if response.ok:
  • Cresponse = requests.request( "POST", url, headers=headers, data=json.dumps(policy), verify=True ) if response.ok:
  • Dresponse = requests.request( "PUT", url, headers=headers, data=json.dumps(policy), verify=True ) if response.ok:

How the community answered

(38 responses)
  • A
    79% (30)
  • B
    13% (5)
  • C
    3% (1)
  • D
    5% (2)

Why each option

Updating an existing SD-WAN Fabric Policy requires a PUT request with SSL verification disabled (verify=False) for a non-production environment script.

Aresponse = requests.request( "PUT", url, headers=headers, data=json.dumps(policy), verify=False ) if response.ok:Correct

PUT is the correct HTTP method for updating an existing resource - in this case modifying an existing policy to change the preferred route to MPLS. verify=False is appropriate in non-production environments where self-signed certificates may be in use. Using POST would attempt to create a new policy rather than update the existing one.

Bresponse = requests.request( "POST", url, headers=headers, data=json.dumps(policy), verify=False ) if response.ok:

POST is used to create a new resource, not to update an existing one - using POST here would attempt to create a duplicate policy rather than modifying the preferred route.

Cresponse = requests.request( "POST", url, headers=headers, data=json.dumps(policy), verify=True ) if response.ok:

POST is incorrect for updating an existing policy, and verify=True would fail in non-production environments using self-signed certificates.

Dresponse = requests.request( "PUT", url, headers=headers, data=json.dumps(policy), verify=True ) if response.ok:

PUT is correct but verify=True would cause SSL verification failures against self-signed certificates in a non-production vManage environment.

Concept tested: SD-WAN vManage API PUT method for policy update

Source: https://developer.cisco.com/docs/sdwan/

Topics

#REST API#Python requests library#SD-WAN Automation#HTTP Methods

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice