From 7526c900119db65eece5e0277b1292377e9ccc70 Mon Sep 17 00:00:00 2001 From: Komal Thareja Date: Tue, 29 Oct 2024 16:47:38 -0400 Subject: [PATCH 1/2] changes to create slice api to pass lifetime --- .swagger-codegen/VERSION | 2 +- docs/MetricsApi.md | 2 +- docs/SlicesApi.md | 6 ++++-- fabric_cf/__init__.py | 2 +- fabric_cf/orchestrator/orchestrator_proxy.py | 6 ++++-- fabric_cf/orchestrator/swagger_client/api/slices_api.py | 6 +++++- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION index 5025f67..af00d93 100644 --- a/.swagger-codegen/VERSION +++ b/.swagger-codegen/VERSION @@ -1 +1 @@ -3.0.54 +3.0.63 diff --git a/docs/MetricsApi.md b/docs/MetricsApi.md index ddca5e8..db2610f 100644 --- a/docs/MetricsApi.md +++ b/docs/MetricsApi.md @@ -11,7 +11,7 @@ Method | HTTP request | Description Control Framework metrics overview -Control Framework metrics overview +Control Framework metrics overview ### Example ```python diff --git a/docs/SlicesApi.md b/docs/SlicesApi.md index 9c7cf12..52cf204 100644 --- a/docs/SlicesApi.md +++ b/docs/SlicesApi.md @@ -76,7 +76,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **slices_creates_post** -> Slivers slices_creates_post(body, name, lease_start_time=lease_start_time, lease_end_time=lease_end_time) +> Slivers slices_creates_post(body, name, lifetime=lifetime, lease_start_time=lease_start_time, lease_end_time=lease_end_time) Create slice @@ -101,12 +101,13 @@ configuration.api_key['Authorization'] = 'YOUR_API_KEY' api_instance = SlicesApi(ApiClient(configuration)) body = SlicesPost() # SlicesPost | Create new Slice name = 'name_example' # str | Slice Name +lifetime = 24 # int | Lifetime of the slice requested in hours. (optional) (default to 24) lease_start_time = 'lease_start_time_example' # str | Lease End Time for the Slice (optional) lease_end_time = 'lease_end_time_example' # str | Lease End Time for the Slice (optional) try: # Create slice - api_response = api_instance.slices_creates_post(body, name, lease_start_time=lease_start_time, lease_end_time=lease_end_time) + api_response = api_instance.slices_creates_post(body, name, lifetime=lifetime, lease_start_time=lease_start_time, lease_end_time=lease_end_time) pprint(api_response) except ApiException as e: print("Exception when calling SlicesApi->slices_creates_post: %s\n" % e) @@ -118,6 +119,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**SlicesPost**](SlicesPost.md)| Create new Slice | **name** | **str**| Slice Name | + **lifetime** | **int**| Lifetime of the slice requested in hours. | [optional] [default to 24] **lease_start_time** | **str**| Lease End Time for the Slice | [optional] **lease_end_time** | **str**| Lease End Time for the Slice | [optional] diff --git a/fabric_cf/__init__.py b/fabric_cf/__init__.py index 008aaa9..ac29be8 100644 --- a/fabric_cf/__init__.py +++ b/fabric_cf/__init__.py @@ -1 +1 @@ -__version__ = "1.7.3" +__version__ = "1.8.0b1" diff --git a/fabric_cf/orchestrator/orchestrator_proxy.py b/fabric_cf/orchestrator/orchestrator_proxy.py index bfff8dd..45997a9 100644 --- a/fabric_cf/orchestrator/orchestrator_proxy.py +++ b/fabric_cf/orchestrator/orchestrator_proxy.py @@ -138,7 +138,7 @@ def __set_tokens(self, *, token: str): def create(self, *, token: str, slice_name: str, ssh_key: Union[str, List[str]], topology: ExperimentTopology = None, slice_graph: str = None, lease_start_time: str = None, - lease_end_time: str = None) -> Tuple[Status, Union[Exception, List[Sliver]]]: + lease_end_time: str = None, lifetime: int = 24) -> Tuple[Status, Union[Exception, List[Sliver]]]: """ Create a slice @param token fabric token @@ -148,6 +148,7 @@ def create(self, *, token: str, slice_name: str, ssh_key: Union[str, List[str]], @param slice_graph Slice Graph string @param lease_start_time Lease Start Time @param lease_end_time Lease End Time + @param slice lifetime in hours @return Tuple containing Status and Exception/Json containing slivers created """ if token is None: @@ -190,7 +191,8 @@ def create(self, *, token: str, slice_name: str, ssh_key: Union[str, List[str]], body = SlicesPost(graph_model=slice_graph, ssh_keys=ssh_keys) slivers = self.slices_api.slices_creates_post(name=slice_name, body=body, lease_end_time=lease_end_time, - lease_start_time=lease_start_time) + lease_start_time=lease_start_time, + lifetime=lifetime) return Status.OK, slivers.data if slivers.data is not None else [] except Exception as e: return Status.FAILURE, e diff --git a/fabric_cf/orchestrator/swagger_client/api/slices_api.py b/fabric_cf/orchestrator/swagger_client/api/slices_api.py index 53f4bc6..b63f12e 100644 --- a/fabric_cf/orchestrator/swagger_client/api/slices_api.py +++ b/fabric_cf/orchestrator/swagger_client/api/slices_api.py @@ -160,6 +160,7 @@ def slices_creates_post(self, body, name, **kwargs): # noqa: E501 :param async_req bool :param SlicesPost body: Create new Slice (required) :param str name: Slice Name (required) + :param int lifetime: Lifetime of the slice requested in hours. :param str lease_start_time: Lease End Time for the Slice :param str lease_end_time: Lease End Time for the Slice :return: Slivers @@ -186,6 +187,7 @@ def slices_creates_post_with_http_info(self, body, name, **kwargs): # noqa: E50 :param async_req bool :param SlicesPost body: Create new Slice (required) :param str name: Slice Name (required) + :param int lifetime: Lifetime of the slice requested in hours. :param str lease_start_time: Lease End Time for the Slice :param str lease_end_time: Lease End Time for the Slice :return: Slivers @@ -193,7 +195,7 @@ def slices_creates_post_with_http_info(self, body, name, **kwargs): # noqa: E50 returns the request thread. """ - all_params = ['body', 'name', 'lease_start_time', 'lease_end_time'] # noqa: E501 + all_params = ['body', 'name', 'lifetime', 'lease_start_time', 'lease_end_time'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -224,6 +226,8 @@ def slices_creates_post_with_http_info(self, body, name, **kwargs): # noqa: E50 query_params = [] if 'name' in params: query_params.append(('name', params['name'])) # noqa: E501 + if 'lifetime' in params: + query_params.append(('lifetime', params['lifetime'])) # noqa: E501 if 'lease_start_time' in params: query_params.append(('lease_start_time', params['lease_start_time'])) # noqa: E501 if 'lease_end_time' in params: From 777ae37c5af50c5a113360d9bbb89a13d548a50d Mon Sep 17 00:00:00 2001 From: Komal Thareja Date: Mon, 6 Jan 2025 15:25:44 -0500 Subject: [PATCH 2/2] up the version --- fabric_cf/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fabric_cf/__init__.py b/fabric_cf/__init__.py index ac29be8..29654ee 100644 --- a/fabric_cf/__init__.py +++ b/fabric_cf/__init__.py @@ -1 +1 @@ -__version__ = "1.8.0b1" +__version__ = "1.8.0" diff --git a/pyproject.toml b/pyproject.toml index 3b6cf23..64077b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ dependencies = [ "six >= 1.10", "python_dateutil >= 2.5.3", "requests>=2.28.1", - "fabric-fim==1.7.2", + "fabric-fim==1.8.0", ] [project.optional-dependencies]