diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..47a3da07aa02388756c56d382563fce094ca6a08 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +.idea +.git +# Byte-compiled / optimized / DLL files +__pycache__/ +./libraries/__pycache__/*.py[cod] +*.py[cod] +*$py.class +*.DS_Store +*.key +*.csr +*.pem +*./valid_ca/* +demo_values.json +capif_provider_details.json \ No newline at end of file diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000000000000000000000000000000000000..c398581f91f3c61d4cff6aceb5718439b7e497ad --- /dev/null +++ b/Pipfile @@ -0,0 +1,13 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +pymongo = "==3.12.0" +inject = "==4.3.1" + +[dev-packages] + +[requires] +python_version = "3.8" diff --git a/README.md b/README.md index c16e0176ec41759ad1875c31981ae7ea1c700856..fb87209611cec461a6fd79016bd5fca68bce4e71 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,106 @@ -# provider-cli +# CAPIF_Provider_ONE +This is the implementation of a Provider (AEF) for the Opennebula service +## Prerequisites +In order to use the Provider you must use the public CAPIF or create a [CAPIF](https://github.com/EVOLVED-5G/CAPIF_API_Services) instance. -## Getting started -To make it easy for you to get started with GitLab, here's a list of recommended next steps. +## Important +This code is intended for testing in a local docker environment. If it is going to be deployed in an environment such as kubernetes, it is necessary to make modifications to the following file: -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files +``` +./capif_ops/config_files/service_api_description_one.json -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: +``` +``` +"ipv4Addr": <url of the service> +``` +## Set Up +This repo is designed to be executed from docker, to create the images and raise the instance it is only necessary to execute the following command: ``` -cd existing_repo -git remote add origin https://labs.etsi.org/rep/ocf/example-clients/provider-cli.git -git branch -M main -git push -uf origin main +./run.sh + ``` -## Integrate with your tools +- Before executing the run.sh command, note that it supports one parameter, this parameter is the CAPIF hostname, by default this field is 'capifcore'. Modify it if necessary or add the hostname when executing the run.sh command -- [ ] [Set up project integrations](https://labs.etsi.org/rep/ocf/example-clients/provider-cli/-/settings/integrations) + ``` + ./run.sh <other_hostname> -## Collaborate with your team + ``` -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) +- It is important to have the following environment variables in the docker-compose file: + ``` + - REGISTER_HOSTNAME = register + - CAPIF_PORT=8080 + - REGISTER_PORT=8084 -## Test and Deploy + extra_hosts: + - host.docker.internal:host-gateway + - capifcore:host-gateway + - register:host-gateway -Use the built-in continuous integration in GitLab. + ``` + By default, these are the ports and names that the CAPIF script uses when launching the different services. If during the deployment of CAPIF you modify these parameters, you must modify them so that they correspond to the new ones. -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) + If the hostname environment variables are modified, the extra host must also be modified so that the hostnames correspond and be able to reach the services deployed in docker. -*** +Now it is only necessary to enter inside the container by executing this command -# Editing this README -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. +``` +./terminal_to_py_aef.sh -## Name -Choose a self-explaining name for your project. +``` -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. +Once inside the container you can run the provider command GUI by running -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. +``` +./python main.py -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. +``` -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. +## Interacting with the GUI +The provider is prepared to make the necessary previous provisions automatically. +The different .json files that must be saved in CAPIF are also added. To make the necessary provisions you just have to execute the following commands within the GUI -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. +``` +register_provider -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. +``` -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. +``` +publish_service -## Contributing -State if you are open to contributions and what your requirements are for accepting them. +``` +*If the first command returns a 401, it means that the token to interact the first time with CAPIF has expired, run the following command + +``` +provider_get_auth + +``` + +## Run ONE Service -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. +This service has Apified some of the functions of ONE. To start the service run the following command: -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. +``` +python service/service_oauth.py + +``` +- It is necessary to modify the URL and the ONE credentials to be used in the python service itself -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. +The endpoints that are implemented are the following -## License -For open source projects, say how it is licensed. +``` +/hello [POST] + +Request Body: +{ + "name": "ocf_user" +} -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +``` diff --git a/capif-provider-one/.helmignore b/capif-provider-one/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..0e8a0eb36f4ca2c939201c0d54b5d82a1ea34778 --- /dev/null +++ b/capif-provider-one/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/capif-provider-one/Chart.yaml b/capif-provider-one/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..55c02b1d401533f0abad132b123899647dfd1de3 --- /dev/null +++ b/capif-provider-one/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: capif-provider-one +description: A Helm chart for capif-provider-one in Kubernetes +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/capif-provider-one/README.md b/capif-provider-one/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3f9143d843df392992d75ab99c2a6ffdbb7e3370 --- /dev/null +++ b/capif-provider-one/README.md @@ -0,0 +1,36 @@ +# Helm of capif-provider-one + + + + + +## Description + +A Helm chart for capif-provider-one in Kubernetes + +## Usage + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| environment | string | `"openshift"` | The Environment variable. It accepts: 'kuberentes-athens', 'kuberentes-uma', 'openshift' | +| ingress_ip | object | `{"athens":"10.161.1.126","uma":"10.11.23.49"}` | If env: 'kuberentes-athens' or env: 'kuberentes-uma', use the Ip address dude for the kubernetes to your Ingress Controller ej: kubectl -n NAMESPACE_CAPIF get ing s | +| kubernetesClusterDomain | string | `"cluster.local"` | | +| oneProviderGui.oneProviderGui.env.capifHostname | string | `"my-capif.apps.ocp-epg.hi.inet"` | | +| oneProviderGui.oneProviderGui.env.capifPort | string | `"80"` | | +| oneProviderGui.oneProviderGui.env.easyRsaPort | string | `"8083"` | | +| oneProviderGui.oneProviderGui.env.requestsCaBundle | string | `"/usr/src/app/ca.crt"` | | +| oneProviderGui.oneProviderGui.env.sslCertFile | string | `"/usr/src/app/ca.crt"` | | +| oneProviderGui.oneProviderGui.image.repository | string | `"709233559969.dkr.ecr.eu-central-1.amazonaws.com/evolved5g:capif-one-provider-gui"` | | +| oneProviderGui.oneProviderGui.image.tag | string | `""` | | +| oneProviderGui.ports[0].name | string | `"capif-provider-one"` | | +| oneProviderGui.ports[0].port | int | `8085` | | +| oneProviderGui.ports[0].targetPort | int | `8085` | | +| oneProviderGui.type | string | `"ClusterIP"` | | + + + + + + diff --git a/capif-provider-one/README.md.gotmpl b/capif-provider-one/README.md.gotmpl new file mode 100644 index 0000000000000000000000000000000000000000..e9cc114359bfa991ca464f67dbcfa391d68f2fe4 --- /dev/null +++ b/capif-provider-one/README.md.gotmpl @@ -0,0 +1,19 @@ +# Helm of capif-provider-one + + +{{ if .Type }} {{ end }} +{{ if .AppVersion }} {{ end }} + +## Description + +{{ template "chart.description" . }} + +## Usage + +{{ template "chart.valuesSection" . }} + +{{ template "chart.homepageLine" . }} + +{{ template "chart.sourcesSection" . }} + +{{ template "chart.maintainersSection" . }} diff --git a/capif-provider-one/templates/_helpers.tpl b/capif-provider-one/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..e5835241932b73f24bad704d6b107856414a2aa7 --- /dev/null +++ b/capif-provider-one/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "capif-provider-one.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "capif-provider-one.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "capif-provider-one.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "capif-provider-one.labels" -}} +helm.sh/chart: {{ include "capif-provider-one.chart" . }} +{{ include "capif-provider-one.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "capif-provider-one.selectorLabels" -}} +app.kubernetes.io/name: {{ include "capif-provider-one.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "capif-provider-one.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "capif-provider-one.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/capif-provider-one/templates/deployment.yaml b/capif-provider-one/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a713b6cc4f21ca6653660331b5008506c8f43d6a --- /dev/null +++ b/capif-provider-one/templates/deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "capif-provider-one.fullname" . }}-provider + labels: + io.kompose.service: capif-provider-one + {{- include "capif-provider-one.labels" . | nindent 4 }} + annotations: + kompose.cmd: kompose -f docker-compose.yml convert + kompose.version: 1.28.0 (c4137012e) +spec: + replicas: {{ .Values.oneProviderGui.replicas }} + selector: + matchLabels: + io.kompose.service: capif-provider-one + {{- include "capif-provider-one.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + io.kompose.service: capif-provider-one + {{- include "capif-provider-one.selectorLabels" . | nindent 8 }} + annotations: + kompose.cmd: kompose -f docker-compose.yml convert + kompose.version: 1.28.0 (c4137012e) + spec: + imagePullSecrets: + - name: regcred + {{- if eq .Values.environment "kubernetes-athens" }} + hostAliases: + - ip: "{{ .Values.ingress_ip.athens }}" + hostnames: + - "{{ .Values.oneProviderGui.oneProviderGui.env.capifHostname }}" + {{- end }} + {{- if eq .Values.environment "kubernetes-uma" }} + hostAliases: + - ip: "{{ .Values.ingress_ip.uma }}" + hostnames: + - "{{ .Values.oneProviderGui.oneProviderGui.env.capifHostname }}" + {{- end }} + containers: + - env: + - name: CAPIF_HOSTNAME + value: {{ quote .Values.oneProviderGui.oneProviderGui.env.capifHostname }} + - name: CAPIF_PORT + value: {{ quote .Values.oneProviderGui.oneProviderGui.env.capifPort }} + - name: EASY_RSA_PORT + value: {{ quote .Values.oneProviderGui.oneProviderGui.env.easyRsaPort }} + - name: REQUESTS_CA_BUNDLE + value: {{ quote .Values.oneProviderGui.oneProviderGui.env.requestsCaBundle }} + - name: SSL_CERT_FILE + value: {{ quote .Values.oneProviderGui.oneProviderGui.env.sslCertFile }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.oneProviderGui.oneProviderGui.image.repository }}-{{ .Values.oneProviderGui.oneProviderGui.image.tag + | default .Chart.AppVersion }} + imagePullPolicy: Always + name: one-provider-gui + ports: + - containerPort: 8085 + resources: {} + restartPolicy: Always \ No newline at end of file diff --git a/capif-provider-one/templates/service.yaml b/capif-provider-one/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e718e848195a2a6e2f5bee3d1afeee0aae81b378 --- /dev/null +++ b/capif-provider-one/templates/service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: capif-provider-one + labels: + io.kompose.service: capif-provider-one + {{- include "capif-provider-one.labels" . | nindent 4 }} + annotations: + kompose.cmd: kompose -f docker-compose.yml convert + kompose.version: 1.28.0 (c4137012e) +spec: + type: {{ .Values.oneProviderGui.type }} + selector: + io.kompose.service: capif-provider-one + {{- include "capif-provider-one.selectorLabels" . | nindent 4 }} + ports: + {{- .Values.oneProviderGui.ports | toYaml | nindent 2 -}} \ No newline at end of file diff --git a/capif-provider-one/values.yaml b/capif-provider-one/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a240203625f46b5cda18fd9ecfebdf8fab91cb41 --- /dev/null +++ b/capif-provider-one/values.yaml @@ -0,0 +1,26 @@ +# -- The Environment variable. It accepts: 'kuberentes-athens', 'kuberentes-uma', 'openshift' +environment: "openshift" + +# -- If env: 'kuberentes-athens' or env: 'kuberentes-uma', use the Ip address dude for the kubernetes to your Ingress Controller ej: kubectl -n NAMESPACE_CAPIF get ing s +ingress_ip: + athens: "10.161.1.126" + uma: "10.11.23.49" + +oneProviderGui: + oneProviderGui: + env: + capifHostname: my-capif.apps.ocp-epg.hi.inet + capifPort: "80" + easyRsaPort: "8083" + requestsCaBundle: /usr/src/app/ca.crt + sslCertFile: /usr/src/app/ca.crt + image: + repository: 709233559969.dkr.ecr.eu-central-1.amazonaws.com/evolved5g:capif-one-provider-gui + tag: "" + ports: + - name: "capif-provider-one" + port: 8085 + targetPort: 8085 + type: ClusterIP + +kubernetesClusterDomain: cluster.local \ No newline at end of file diff --git a/cleanup_docker_containers.sh b/cleanup_docker_containers.sh new file mode 100755 index 0000000000000000000000000000000000000000..173766f4246278e0152565ef3bcfc620f130128d --- /dev/null +++ b/cleanup_docker_containers.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker-compose down --rmi all --remove-orphans + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..ac160261778589a784f1fb40aafb5086f64f1ab7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: '3' + +services: + one_provider_gui: + image: dockerhub.hi.inet/evolved-5g/capif/one_provider_gui:latest + hostname: exposer + container_name: one_provider_gui + build: + context: ./one_provider_gui + volumes: + - ./one_provider_gui:/usr/src/app + environment: + - CAPIF_HOSTNAME=${CAPIF_HOSTNAME} + - CAPIF_PORT=8080 + - REGISTER_HOSTNAME=register + - REGISTER_PORT=8084 + + extra_hosts: + - host.docker.internal:host-gateway + - capifcore:host-gateway + - register:host-gateway + +networks: + default: + external: + name: capif-network + diff --git a/one_provider_gui/Dockerfile b/one_provider_gui/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..91a058366ac09561905f30b4025794a8de096227 --- /dev/null +++ b/one_provider_gui/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.8 +ENV PYTHONUNBUFFERED 1 + +RUN apt-get update && apt-get install -y jq && apt-get clean + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app +ADD requirements.txt /usr/src/app/ +RUN pip install -r requirements.txt + +ADD . /usr/src/app/ +RUN mkdir -p ./capif_ops/certs + +EXPOSE 8085 + +CMD ["sh", "prepare.sh"] \ No newline at end of file diff --git a/one_provider_gui/Pipfile b/one_provider_gui/Pipfile new file mode 100644 index 0000000000000000000000000000000000000000..c398581f91f3c61d4cff6aceb5718439b7e497ad --- /dev/null +++ b/one_provider_gui/Pipfile @@ -0,0 +1,13 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +pymongo = "==3.12.0" +inject = "==4.3.1" + +[dev-packages] + +[requires] +python_version = "3.8" diff --git a/one_provider_gui/capif_ops/__init__.py b/one_provider_gui/capif_ops/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/one_provider_gui/capif_ops/certs/.gitkeep b/one_provider_gui/capif_ops/certs/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/one_provider_gui/capif_ops/config_files/api_provider_domain.json b/one_provider_gui/capif_ops/config_files/api_provider_domain.json new file mode 100644 index 0000000000000000000000000000000000000000..12fbbe7b27df6e3dd5afae08446daa24049c3b6d --- /dev/null +++ b/one_provider_gui/capif_ops/config_files/api_provider_domain.json @@ -0,0 +1,24 @@ +{ + "apiProvFuncs": [ + { + "regInfo": { + "apiProvPubKey": "" + }, + "apiProvFuncRole": "AEF" + }, + { + "regInfo": { + "apiProvPubKey": "" + }, + "apiProvFuncRole": "APF" + }, + { + "regInfo": { + "apiProvPubKey": "" + }, + "apiProvFuncRole": "AMF" + } + ], + "suppFeat": "fff", + "failReason": "string" +} diff --git a/one_provider_gui/capif_ops/config_files/credentials.properties b/one_provider_gui/capif_ops/config_files/credentials.properties new file mode 100644 index 0000000000000000000000000000000000000000..6db6f26a7b646625595b2528f76e76d2b6372df5 --- /dev/null +++ b/one_provider_gui/capif_ops/config_files/credentials.properties @@ -0,0 +1,12 @@ +[credentials] +exposer_username = ocf_user +exposer_password = user_pass +exposer_description = Exposer (APF, AMF, AEF) +exposer_email = ocf@gg.com +exposer_enterprise = ETSI +exposer_country = Spain +exposer_purpose = Use OCF +exposer_phone = +123456789 +exposer_web = https://ocf.etsi.org/ +capif_callback_ip = host.docker.internal +capif_callback_port = 8087 \ No newline at end of file diff --git a/one_provider_gui/capif_ops/config_files/events_values.json b/one_provider_gui/capif_ops/config_files/events_values.json new file mode 100644 index 0000000000000000000000000000000000000000..de9adc54e0db4bf73acb38275f69f6759bff1d4e --- /dev/null +++ b/one_provider_gui/capif_ops/config_files/events_values.json @@ -0,0 +1,32 @@ +{ + "events": ["API_INVOKER_ONBOARDED", + "API_INVOKER_OFFBOARDED", + "ACCESS_CONTROL_POLICY_UPDATE", + "ACCESS_CONTROL_POLICY_UNAVAILABLE", + "API_INVOKER_UPDATED"], + "notificationDestination": "http://192.168.100.26:2222", + "supportedFeatures": "fffffff", + "securityInfo": [ + { + "authenticationInfo": "authenticationInfo", + "authorizationInfo": "authorizationInfo", + "interfaceDetails": { + "ipv4Addr": "10.95.47.147", + "securityMethods": ["PSK"], + "port": 2222 + }, + "prefSecurityMethods": ["PSK", "PKI", "OAUTH"] + }, + { + "authenticationInfo": "authenticationInfo", + "authorizationInfo": "authorizationInfo", + "prefSecurityMethods": ["PSK", "PKI", "OAUTH"], + "aefId": "aefId" + } + ], + "websockNotifConfig": { + "requestWebsocketUri": true, + "websocketUri": "websocketUri" + }, + "requestTestNotification": true + } \ No newline at end of file diff --git a/one_provider_gui/capif_ops/provider_admin_login.py b/one_provider_gui/capif_ops/provider_admin_login.py new file mode 100644 index 0000000000000000000000000000000000000000..38f59d2c9af221f515acefa0d45e330ddcd82ed6 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_admin_login.py @@ -0,0 +1,70 @@ +import requests +import json +import configparser +import os +from termcolor import colored +import warnings +from urllib3.exceptions import InsecureRequestWarning + +class LoginAdmin(): + + warnings.filterwarnings("ignore", category=InsecureRequestWarning) + + def __login_admin__(self, register_ip, register_port, user, passw, log_level): + + url = "https://{}:{}/login".format(register_ip,register_port) + + print(colored("\nLogin admin", "yellow")) + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request admin credentials: {user}/{passw}", "yellow")) + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + try: + response = requests.request("POST", url, verify=False, auth=(user, passw)) + + response.raise_for_status() + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + response_payload = json.loads(response.text) + return response_payload['refresh_token'], response_payload['access_token'] + except requests.exceptions.HTTPError as err: + raise Exception(err.response.status_code) + + + + def execute_login_admin(self, admin_username, admin_pass, log_level): + + register_ip = os.getenv('REGISTER_HOSTNAME') + register_port = os.getenv('REGISTER_PORT') + + if os.path.exists("capif_ops/config_files/demo_values.json"): + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + else: + demo_values = {} + + try: + refresh_token, access_token = self.__login_admin__(register_ip, register_port, admin_username, admin_pass, log_level) + demo_values['refresh_token'] = refresh_token + demo_values['access_token']= access_token + + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + + print(colored(f"\nAccess token: {access_token} received.\n","green")) + + except Exception as e: + status_code = e.args[0] + if status_code == 401: + print(colored(f"\nUnauthorized credentials.\n", "red")) + else: + print(colored(f"\n{e}.\n", "red")) + + return True diff --git a/one_provider_gui/capif_ops/provider_aef_publish_service.py b/one_provider_gui/capif_ops/provider_aef_publish_service.py new file mode 100644 index 0000000000000000000000000000000000000000..741f6f1d15cfe2ee5d195842200306f4c1cec477 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_aef_publish_service.py @@ -0,0 +1,81 @@ +import requests +import json +import configparser +import os +from datetime import datetime, timedelta +from termcolor import colored + + +class PublishService(): + + def __publish_service_api_to_capif(self, capif_ip, apf_id, aef_id, payload_dict, log_level): + + print(colored("\nPublishing api service to CAPIF", "yellow")) + + url = 'https://{}/published-apis/v1/{}/service-apis'.format(capif_ip, apf_id) + for profile in payload_dict["aefProfiles"]: + profile["aefId"] = aef_id + for version in profile["versions"]: + expiry = datetime.now() + timedelta(days=365) + version["expiry"]=expiry.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]+"Z" + + + headers = { + 'Content-Type': 'application/json' + } + + payload = json.dumps(payload_dict, indent=2) + #print(colored(f"Request Body: {payload}", "yellow")) + + try: + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"Request body: {payload}", "yellow")) + print(colored(f"''''''''''REQUEST'''''''''''''''''\n", "yellow")) + + response = requests.request("POST", url, headers=headers, data=json.dumps(payload_dict), cert=('capif_ops/certs/APF_dummy.crt', 'capif_ops/certs/APF_private_key.key'), verify='capif_ops/certs/ca.crt') + response.raise_for_status() + response_payload = json.loads(response.text) + + + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("Success, registered api service to CAPIF","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + return response_payload['apiId'] + except requests.exceptions.HTTPError as err: + message = json.loads(err.response.text) + status = err.response.status_code + raise Exception(message, status) + + + def execute_publish(self, route, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + with open('capif_ops/config_files//demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + capif_ip = os.getenv('CAPIF_HOSTNAME') + #Publish service in CAPIF + try: + payload = open(route, 'rb') + payload_dict = json.load(payload) + + if 'apf_id' in demo_values: + service_api_id = self.__publish_service_api_to_capif(capif_ip, demo_values['apf_id'], demo_values['aef_id'], payload_dict, log_level) + + demo_values[f"{payload_dict['apiName']}_id"]= service_api_id + print(colored(f"\nService Api Id: {service_api_id}\n", "green")) + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + except Exception as e: + print(colored(f"\n{e}\n", "red")) + return True diff --git a/one_provider_gui/capif_ops/provider_aef_remove_service.py b/one_provider_gui/capif_ops/provider_aef_remove_service.py new file mode 100644 index 0000000000000000000000000000000000000000..e3acafdcf0f87ddf9d2c911fbeaa854dddd5cd7c --- /dev/null +++ b/one_provider_gui/capif_ops/provider_aef_remove_service.py @@ -0,0 +1,69 @@ +import requests +import json +import configparser +import os +from termcolor import colored + + +class RemoveService(): + + def __remove_service_api_to_capif(self, capif_ip, apf_id, service_api_id, log_level): + + print(colored("\nRemoving api service from CAPIF", "yellow")) + + url = 'https://{}/published-apis/v1/{}/service-apis/{}'.format(capif_ip, apf_id, service_api_id) + + headers = { + 'Content-Type': 'application/json' + } + + try: + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"''''''''''REQUEST'''''''''''''''''\n", "yellow")) + + response = requests.request("DELETE", url, headers=headers, cert=('capif_ops/certs/APF_dummy.crt', 'capif_ops/certs/APF_private_key.key'), verify='capif_ops/certs/ca.crt') + response.raise_for_status() + + + if log_level == "debug": + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("Success, remove api service from CAPIF","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + + except requests.exceptions.HTTPError as err: + message = json.loads(err.response.text) + status = err.response.status_code + raise Exception(message, status) + + + def execute_remove(self, name, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + with open('capif_ops/config_files//demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + capif_ip = os.getenv('CAPIF_HOSTNAME') + + + #Publish service in CAPIF + try: + self.__remove_service_api_to_capif(capif_ip, demo_values['apf_id'], demo_values[f"{name}_id"], log_level) + + with open('capif_ops/config_files//demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + + print(colored(f"\nService Api {name} with id {demo_values[f'{name}_id']}, removed\n", "green")) + demo_values.pop(f"{name}_id") + + + except Exception as e: + print(colored(f"\n{e}\n", "red")) + return True diff --git a/one_provider_gui/capif_ops/provider_delete.py b/one_provider_gui/capif_ops/provider_delete.py new file mode 100644 index 0000000000000000000000000000000000000000..da36cb2dddd210d3339f0606d576937cada51922 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_delete.py @@ -0,0 +1,69 @@ +import requests +import json +import configparser +import os +from termcolor import colored + + +class RemoveProvider(): + + def __offboard_provider_to_capif(self, capif_ip, api_prov_dom_id, log_level): + + print(colored("\nOffboarding provider to CAPIF", "yellow")) + + url = 'https://{}/api-provider-management/v1/registrations/{}'.format(capif_ip, api_prov_dom_id) + + headers = { + 'Content-Type': 'application/json' + } + + + try: + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"''''''''''REQUEST'''''''''''''''''\n", "yellow")) + + response = requests.request("DELETE", url, headers=headers, cert=('capif_ops/certs/AMF_dummy.crt', 'capif_ops/certs/AMF_private_key.key'), verify='capif_ops/certs/ca.crt') + response.raise_for_status() + + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("Success, removed provider from CAPIF","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + + except requests.exceptions.HTTPError as err: + message = json.loads(err.response.text) + status = err.response.status_code + raise Exception(message, status) + + + def execute_remove_provider(self, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + with open('capif_ops/config_files//demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + capif_ip = os.getenv('CAPIF_HOSTNAME') + + + #Publish service in CAPIF + try: + if 'api_prov_dom_id' in demo_values: + self.__offboard_provider_to_capif(capif_ip, demo_values['api_prov_dom_id'], log_level) + + print(colored(f"\nProvider {demo_values['api_prov_dom_id']} removed\n", "green")) + demo_values.pop("api_prov_dom_id") + demo_values.pop("apf_id") + demo_values.pop("aef_id") + with open('capif_ops/config_files//demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + except Exception as e: + print(colored(f"\n{e}.\n", "red")) + return True diff --git a/one_provider_gui/capif_ops/provider_get_auth.py b/one_provider_gui/capif_ops/provider_get_auth.py new file mode 100644 index 0000000000000000000000000000000000000000..cefd0b0b6e2034ca9255357c071a7c314e7ffb25 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_get_auth.py @@ -0,0 +1,80 @@ +import requests +import json +import configparser +import os +from termcolor import colored + +class PreviousAuth(): + + def __get_capif_auth(self, register_ip, register_port, username, password, log_level): + + #print("Geting Auth to exposer") + #url = "https://register:8084/getauth".format(capif_port) + url = "https://{}:{}/getauth".format(register_ip, register_port) + + + try: + print(colored("\nGetting authorization token", "yellow")) + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request user: {username}/{password}", "yellow")) + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + response = requests.request("GET", url, verify=False, auth=(username, password)) + + response.raise_for_status() + response_payload = json.loads(response.text) + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + return response_payload + + except requests.exceptions.HTTPError as err: + raise Exception(err.response.text, err.response.status_code) + + + def execute_get_auth(self, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + username = config.get("credentials", "exposer_username") + password = config.get("credentials", "exposer_password") + + + register_ip = os.getenv('REGISTER_HOSTNAME') + register_port = os.getenv('REGISTER_PORT') + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + try: + response = self.__get_capif_auth(register_ip, register_port, username, password, log_level) + demo_values['capif_access_token_exposer'] = response["access_token"] + demo_values['ccf_api_onboarding_url'] = response["ccf_api_onboarding_url"] + demo_values['ccf_discover_url'] = response["ccf_discover_url"] + demo_values['ccf_onboarding_url'] = response["ccf_onboarding_url"] + demo_values['ccf_publish_url'] = response["ccf_publish_url"] + demo_values['ccf_security_url'] = response["ccf_security_url"] + ca_root = response["ca_root"] + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + + certification_file = open('capif_ops/certs/ca.crt', 'w') + certification_file.write(ca_root) + + print(colored("\nCertificate ca_root, token and URLs received\n","green")) + except Exception as e: + status_code = e.args[0] + if status_code == 409: + print(colored("\nUser already registed. Continue with token request\n", "red")) + print("User already registed. Continue with token request\n") + else: + print(colored(f"\n{e}.\n", "red")) + + + return True diff --git a/one_provider_gui/capif_ops/provider_get_publish_service.py b/one_provider_gui/capif_ops/provider_get_publish_service.py new file mode 100644 index 0000000000000000000000000000000000000000..a5ab7629a634883a4f8245ac7084589d708994d3 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_get_publish_service.py @@ -0,0 +1,74 @@ +import requests +import json +import configparser +import os +from datetime import datetime, timedelta +from termcolor import colored + + +class GetPublishService(): + + def __get_service_apis(self, capif_ip, apf_id, log_level): + + + url = 'https://{}/published-apis/v1/{}/service-apis'.format(capif_ip, apf_id) + + + headers = { + 'Content-Type': 'application/json' + } + + #print(colored(f"Request Body: {payload}", "yellow")) + + try: + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"''''''''''REQUEST'''''''''''''''''\n", "yellow")) + + response = requests.request("GET", url, headers=headers, cert=('capif_ops/certs/APF_dummy.crt', 'capif_ops/certs/APF_private_key.key'), verify='capif_ops/certs/ca.crt') + response.raise_for_status() + response_payload = json.loads(response.text) + + + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("Success, registered api service to CAPIF","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + return response_payload + except requests.exceptions.HTTPError as err: + message = json.loads(err.response.text) + status = err.response.status_code + raise Exception(message, status) + + + def execute_get_publish(self, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + with open('capif_ops/config_files//demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + capif_ip = os.getenv('CAPIF_HOSTNAME') + #Publish service in CAPIF + try: + + if 'apf_id' in demo_values: + api_list = self.__get_service_apis(capif_ip, demo_values['apf_id'], log_level) + if len(api_list)==0: + print(colored("\nYou have not published APIs yet", "red")) + else: + print(colored("\nPublished APIs:", "yellow")) + for api in api_list: + print(colored(f"{api['apiName']}", "green")) + + print("\n") + except Exception as e: + print(colored(f"\n{e}\n", "red")) + return True diff --git a/one_provider_gui/capif_ops/provider_previous_register.py b/one_provider_gui/capif_ops/provider_previous_register.py new file mode 100644 index 0000000000000000000000000000000000000000..dcf6ca2668f61429d0006262d14c31b048f6a386 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_previous_register.py @@ -0,0 +1,103 @@ +import requests +import json +import configparser +import os +from termcolor import colored +import warnings +from urllib3.exceptions import InsecureRequestWarning + +class PreviousRegister(): + + warnings.filterwarnings("ignore", category=InsecureRequestWarning) + + def __register_exposer_to_capif(self, register_ip, register_port, username, password, description, email, enterprise, country, purpose, phone_number, website, access_token, log_level): + + url = "https://{}:{}/createUser".format(register_ip,register_port) + + payload = dict() + payload['username'] = username + payload['password'] = password + payload['enterprise'] = enterprise + payload['description'] = description + payload['email'] = email + payload['country'] = country + payload['purpose'] = purpose + payload['phone_number'] = phone_number + payload['website'] = website + + headers = { + 'Authorization': 'Bearer {}'.format(access_token), + 'Content-Type': 'application/json' + } + + print(colored("\nRegistering user", "yellow")) + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"Request Body: {payload}", "yellow")) + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + + try: + response = requests.request("POST", url, headers=headers, data=json.dumps(payload), verify=False) + response.raise_for_status() + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + response_payload = json.loads(response.text) + + return response_payload['uuid'] + except requests.exceptions.HTTPError as err: + raise Exception(err.response.status_code) + + + + def execute_previous_register_provider(self, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + username = config.get("credentials", "exposer_username") + password = config.get("credentials", "exposer_password") + description = config.get("credentials", "exposer_description") + email = config.get("credentials", "exposer_email") + enterprise = config.get("credentials", "exposer_enterprise") + country = config.get("credentials", "exposer_country") + purpose = config.get("credentials", "exposer_purpose") + phone_number = config.get("credentials", "exposer_phone") + website = config.get("credentials", "exposer_web") + + register_ip = os.getenv('REGISTER_HOSTNAME') + register_port = os.getenv('REGISTER_PORT') + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + + #First we need register exposer in CAPIF + if "access_token" not in demo_values: + print(colored("\nYou need the admin access token to create an user. Use login_admin command to receive the token.\n", "red")) + return True + try: + uuid = self.__register_exposer_to_capif(register_ip, register_port, username, password, description, email, enterprise, country, purpose, phone_number, website, demo_values["access_token"], log_level) + demo_values['user_uuid'] = uuid + + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + + print(colored(f"\nUser created with id : {uuid}.\n","green")) + + except Exception as e: + status_code = e.args[0] + if status_code == 401: + print(colored("\nAccess token expired.\n", "red")) + elif status_code == 409: + print(colored("\nThe user is already registered\n", "red")) + else: + print(colored(f"\n{e}.\n", "red")) + + return True diff --git a/one_provider_gui/capif_ops/provider_refresh_admin_token.py b/one_provider_gui/capif_ops/provider_refresh_admin_token.py new file mode 100644 index 0000000000000000000000000000000000000000..1c2a61d04817bb52fbbe251fc830360e106e9d46 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_refresh_admin_token.py @@ -0,0 +1,69 @@ +import requests +import json +import configparser +import os +from termcolor import colored +import warnings +from urllib3.exceptions import InsecureRequestWarning + +class refreshAdmin(): + + warnings.filterwarnings("ignore", category=InsecureRequestWarning) + + def __refresh_admin_token__(self, register_ip, register_port, refresh_token, log_level): + + url = "https://{}:{}/refresh".format(register_ip,register_port) + + headers = { + 'Authorization': 'Bearer {}'.format(refresh_token), + } + + print(colored("\nRefreshing admin tokens", "yellow")) + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + try: + response = requests.request("POST", url, headers=headers, verify=False) + response.raise_for_status() + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + response_payload = json.loads(response.text) + return response_payload['access_token'] + except requests.exceptions.HTTPError as err: + raise Exception(err.response.status_code) + + + + def execute_refresh_admin(self, log_level=None): + + register_ip = os.getenv('REGISTER_HOSTNAME') + register_port = os.getenv('REGISTER_PORT') + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + try: + if "refresh_token" not in demo_values: + print(colored(f"\nYou need to log in as an administrator to receive the refresh token.\n", "red")) + return True + + access_token = self.__refresh_admin_token__(register_ip, register_port, demo_values["refresh_token"], log_level) + demo_values['access_token']= access_token + + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + + print(colored(f"\nAccess token: {access_token} received.\n","green")) + + except Exception as e: + status_code = e.args[0] + print(colored(f"\n{e}.\n", "red")) + + return True diff --git a/one_provider_gui/capif_ops/provider_register_capif.py b/one_provider_gui/capif_ops/provider_register_capif.py new file mode 100644 index 0000000000000000000000000000000000000000..ebd36e099206939bdc7e5087f0ea1185d9c8cdc5 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_register_capif.py @@ -0,0 +1,146 @@ + +import requests +import json +import configparser +import os +from termcolor import colored + +# Get environment variables + + +from OpenSSL.SSL import FILETYPE_PEM +from OpenSSL.crypto import (dump_certificate_request, dump_privatekey, load_publickey, PKey, TYPE_RSA, X509Req, dump_publickey) + +class RegisterProvider(): + + def __create_csr(self, name): + + # create public/private key + key = PKey() + key.generate_key(TYPE_RSA, 2048) + + # Generate CSR + req = X509Req() + req.get_subject().CN = name + req.get_subject().O = 'Telefonica I+D' + req.get_subject().C = 'ES' + req.set_pubkey(key) + req.sign(key, 'sha256') + + + csr_request = dump_certificate_request(FILETYPE_PEM, req) + + private_key = dump_privatekey(FILETYPE_PEM, key) + + return csr_request, private_key + + + def __register_api_provider_to_capif(self, capif_ip, ccf_url, access_token, name, log_level): + + print(colored("\nRegistering api provider to CAPIF", "yellow")) + + url = 'https://{}/{}'.format(capif_ip, ccf_url) + json_file = open('capif_ops/config_files/api_provider_domain.json', "rb") + payload_dict = json.load(json_file) + payload_dict["regSec"]=access_token + payload_dict["apiProvDomInfo"]=name + + + for api_func in payload_dict['apiProvFuncs']: + public_key, private_key = self.__create_csr(api_func["apiProvFuncRole"]) + api_func["regInfo"]["apiProvPubKey"] = public_key.decode("utf-8") + api_func["apiProvFuncInfo"] = name + "_" + api_func["apiProvFuncRole"] + private_key_file = open("capif_ops/certs/"+api_func["apiProvFuncRole"]+"_private_key.key", 'wb+') + private_key_file.write(bytes(private_key)) + private_key_file.close() + + payload = json.dumps(payload_dict, indent=2) + + headers = { + 'Authorization': 'Bearer {}'.format(access_token), + 'Content-Type': 'application/json' + } + + + + #print(colored(f"Request Body: {payload}", "yellow")) + + try: + + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"Request Body: {payload}", "yellow")) + print(colored(f"''''''''''REQUEST'''''''''''''''''\n", "yellow")) + + response = requests.request("POST", url, headers=headers, data=payload, verify='capif_ops/certs/ca.crt') + response.raise_for_status() + response_payload = json.loads(response.text) + + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("Success, registered api provider domain to CAPIF","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + + for func_provile in response_payload["apiProvFuncs"]: + # if log_level == "debug": + # #print(func_provile['regInfo']['apiProvCert']) + certification_file = open("capif_ops/certs/"+func_provile["apiProvFuncRole"]+'_dummy.crt', 'wb') + certification_file.write(bytes(func_provile['regInfo']['apiProvCert'], 'utf-8')) + certification_file.close() + + return response_payload + + except requests.exceptions.HTTPError as err: + message = json.loads(err.response.text) + status = err.response.status_code + raise Exception(message, status) + + + + + def execute_register_provider(self, name, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + capif_ip = os.getenv('CAPIF_HOSTNAME') + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + try: + if 'ccf_api_onboarding_url' in demo_values and "capif_access_token_exposer" in demo_values and "api_prov_dom_id" not in demo_values: + + capif_access_token = demo_values['capif_access_token_exposer'] + ccf_api_onboarding_url = demo_values['ccf_api_onboarding_url'] + + response = self.__register_api_provider_to_capif(capif_ip, ccf_api_onboarding_url, capif_access_token, name, log_level) + + for api_prov_func in response["apiProvFuncs"]: + if api_prov_func["apiProvFuncRole"] == "AEF": + demo_values["aef_id"] = api_prov_func["apiProvFuncId"] + elif api_prov_func["apiProvFuncRole"] == "APF": + demo_values["apf_id"] = api_prov_func["apiProvFuncId"] + + api_prov_dom_id = response["apiProvDomId"] + demo_values["api_prov_dom_id"] = api_prov_dom_id + + print(colored(f"\nAPI provider domain Id: {api_prov_dom_id}\n","green")) + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + else: + print(colored("\nAPI provider domain already registered.\n", "red")) + except Exception as e: + status_code = e.args[0] + if status_code == 403: + print(colored("\nAPI provider domain already registered.\n", "red")) + else: + print(colored(f"\n{e}\n", "red")) + + return True diff --git a/one_provider_gui/capif_ops/provider_register_events.py b/one_provider_gui/capif_ops/provider_register_events.py new file mode 100644 index 0000000000000000000000000000000000000000..b5f13853613d479272d0e760d85f69f0fb05b5a7 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_register_events.py @@ -0,0 +1,75 @@ +import requests +import json +import configparser +import os +from termcolor import colored + + +class AddEvents(): + + def __add_events_to_capif(self, capif_ip, apf_id, log_level): + + print(colored("\nSubscribing to events", "yellow")) + + url = 'https://{}/capif-events/v1/{}/subscriptions'.format(capif_ip, apf_id) + payload = open('capif_ops/config_files/events_values.json', 'rb') + payload_dict = json.load(payload) + + headers = { + 'Content-Type': 'application/json' + } + + payload = json.dumps(payload_dict, indent=2) + + try: + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"Request Headers: {headers}", "yellow")) + print(colored(f"Request Body: {payload}", "yellow")) + print(colored(f"''''''''''REQUEST'''''''''''''''''\n", "yellow")) + + response = requests.request("POST", url, headers=headers, data=json.dumps(payload_dict), cert=('capif_ops/certs/APF_dummy.crt', 'capif_ops/certs/APF_private_key.key'), verify=False) + response.raise_for_status() + response_payload = json.loads(response.text) + + + if log_level == "debug": + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response: {json.dumps(response.json(), indent=2)}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("Success, events subscribed ","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + + header = response.headers.get("Location") + + return header.split('/')[len(header.split('/'))-1] + except requests.exceptions.HTTPError as err: + message = json.loads(err.response.text) + status = err.response.status_code + raise Exception(message, status) + + + def execute_add_events(self, log_level): + + config = configparser.ConfigParser() + config.read('capif_ops/config_files/credentials.properties') + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + demo_values = json.load(demo_file) + + capif_ip = os.getenv('CAPIF_HOSTNAME') + + + #Add the event in CAPIF + try: + subscription_id = self.__add_events_to_capif(capif_ip, demo_values['apf_id'], log_level) + demo_values['subscription_id']= subscription_id + print(colored("\nEvents subscription id: {}\n".format(subscription_id),"green")) + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + except Exception as e: + print(colored(f"\n{e}\n", "red")) + return True \ No newline at end of file diff --git a/one_provider_gui/capif_ops/provider_remove_user.py b/one_provider_gui/capif_ops/provider_remove_user.py new file mode 100644 index 0000000000000000000000000000000000000000..8f0add90ea023b76dd7639ee4cc39d9e01c62da0 --- /dev/null +++ b/one_provider_gui/capif_ops/provider_remove_user.py @@ -0,0 +1,92 @@ +import requests +import json +import configparser +import os +from termcolor import colored +import warnings +from urllib3.exceptions import InsecureRequestWarning + +class RemoveUser(): + + def __delete_user(self, register_ip, register_port, uuid, access_token, log_level): + + url = "https://{}:{}/deleteUser/{}".format(register_ip, register_port, uuid) + + headers = { + 'Authorization': 'Bearer {}'.format(access_token), + } + + try: + print(colored("\nRemoving User\n", "yellow")) + if log_level == "debug": + if log_level == "debug": + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + print(colored(f"Request: to {url}","yellow")) + print(colored(f"User uuid: {uuid}", "yellow")) + print(colored("''''''''''REQUEST'''''''''''''''''","yellow")) + + response = requests.request("DELETE", url, headers=headers, verify=False) + + if log_level == "debug": + print(colored("\n''''''''''RESPONSE'''''''''''''''''","green")) + print(colored(f"Response to: {response.url}","green")) + print(colored(f"Response Headers: {response.headers}","green")) + print(colored(f"Response Status code: {response.status_code}","green")) + print(colored("''''''''''RESPONSE'''''''''''''''''","green")) + + #response.raise_for_status() + #response_payload = json.loads(response.text) + print(colored("User Removed\n","green")) + + except requests.exceptions.HTTPError as err: + raise Exception(err.response.text, err.response.status_code) + + def execute_remove_user(self, log_level): + + register_ip = os.getenv('REGISTER_HOSTNAME') + register_port = os.getenv('REGISTER_PORT') + + with open('capif_ops/config_files/demo_values.json', 'r') as demo_file: + content = json.load(demo_file) + + if "user_uuid" not in content: + print(colored("\nUser uuid not found.\n", "red")) + return True + if "access_token" not in content: + print(colored("\nYou need the admin access token to remove an user. Use login_admin command to receive the token.\n", "red")) + return True + + try: + self.__delete_user(register_ip, register_port, content["user_uuid"], content["access_token"], log_level) + + except Exception as e: + status_code = e.args[0] + if status_code == 401: + print(colored("\nAccess token expired.\n", "red")) + else: + print(colored(f"\n{e}.\n", "red")) + + keys = ['refresh_token', 'access_token'] + + # Crear diccionario con los campos seleccionados + demo_values = {key: content[key] for key in keys if key in content} + + with open('capif_ops/config_files/demo_values.json', 'w') as outfile: + json.dump(demo_values, outfile) + + if os.path.exists("capif_ops/certs/AEF_dummy.crt"): + os.remove("capif_ops/certs/AEF_dummy.crt") + if os.path.exists("capif_ops/certs/AEF_private_key.key"): + os.remove("capif_ops/certs/AEF_private_key.key") + if os.path.exists("capif_ops/certs/AMF_dummy.crt"): + os.remove("capif_ops/certs/AMF_dummy.crt") + if os.path.exists("capif_ops/certs/AMF_private_key.key"): + os.remove("capif_ops/certs/AMF_private_key.key") + if os.path.exists("capif_ops/certs/APF_dummy.crt"): + os.remove("capif_ops/certs/APF_dummy.crt") + if os.path.exists("capif_ops/certs/APF_private_key.key"): + os.remove("capif_ops/certs/APF_private_key.key") + if os.path.exists("capif_ops/certs/ca.crt"): + os.remove("capif_ops/certs/ca.crt") + + return True diff --git a/one_provider_gui/main.py b/one_provider_gui/main.py new file mode 100644 index 0000000000000000000000000000000000000000..6da5430181703e6d84a60842caee65c91abbd4e6 --- /dev/null +++ b/one_provider_gui/main.py @@ -0,0 +1,139 @@ +from cmd import Cmd +from capif_ops.provider_previous_register import PreviousRegister +from capif_ops.provider_register_capif import RegisterProvider +from capif_ops.provider_aef_publish_service import PublishService +from capif_ops.provider_delete import RemoveProvider +from capif_ops.provider_get_auth import PreviousAuth +from capif_ops.provider_aef_remove_service import RemoveService +from capif_ops.provider_remove_user import RemoveUser +from capif_ops.provider_get_publish_service import GetPublishService +from capif_ops.provider_register_events import AddEvents +from capif_ops.provider_admin_login import LoginAdmin +from capif_ops.provider_refresh_admin_token import refreshAdmin +import shlex +import subprocess +from art import * +from termcolor import colored + +prev_register = PreviousRegister() +regiter_capif = RegisterProvider() +publish_service = PublishService() +remove_provider = RemoveProvider() +remove_service = RemoveService() +provider_auth = PreviousAuth() +remove_user = RemoveUser() +get_services = GetPublishService() +register_events = AddEvents() +admin_login = LoginAdmin() +refresh_admin = refreshAdmin() + + +class CAPIFProvider(Cmd): + + def __init__(self): + Cmd.__init__(self) + self.prompt = "> " + self.intro = tprint("Welcome to Provider Console") + + def emptyline(self): + """Do nothing on empty input line""" + pass + + # def preloop(self): + # #state = prev_register.execute_previous_register_provider("") + # self.previous_register_state = state + + def precmd(self, line): + + args = shlex.split(line) + + if len(args) >= 1 and args[0] in ["goodbye"]: + print("The first argument is username") + return "" + + elif len(args) >= 1 and args[0] not in ["->", "wall", "follows", "exit", "help"]: + pass + + return line + + def do_login_admin(self, input): + 'Login with admin credentials to obtain the admin tokens' + args = input.split() + if len(args) < 2: + print(colored("\nLogin admin needs the username and password of the administrator.\n", "red")) + else: + arg1 = args[0] + arg2 = args[1] + arg3 = args[2] if len(args) > 2 else None + admin_login.execute_login_admin(arg1, arg2, arg3) + + def do_refresh_admin(self, input): + 'Refresh the admin access token' + refresh_admin.execute_refresh_admin(input) + + + def do_register_user(self, input): + 'Register an user from the registry service' + prev_register.execute_previous_register_provider(input) + + def do_register_provider(self, input): + 'Register a provider to CAPIF instance' + args = input.split() + if len(args) < 1: + print(colored("\nRegister provider needs the name of the provider.\n", "red")) + else: + arg1 = args[0] + arg2 = args[1] if len(args) > 1 else None + regiter_capif.execute_register_provider(arg1, arg2) + + def do_register_events(self, input): + 'Register events for provider' + register_events.execute_add_events(input) + + def do_publish_service(self, input): + 'Publish Service in CAPIF' + args = input.split() + if len(args) < 1: + print(colored("\nPublish service needs a json.\n", "red")) + else: + arg1 = args[0] + arg2 = args[1] if len(args) > 1 else None + publish_service.execute_publish(arg1, arg2) + + def do_provider_get_auth(self, input): + 'Get jwt token to register provider in CAPIF' + provider_auth.execute_get_auth(input) + + def do_remove_service(self, input): + 'Remove published service in CAPIF' + args = input.split() + if len(args) < 1: + print(colored("\nRemove service needs an API name.\n", "red")) + else: + arg1 = args[0] + arg2 = args[1] if len(args) > 1 else None + remove_service.execute_remove(arg1, arg2) + + def do_remove_provider(self, input): + 'Remove provider registered from CAPIF' + remove_provider.execute_remove_provider(input) + + def do_get_services(self, input): + 'Returns the APIs published by the APF' + get_services.execute_get_publish(input) + + def do_remove_user(self, input): + 'Delete a user from the registry service' + remove_user.execute_remove_user(input) + + def do_exit(self, input): + 'Exit program' + print('\nExiting...') + return True + + +if __name__ == '__main__': + try: + CAPIFProvider().cmdloop() + except KeyboardInterrupt: + print('\nExiting...') \ No newline at end of file diff --git a/one_provider_gui/prepare.sh b/one_provider_gui/prepare.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0ada4d1ceec6bf688cc1fabf5144b83f0061678 --- /dev/null +++ b/one_provider_gui/prepare.sh @@ -0,0 +1,8 @@ +if echo $CAPIF_HOSTNAME | grep -q ":"; +then + openssl s_client -connect $CAPIF_HOSTNAME | openssl x509 -text > ./capif_ops/certs/cert_server.pem +else + openssl s_client -connect $CAPIF_HOSTNAME:443 | openssl x509 -text > ./capif_ops/certs/cert_server.pem +fi + +tail -f /dev/null \ No newline at end of file diff --git a/one_provider_gui/requirements.txt b/one_provider_gui/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..172771b631d3affbd3b5f6acc64c03a322e5ad04 --- /dev/null +++ b/one_provider_gui/requirements.txt @@ -0,0 +1,10 @@ +requests +configparser +redis +pyopenssl +Flask >= 2.0.3 +termcolor +pyOpenSSL +art +pyone +flask_jwt_extended diff --git a/one_provider_gui/service/__init__.py b/one_provider_gui/service/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/one_provider_gui/service/demo_api_one.json b/one_provider_gui/service/demo_api_one.json new file mode 100644 index 0000000000000000000000000000000000000000..b02c43056491f54dbc58917c11167c83dde0e907 --- /dev/null +++ b/one_provider_gui/service/demo_api_one.json @@ -0,0 +1,63 @@ + +{ + "apiName": "demo_api_OCF", + "aefProfiles": [ + { + "aefId": "", + "versions": [ + { + "apiVersion": "v1", + "expiry": "2021-11-30T10:32:02.004Z", + "resources": [ + { + "resourceName": "create-vm-endpoint", + "commType": "REQUEST_RESPONSE", + "uri": "/hello", + "custOpName": "string", + "operations": [ + "POST" + ], + "description": "Endpoint to say hello" + } + ], + "custOperations": [ + { + "commType": "REQUEST_RESPONSE", + "custOpName": "string", + "operations": [ + "POST" + ], + "description": "string" + } + ] + } + ], + "protocol": "HTTP_1_1", + "dataFormat": "JSON", + "securityMethods": ["Oauth"], + "interfaceDescriptions": [ + { + "ipv4Addr": "one_provider_gui", + "port": 8088, + "securityMethods": ["Oauth"] + } + ] + } + ], + "description": "Hello api services", + "supportedFeatures": "fffff", + "shareableInfo": { + "isShareable": true, + "capifProvDoms": [ + "string" + ] + }, + "serviceAPICategory": "string", + "apiSuppFeats": "fffff", + "pubApiPath": { + "ccfIds": [ + "string" + ] + }, + "ccfId": "string" + } \ No newline at end of file diff --git a/one_provider_gui/service/events_destination.py b/one_provider_gui/service/events_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..b7c4a5206972daead69d913b99492665b8a72717 --- /dev/null +++ b/one_provider_gui/service/events_destination.py @@ -0,0 +1,26 @@ +from flask import Flask, request, jsonify +import json +from termcolor import colored + +app = Flask(__name__) + +@app.route('/', methods=['POST']) +def recibir_solicitud(): + try: + response = request.get_json() + + #print(json.dumps(response, indent=2)) + print(colored("\n''''''''''EVENT'''''''''''''''''","green")) + print(colored(f"{json.dumps(response, indent=2)}","green")) + print(colored("''''''''''EVENT'''''''''''''''''\n","green")) + print(colored(f"Response message: ","green")) + return jsonify({"\nmessage": "received"}) + + except Exception as e: + return jsonify({"error": str(e)}) + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=2222) + + + diff --git a/one_provider_gui/service/service_oauth.py b/one_provider_gui/service/service_oauth.py new file mode 100644 index 0000000000000000000000000000000000000000..3814270a2edb400b71d78a579ab0563d6c7e88f1 --- /dev/null +++ b/one_provider_gui/service/service_oauth.py @@ -0,0 +1,38 @@ +from flask import Flask, jsonify, request +from flask_jwt_extended import jwt_required, JWTManager, get_jwt_identity, get_jwt +import ssl +from werkzeug import serving +import socket, ssl +import OpenSSL +from OpenSSL import crypto +import jwt + +app = Flask(__name__) + +jwt_flask = JWTManager(app) + + +with open("../capif_ops/certs/cert_server.pem", "rb") as cert_file: + cert= cert_file.read() + +crtObj = crypto.load_certificate(crypto.FILETYPE_PEM, cert) +pubKeyObject = crtObj.get_pubkey() +pubKeyString = crypto.dump_publickey(crypto.FILETYPE_PEM,pubKeyObject) + +app.config['JWT_ALGORITHM'] = 'RS256' +app.config['JWT_PUBLIC_KEY'] = pubKeyString + + +@app.route("/hello", methods=["POST"]) +@jwt_required() +def hello(): + + request_data = request.get_json() + + user_name = request_data['name'] + + return jsonify(f"Welcome to OpenCAPIF {user_name}!") + + +if __name__ == '__main__': + serving.run_simple("0.0.0.0", 8088, app) \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..2661ac7fbbb5c06bb9eeff8f612fbfe81f6d199d --- /dev/null +++ b/run.sh @@ -0,0 +1,10 @@ +#!/bin/bash +HOSTNAME=capifcore +if [ "$#" -eq 1 ]; then + HOSTNAME=$1 +fi +echo CAPIF hostname will be $HOSTNAME + +docker network create demo-network + +CAPIF_HOSTNAME=$HOSTNAME docker-compose up --detach --remove-orphans --build diff --git a/terminal_to_py_aef.sh b/terminal_to_py_aef.sh new file mode 100755 index 0000000000000000000000000000000000000000..a23cca3e25f03e63338d394e3234dbe7757ceacc --- /dev/null +++ b/terminal_to_py_aef.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker exec -it $(docker ps -q -f "name=one_provider_gui") bash \ No newline at end of file