Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dependencies and display project name as part of show config #385

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased



## [1.7.4] - 11/05/2024

### Added
- Missing docstrings in network_service module (Issue [#313](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/314))
- Artifact Manager Support (Issue [#358](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/358))
@@ -28,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Node objects returned from slice.get_node(name) are not the same as the node objects returned from slice.get_nodes() (Issue [#380](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/380))
- Multiple calls to fablib.get_slice(name) in the same interpreter yield different objects (Issue [#379](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/379))
- FablibManager.get_slices doesn't return unsubmitted slices created by new_slice() (Issue [#294](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/294))
- Display Project Name in show_config() (Issue [#384](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/384))
- Add support for Attestable Switch from CREASE project (PR [#386](https://github.com/fabric-testbed/fabrictestbed-extensions/pull/386))


9 changes: 9 additions & 0 deletions fabrictestbed_extensions/fablib/config/config.py
Original file line number Diff line number Diff line change
@@ -132,6 +132,7 @@ class Config:
Constants.AM_HOST: "Artifact Manager",
Constants.TOKEN_LOCATION: "Token File",
Constants.PROJECT_ID: "Project ID",
Constants.PROJECT_NAME: "Project Name",
Constants.BASTION_USERNAME: "Bastion Username",
Constants.BASTION_KEY_LOCATION: "Bastion Private Key File",
Constants.BASTION_HOST: "Bastion Host",
@@ -568,6 +569,14 @@ def set_project_id(self, project_id: str):
"""
self.runtime_config[Constants.PROJECT_ID] = project_id

def get_project_name(self):
"""
Get the Project Name:
:return: Project Name
:rtype: String
"""
return self.runtime_config.get(Constants.PROJECT_NAME)

def set_log_level(self, log_level: str = "INFO"):
"""
Sets the current log level for logging
1 change: 1 addition & 0 deletions fabrictestbed_extensions/fablib/constants.py
Original file line number Diff line number Diff line change
@@ -111,6 +111,7 @@ class Constants:
AM_HOST = "am_host"
TOKEN_LOCATION = "token_location"
PROJECT_ID = "project_id"
PROJECT_NAME = "project_name"
BASTION_HOST = "bastion_host"
BASTION_USERNAME = "bastion_username"
BASTION_KEY_LOCATION = "bastion_key_location"
3 changes: 3 additions & 0 deletions fabrictestbed_extensions/fablib/fablib.py
Original file line number Diff line number Diff line change
@@ -1160,6 +1160,9 @@ def __build_manager(self) -> FabricManager:
logging.debug("Fabric manager initialized!")
# Update Project ID to be same as in Slice Manager
self.set_project_id(project_id=self.manager.project_id)
self.runtime_config[Constants.PROJECT_NAME] = (
self.manager.get_project_name()
)
self.determine_bastion_username()
except Exception as e:
logging.error(e, exc_info=True)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ dependencies = [
"ipyleaflet",
"ipycytoscape",
"tabulate",
"fabrictestbed==1.7.8",
"fabrictestbed==1.7.9",
"paramiko",
"jinja2>=3.0.0",
"pandas",
4 changes: 1 addition & 3 deletions tests/unit/test_basic.py
Original file line number Diff line number Diff line change
@@ -62,9 +62,7 @@ def test_fablib_manager_test_only_orchestrator_host(self):
def test_fablib_manager_test_only_project_id(self):
os.environ[Constants.FABRIC_PROJECT_ID] = "dummy"
os.environ[Constants.FABRIC_TOKEN_LOCATION] = self.DUMMY_TOKEN_LOCATION
self.assertRaises(
TokenManagerException, FablibManager, fabric_rc=self.rcfile.name
)
self.assertRaises(Exception, FablibManager, fabric_rc=self.rcfile.name)

def test_fablib_manager_test_only_token_location(self):
os.environ[Constants.FABRIC_TOKEN_LOCATION] = "dummy"