Skip to content

Commit c62b6a1

Browse files
committed
added quali api samples
1 parent 2666853 commit c62b6a1

File tree

5 files changed

+134
-0
lines changed

5 files changed

+134
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from cloudshell.api.cloudshell_api import CloudShellAPISession
2+
3+
user = "admin"
4+
password = "admin"
5+
server = "localhost"
6+
domain = "Global"
7+
8+
TOTAL_RESOURCES = 1000
9+
10+
api = CloudShellAPISession(host=server, username=user, password=password, domain=domain)
11+
12+
print("building resources...")
13+
for i in range(TOTAL_RESOURCES):
14+
print("resource" + str(i + 1))
15+
api.CreateResource(resourceModel="Generic Dut",
16+
resourceName="generic_dummy_b_{}".format(str(i + 1)),
17+
resourceAddress="{0}.{0}.{0}.{0}".format(str(i)),
18+
folderFullPath="dummy resources 2")
19+
20+
print("done")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from cloudshell.api.cloudshell_api import CloudShellAPISession
2+
3+
user = "admin"
4+
password = "admin"
5+
server = "localhost"
6+
domain = "Global"
7+
8+
api = CloudShellAPISession(host=server, username=user, password=password, domain=domain)
9+
10+
res_id = "3bac3765-ba86-4ad3-819b-3a2127c1cbef"
11+
blueprint_name = "L1 connectivity - 9.2 Ogura Test"
12+
13+
res = api.ActivateTopology(reservationId=res_id, topologyFullPath=blueprint_name)
14+
pass
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from quali_api_wrapper import QualiAPISession
2+
import json
3+
4+
with open('suite_data.json') as handle:
5+
suite_data_dict = json.loads(handle.read())
6+
7+
api = QualiAPISession(host="localhost", username="admin", password="admin")
8+
9+
suite_id = api.enqueue_suite(suite_data=suite_data_dict)
10+
suite_details = api.get_suite_details(suite_id)
11+
12+
print("suite id: " + suite_id)
13+
print("===== suite details =====")
14+
print(suite_details)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"SuiteTemplateName": "uat demo",
3+
"SuiteName": "Quali API Suite",
4+
"Description": "this is a suite ran through API",
5+
"Type": "TestShell",
6+
"Owner": "admin",
7+
"EmailNotifications": "ErrorsOnly",
8+
"RemoveJobsFromQueueAfter": -1,
9+
"EndReservationOnEnd": true,
10+
"JobsDetails": [
11+
{
12+
"Name": "First Job Sample",
13+
"Description": "sample description",
14+
"ExecutionServers": [],
15+
"LoggingProfile": "All",
16+
"EstimatedDuration": 2,
17+
"StopOnFail": false,
18+
"StopOnError": false,
19+
"Tests": [
20+
{
21+
"TestPath": "TestShell\\Tests\\Shared\\Demo\\input_demo",
22+
"State": null,
23+
"StartTime": null,
24+
"EndTime": null,
25+
"Result": null,
26+
"ReportId": null,
27+
"Parameters": [
28+
{
29+
"ParameterName": "input_1",
30+
"ParameterValue": "hello there I'm input 1"
31+
}
32+
],
33+
"EstimatedDuration": null
34+
}
35+
],
36+
"Topology": null,
37+
"DurationTimeBuffer": 0,
38+
"EmailNotifications": null,
39+
"Type": "TestShell"
40+
}
41+
],
42+
"ExistingReservationId": null
43+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"SuiteTemplateName": "uat demo",
3+
"SuiteName": "Quali API Suite",
4+
"Description": "this is a suite ran through API",
5+
"Type": "TestShell",
6+
"Owner": "admin",
7+
"EmailNotifications": "ErrorsOnly",
8+
"RemoveJobsFromQueueAfter": -1,
9+
"EndReservationOnEnd": true,
10+
"JobsDetails": [
11+
{
12+
"Name": "First Job Sample",
13+
"Description": "sample description",
14+
"ExecutionServers": [],
15+
"LoggingProfile": "All",
16+
"EstimatedDuration": 2,
17+
"StopOnFail": false,
18+
"StopOnError": false,
19+
"Tests": [
20+
{
21+
"TestPath": "TestShell\\Tests\\Shared\\Demo\\input_demo",
22+
"State": null,
23+
"StartTime": null,
24+
"EndTime": null,
25+
"Result": null,
26+
"ReportId": null,
27+
"Parameters": [
28+
{
29+
"ParameterName": "input_1",
30+
"ParameterValue": "hello there I'm input 1"
31+
}
32+
],
33+
"EstimatedDuration": null
34+
}
35+
],
36+
"Topology": null,
37+
"DurationTimeBuffer": 0,
38+
"EmailNotifications": null,
39+
"Type": "TestShell"
40+
}
41+
],
42+
"ExistingReservationId": null
43+
}

0 commit comments

Comments
 (0)