[Arguments] ${controller_ip} ${num_cars} ${timeout}=60s
${resp} InitCar ${controller_ip} ${PORT}
Should Be Equal As Strings ${resp.status_code} 204
- ${resp} AddCar ${controller_ip} ${RESTCONFPORT} ${num_cars}
+ ${resp} AddCar ${controller_ip} ${RESTCONFPORT} ${num_cars} 204
Should Be Equal As Strings ${resp.status_code} 204
Wait Until Keyword Succeeds ${timeout} 2s Get Cars And Verify ${controller_ip} ${num_cars}
Add Cars And Verify Without Init
[Documentation] Adds cars to an initialized cars shard then performs a GET as a check.
[Arguments] ${controller_ip} ${num_cars} ${timeout}=60s
- ${resp} AddCar ${controller_ip} ${RESTCONFPORT} ${num_cars}
+ Comment First car add may return 409, but subsequent should be 204
+ ${resp} AddCar ${controller_ip} ${RESTCONFPORT} ${num_cars} 204 409
Should Be Equal As Strings ${resp.status_code} 204
Wait Until Keyword Succeeds ${timeout} 2s Get Cars And Verify ${controller_ip} ${num_cars}
[Documentation] Note: The first AddPerson call passed with 0 posts directly to the data store to get
[Documentation] the people container created so the subsequent AddPerson RPC calls that put
[Documentation] to the person list will succeed.
- ${resp} AddPerson ${controller_ip} ${RESTCONFPORT} ${0}
+ ${resp} AddPerson ${controller_ip} ${RESTCONFPORT} ${0} 204
Should Be Equal As Strings ${resp.status_code} 204
Wait Until Keyword Succeeds 60s 2s Get One Person And Verify ${controller_ip} ${0}
- ${resp} AddPerson ${controller_ip} ${RESTCONFPORT} ${num_people}
+ ${resp} AddPerson ${controller_ip} ${RESTCONFPORT} ${num_people} 200
Wait Until Keyword Succeeds 60s 2s Get People And Verify ${controller_ip} ${num_people}
Get One Person And Verify
return resp
-def addCar(hostname, port, numberOfCars):
+def addCar(hostname, port, numberOfCars, *expected):
"""Creates the specified number of cars based on Cars yang model using RESTCONF"""
for x in range(1, numberOfCars + 1):
strId = str(x)
print("the response of the POST to add car=")
print(resp)
+ if expected and str(resp.status_code) not in expected:
+ raise RuntimeError('Add car failed for {}:{} with status {}'.
+ format(hostname, port, resp.status_code))
+
return resp
# TBD: Detailed validation
-def addPerson(hostname, port, numberOfPersons):
+def addPerson(hostname, port, numberOfPersons, *expected):
"""Creates the specified number of persons based on People yang model using main RPC
<note>
To enable RPC a non-user input person entry is created with personId=user0
print(payload)
print("the response of the POST to add person=")
print(resp)
+ if expected and str(resp.status_code) not in expected:
+ raise RuntimeError('Add person failed for {}:{} with status {}'.
+ format(hostname, port, resp.status_code))
return resp