Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device service refactoring integration #38

Merged
merged 33 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c01829a
Move Abstract Database Classes to Common
Mar 9, 2023
9af5831
Bugfix request and response type generation
Mar 20, 2023
97867cd
Begin restructuring of Device Service
Mar 20, 2023
34c453e
Add new tuple handling for type generation
Mar 20, 2023
ee0a064
Further refactoring & tests folder structure
Mar 20, 2023
ad726de
Small changes and fixes
Mar 21, 2023
0b38e46
Small changes to AbstractRepository/-TestSuite
Mar 21, 2023
5fa03e9
Small bugfixes for schema generation and client
Mar 21, 2023
eaa8087
WIP: Restructuring and Database Tests
Mar 21, 2023
120e2a4
WIP: Update API
Mar 23, 2023
f27daa6
small bugfix
Mar 23, 2023
13db4ad
Restructure TypeScript-Plugin
Mar 27, 2023
55ff89a
Update API and add empty test functions
Mar 27, 2023
6e5143d
Update API
Mar 27, 2023
ddc4e82
Update error status codes
Mar 27, 2023
9492d2d
Add config and urlFromId tests
Mar 27, 2023
e3b4527
Add tests for availability and callback methods
Mar 28, 2023
b90b847
Add callbacks methods tests
Mar 28, 2023
e27d71f
Add signaling methods tests
Mar 28, 2023
d275483
Add post /devices operation tests
Mar 28, 2023
8896cc2
fix build script
Mar 28, 2023
5151c62
WIP: Add further testData and operation tests
Mar 29, 2023
20c685d
Update securityRequirement handling and UserData type
Mar 31, 2023
e189785
Update openapi, edit models, fix device repository, add tests
Apr 18, 2023
2ab2b68
Add addTest function to simplify adding test cases
Apr 19, 2023
0e4655a
Change index.ts to function and add callback tests
Apr 21, 2023
db33361
Add more testcases
Apr 24, 2023
4353bff
Fix client generation
Apr 24, 2023
a67c71f
Add ImpossibleOperationError and StatusChangedMessage-Schema
Apr 24, 2023
d9165fa
Prepare Merge
Apr 25, 2023
43c3a90
Fix linting errors
Apr 26, 2023
974e4d0
Fix code generation and smaller issues
Apr 27, 2023
2ab3f9d
Address requested changes (except prettierrc)
Apr 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ services/auth:
- script: lint
dependencies:
- services/auth:build
- script: test
dependencies:
- services/auth:build

services/booking:
- script: build-spec
Expand All @@ -117,6 +120,9 @@ services/device:
- script: build-docker
dependencies:
- services/device:build
- script: test
dependencies:
- services/auth:build

services/experiment:
- script: build-spec
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ The following table shows the status for all jobs in this repository.
| helper/dummy-device/js | | | [![build](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/lint.log) | | |
| helper/dummy-device/python | | | [![build](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/lint.log) | | |
| services/common | | | [![build](https://ci.goldi-labs.de/crosslab/main/services/common/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/common/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/common/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/common/dist/lint.log) | | |
| services/auth | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.log) | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.log) |
| services/auth | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.log) | [![test](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/test.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/test.log) | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.log) |
| services/booking | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/lint-spec.log) | | | | |
| services/device | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.log) | | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.log) |
| services/device | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.log) | | [![test](https://ci.goldi-labs.de/crosslab/main/services/device/dist/test.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/test.log) | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.log) |
| services/experiment | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint.log) | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-docker.log) |
| services/federation | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build.log) | | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-docker.log) |
| services/update | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/update/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build.log) | | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-docker.log) |
Expand Down Expand Up @@ -138,6 +138,7 @@ graph LR
services/auth:build-spec[build-spec]
services/auth:lint[lint]
services/auth:lint-spec[lint-spec]
services/auth:test[test]
end
subgraph services/booking
services/booking:build-spec[build-spec]
Expand All @@ -152,6 +153,7 @@ graph LR
services/device:build-docker[build-docker]
services/device:build-spec[build-spec]
services/device:lint-spec[lint-spec]
services/device:test[test]
end
subgraph services/experiment
services/experiment:build[build]
Expand Down Expand Up @@ -235,6 +237,7 @@ helper/python-test-helper --> clients/soa_services/webcam/python
helper/tsdoc-theme --> clients/api/js
services/auth --> clients/api/js
services/auth --> integration-test
services/auth --> services/device
services/auth --> services/openapi
services/booking --> clients/api/js
services/booking --> services/openapi
Expand Down
4 changes: 4 additions & 0 deletions clients/api/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions clients/api/python/src/crosslab/api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
CreatePeerconnectionResponse,
GetPeerconnectionResponse,
DeletePeerconnectionResponse,
PatchPeerconnectionDeviceStatusRequest,
PatchPeerconnectionDeviceStatusResponse,
ListExperimentsResponse,
CreateExperimentRequest,
CreateExperimentResponse,
Expand Down Expand Up @@ -1160,6 +1162,37 @@ async def delete_peerconnection(self, url: str) -> DeletePeerconnectionResponse:
return resp
raise Exception(f"Unexpected status code: {status}")

async def patch_peerconnection_device_status(self, url: str, body: PatchPeerconnectionDeviceStatusRequest, device_url: str) -> PatchPeerconnectionDeviceStatusResponse: # noqa: E501
"""
Sets the peerconnection status of a single device.
""" # noqa: E501
if not self.BASE_URL:
raise Exception("No base url set")

# match path to url schema
m = re.search(r'^('+re.escape(self.BASE_URL)+r')?\/?(peerconnections\/[^?]*?)(\/device_status)?$', url)
if m is None:
raise Exception("Invalid url")
valid_url = '/'+m.group(2)+'/device_status'
if valid_url.startswith('//'):
valid_url = valid_url[1:]

# build query params
query_params: Dict[str, Union[List[str], str]] = {}
if device_url:
if isinstance(device_url, list):
query_params['device_url'] = device_url
else:
query_params['device_url'] = str(device_url)

# make http call
status, resp = await self._fetch(valid_url, method="patch", body=body, params=query_params)

# transform response
if status == 201:
return resp
raise Exception(f"Unexpected status code: {status}")

async def list_experiments(self, url: str = "/experiments") -> ListExperimentsResponse: # noqa: E501
"""
List experiments
Expand Down
Loading