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

Add CNF NFD generation to build command #8

Merged
merged 55 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5cdd0d8
Draft create NFDV using python SDK
sunnycarter Apr 26, 2023
105c809
pushing this but then moving on to delete
sunnycarter Apr 27, 2023
a2de28e
Merge branch 'add-aosm-extension' into sunny/bicep-deployer
sunnycarter Apr 27, 2023
9baaeb3
start to move to bicep deployer
sunnycarter Apr 28, 2023
4fa8b8a
VNF generate and deploy bare bones, not working
sunnycarter Apr 28, 2023
4ea921a
predeployer maybe working
sunnycarter May 2, 2023
27a2597
Fix up VNF generate and deploy
sunnycarter May 2, 2023
c19920e
printing
sunnycarter May 2, 2023
8bbe2b7
artifact upload half broken
sunnycarter May 3, 2023
91cfe36
Artifact manifest stuff over to SDK
sunnycarter May 3, 2023
a2410b4
delete NFD function
sunnycarter May 3, 2023
bfadbeb
linting
sunnycarter May 3, 2023
1625852
add psudo code for CNF generation
jddarby May 4, 2023
18d00d0
Fix up json config -> VNFConfiguration
sunnycarter May 4, 2023
1b77c7e
add psudo code for CNF generation
jddarby May 4, 2023
0d15355
Add CNFConfiguration
jddarby May 5, 2023
fb0a3d3
Merge branch 'add-cnf-generation' of https://github.com/jddarby/azure…
May 5, 2023
bf0a29f
artifact manifests separate
sunnycarter May 5, 2023
c741773
style
sunnycarter May 5, 2023
a956ce6
renames
sunnycarter May 5, 2023
7088b06
style
sunnycarter May 5, 2023
3e224a2
lint and reverse some renames
sunnycarter May 5, 2023
155c533
dev instructions
sunnycarter May 5, 2023
edd5d10
oops. bad find and replace work.
sunnycarter May 5, 2023
d2e19c2
undo friday afternoon bad changes
sunnycarter May 5, 2023
1aaa00a
manifest optional
sunnycarter May 5, 2023
1c598cb
Basic README
sunnycarter May 5, 2023
985ceb2
delete publisher definition
sunnycarter May 5, 2023
eb83c78
unwanted constant
sunnycarter May 5, 2023
fe87a11
d
sunnycarter May 5, 2023
cb51f0a
fill in init function
jddarby May 9, 2023
5d3bc12
Merge remote-tracking branch 'origin/sunny/bicep-deployer' into add-c…
jddarby May 9, 2023
08cbca0
Add more boilerplate
jddarby May 10, 2023
c94535e
Merge branch 'add-cnf-generation' of https://github.com/jddarby/azure…
May 11, 2023
b69aa14
initial commit; will remove input.json after testing done
May 12, 2023
9f2136f
tried a few functions
May 12, 2023
da317e8
up to generate nf application
May 15, 2023
e1e8c67
tidied + fixed helmconfig as dict issue
May 15, 2023
80f9a32
fixed merge conflicts
May 15, 2023
1eaa34f
removed deploy with sdk
May 15, 2023
21809b2
added artifact list
May 16, 2023
89636e5
push example cnf bicep
jddarby May 16, 2023
0f50403
added output dir; fixing getchartmappingschema
May 16, 2023
fbba297
Merge branch 'jl/add-cnf-generation' of github.com:jddarby/azure-cli-…
May 16, 2023
dfd5790
fixed parameter mappings + copied needed files to output folder
May 17, 2023
4747224
jinja2 and find value paths
jddarby May 17, 2023
58d525d
Merge branch 'jl/add-cnf-generation' of github.com:jddarby/azure-cli-…
jddarby May 17, 2023
3188399
fixed typos + self.aritfacts only has unique artifacts
May 17, 2023
30921b8
use regex instead of string to find deploy params
jddarby May 18, 2023
3501b82
delete accidentaly commited input.json
jddarby May 18, 2023
7064890
fixed deploy params; added indent to mapping file
May 18, 2023
ae4f8fe
Merge branch 'jl/add-cnf-generation' of github.com:jddarby/azure-cli-…
May 18, 2023
8274996
renamed values.nondef + added cli errors
May 18, 2023
eb3c1a5
fixed parameter vals not updating
May 18, 2023
1a29b43
delete unuseed temoplate and update jinja2 templates
jddarby May 18, 2023
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
34 changes: 30 additions & 4 deletions src/aosm/azext_aosm/_configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
from typing import Dict, Optional, Any
from dataclasses import dataclass, field
jordlay marked this conversation as resolved.
Show resolved Hide resolved
from typing import Dict, Optional, Any, List
from pathlib import Path
from azure.cli.core.azclierror import ValidationError, InvalidArgumentValueError
from azext_aosm.util.constants import VNF_DEFINITION_OUTPUT_BICEP_PREFIX, VNF, CNF, NSD
Expand Down Expand Up @@ -126,7 +126,6 @@ def validate(self) -> None:
def sa_manifest_name(self) -> str:
"""Return the Storage account manifest name from the NFD name."""
return f"{self.nf_name}-sa-manifest-{self.version.replace('.', '-')}"

@property
def build_output_folder_name(self) -> str:
"""Return the local folder for generating the bicep template to."""
Expand All @@ -135,6 +134,32 @@ def build_output_folder_name(self) -> str:
f"{VNF_DEFINITION_OUTPUT_BICEP_PREFIX}{Path(str(arm_template_path)).stem}"
)

@dataclass
class HelmPackageConfig:
name: str = "Name of the Helm package"
path_to_chart: str = "Path to the Helm chart"
jordlay marked this conversation as resolved.
Show resolved Hide resolved
depends_on: List[str] = field(default_factory=lambda: ["Names of the Helm packages this package depends on"])
jordlay marked this conversation as resolved.
Show resolved Hide resolved

@dataclass
class CNFConfiguration(NFConfiguration):
helm_packages: List[Any] = field(default_factory=lambda: [HelmPackageConfig()])

def __post_init__(self):
"""
Cope with deserializing subclasses from dicts to HelmPackageConfig.

Used when creating CNFConfiguration object from a loaded json config file.
"""
for package in self.helm_packages:
if isinstance(package, dict):
package = HelmPackageConfig(**dict(package))

@property
def build_output_folder_name(self) -> str:
"""Return the local folder for generating the bicep template to."""
return (
f"{VNF_DEFINITION_OUTPUT_BICEP_PREFIX}{self.nf_name}"
jordlay marked this conversation as resolved.
Show resolved Hide resolved
)

def get_configuration(
definition_type: str, config_as_dict: Optional[Dict[Any, Any]] = None
Expand All @@ -145,7 +170,7 @@ def get_configuration(
if definition_type == VNF:
config = VNFConfiguration(**config_as_dict)
elif definition_type == CNF:
config = NFConfiguration(**config_as_dict)
config = CNFConfiguration(**config_as_dict)
elif definition_type == NSD:
config = NFConfiguration(**config_as_dict)
else:
Expand All @@ -154,3 +179,4 @@ def get_configuration(
)

return config

Loading