Skip to content

Commit

Permalink
Merge pull request #86 from fabric-testbed/adv-res
Browse files Browse the repository at this point in the history
Adv reservation support
  • Loading branch information
kthare10 authored Jun 24, 2024
2 parents 16138fa + 82a8ea7 commit c6e3dee
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fabrictestbed/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.7.0b1"
__version__ = "1.7.0b8"
__VERSION__ = __version__
26 changes: 23 additions & 3 deletions fabrictestbed/slice_manager/slice_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,15 @@ def clear_token_cache(self, *, file_name: str = None):
return Status.FAILURE, f"Failed to clear token cache: {Utils.extract_error_message(exception=exception)}"

def create(self, *, slice_name: str, ssh_key: Union[str, List[str]], topology: ExperimentTopology = None,
slice_graph: str = None,
slice_graph: str = None, lease_start_time: str = None,
lease_end_time: str = None) -> Tuple[Status, Union[SliceManagerException, List[Sliver]]]:
"""
Create a slice
@param slice_name slice name
@param ssh_key SSH Key(s)
@param topology Experiment topology
@param slice_graph Slice Graph string
@param lease_start_time Lease Start Time
@param lease_end_time Lease End Time
@return Tuple containing Status and Exception/Json containing slivers created
"""
Expand All @@ -304,7 +305,8 @@ def create(self, *, slice_name: str, ssh_key: Union[str, List[str]], topology: E
if self.__should_renew():
self.__load_tokens()
return self.oc_proxy.create(token=self.get_id_token(), slice_name=slice_name, ssh_key=ssh_key,
topology=topology, slice_graph=slice_graph, lease_end_time=lease_end_time)
topology=topology, slice_graph=slice_graph, lease_end_time=lease_end_time,
lease_start_time=lease_start_time)
except Exception as e:
error_message = Utils.extract_error_message(exception=e)
return Status.FAILURE, SliceManagerException(error_message)
Expand Down Expand Up @@ -627,4 +629,22 @@ def get_project_info(self, project_name: str = "all", project_id: str = "all", u
return core_api_proxy.get_user_projects(project_name=project_name, project_id=project_id, uuid=uuid)
except Exception as e:
error_message = Utils.extract_error_message(exception=e)
raise SliceManagerException(error_message)
raise SliceManagerException(error_message)

def get_metrics_overview(self, excluded_projects: List[str] = None,
authenticated: bool = False) -> Tuple[Status, Union[list, Exception]]:
"""
Get Metrics overview
@param excluded_projects: excluded_projects
@param authenticated: Specific user metrics
@return list of metrics
"""
try:
token = None
if authenticated and self.__should_renew():
self.__load_tokens()
token = self.get_id_token()
return self.oc_proxy.get_metrics_overview(token=token, excluded_projects=excluded_projects)
except Exception as e:
error_message = Utils.extract_error_message(exception=e)
return Status.FAILURE, SliceManagerException(error_message)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies = [
"fabric_fss_utils>=1.5.1",
"click",
"fabric-credmgr-client==1.6.1",
"fabric-orchestrator-client==1.7.0b1",
"fabric-orchestrator-client==1.7.0b8",
"paramiko"
]

Expand Down

0 comments on commit c6e3dee

Please sign in to comment.