nerdexam
Cisco

300-635 · Question #62

Refer to the exhibit above and click on the resource tabs in the top left corner to view resources to help with this question. An engineer is creating a Python script to update the firmware on a…

The correct answer is B. ``` "https://www.intersight.com/api/v1/" + "compute/RackUnits?$select=DeviceMoid,Model,AssetTag" + "$filter=AssetTag eq 'DMZ-R-L2-ADJM'" ```. Note: This question asks for two answers - a GET request URL and a dictionary update. Only one correct answer (B) is listed here, so the second answer (most likely C) appears to be omitted from what you've shared. Why B is correct (GET request): Option B properly constructs the…

Cisco Intersight

Question

Refer to the exhibit above and click on the resource tabs in the top left corner to view resources to help with this question. An engineer is creating a Python script to update the firmware on a specific Cisco UCS Rack server that is managed by Cisco Intersight. The script uses the Cisco Intersight REST API. The value of the 'resource_path' key in the rackunitJson_body Python dictionary retrieves the server with the AssetTag DMZ-R-L2- ADJM. The AssetTag is assigned to only one server. The value of the 'Server' key must be set in the firm ware_json_body Python dictionary with a value from the query result. Which two Python statements, a GET request and a dictionary update, are required to complete the code? (Choose two.)
# Intersight
# Query for RackUnit
rackunit_json_body = {
 "Query": {
 "ResourceType": "GET",
 "resource_path": ""
 }
}
Query Results
"ObjectType": "compute.RackUnit.List",
"Results": [
 {
 "AssetTag": "DMZ-R-L2-ADJM",
 "ClassId": "compute.RackUnit",
 "CreateTime": "2022-04-26T20:43:00.432Z",
 "Model": "CSC-C220-M4SX",
 "ObjectType": "compute.RackUnit"
 }
]
firmware_json_body = {
 "request_method": "POST",
 "request_body": {
 "Firmware_Upload": {},
 "NetworkShare": {
 "Mapping": "/fws",
 "UpdExemption": "no_upgrade_full",
 "HttpServer": {
 }
 }
 },
 "UpgradeType": "network_upgrade",
 "Server": ""
}

RESPONSE = requests.request(
 method=firmware_json_body['request_method'],
 url=rackunit_json_body['resource_path'],
 auth=auth
)


RESPONSE = requests.request(
 method=firmware_json_body['request_method'],
 url=firmware_json_body['resource_path'],
 json=json.loads(firmware_json_body['request_body']),
 auth=auth
)

Options

  • A
    "https://www.intersight.com/api/v1/" +
    "compute/RackUnits?$select=DeviceMoid,Model,AssetTag&" +
    "$filter=AssetTag eq 'DMZ-R-L2-ADJM'
    
  • B
    "https://www.intersight.com/api/v1/" +
    "compute/RackUnits?$select=DeviceMoid,Model,AssetTag" +
    "$filter=AssetTag eq 'DMZ-R-L2-ADJM'"
    
  • C
    firmware_json_body['request_body']['Server'] = (
     json.loads(RESPONSE.text)['Results'][0]['DeviceMoid']
    )
    
  • D
    firmware_json_body['request_body']['Server'] = (
     json.loads(RESPONSE.text)['Results'][0]['AssetTag']
    )
    
  • E
    firmware_json_body['Server'] = (
     json.loads(RESPONSE.text)['Results'][0]['Server']
    )
    

How the community answered

(24 responses)
  • A
    8% (2)
  • B
    79% (19)
  • D
    4% (1)
  • E
    8% (2)

Explanation

Note: This question asks for two answers - a GET request URL and a dictionary update. Only one correct answer (B) is listed here, so the second answer (most likely C) appears to be omitted from what you've shared.

Why B is correct (GET request): Option B properly constructs the Intersight REST API URL using OData query parameters - $select to specify which fields to return (including DeviceMoid, Model, and AssetTag) and $filter to narrow results to the server with AssetTag eq 'DMZ-R-L2-ADJM', which is the required syntax for filtering Intersight API queries.

Why A is wrong: A appears structurally similar but has an unclosed string literal on the final line (missing closing "), making it a Python syntax error that would crash before the request is ever made.

Why C is the likely second correct answer: The firmware body's Server key needs to be populated with the server's DeviceMoid (the Managed Object ID - Intersight's unique object reference), retrieved via json.loads(RESPONSE.text)['Results'][0]['DeviceMoid'].

Why D and E are wrong: D incorrectly uses AssetTag as the server reference - the Intersight API expects an MoRef (object reference), not a human-readable tag. E uses the correct key path (firmware_json_body['Server']), but looks for a nonexistent 'Server' key in the API response rather than 'DeviceMoid'.

Memory tip: Think DeviceMoid = Database ID for Intersight objects - any cross-reference between resources (like linking a server to a firmware job) always uses DeviceMoid, not display fields like AssetTag or Model.

Topics

#Intersight REST API#OData Query Syntax#JSON Parsing#UCS Server Management

Community Discussion

No community discussion yet for this question.

Full 300-635 Practice