Skip to content

Commit

Permalink
Merge pull request #83 from jddarby/andy/catch-up-with-main-add-aosm-…
Browse files Browse the repository at this point in the history
…extension

renamed nsdg to nsd
  • Loading branch information
Cyclam committed Sep 25, 2023
2 parents efb0423 + 9501b63 commit 5436a0c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
12 changes: 6 additions & 6 deletions src/aosm/azext_aosm/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"For ARM templates this must be in format A.B.C"
),
"nsdv_description": "Description of the NSDV",
"nsdg_name": (
"Network Service Design Group Name. This is the collection of Network Service"
"nsd_name": (
"Network Service Design (NSD) name. This is the collection of Network Service"
" Design Versions. Will be created if it does not exist."
),
"nsd_version": (
Expand Down Expand Up @@ -498,7 +498,7 @@ class NSConfiguration(Configuration):
NFDRETConfiguration(),
]
)
nsdg_name: str = DESCRIPTION_MAP["nsdg_name"]
nsd_name: str = DESCRIPTION_MAP["nsd_name"]
nsd_version: str = DESCRIPTION_MAP["nsd_version"]
nsdv_description: str = DESCRIPTION_MAP["nsdv_description"]

Expand Down Expand Up @@ -536,7 +536,7 @@ def validate(self):

for configuration in self.network_functions:
configuration.validate()
if self.nsdg_name in (DESCRIPTION_MAP["nsdg_name"], ""):
if self.nsd_name in (DESCRIPTION_MAP["nsd_name"], ""):
raise ValueError("NSD name must be set")
if self.nsd_version in (DESCRIPTION_MAP["nsd_version"], ""):
raise ValueError("NSD Version must be set")
Expand All @@ -550,12 +550,12 @@ def output_directory_for_build(self) -> Path:
@property
def nfvi_site_name(self) -> str:
"""Return the name of the NFVI used for the NSDV."""
return f"{self.nsdg_name}_NFVI"
return f"{self.nsd_name}_NFVI"

@property
def cg_schema_name(self) -> str:
"""Return the name of the Configuration Schema used for the NSDV."""
return f"{self.nsdg_name.replace('-', '_')}_ConfigGroupSchema"
return f"{self.nsd_name.replace('-', '_')}_ConfigGroupSchema"

