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

110 align block storage #123

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ coverage.xml
os_secret
k8s_secret
.gx-credentials
config/config.yaml
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
![Static Badge](https://img.shields.io/badge/version-1.0.0-green)
![Static Badge](https://img.shields.io/badge/Gaia--X_Release-Tagus-blue?color=%23D901D9)
![Static Badge](https://img.shields.io/badge/Gaia--X_Compliance-Conformity-blue?color=%23D901D9)
![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)

Tool for creating compliant Gaia-X Credentials, previously known as Gaia-X Self-Description, for SCS-compliant cloud infrastructures.
To get familiar with Gaia-X Credentials, please consult the corresponding [documentation](https://docs.gaia-x.eu/).
Expand Down Expand Up @@ -80,6 +81,8 @@ Installing dependecies into a Python [virtualenv](https://virtualenv.pypa.io/en/
pip install -r requirements.txt
```

Please use python version 3.10!

### Cloud Service Provider

#### 1. Create configuration file
Expand Down
4 changes: 2 additions & 2 deletions config/config.yaml → config/config.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ IaaS:
# allowed values are: digital, physical
access-type: digital
# Allowed values are MIME types
format-type: "plain"
format-type: "text/plain"

# Endpoints of Gaia-X Digital Clearing House
gxdch:
GXDCH:
notary-service: https://registrationnumber.notary.lab.gaia-x.eu/v1-staging
compliance-service: https://compliance.lab.gaia-x.eu/v1-staging
registry-service: https://registry.lab.gaia-x.eu/v1-staging
Expand Down
25 changes: 11 additions & 14 deletions generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
DATA_FILE_FORMAT = "json-ld"

VC_NAME_LOOKUP = {
"lp": "Legal Person",
"legal_person": "Legal Person",
"lrn": "Legal Registration Number",
"tandc": "Gaia-X Terms and Conditions",
"cs_csp": "GXDCH Compliance Service",
"cs_so": "GXDCH Compliance Service",
"csp_compliance": "GXDCH Compliance Service",
"so_compliance": "GXDCH Compliance Service",
"so": "Service Offering",
"vmso": "Virtual Machine Service Offering",
}
Expand Down Expand Up @@ -94,7 +94,7 @@ def cli_commands():
pass


@click.command()
@cli_commands.command()
@add_logging_options
@click.option(
"--auto-sign/--no-auto-sign",
Expand Down Expand Up @@ -147,7 +147,7 @@ def openstack(cloud, timeout, config, out_dir, auto_sign):
_print_vcs(vcs, out_dir)


@click.command()
@cli_commands.command()
@add_logging_options
def kubernetes():
"""Generates Gaia-X Credentials for CSP and Kubernetes."""
Expand All @@ -160,7 +160,7 @@ def kubernetes():
# graph.parse(filepath, format=file_format)
# return graph

@click.command()
@cli_commands.command()
@add_logging_options
@click.option(
"--auto-sign/--no-auto-sign",
Expand Down Expand Up @@ -232,6 +232,7 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int
@param timeout: timeout for connection to OpenStack cloud. If timeout expires, connection is initialed a second time.
@return: A list of Gaia-X Credentials describing given OpenStack cloud.
"""

csp = conf.get_value([const.CONFIG_CSP])
# iaas = conf.get_value([const.CONFIG_IAAS]) not yet used, as Gaia-X "abuses" id attribute of Verifiable Credentials
cred_settings = conf.get_value([const.CONFIG_CRED])
Expand All @@ -247,7 +248,7 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int
vmso_vc = {
'@context': [const.VC_CONTEXT, const.JWS_CONTEXT, const.REG_CONTEXT],
'type': "VerifiableCredential",
'id': cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/vmo.json",
'id': cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/vmso.json",
'issuer': csp['did'],
'issuanceDate': str(datetime.now(tz=timezone.utc).isoformat()),
'credentialSubject': json.loads(json.dumps(vm_offering, default=json_ld.to_json_ld)),
Expand All @@ -269,7 +270,7 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int
"type": "gx:ServiceOffering",
"id": cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/so.json#subject", # iaas['did'],
"gx:providedBy": {
'id': csp_vcs['lp']['credentialSubject']['id']
'id': csp_vcs['legal_person']['credentialSubject']['id']
},
"gx:termsAndConditions": [
{'gx:URL': s_tac.url, 'gx:hash': s_tac.hash}
Expand All @@ -291,12 +292,12 @@ def create_vmso_vcs(conf: Config, cloud: str, csp_vcs: List[dict], timeout: int

# Request Gaia-X Compliance Credential for Service Offering
logging.info('Request VC of type "gx:compliance" for Service Offering at GXDCH Compliance Service...')
vp = credentials.convert_to_vp(creds=[csp_vcs['tandc'], csp_vcs['lrn'], csp_vcs['lp'], so_vc_signed])
vp = credentials.convert_to_vp(creds=[csp_vcs['tandc'], csp_vcs['lrn'], csp_vcs['legal_person'], so_vc_signed])
comp_vc = compliance.request_compliance_vc(vp,
cred_settings[const.CONFIG_CRED_BASE_CRED_URL] + "/so_compliance.json")

logging.info('ok')
return {'so': so_vc, 'cs_so': json.loads(comp_vc), 'vmso': vmso_vc_signed, 'vp_so': vp}
return {'so': so_vc, 'so_compliance': json.loads(comp_vc), 'vmso': vmso_vc_signed, 'vp_so': vp}


def _get_timestamp():
Expand Down Expand Up @@ -356,9 +357,5 @@ def _are_gaiax_tandc_signed(conf: Config) -> bool:
return False


cli_commands.add_command(openstack)
cli_commands.add_command(kubernetes)
cli_commands.add_command(csp)

if __name__ == "__main__":
cli_commands()
2 changes: 1 addition & 1 deletion generator/common/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
CONFIG_CSP_EUID = "euid"

# GXDCH
CONST_GXDCH = "gxdch"
CONST_GXDCH = "GXDCH"
CONST_GXDCH_NOT = "notary-service"
CONST_GXDCH_COMP = "compliance-service"
CONST_GXDCH_REG = "registry-service"
Expand Down
Loading
Loading