Test Images REST APIs
About XPRESSO Test Images REST APIs
XPRESSO provides the following public REST APIs to build, pull, and retrieve Test Images.
Retrieve Test Image
Return registered test image information.
- URL:
/api/v2/images/:uuid - Method:
GET - Permission Required: No permission required. User needs to be a member of the group that owns the image.
- Group: retrieved from
headers - Success Response
- Condition: If test image exists and Authorized User is a member of the group.
- Code:
200 OK - Response example:
{ "uuid":"123-123-123-91d1-123", "name":"test1019-3", "tag":"latest", "status":"successful", "type":"pyats", "custom":true, "yaml_content":"packages: ...", "container_details":{ "detail":{} }, "size":0, "virtual_size":0, "image_id":null, "push_url":"dockerhub.cisco.com/ng-taas-docker/haifwu", "date_created":"2021-10-20 03:50:43", "date_updated":"2021-10-20 03:56:02", "nfs_path":null, "group":"haifwu", "is_deleted":false, "image":null, "data":{ "name":"test1019-3", "tag":"latest", "automation_token":"Jwt eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...", "group":"haifwu", "yaml_content":"packages: ...", "pin_version":false, "submitter":"system", "uuid":"1d252f72-181b-4af8-91d1-da34f248a004", "default_credential":true, "push_url":"dockerhub.cisco.com/ng-taas-docker/haifwu", "type":"pyats", "meta":null, "custom":true }, "meta":{ "worker":{ "app_label":"pyats-cloud-worker-2-h5499", "worker_id":"1b0b7879-e149-42d8-87ad-a3b6d4e8343f", "site":"SJC", "bldg":"SJC-2", "caps":[ "polaris_image", "image", "pyats" ], "service_name":"pyats-worker-sjc23-polaris9927", "service_url":"http://pyats-cld-sjc23.cisco.com:8825/workers/api/v1", "interest_list":[], "group":"general", "insert_time":"2021-10-20T03:34:03.267583Z" }, "logs_dir":"/s3/data/2021/10/images/1d252f72-181b-4af8-91d1-da34f248a004", "container_details":{ "detail":{ } } }, "jobs":[ "/pyats/dest/basic/basic_example_job.py", ], "manifests":[ ], "logs_dir":"/s3/data/2021/10/images/1d252f72-181b-4af8-91d1-da34f248a004", "worker":{ "app_label":"pyats-cloud-worker-2-h5499", "worker_id":"1b0b7879-e149-42d8-87ad-a3b6d4e8343f", "site":"SJC", "bldg":"SJC-2", "caps":[ "polaris_image", "image", "pyats" ], "service_name":"pyats-worker-sjc23-polaris9927", "service_url":"http://pyats-cld-sjc23.cisco.com:8825/workers/api/v1", "interest_list":[], "group":"general", "insert_time":"2021-10-20T03:34:03.267583Z" }, "logs":"example", "tags":[ ], "deleted":false }
- Error Response
- Condition: If test image does not exist with provided
uuid - Code:
404 NOT FOUND - Response example:
{ detail: 'No Resources found' }
- Condition: If test image does not exist with provided
Retrieve Test Images
Return registered test images information belonging to a group.
- URL:
/api/v2/images - Method:
GET - Permission Required: No permission required. User needs to be a member of the group that owns the images.
- Group: retrieved from
headers - Success Response
- Condition: If test image exists and Authorized User is a member of the group.
- Code:
200 OK - Response example:
[ { "uuid": "f25b02f6-822f-4b30-9403-289ede802902", "name": "test-1019-2", "tag": "latest", "status": "successful", "type": "pyats", "custom": true, "yaml_content": "packages: ...", "container_details": { "detail": {} }, "size": 0, "virtual_size": 0, "image_id": null, "push_url": "dockerhub.cisco.com/ng-taas-docker/haifwu", "date_created": "2021-10-19 16:09:55", "date_updated": "2021-10-19 16:14:59", "nfs_path": null, "group": "haifwu", "is_deleted": false } ]
Pull(Register) Test Image
Pull and register a test image.
URL:
/api/v2/images/pullMethod:
POSTPermission Required: No permission required. User needs to be a member of the group.
Group: retrieved from
headersData Payload:
NOTE:
1.name,tag,push_urlare required for pulling an image from registry. (eg. docker.io/library/python:latest,namewill bepython,tagwill belatest,push_urlwill bedocker.io/library)
2. It's recommended to havediscoverto betrue, xpresso will help you find jobs/manifests from your image.
3. If pulling the image requires credential, you need to provideusernameandpassword. Otherwise, remove them.
4.pin_version:falsemeans we pull latest test image from registry when doing pyats run. Otherwise, cloud worker will use cached test image.{ "name": "andrews_test_repo", "tag": "0824", "username": "username", "password": "password", "push_url": "dockerhub.cisco.com/ng-taas-docker", "discover": true, "pin_version": false }Success Response
- Condition: If pull request has been sent successfully.
- Code:
200 OK - Response example:
{ "uuid":"123-123-123-91d1-123", "name":"test1019-3", "tag":"latest", "status":"successful", "type":"pyats", "custom":true, "yaml_content":"packages: ...", "container_details":{ "detail":{} }, "size":0, "virtual_size":0, "image_id":null, "push_url":"dockerhub.cisco.com/ng-taas-docker/haifwu", "date_created":"2021-10-20 03:50:43", "date_updated":"2021-10-20 03:56:02", "nfs_path":null, "group":"haifwu", "is_deleted":false, "image":null, "data":{ "name":"test1019-3", "tag":"latest", "automation_token":"Jwt eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...", "group":"haifwu", "yaml_content":"packages: ...", "pin_version":false, "submitter":"system", "uuid":"1d252f72-181b-4af8-91d1-da34f248a004", "default_credential":true, "push_url":"dockerhub.cisco.com/ng-taas-docker/haifwu", "type":"pyats", "meta":null, "custom":true }, "meta":{ "worker":{ "app_label":"pyats-cloud-worker-2-h5499", "worker_id":"1b0b7879-e149-42d8-87ad-a3b6d4e8343f", "site":"SJC", "bldg":"SJC-2", "caps":[ "polaris_image", "image", "pyats" ], "service_name":"pyats-worker-sjc23-polaris9927", "service_url":"http://pyats-cld-sjc23.cisco.com:8825/workers/api/v1", "interest_list":[], "group":"general", "insert_time":"2021-10-20T03:34:03.267583Z" }, "logs_dir":"/s3/data/2021/10/images/1d252f72-181b-4af8-91d1-da34f248a004", "container_details":{ "detail":{ } } }, "jobs":[ "/pyats/dest/basic/basic_example_job.py", ], "manifests":[ ], "logs_dir":"/s3/data/2021/10/images/1d252f72-181b-4af8-91d1-da34f248a004", "worker":{ "app_label":"pyats-cloud-worker-2-h5499", "worker_id":"1b0b7879-e149-42d8-87ad-a3b6d4e8343f", "site":"SJC", "bldg":"SJC-2", "caps":[ "polaris_image", "image", "pyats" ], "service_name":"pyats-worker-sjc23-polaris9927", "service_url":"http://pyats-cld-sjc23.cisco.com:8825/workers/api/v1", "interest_list":[], "group":"general", "insert_time":"2021-10-20T03:34:03.267583Z" }, "logs":"example", "tags":[ ], "deleted":false }
Error Response
- Condition: If any filed is not proper.
- Code:
400 Bad Request - Response example:
{ detail: 'reason why it's not proper }
Build a Polaris Test Image
NOTE:
This api is only for cisco internal use.
Let xpresso build a polaris test image and register it to xpresso.
URL:
/api/v2/images/polaris_buildMethod:
POSTPermission Required: No permission required. User needs to be a member of the group that owns the image.
Group: retrieved from
headersData Payload:
NOTE:
1.git_ref,nameandtagis required, the rests are optional.
2. You will see the defaultpush_urlfrom the response.{ "git_ref": "BLD_POLARIS_DEV_S2C_20210819_151726", "name": "polaris", "tag": "haifwu-1", "base_ref": "polaris_dev" }Success Response
- Condition: If pull request has been sent successfully.
- Code:
200 OK - Response example:
{ "uuid":"123-123-123-91d1-123", "name":"polaris", "tag":"haifwu-1", "status":"successful", "type":"polaris", "custom":true, "yaml_content":"packages: ...", "container_details":{ "detail":{} }, "size":0, "virtual_size":0, "image_id":null, "push_url":"dockerhub.cisco.com/ng-taas-docker/haifwu", "date_created":"2021-10-20 03:50:43", "date_updated":"2021-10-20 03:56:02", "nfs_path":null, "group":"haifwu", "is_deleted":false, "image":null, "data":{ "name":"polaris", "tag":"haifwu-1", "automation_token":"Jwt eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...", "group":"haifwu", "yaml_content":"packages: ...", "pin_version":false, "submitter":"system", "uuid":"1d252f72-181b-4af8-91d1-da34f248a004", "default_credential":true, "push_url":"dockerhub.cisco.com/ng-taas-docker/haifwu", "type":"polaris", "meta":null, "custom":true }, "meta":{ "worker":{ "app_label":"pyats-cloud-worker-2-h5499", "worker_id":"1b0b7879-e149-42d8-87ad-a3b6d4e8343f", "site":"SJC", "bldg":"SJC-2", "caps":[ "polaris_image", "image", "pyats" ], "service_name":"pyats-worker-sjc23-polaris9927", "service_url":"http://pyats-cld-sjc23.cisco.com:8825/workers/api/v1", "interest_list":[], "group":"general", "insert_time":"2021-10-20T03:34:03.267583Z" }, "logs_dir":"/s3/data/2021/10/images/1d252f72-181b-4af8-91d1-da34f248a004", "container_details":{ "detail":{ } } }, "jobs":[ "/pyats/dest/basic/basic_example_job.py", ], "manifests":[ ], "logs_dir":"/s3/data/2021/10/images/1d252f72-181b-4af8-91d1-da34f248a004", "worker":{ "app_label":"pyats-cloud-worker-2-h5499", "worker_id":"1b0b7879-e149-42d8-87ad-a3b6d4e8343f", "site":"SJC", "bldg":"SJC-2", "caps":[ "polaris_image", "image", "pyats" ], "service_name":"pyats-worker-sjc23-polaris9927", "service_url":"http://pyats-cld-sjc23.cisco.com:8825/workers/api/v1", "interest_list":[], "group":"general", "insert_time":"2021-10-20T03:34:03.267583Z" }, "logs":"example", "tags":[ ], "deleted":false }
Error Response
- Condition: If any filed is not proper.
- Code:
400 Bad Request - Response example:
{ detail: 'reason why it's not proper }