Commit d63d5a4f authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Merge branch 'feat/dockerfiles' into 'main'

Feat/dockerfiles

See merge request !6
parents 340604c4 06522a47
Loading
Loading
Loading
Loading
Loading

ci_cd_test/Dockerfile

0 → 100644
+28 −0
Original line number Diff line number Diff line
FROM labs.etsi.org:5050/ocf/capif/python:3-slim-bullseye

RUN apt update
RUN apt update && apt install -y git nano && \
    rm -rf /var/lib/apt/lists/*

ARG BRANCH=main

RUN echo "Cloning branch: ${BRANCH}" && \
    git clone -b ${BRANCH} https://labs.etsi.org/rep/ocf/sdk.git

WORKDIR /sdk

RUN python -m pip install --upgrade pip
RUN pip install -r installation/requirements.txt
RUN pip install .

# Ejecutar provider y luego invoker al iniciar el contenedor
ENTRYPOINT sh -c "\
  cd ci_cd_test/testing_samples/testing_provider_sample && \
  echo '🚀 Ejecutando provider...' && \
  python network_app_provider.py && \
  echo '✅ Provider finalizado.' && \
  cd ../testing_invoker_sample && \
  echo '🚀 Ejecutando invoker...' && \
  python network_app_invoker.py && \
  echo '✅ Invoker finalizado. Contenedor quedará activo.' && \
  tail -f /dev/null"
 No newline at end of file
+42 −0
Original line number Diff line number Diff line
{
  "capif_host": "capifcore",
  "register_host": "services-register-1",
  "capif_https_port": "443",
  "capif_register_port": "8080",
  "capif_username": "custom_user",
  "capif_password": "user_pass",
  "debug_mode": "True",
  "invoker": {
    "invoker_folder": "/sdk/testing_samples/testing_invoker_sample/test_invoker_certificate_folder",
    "capif_callback_url": "http://localhost:5000",
    "supported_features": "0",
    "check_authentication_data": {
      "ip": "",
      "port": ""
    },
    "cert_generation": {
      "csr_common_name": "sdk-capif-demo",
      "csr_organizational_unit": "discovery",
      "csr_organization": "telefonica",
      "csr_locality": "madrid",
      "csr_state_or_province_name": "madrid",
      "csr_country_name": "ES",
      "csr_email_address": "adios@gmail.com"
    },
    "discover_filter": {
      "api-name": "",
      "api-version": "",
      "comm-type": "",
      "protocol": "",
      "aef-id": "",
      "data-format": "",
      "api-cat": "",
      "preferred-aef-loc": "",
      "req-api-prov-name": "",
      "supported-features": "",
      "api-supported-features": "",
      "ue-ip-addr": "",
      "service-kpis": ""
    }
  }
}
+32 −0
Original line number Diff line number Diff line
import json
import time
import requests
from opencapif_sdk import capif_invoker_connector, service_discoverer
import logging


# Path to the OpenCAPIF SDK configuration file
capif_sdk_config_path = "./capif_sdk_config_sample.json"

import requests
import json

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)

    # Onboard the Invoker (creates keys, registers, obtains certs)
    capif_connector = capif_invoker_connector(config_file=capif_sdk_config_path)
    capif_connector.onboard_invoker()
    print("✅ INVOKER ONBOARDING COMPLETED")

    # Discover APIs and obtain JWT token
    discoverer = service_discoverer(config_file=capif_sdk_config_path)
    discoverer.discover()
    discoverer.get_tokens()

    # Show the token
    print("✅ ACCESS TOKEN:")
    print(discoverer.token)

    # End
    print("🎉 Script finished successfully.")
+75 −0
Original line number Diff line number Diff line
{
  "capif_host": "",
  "register_host": "",
  "capif_https_port": "",
  "capif_register_port": "",
  "capif_username": "",
  "capif_password": "",
  "debug_mode": "",
  "invoker": {
    "invoker_folder": "",
    "capif_callback_url": "",
    "supported_features":"",
    "check_authentication_data":{
      "ip":"",
      "port":""
    },
    "cert_generation": {
      "csr_common_name": "",
      "csr_organizational_unit": "",
      "csr_organization": "",
      "csr_locality": "",
      "csr_state_or_province_name": "",
      "csr_country_name": "",
      "csr_email_address": ""
    },
    "discover_filter": {
      "api-name": "",
      "api-version": "",
      "comm-type": "",
      "protocol": "",
      "aef-id": "",
      "data-format": "",
      "api-cat": "",
      "preferred-aef-loc": "",
      "req-api-prov-name": "",
      "supported-features": "",
      "api-supported-features": "",
      "ue-ip-addr": "",
      "service-kpis": ""
    }
  },
  "provider": {
    "provider_folder": "",
    "supported_features": "",
    "apfs": "2",
    "aefs": "3",
    "publish_req": {
      "service_api_id": "",
      "publisher_apf_id": "",
      "publisher_aefs_ids": [
        "",
        ""
      ]
    },
    "cert_generation": {
      "csr_common_name": "",
      "csr_organizational_unit": "",
      "csr_organization": "",
      "csr_locality": "",
      "csr_state_or_province_name": "",
      "csr_country_name": "",
      "csr_email_address": ""
    },
    "api_description_path": "",
    "log":{            
      "apiName": "",
      "apiVersion": "",
      "resourceName": "",
      "uri": "",
      "protocol": "",
      "operation": "",
      "result": ""
    }
   }
}
+330 −0
Original line number Diff line number Diff line
{
    "apiName": "6G-resilience",
    "aefProfiles": [
        {
            "aefId": "AEF6fc1d116574bcc797ecd74b8902b35",
            "versions": [
                {
                    "apiVersion": "6G_Resilience_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
                            "resourceName": "RESILIENCE_MANAGEMENT",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/resilience",
                            "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint to manage resilience functionalities in 6G networks"
                        },
                        {
                            "resourceName": "RESILIENCE_SINGLE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/resilience/{profileId}",
                            "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint to manage a single resilience profile"
                        }
                    ],
                    "custOperations": [
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
                            "description": "Custom operation for managing 6G resilience parameters"
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        }
                    ]
                }
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
            "securityMethods": [
                "OAUTH"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "localhost",
                    "port": 8088,
                    "securityMethods": [
                        "OAUTH"
                    ]
                }
            ]
        },
        {
            "aefId": "AEFa8e49e01d179c79e6a4750a8363f1d",
            "versions": [
                {
                    "apiVersion": "6G_Resilience_v1",
                    "expiry": "2100-11-30T10:32:02.004Z",
                    "resources": [
                        {
                            "resourceName": "SLICE_RESILIENCE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/slice/resilience",
                            "custOpName": "http_post",
                            "operations": [
                                "GET",
                                "POST"
                            ],
                            "description": "Endpoint for managing resilience in network slices"
                        },
                        {
                            "resourceName": "SLICE_SINGLE_RESILIENCE",
                            "commType": "SUBSCRIBE_NOTIFY",
                            "uri": "/slice/{sliceId}/resilience",
                            "custOpName": "http_get",
                            "operations": [
                                "GET",
                                "PUT",
                                "DELETE"
                            ],
                            "description": "Endpoint for managing a single slice's resilience"
                        }
                    ],
                    "custOperations": [
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "string",
                            "operations": [
                                "POST"
                            ],
                            "description": "Custom operation for configuring resilience in network slices"
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "check-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Check authentication request."
                        },
                        {
                            "commType": "REQUEST_RESPONSE",
                            "custOpName": "revoke-authentication",
                            "operations": [
                                "POST"
                            ],
                            "description": "Revoke authorization for service APIs."
                        }
                    ]
                }
            ],
            "protocol": "HTTP_1_1",
            "dataFormat": "JSON",
            "securityMethods": [
                "OAUTH",
                "PSK"
            ],
            "interfaceDescriptions": [
                {
                    "ipv4Addr": "localhost",
                    "port": 8088,
                    "securityMethods": [
                        "OAUTH"
                    ]
                }
            ]
        }
    ],
    "description": "API of dummy Network-App to test",
    "supportedFeatures": "0",
    "shareableInfo": {
        "isShareable": true,
        "capifProvDoms": [
            "string"
        ]
    },
    "serviceAPICategory": "string",
    "apiSuppFeats": "0",
    "pubApiPath": {
        "ccfIds": [
            "string"
        ]
    },
    "ccfId": "string"
}
 No newline at end of file
Loading