Skip to content
Snippets Groups Projects
Commit 04a765d8 authored by JorgeEcheva26's avatar JorgeEcheva26
Browse files

Changes for release 2

parent 0c24a548
No related branches found
No related tags found
No related merge requests found
......@@ -34,11 +34,16 @@ class api_schema_translator:
self.api_info = self.__load_api_file(self.api_path)
self.__validate_api_info()
def build(self, api_name, ip=None, port=None, fqdn=None, ipv6Addr=None):
def build(self, api_name, supported_features, api_supp_features, ip=None, port=None, fqdn=None, ipv6Addr=None):
"""
Builds the API description and saves it to a JSON file.
Supports either IPv4 (ip), IPv6 (ipv6Addr), or FQDN (fqdn).
"""
# Validate required fields
if not supported_features or not api_supp_features:
self.logger.error("Both 'supported_features' and 'api_supp_features' are required. Aborting build.")
return
# Validate that at least one of ip, ipv6Addr, or fqdn is provided
if not (ip or ipv6Addr or fqdn):
self.logger.error("At least one of 'ip', 'ipv6Addr', or 'fqdn' must be provided. Aborting build.")
......@@ -55,13 +60,13 @@ class api_schema_translator:
"apiName": self.api_info["info"].get("title", api_name),
"aefProfiles": self.__build_aef_profiles(ip, port, fqdn, ipv6Addr),
"description": self.api_info["info"].get("description", "No description provided"),
"supportedFeatures": "fffff",
"supportedFeatures": supported_features,
"shareableInfo": {
"isShareable": True,
"capifProvDoms": ["string"]
},
"serviceAPICategory": "string",
"apiSuppFeats": "fffff",
"apiSuppFeats": api_supp_features,
"pubApiPath": {
"ccfIds": ["string"]
},
......
......@@ -193,7 +193,6 @@ class capif_provider_connector:
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
with socket.create_connection((self.capif_host, self.capif_https_port)) as sock:
with context.wrap_socket(sock, server_hostname=self.capif_host) as ssock:
cert = ssock.getpeercert(binary_form=True)
......@@ -1160,7 +1159,7 @@ class capif_provider_connector:
self.logger.info("Starting certificate removal process...")
# List of possible certificate patterns to remove
cert_patterns = ["APF-", "apf-", "AEF-", "aef-", "AMF", "amf"]
cert_patterns = ["APF-", "apf-", "AEF-", "aef-"]
cert_extensions = ["_private_key.key", "_public.csr", ".crt"]
# Iterate over the directory and remove matching files
......
......@@ -7,7 +7,7 @@ with open(os.path.join(this_directory, "README_pipy.md"), encoding="utf-8") as f
setup(
name="opencapif_sdk",
version="0.1.19",
version="0.1.20",
author="JorgeEcheva, dgs-cgm",
author_email="jorge.echevarriauribarri.practicas@telefonica.com, daniel.garciasanchez@telefonica.com",
description=(
......
......@@ -9,7 +9,7 @@
"invoker": {
"invoker_folder": "/Users/IDB0128/Documents/OpenCapif/test_invoker_certificate_folder",
"capif_callback_url": "http://localhost:5000",
"supported_features": "fffffff",
"supported_features": "0",
"check_authentication_data": {
"ip": "",
"port": ""
......@@ -51,7 +51,7 @@
},
"provider": {
"provider_folder": "/Users/IDB0128/Documents/OpenCapif/test_provider_certificate_folder",
"supported_features": "fffffff",
"supported_features": "0",
"cert_generation": {
"csr_common_name": "provider",
"csr_organizational_unit": "discovery",
......
......@@ -2,7 +2,7 @@
"apiName": "Testtrece",
"aefProfiles": [
{
"aefId": "AEF6b074911c72c9a49c8a3ea7e881b85",
"aefId": "AEF5ab315755935b121309e787620c354",
"versions": [
{
"apiVersion": "v1",
......@@ -77,7 +77,7 @@
]
},
{
"aefId": "AEFfaa1b3b961a3a09c71b633fe8327c3",
"aefId": "AEF32cfb4a7b1b8c705217a6bb37b43f2",
"versions": [
{
"apiVersion": "v1",
......@@ -169,7 +169,7 @@
}
],
"description": "API of dummy Network-App to test",
"supportedFeatures": "fffffff",
"supportedFeatures": "0",
"shareableInfo": {
"isShareable": true,
"capifProvDoms": [
......@@ -177,7 +177,7 @@
]
},
"serviceAPICategory": "string",
"apiSuppFeats": "fffff",
"apiSuppFeats": "0",
"pubApiPath": {
"ccfIds": [
"string"
......
......@@ -2,7 +2,7 @@
"apiName": "Test-three",
"aefProfiles": [
{
"aefId": "AEF46db4d6b56d212ab007201ac8224dc",
"aefId": "AEFae4735f83ce9adc2caf460a30cc6dd",
"versions": [
{
"apiVersion": "v1",
......@@ -77,7 +77,7 @@
]
},
{
"aefId": "AEF7d3d9ec715697bd6dc5974e5d78081",
"aefId": "AEF6b4030a99398cadd25c89307cc6e04",
"versions": [
{
"apiVersion": "v1",
......@@ -169,7 +169,7 @@
}
],
"description": "API of dummy Network-App to test",
"supportedFeatures": "fffffff",
"supportedFeatures": "0",
"shareableInfo": {
"isShareable": true,
"capifProvDoms": [
......@@ -177,7 +177,7 @@
]
},
"serviceAPICategory": "string",
"apiSuppFeats": "fffff",
"apiSuppFeats": "0",
"pubApiPath": {
"ccfIds": [
"string"
......
......@@ -2,7 +2,7 @@
"apiName": "API of dummy Network-App to test",
"aefProfiles": [
{
"aefId": "AEF74df7938fe9b102e1014ec3b0058d6",
"aefId": "AEF31918dcf7bd894c86af1faf271a2d7",
"versions": [
{
"apiVersion": "v1",
......@@ -144,7 +144,7 @@
}
],
"description": "API of dummy Network-App to test",
"supportedFeatures": "fffff",
"supportedFeatures": "0",
"shareableInfo": {
"isShareable": true,
"capifProvDoms": [
......@@ -152,7 +152,7 @@
]
},
"serviceAPICategory": "string",
"apiSuppFeats": "fffff",
"apiSuppFeats": "0",
"pubApiPath": {
"ccfIds": [
"string"
......
......@@ -41,7 +41,7 @@ def test_provider_publish(test_provider_update):
AEF1 = provider.provider_capif_ids['AEF-1']
translator = api_schema_translator("./test1.yaml")
translator.build("test1",ip="0.0.0.0",port=9090)
translator.build("test1",ip="0.0.0.0",port=9090,supported_features="0",api_supp_features="0")
provider.api_description_path="./test1.json"
# Update configuration file
provider.publish_req['publisher_apf_id'] = APF1
......@@ -80,7 +80,7 @@ def test_logs(test_provider_publish,tokens):
capif_log.create_logs(aefId=AEF1,jwt=token)
def test_invoker_discover(invoker_setup):
def test_invoker_discover(invoker_setup,test_provider_publish):
discoverer = service_discoverer(config_file=capif_sdk_config_path)
discoverer.discover()
discoverer.get_tokens()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment