[cloud2cloud-gateway] Resource APIs can not retrieve resource data with query parameter (i.e. ?if=oic.if.baseline).
Trishia opened this issue · 4 comments
Description
@ondrejtomcik @jkralik
Recently, I'm doing test plgd cloud with CTT Tool. I found that Resource API(i.e. /api/v1/devices/{deviceId}/{resourceHref}) of cloud2cloud-gateway can not retrieve resource data with query parameter (i.e. ?if=oic.if.baseline).
Logs
22:39:47 VERBOSE: CTT HTTP Client -> [request ID=4E07D12D] GET https://c2c-api.ttaocfcloud.org/api/v1/devices/a0253411-a758-4a30-6efc-27b5061bbd58/platform?if=oic.if.baseline
Headers: [Accept=application/json, Authorization=Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImxfcUtMNlE3djFRNTNyZ3dSSFN1aiJ9.eyJpc3MiOiJodHRwczovL3R0YW9jZi51cy5hdXRoMC5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDQ0MzAyMzI5NjAyMzA1ODY1OTUiLCJhdWQiOiJodHRwczovL3d3dy50dGFvY2ZjbG91ZC5vcmciLCJpYXQiOjE2MzA0ODI4MTYsImV4cCI6MTYzMDU2OTIxNiwiYXpwIjoieXhGOXJQQ3B0OFRrcVJEbmpYZ1NPa0YxR3dFUVVaYVoiLCJzY29wZSI6InI6ZGV2aWNlaW5mb3JtYXRpb246KiByOnJlc291cmNlczoqIHc6cmVzb3VyY2VzOioifQ.DTdhrd0FyzDIdQpj_IAFWvAmhDc4gwkogYBIRf7_8QJX0aAtqKVwdN6LGipVVLDhdZfaVi6UvGy0Qu2nw-U_kW68iQtP3oQF_ISEWGxRn3vOzLiyD6ppzqV6l5g4dLZXwd9KuEcdQ7rLOEb0Kz3PSd1tU8PUlPDsSm2_NDVl_Hm3PU4xnhMk_ReL11sATOlS3uKo11fUKciHPjbWAXuJEZ3SX6uFUEqFnVomwh592FpBaGpXLAEGm6jgOWwF05YikoeXys9EeyFA6CIcmHUzdAvyTCcRX7hzY9QGWFTc2uaA_L56Sw9sDZBkxExjUh0LgAwFvpUw82iUC-7TPlW5RA]
22:39:47 VERBOSE: CTT HTTP Client <- [response ID=4E07D12D] GET https://c2c-api.ttaocfcloud.org/api/v1/devices/a0253411-a758-4a30-6efc-27b5061bbd58/platform?if=oic.if.baseline
Code: 404 NotFound
Headers: [Connection=keep-alive, Content-Length=213, Content-Type=text/plain; charset=UTF-8, Date=Wed, 01 Sep 2021 13:39:47 GMT, Via=kong/2.5.0, X-Kong-Proxy-Latency=0, X-Kong-Upstream-Latency=3]
Body: cannot retrieve resource: cannot retrieve resource(deviceID: a0253411-a758-4a30-6efc-27b5061bbd58, Href: /platform?if=oic.if.baseline): rpc error: code = NotFound desc = cannot retrieve resources values: not found
22:39:47 ERROR: CT5.2.2_Check_3: Status code in response ID=4E07D12D is 404 while 200 was expected
CTT is expecting below step:
Step 3.5: If the Resource is a Collection or Atomic Measurement, the CTT Origin Cloud also sends a HTTPS GET message to "/api/v1/devices/{link href}" where {link href} is the "href" Link Parameter of the first Link returned in the response received in Step 2. The request contains a baseline OCF Interface query.
Environment
- plgd source : commit e019708
- IoTivity version: jakarta branch merged with master
- Deployment option: bundle on my own
And the default response of collection resource (oic.wk.col) should be the response of oic.if.ll, but the response of /api/v1/devices/{deviceId}/{resourceHref} of cloud2cloud-gateway is always baseline response. So CTT is exposing invalid schema error of #/definitions/slink
.
See the logs below:
22:39:45 VERBOSE: CTT HTTP Client -> [request ID=4E07D12C] GET https://c2c-api.ttaocfcloud.org/api/v1/devices/a0253411-a758-4a30-6efc-27b5061bbd58/platform
Headers: [Accept=application/json, Authorization=Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImxfcUtMNlE3djFRNTNyZ3dSSFN1aiJ9.eyJpc3MiOiJodHRwczovL3R0YW9jZi51cy5hdXRoMC5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDQ0MzAyMzI5NjAyMzA1ODY1OTUiLCJhdWQiOiJodHRwczovL3d3dy50dGFvY2ZjbG91ZC5vcmciLCJpYXQiOjE2MzA0ODI4MTYsImV4cCI6MTYzMDU2OTIxNiwiYXpwIjoieXhGOXJQQ3B0OFRrcVJEbmpYZ1NPa0YxR3dFUVVaYVoiLCJzY29wZSI6InI6ZGV2aWNlaW5mb3JtYXRpb246KiByOnJlc291cmNlczoqIHc6cmVzb3VyY2VzOioifQ.DTdhrd0FyzDIdQpj_IAFWvAmhDc4gwkogYBIRf7_8QJX0aAtqKVwdN6LGipVVLDhdZfaVi6UvGy0Qu2nw-U_kW68iQtP3oQF_ISEWGxRn3vOzLiyD6ppzqV6l5g4dLZXwd9KuEcdQ7rLOEb0Kz3PSd1tU8PUlPDsSm2_NDVl_Hm3PU4xnhMk_ReL11sATOlS3uKo11fUKciHPjbWAXuJEZ3SX6uFUEqFnVomwh592FpBaGpXLAEGm6jgOWwF05YikoeXys9EeyFA6CIcmHUzdAvyTCcRX7hzY9QGWFTc2uaA_L56Sw9sDZBkxExjUh0LgAwFvpUw82iUC-7TPlW5RA]
22:39:46 VERBOSE: CTT HTTP Client <- [response ID=4E07D12C] GET https://c2c-api.ttaocfcloud.org/api/v1/devices/a0253411-a758-4a30-6efc-27b5061bbd58/platform
Code: 200 OK
Headers: [Connection=keep-alive, Content-Length=414, Content-Type=application/json, Date=Wed, 01 Sep 2021 13:39:45 GMT, Via=kong/2.5.0, X-Kong-Proxy-Latency=0, X-Kong-Upstream-Latency=2]
Body: {"if":["oic.if.ll","oic.if.create","oic.if.b","oic.if.baseline"],"links":[{"eps":[],"href":"/switch","if":["oic.if.a","oic.if.baseline"],"ins":1854490588,"p":{"bm":3},"rel":["hosts"],"rt":["oic.r.switch.binary"],"tag-func-desc":"smart","tag-pos-desc":"top","tag-pos-rel":[0.34,0.5,0.8],"x.openconnectivity.name":"platform_switch"}],"rt":["oic.wk.col"],"rts":["oic.r.switch.binary"],"rts-m":["oic.r.switch.binary"]}
22:39:47 ERROR: {'if': ['oic.if.ll', 'oic.if.create', 'oic.if.b', 'oic.if.baseline'], 'links': [{'if': ['oic.if.a', 'oic.if.baseline'], 'ins': 1854490588, 'rt': ['oic.r.switch.binary'], 'x.openconnectivity.name': 'pl...
22:39:47 ERROR: IUT response messages do not follow JSON schema '#/definitions/slinks'
22:39:47 ERROR: CT5.2.2_Check_19: Resource has not all mandatory properties or interfaces or does not comply to schema
22:39:47 ERROR: CT5.2.2_Check_21: Bad type(s) of property 'resource' should be array but is <type 'dict'>. ({'if': ['oic.if.ll', 'oic.if.create', 'oic.if.b', 'oic.if.baseline'], 'links': [{'if': ['oic.if.a', 'oic.if....
22:39:47 ERROR: CT5.2.2_Check_23: Vendor specified properties shall follow the syntax x.<Domain_Name>.<property>. Invalid properties names: links, rts-m, rts
22:39:47 ERROR: CT5.2.2_Check_27: Bad type(s) of property 'resource' should be array but is <type 'dict'>. ({'if': ['oic.if.ll', 'oic.if.create', 'oic.if.b', 'oic.if.baseline'], 'links': [{'if': ['oic.if.a', 'oic.if....
@ondrejtomcik @jkralik
How can I solve this problem? Advise me plz...
@Trishia is this still a problem? All CTT 5.x.x succeed with plgd hub v2.2.3.
@Danielius1922
I don't know exactly because I have never chance to test plgd hub v2.2.3. If you think this issue is solved I will close this issue now.
@Danielius1922 I don't know exactly because I have never chance to test plgd hub v2.2.3. If you think this issue is solved I will close this issue now.
Thanks, I think given that the CTT Target Cloud test cases (5.x.x) work this issue should be fixed. (We can reopen / open a new issue if it proves wrong)