From cf6ceaa888be7b90ecb724b7b79c97aec2bf80ec Mon Sep 17 00:00:00 2001 From: Urtza Iturraspe <urtza.iturraspe@tecnalia.com> Date: Thu, 31 Oct 2024 08:14:19 +0100 Subject: [PATCH] Changes for manage dataproducts --- API_OASEES/app/utils/connector_utils.py | 34 ----------------- API_OASEES/app/utils/create_asset.py | 3 +- .../app/utils/create_contract_definition.py | 3 +- API_OASEES/app/utils/create_policy.py | 1 + API_OASEES/oasees.env | 37 +------------------ .../docker-compose.yml | 33 +++++++++-------- .../app/utils/connector_utils.py | 34 ----------------- .../app/utils/create_asset.py | 3 +- .../app/utils/create_contract_definition.py | 3 +- .../app/utils/create_policy.py | 1 + .../gaiax-selfdescriptor-module/oasees.env | 17 +-------- 11 files changed, 26 insertions(+), 143 deletions(-) diff --git a/API_OASEES/app/utils/connector_utils.py b/API_OASEES/app/utils/connector_utils.py index 2a1fc35..ba9f4b0 100644 --- a/API_OASEES/app/utils/connector_utils.py +++ b/API_OASEES/app/utils/connector_utils.py @@ -1,37 +1,3 @@ -""" -MIT License - -Copyright (c) 2024 Tecnalia, Basque Research & Technology Alliance (BRTA) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - -import json -import os -import uuid -from tecnalia.models.dataProductResourcesBody import DataProductResourcesModel -from fastapi import HTTPException - -from app.utils.create_asset import invoke_create_asset -from app.utils.create_policy import invoke_create_policy, checkPolicyId -from app.utils.create_contract_definition import invoke_create_contract_definition - logger = logging.getLogger("uvicorn.error") def load_asset_edc(body:DataProductResourcesModel, dataResouceAPi_URL:str): diff --git a/API_OASEES/app/utils/create_asset.py b/API_OASEES/app/utils/create_asset.py index 0d99b44..9e03567 100644 --- a/API_OASEES/app/utils/create_asset.py +++ b/API_OASEES/app/utils/create_asset.py @@ -21,12 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ - +import logging import os import json import requests - logger = logging.getLogger("uvicorn.error") def invoke_create_asset(dataProductId: str, dataProductName: str, dataProductFormatType: str, diff --git a/API_OASEES/app/utils/create_contract_definition.py b/API_OASEES/app/utils/create_contract_definition.py index 8ee1851..bd961f7 100644 --- a/API_OASEES/app/utils/create_contract_definition.py +++ b/API_OASEES/app/utils/create_contract_definition.py @@ -21,12 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +import logging import os import json import requests - - logger = logging.getLogger("uvicorn.error") diff --git a/API_OASEES/app/utils/create_policy.py b/API_OASEES/app/utils/create_policy.py index ffeba85..b5a8cc1 100644 --- a/API_OASEES/app/utils/create_policy.py +++ b/API_OASEES/app/utils/create_policy.py @@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import json +import logging import os import requests diff --git a/API_OASEES/oasees.env b/API_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Ia9kewavQ93EVHY5ggMoRR+jShTCpuROp3v+HVCCWCI3Yker7M -v9TWdiwU3NECgYB1txcwjJ0hlsl1OiocBdbt+IF/S7qYLARDCvNfTJXeZf8xTwj9 -1c9wjwsSv663K6E1WYTP6j0wkTfNT04nA1UCPow1wQlfMNOhxE5EfBKgkXU6jqq8 -uq15PloY8Yp6Zb2ARCCAINIT9ZGXIZfilhyh2tk223H7nAprQYQM5r/0IQKBgQCl -5/w3FDL5WcnApq3yKfoCqi67UeoV3FFtXJrzThmQrvQd1pZwy5Zqh/kHsRkhiUkN -NBwneLyzg+Uk5OEFBWz/d7GTWj59m+e46Itt9og78TDO5weY4nP6RTH3fxT6Ntms -yTTZgk/IibxAa2JY9Gd762Q3dnQ+4r+iKjZIJjjNUQKBgQCpNJkwNE092BQ8ByA0 -zRPLAxW/ntX4QzySB4eqe0BHYRfADDw+DCwJBQLlluyb8DJn2GoyY7GMsEBXXxSI -I765ki7y1MVcai3vVjS91mL3pGbDfYg1r3fS0ShUKqcEu7ZE2TvtpXwOMTa12MXa -Urbz/GqWw2FUqcJLFloRodkVaA== + -----END PRIVATE KEY-----" @@ -118,20 +98,7 @@ Urbz/GqWw2FUqcJLFloRodkVaA== #EDC INFO - -POLICY_ID=no-restriction-policy -CONTRACT_ID=contract_no_restriction -#POLICY_TIME_INTERVAL=true -#POLICY_TIME_INTERVAL_START_DATE=2022-12-31T23:00:00.000Z -#POLICY_TIME_INTERVAL_END_DATE=2026-09-30T23:00:00.000Z - - -PROVIDER_HOST=oasees.tri.lan -PROVIDER_CONTROL_PORT=9192 -PROVIDER_MANAGEMENT_PORT=9193 - -#PROVIDER_HOST_PORT=mgmt.connector.prov.hx001.digital.tecnalia.dev - +PROVIDER_MANAGEMENT_URL=http://oasees.tri.lan:9193/management/v3 HEADER_AUTHORIZATION=2dSXJqNXgKAf08PINHOpwTgbcIE5tNgS diff --git a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/docker-compose.yml b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/docker-compose.yml index 1fb0fca..dbc1a47 100644 --- a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/docker-compose.yml +++ b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/docker-compose.yml @@ -58,26 +58,27 @@ services: networks: - oasees-network - postgres: - image: postgres:10.5 - container_name: oasees_postgres - restart: always - environment: - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=12345 - logging: - options: - max-size: 10m - max-file: "3" - ports: + + + postgres: + image: postgres:10.5 + container_name: oasees_postgres + restart: always + + ports: - '5432:5432' - - volumes: + + env_file: + - ./postgres.env + + volumes: - ./postgres-data:/var/lib/postgresql/data # copy the sql script to create tables - ./sql/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql - networks: - - oasees-network + networks: + - oasees-network + + volumes: app: {} diff --git a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/connector_utils.py b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/connector_utils.py index 2a1fc35..ba9f4b0 100644 --- a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/connector_utils.py +++ b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/connector_utils.py @@ -1,37 +1,3 @@ -""" -MIT License - -Copyright (c) 2024 Tecnalia, Basque Research & Technology Alliance (BRTA) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - -import json -import os -import uuid -from tecnalia.models.dataProductResourcesBody import DataProductResourcesModel -from fastapi import HTTPException - -from app.utils.create_asset import invoke_create_asset -from app.utils.create_policy import invoke_create_policy, checkPolicyId -from app.utils.create_contract_definition import invoke_create_contract_definition - logger = logging.getLogger("uvicorn.error") def load_asset_edc(body:DataProductResourcesModel, dataResouceAPi_URL:str): diff --git a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_asset.py b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_asset.py index 0d99b44..9e03567 100644 --- a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_asset.py +++ b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_asset.py @@ -21,12 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ - +import logging import os import json import requests - logger = logging.getLogger("uvicorn.error") def invoke_create_asset(dataProductId: str, dataProductName: str, dataProductFormatType: str, diff --git a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_contract_definition.py b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_contract_definition.py index 8ee1851..bd961f7 100644 --- a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_contract_definition.py +++ b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_contract_definition.py @@ -21,12 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ +import logging import os import json import requests - - logger = logging.getLogger("uvicorn.error") diff --git a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_policy.py b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_policy.py index ffeba85..b5a8cc1 100644 --- a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_policy.py +++ b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/app/utils/create_policy.py @@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import json +import logging import os import requests diff --git a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/oasees.env b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/oasees.env index 15bae16..c8e154d 100644 --- a/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/oasees.env +++ b/GAIAX_DATAPRODUCT_OASEES_DOCKER_COMPOSE/gaiax-selfdescriptor-module/oasees.env @@ -116,22 +116,7 @@ Urbz/GqWw2FUqcJLFloRodkVaA== #EDC INFO - - - -POLICY_ID=no-restriction-policy -CONTRACT_ID=contract_no_restriction -#POLICY_TIME_INTERVAL=true -#POLICY_TIME_INTERVAL_START_DATE=2022-12-31T23:00:00.000Z -#POLICY_TIME_INTERVAL_END_DATE=2026-09-30T23:00:00.000Z - - -PROVIDER_HOST=oasees.tri.lan -PROVIDER_CONTROL_PORT=9192 -PROVIDER_MANAGEMENT_PORT=9193 - -#PROVIDER_HOST_PORT=mgmt.connector.prov.hx001.digital.tecnalia.dev - +PROVIDER_MANAGEMENT_URL=http://oasees.tri.lan:9193/management/v3 HEADER_AUTHORIZATION=2dSXJqNXgKAf08PINHOpwTgbcIE5tNgS -- GitLab