@property
def acr_manifest_names(self) -> List[str]:
Expand Down
4 changes: 2 additions & 2 deletions src/aosm/azext_aosm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ def delete_published_design(
we use cf_resources, but other extensions seem to pass a client
around like this.
:param config_file: Path to the config file
:param clean: if True, will delete the NSDG, artifact stores and publisher too.
:param clean: if True, will delete the NSD, artifact stores and publisher too.
Defaults to False. Only works if no resources have those as a parent.
Use with care.
:param clean: if True, will delete the NSDG on top of the other resources.
:param clean: if True, will delete the NSD on top of the other resources.
:param force: if True, will not prompt for confirmation before deleting the resources.
"""
# Check that the required features are enabled on the subscription
Expand Down
20 changes: 10 additions & 10 deletions src/aosm/azext_aosm/delete/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def delete_nsd(self, clean: bool = False, force: bool = False) -> None:
)
if clean:
print(
f"Because of the --clean flag, the NSDG {self.config.nsdg_name} will also be deleted."
f"Because of the --clean flag, the NSD {self.config.nsd_name} will also be deleted."
)
print("There is no undo. Type 'delete' to confirm")
if not input_ack("delete", "Confirm delete:"):
Expand Down Expand Up @@ -150,15 +150,15 @@ def delete_nsdv(self):
assert isinstance(self.config, NSConfiguration)
message = (
f"Delete NSDV {self.config.nsd_version} from group"
f" {self.config.nsdg_name} and publisher {self.config.publisher_name}"
f" {self.config.nsd_name} and publisher {self.config.publisher_name}"
)
logger.debug(message)
print(message)
try:
poller = self.api_clients.aosm_client.network_service_design_versions.begin_delete(
resource_group_name=self.config.publisher_resource_group_name,
publisher_name=self.config.publisher_name,
network_service_design_group_name=self.config.nsdg_name,
network_service_design_group_name=self.config.nsd_name,
network_service_design_version_name=self.config.nsd_version,
)
LongRunningOperation(self.cli_ctx, "Deleting NSDV...")(poller)
Expand All @@ -167,7 +167,7 @@ def delete_nsdv(self):
logger.error(
"Failed to delete NSDV %s from group %s",
self.config.nsd_version,
self.config.nsdg_name,
self.config.nsd_name,
)
raise

Expand Down Expand Up @@ -218,23 +218,23 @@ def delete_artifact_manifest(self, store_type: str) -> None:
raise

def delete_nsdg(self) -> None:
"""Delete the NSDG."""
"""Delete the NSD."""
assert isinstance(self.config, NSConfiguration)
message = f"Delete NSD Group {self.config.nsdg_name}"
message = f"Delete NSD {self.config.nsd_name}"
logger.debug(message)
print(message)
try:
poller = (
self.api_clients.aosm_client.network_service_design_groups.begin_delete(
resource_group_name=self.config.publisher_resource_group_name,
publisher_name=self.config.publisher_name,
network_service_design_group_name=self.config.nsdg_name,
network_service_design_group_name=self.config.nsd_name,
)
)
LongRunningOperation(self.cli_ctx, "Deleting NSD Group...")(poller)
print("Deleted NSD Group")
LongRunningOperation(self.cli_ctx, "Deleting NSD...")(poller)
print("Deleted NSD")
except Exception:
logger.error("Failed to delete NFDG.")
logger.error("Failed to delete NSD.")
raise

def delete_nfdg(self) -> None:
Expand Down
8 changes: 4 additions & 4 deletions src/aosm/azext_aosm/deploy/deploy_with_arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def construct_parameters(self) -> Dict[str, Any]:
"location": {"value": self.config.location},
"publisherName": {"value": self.config.publisher_name},
"acrArtifactStoreName": {"value": self.config.acr_artifact_store_name},
"nsDesignGroup": {"value": self.config.nsdg_name},
"nsDesignGroup": {"value": self.config.nsd_name},
"nsDesignVersion": {"value": self.config.nsd_version},
"nfviSiteName": {"value": self.config.nfvi_site_name},
}
Expand Down Expand Up @@ -465,7 +465,7 @@ def deploy_nsd_from_bicep(self) -> None:
logger.info(message)
self.deploy_bicep_template(bicep_path, self.parameters)
print(
f"Deployed NSD {self.config.nsdg_name} "
f"Deployed NSD {self.config.nsd_name} "
f"version {self.config.nsd_version}."
)

Expand Down Expand Up @@ -498,7 +498,7 @@ def deploy_manifest_template(self) -> None:

def nsd_predeploy(self) -> bool:
"""
All the predeploy steps for a NSD. Check if the RG, publisher, ACR, NSDG and
All the predeploy steps for a NSD. Check if the RG, publisher, ACR, NSD and
artifact manifest exist.
Return True if artifact manifest already exists, False otherwise
Expand All @@ -507,7 +507,7 @@ def nsd_predeploy(self) -> bool:
self.pre_deployer.ensure_config_resource_group_exists()
self.pre_deployer.ensure_config_publisher_exists()
self.pre_deployer.ensure_acr_artifact_store_exists()
self.pre_deployer.ensure_config_nsdg_exists()
self.pre_deployer.ensure_config_nsd_exists()
return self.pre_deployer.do_config_artifact_manifests_exist()

def deploy_bicep_template(
Expand Down
26 changes: 13 additions & 13 deletions src/aosm/azext_aosm/deploy/pre_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,18 +319,18 @@ def ensure_config_nfdg_exists(
self.config.location,
)

def ensure_config_nsdg_exists(
def ensure_config_nsd_exists(
self,
):
"""
Ensures that the Network Function Definition Group exists.
Ensures that the Network Service Design exists.
Finds the parameters from self.config
"""
self.ensure_nsdg_exists(
self.ensure_nsd_exists(
self.config.publisher_resource_group_name,
self.config.publisher_name,
self.config.nsdg_name,
self.config.nsd_name,
self.config.location,
)

Expand Down Expand Up @@ -386,11 +386,11 @@ def do_config_artifact_manifests_exist(

return acr_manny_exists

def ensure_nsdg_exists(
def ensure_nsd_exists(
self,
resource_group_name: str,
publisher_name: str,
nsdg_name: str,
nsd_name: str,
location: str,
):
"""
Expand All @@ -400,25 +400,25 @@ def ensure_nsdg_exists(
:type resource_group_name: str
:param publisher_name: The name of the publisher.
:type publisher_name: str
:param nsdg_name: The name of the network service design group.
:type nsdg_name: str
:param nsd_name: The name of the network service design group.
:type nsd_name: str
:param location: The location of the network service design group.
:type location: str
"""
print(
f"Creating Network Service Design Group {nsdg_name} if it does not exist",
f"Creating Network Service Design {nsd_name} if it does not exist",
)
logger.info(
"Creating Network Service Design Group %s if it does not exist",
nsdg_name,
"Creating Network Service Design %s if it does not exist",
nsd_name,
)
poller = self.api_clients.aosm_client.network_service_design_groups.begin_create_or_update(
resource_group_name=resource_group_name,
publisher_name=publisher_name,
network_service_design_group_name=nsdg_name,
network_service_design_group_name=nsd_name,
parameters=NetworkServiceDesignGroup(location=location),
)
LongRunningOperation(self.cli_ctx, "Creating Network Service Design group...")(
LongRunningOperation(self.cli_ctx, "Creating Network Service Design...")(
poller
)

Expand Down

0 comments on commit 5436a0c

Please sign in to comment.