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 aosm extension #6426

Merged
merged 297 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
297 commits
Select commit Hold shift + click to select a range
1eaa34f
removed deploy with sdk
May 15, 2023
21809b2
added artifact list
May 16, 2023
89636e5
push example cnf bicep
jddarby May 16, 2023
715c925
Add temporary build workflow for AOSM extension (#4)
PerfectChaos 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
f92435c
Add empty init files to inner modules so setuptools recognises them a…
PerfectChaos May 16, 2023
0b1266f
Merge pull request #5 from jddarby/chaos/fixpackages
PerfectChaos May 16, 2023
599ac38
Use latest RG model to remove unnecessary dependency on version
PerfectChaos May 16, 2023
5437fac
Merge pull request #6 from jddarby/chaos/generalrgmodel
PerfectChaos May 16, 2023
2efdba6
Use latest deployment model to remove unnecessary dependency on version
PerfectChaos May 16, 2023
c80ced8
Merge pull request #7 from jddarby/chaos/generaldeploymodel
PerfectChaos 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
2604a71
Update readme with install/bug reporting instructions
PerfectChaos May 18, 2023
961daad
Adjust headers so rendered readme looks nicer
PerfectChaos May 18, 2023
8274996
renamed values.nondef + added cli errors
May 18, 2023
d4fbc16
Split help command example lines
PerfectChaos May 18, 2023
671fb64
Clarify that bug process is internal
PerfectChaos May 18, 2023
b3573e8
Merge pull request #9 from jddarby/chaos/installinstructions
PerfectChaos May 18, 2023
eb3c1a5
fixed parameter vals not updating
May 18, 2023
1a29b43
delete unuseed temoplate and update jinja2 templates
jddarby May 18, 2023
13f72f4
Merge pull request #8 from jddarby/jl/add-cnf-generation
jordlay May 19, 2023
6099b7a
Update README.md
jordlay May 22, 2023
3c52481
Update README.md
jordlay May 22, 2023
8c94905
added docstrings; added basic error catching with file handling
May 22, 2023
aa0b061
small refactor of generate nfd
May 23, 2023
c988938
Merge pull request #11 from jddarby/jl/tidy-up
jordlay May 23, 2023
9d15f95
fixed j2 template captions; added create_nfd to cnf; edited error mes…
May 24, 2023
1853cba
fixed file not found erroe
May 24, 2023
c6d6680
Refactor commands to az aosm nfd|nsd build (#10)
sunnycarter May 24, 2023
13c27cc
fixed most style errors; ran static checks and azdev style
May 24, 2023
ff1793c
pre merge commit
May 24, 2023
651ba78
Merge branch 'add-aosm-extension' of github.com:jddarby/azure-cli-ext…
May 24, 2023
5bde597
more style changes; renamed vnfbicepnfd to vnfnfd
May 24, 2023
a79ef57
Update readme with workflow
sunnycarter May 24, 2023
168c265
added configfile validation
May 24, 2023
e43cb92
added temp dir to vnf; renamed shared constants
May 25, 2023
9694c9b
sunny markups
sunnycarter May 25, 2023
9efa296
removed create_nfd_folder; added schema prefix to constant
May 25, 2023
2d19e34
fixed merge conflicts
May 25, 2023
a40cc3d
added deploymentparams to constants.py
May 25, 2023
e63f199
added error catching for get chart name and version
May 25, 2023
c26369a
Merge pull request #12 from jddarby/jl/post-review-fixes
jordlay May 25, 2023
2dee8c4
added meaningful logs; prevent auto overwriting input.json
May 25, 2023
bb6302a
edited vnf schema to have accepted types
May 26, 2023
d5b03c6
added templates to setup.py
May 26, 2023
f43f313
Merge pull request #14 from jddarby/jl/fix-python-wheel
jordlay May 26, 2023
276d3ca
Merge pull request #13 from jddarby/jl/first-round-feedback
jordlay May 26, 2023
d7f1b7a
added location from input file not resourceGroup().location
May 26, 2023
938b02e
Merge pull request #16 from jddarby/jl/manifest-location-bug
jordlay May 26, 2023
ab95a7c
added path_to_mappings to input.json; added logic to take mappings fr…
Jun 2, 2023
65ac401
renamed non_def_values to mappings_path
Jun 2, 2023
371a1ea
Merge pull request #18 from jddarby/jl/change-value-mappings
jordlay Jun 2, 2023
dda5957
Pk5/add nsd cli (#15)
patrykkulik-microsoft Jun 2, 2023
cdfde0f
fix CNF depends on
jddarby Jun 6, 2023
25d05b1
Merge pull request #19 from jddarby/jdd/fix-depends-on
jddarby Jun 6, 2023
6ed8ffa
Merge remote-tracking branch 'origin/main' into add-aosm-extension
jddarby Jun 6, 2023
5b1e3aa
initial commit; ran python static checks fmt (except on vendored sdks…
Jun 6, 2023
a1035f7
Name uploaded VHD correctly
Jamieparsons Jun 6, 2023
77e2e95
Self review markups
Jamieparsons Jun 6, 2023
1c642bb
broken config generation code
jddarby Jun 6, 2023
b557b7f
fixed up configuration.py
Jun 6, 2023
a7d7574
fixed cnf generator styling
Jun 6, 2023
6d0520d
fixed styling for cnf generator
Jun 6, 2023
4c1a2ee
fixed up nfd generator base and deploy with arm
Jun 6, 2023
8e8db34
fixed styling for artifact.py
Jun 6, 2023
44299e6
fixed styling for atrifact manifest .py
Jun 6, 2023
e38d425
Code review markups
Jamieparsons Jun 6, 2023
6cda523
Merge pull request #20 from jddarby/JDP/bug-735056
jamiedparsons Jun 6, 2023
d0f1276
fixed more linting
Jun 7, 2023
a6c292c
fixed merge conflicts
Jun 7, 2023
649ace6
Merge pull request #21 from jddarby/jl/fix-style
jordlay Jun 7, 2023
5f7b608
first attempt at regex
Jun 9, 2023
09be248
Sunny/choose deploy parameters (#23)
sunnycarter Jun 9, 2023
e680931
Fix for oras target string with erroneous spaces
Jun 14, 2023
a087421
Merge pull request #26 from jddarby/achurchard/fix_oras_target_string
Cyclam Jun 14, 2023
4c54367
fixed regex; tested on existing charts and sas charts; committing to …
Jun 15, 2023
70c7346
changed regex constants + tidied
Jun 15, 2023
126c68c
fixed blankspace
Jun 15, 2023
cbf8f67
fix merge conflicts
Jun 15, 2023
93fb6af
markups
Jun 15, 2023
b19dcc3
Merge pull request #28 from jddarby/jl/edit-image-secrets-paths
jordlay Jun 15, 2023
c57e4c5
initial commit
Jun 16, 2023
63b4346
tidied code and added comments
Jun 16, 2023
a88e757
add multi nf config
jddarby Jun 17, 2023
9e67219
Merge branch 'Azure:main' into add-aosm-extension
jddarby Jun 17, 2023
93840e8
Add style and lint check
jddarby Jun 17, 2023
6c9a478
added logic for handling deployparams within lists
Jun 19, 2023
3adcb80
one line fix from review
Jun 19, 2023
1c0dbe1
Merge pull request #29 from jddarby/jl/refactor-deploy-params
jordlay Jun 19, 2023
85ae247
removing print statement
Jun 19, 2023
0f2fb35
Merge pull request #31 from jddarby/jl/refactor-deploy-params
jordlay Jun 19, 2023
7719df2
added new test file and one unit test
Jun 20, 2023
077531d
added workflow for unit tests in pipeline + set up rough structure of…
Jun 20, 2023
9419ef9
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
sunnycarter Jun 20, 2023
d7a4abf
instantiated cnf class; added fake invalid helm package; added new fi…
Jun 21, 2023
4013895
Nsd for cnfs (#33)
sunnycarter Jun 22, 2023
689acf4
Add Publish command to the CNF azure CLI (#24)
patrykkulik-microsoft Jun 23, 2023
a403856
Expose NFD version and managed identities (#34)
jamiedparsons Jun 27, 2023
c492fae
Merge branch 'add-aosm-extension' into jl/add-unit-testing
Jamieparsons Jun 28, 2023
aad112f
Add a first VNF test
Jamieparsons Jun 28, 2023
f06efc3
achurchard/style fixes (#35)
Cyclam Jun 29, 2023
31672ae
Add CNF UTs that will fail at the moment
Jamieparsons Jun 30, 2023
f8b317f
Actually include all files.
Jamieparsons Jun 30, 2023
53e7729
Always run tests
Jamieparsons Jun 30, 2023
51eb04b
Merge branch 'add-aosm-extension' into jl/add-unit-testing
Jamieparsons Jun 30, 2023
9d21900
Add another test that won't pass yet
Jamieparsons Jun 30, 2023
716737e
remove github pipeline tests - they should run in Azure
Jamieparsons Jun 30, 2023
0f86392
Sundry fixes for CNF quickstart (#38)
sunnycarter Jul 4, 2023
ad88098
NSD UTs
Jamieparsons Jul 4, 2023
9f4f269
Merge branch 'add-aosm-extension' into jl/add-unit-testing
Jamieparsons Jul 4, 2023
de248c1
Update read me.
Jamieparsons Jul 4, 2023
0497ec7
Improve path handling, other small refactorings (#39)
Cyclam Jul 4, 2023
91b7f39
Fix Artifact upload on Windows (#40)
sunnycarter Jul 4, 2023
ea3fd77
Black
Jamieparsons Jul 5, 2023
e994c60
Mark ups
Jamieparsons Jul 5, 2023
95af0fc
Merge in add-aosm-extension
Jamieparsons Jul 5, 2023
b5b70b9
Merge pull request #32 from jddarby/jl/add-unit-testing
jamiedparsons Jul 5, 2023
09f6a45
Sunny/fix artifact upload windows (#41)
sunnycarter Jul 5, 2023
21154ff
Fix VNFD build (#42)
sunnycarter Jul 5, 2023
d02bc45
Multiple instances of the same NF
Jamieparsons Jul 7, 2023
a299eba
fix vnf deploy schema types (#44)
sunnycarter Jul 7, 2023
ebb5b46
Tidy up
Jamieparsons Jul 8, 2023
1f18b8d
Mypy and docs
Jamieparsons Jul 8, 2023
64e9a44
history.rst
Jamieparsons Jul 8, 2023
7460892
Update README with logging info (#43)
patrykkulik-microsoft Jul 10, 2023
8a05139
Merge in add-aosm-extension
Jamieparsons Jul 11, 2023
71ae242
self markups
Jamieparsons Jul 11, 2023
44344ff
Take oras 0.1.19 to fix Windows artifact upload (#46)
sunnycarter Jul 12, 2023
60140e2
Fix merge
Jamieparsons Jul 17, 2023
ab98755
Merge pull request #45 from jddarby/JDP/multiple_NFs
jamiedparsons Jul 17, 2023
3199a57
Horrific merge
Jamieparsons Jul 18, 2023
607b2d1
Rename a few things
Jamieparsons Jul 18, 2023
5da563b
Fix another merge
Jamieparsons Jul 18, 2023
b40b62c
DRY the deploy_nfd_from_bicep code
Jul 18, 2023
3241761
Make conditional statements clearer
Jul 18, 2023
5388f19
black
Jul 18, 2023
68e11cc
Update custom.py to use new nfd deploy method
Jul 19, 2023
b28e5f5
Black with text processing
Jul 19, 2023
64c645b
Create new nfRET class
Jamieparsons Jul 19, 2023
d11e82c
Merge branch 'achurchard/dry-the-deploy-nfd-code' into jdd/multi-nf-s…
Jamieparsons Jul 19, 2023
dc9deca
Mypy passing
Jamieparsons Jul 21, 2023
bfdb6dc
UTs passing
Jamieparsons Jul 21, 2023
ed20b35
Dry the deploy_nfd_from_bicep() code (#48)
Cyclam Jul 21, 2023
0a7dc2d
Unit tests added
Jamieparsons Jul 24, 2023
17147d7
Versions are wrong in NSD template comments
sunnycarter Jul 24, 2023
980ebc2
Self review markups
Jamieparsons Jul 24, 2023
55a2320
Remove wrong comments
sunnycarter Jul 24, 2023
e286c17
Code review markups
Jamieparsons Jul 25, 2023
e9925a1
Extra markups
Jamieparsons Jul 26, 2023
6c6ec80
Merge in changes
Jamieparsons Jul 26, 2023
100a844
Fix mypy
Jamieparsons Jul 26, 2023
9483466
Pk5/add integration tests (#51)
patrykkulik-microsoft Jul 26, 2023
6c5bea2
More markups
Jamieparsons Jul 26, 2023
ea6e507
Update output in tests
Jamieparsons Jul 26, 2023
c087b45
Pk5/minor integration tests changes (#52)
patrykkulik-microsoft Jul 26, 2023
7a4154d
Merge in changes
Jamieparsons Jul 26, 2023
12a2179
Update recordings
Jamieparsons Jul 27, 2023
d39d584
Fix up merge
Jamieparsons Jul 27, 2023
687d506
Update developer docs
Jamieparsons Jul 27, 2023
b192027
Merge pull request #47 from jddarby/jdd/multi-nf-support
jamiedparsons Jul 27, 2023
5646f52
Remove credentials
Jamieparsons Jul 27, 2023
aaf2e39
Merge pull request #53 from jddarby/JDP/remove_creds
jamiedparsons Jul 27, 2023
430f57c
Fix linting
Jamieparsons Aug 1, 2023
8827e75
cheeky extra change
sunnycarter Aug 1, 2023
1ebce61
Merge pull request #55 from jddarby/JDP/fix_linting
jamiedparsons Aug 1, 2023
28096d2
Remove credentials from the integration test recordings (#54)
patrykkulik-microsoft Aug 8, 2023
cf6b144
Remove the integration test from the repo (#56)
patrykkulik-microsoft Aug 11, 2023
2d89e7a
prerequisite docker for cnf
sunnycarter Aug 14, 2023
6276a13
Fix bicep render on Windows (#57)
sunnycarter Aug 16, 2023
d1c7b8b
Fixes for Windows (#58)
sunnycarter Aug 17, 2023
63ebf43
ADO-880627: Use docker-less ACR login
wbradley94 Aug 21, 2023
9250046
docker is not required any more
sunnycarter Aug 22, 2023
bfe1cfb
Merge branch 'Azure:main' into add-aosm-extension
sunnycarter Aug 22, 2023
2a9407d
Remove pre-release build and lint files from release branch (#63)
sunnycarter Aug 22, 2023
b5372aa
Release markups - release branch (#65)
sunnycarter Aug 24, 2023
485a119
Fix integration tests (#67)
patrykkulik-microsoft Aug 24, 2023
df1ca06
Add aosm to service_name.json
sunnycarter Aug 24, 2023
a28cbc5
move artifact upload to before nfd/nsd deploy (#62)
sunnycarter Aug 25, 2023
dbc2aca
non-working attempt to use token creds
sunnycarter Aug 30, 2023
28e3262
Check for Azure features on deploy and delete (#71)
sunnycarter Aug 31, 2023
535aa95
code working
sunnycarter Sep 1, 2023
c98ea0d
Fix generate-config
sunnycarter Sep 1, 2023
362dad8
Fix tests
sunnycarter Sep 1, 2023
2f0df1e
lint
sunnycarter Sep 1, 2023
703ec23
linting
sunnycarter Sep 1, 2023
445c220
Jl/nfdv proxy (#73)
jordlay Sep 4, 2023
bfaf93b
Code review mark ups
Jamieparsons Sep 5, 2023
86c3e1e
Merge in main
Jamieparsons Sep 5, 2023
e5a6e44
Linting and fix UTs
Jamieparsons Sep 5, 2023
1e5fd22
Merge pull request #72 from jddarby/sunny/credentials-for-cnf-image-u…
jamiedparsons Sep 5, 2023
479ba54
aosm codeowner
sunnycarter Sep 6, 2023
0e5b739
Update HISTORY.rst
jordlay Sep 11, 2023
d5e51ff
Merge branch 'Azure:main' into add-aosm-extension
PerfectChaos Sep 19, 2023
db5b384
Normalise aosm version to 1.0.0b1 for release
PerfectChaos Sep 19, 2023
b9a8997
update hashes in recording
PerfectChaos Sep 19, 2023
0e4d0e7
Temporary test revert of "aosm codeowner"
PerfectChaos Sep 20, 2023
c2e58e1
Fix license header formatting
PerfectChaos Sep 20, 2023
98b412f
Revert "Temporary test revert of "aosm codeowner""
PerfectChaos Sep 20, 2023
0d63c7c
Remove nonexistent entry from codeowners
PerfectChaos Sep 20, 2023
246ff48
Fix source_local_docker_image defaults to placeholder text (#79)
jordlay Sep 21, 2023
96c3187
renamed nsdg to nsd
Sep 21, 2023
ea7a7b4
Merge pull request #81 from jddarby/jl/nsdg_name_change
jddarby Sep 22, 2023
c172f41
Helptext + a little bit of validation
Jamieparsons Sep 22, 2023
3ef7042
Fixed up validation
Jamieparsons Sep 25, 2023
ceeeb2d
Return True if _all_ required artifact manifests exist, not just the …
Sep 26, 2023
c699258
Code markups + linting.
Jamieparsons Sep 26, 2023
84eff1f
Merge pull request #85 from jddarby/JDP/fix_helptext_and_validation
jamiedparsons Sep 26, 2023
b4f07e4
Docs: CNF publish options and permissions (#91)
sunnycarter Sep 26, 2023
f5fe6af
Requirement for docker again
sunnycarter Sep 26, 2023
4ebc39d
revert bad markup (#94)
sunnycarter Sep 27, 2023
634447c
Move live tests to swedensouth
Sep 29, 2023
9bf49a2
Actually move to uaenorth
Sep 29, 2023
b96e7d2
Don't log out ACR passwords when artifact commands fail (#97)
PerfectChaos Sep 29, 2023
8795b87
Fix cnf image take 2 (#101)
sunnycarter Oct 3, 2023
4ee9ab9
Default RG and ACR Values with Publisher Name (#103)
jordlay Oct 4, 2023
5f0e04f
Fix unauthorized error bug
Jamieparsons Oct 6, 2023
68132c5
Add spacing
Jamieparsons Oct 6, 2023
b9dc90a
fix unexpected symbol when parsing lists (#107)
sunnycarter Oct 6, 2023
2e426fb
Merge pull request #106 from jddarby/JDP/unauthorized_error_bug
jamiedparsons Oct 6, 2023
2779e8e
Validation requirements on helm names (#109)
sunnycarter Oct 9, 2023
68f6458
Fix error parsing
Jamieparsons Oct 9, 2023
bf13498
Merge pull request #111 from jddarby/JDP/fix_error_parsing
jamiedparsons Oct 9, 2023
848ee2e
Lower case acr names (#112)
sunnycarter Oct 9, 2023
c756deb
always allow azureDeployLocation to be configurable
jddarby Oct 10, 2023
759727e
Add new optional VHD parameters
jddarby Oct 10, 2023
c42157b
Make VNF publish and delete a live test only
jddarby Oct 10, 2023
c745388
Validate VHD parameters in build UT
jddarby Oct 10, 2023
ba4c4c3
Markups from the CLI team
Jamieparsons Oct 13, 2023
07273b8
Merge pull request #117 from jddarby/JDP/cli_team_markups
jamiedparsons Oct 13, 2023
f4b278e
mark-ups
jddarby Oct 13, 2023
744d415
remove azureDeployLocation as a configurable vhd parameter
jddarby Oct 17, 2023
907e27e
add explanitory comments
jddarby Oct 19, 2023
69e03d1
Merge pull request #114 from jddarby/jdarby/image-value-mappings-fixes
jddarby Oct 19, 2023
24c9849
Updates for 2023-09-01 API (#84)
Cyclam Oct 19, 2023
17f2e6a
Merge branch 'Azure:main' into add-aosm-extension
jddarby Oct 19, 2023
8d35266
Correctly get array item types in CNF deployment parameter schemas
PerfectChaos Oct 19, 2023
bd1274f
Merge pull request #118 from jddarby/chaos/schemarrays
PerfectChaos Oct 20, 2023
171a873
Revert master .flake8 config
Oct 23, 2023
288c8f8
Fix double space in user output.
Cyclam Oct 23, 2023
793adcd
Remove delete message to be consistent with other CLI extensions
Oct 23, 2023
84c22ed
Move "Deleted <resource>" messages to logger.info().
Oct 23, 2023
cf4bc47
Remove Blob_SAS_URL Option from ArmTemplate in input file (#119)
jordlay Oct 23, 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
21 changes: 14 additions & 7 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
max-line-length = 120
max-complexity = 10
ignore =
E501, # line too long, it is covered by pylint
E722, # bare except, bad practice, to be removed in the future
F401, # imported but unused, too many violations, to be removed in the future
F811, # redefinition of unused, to be removed in the future
C901 # code flow is too complex, too many violations, to be removed in the future
W503 # line break before binary operator effect on readability is subjective
W504 # line break after binary operator effect on readability is subjective
# line too long, it is covered by pylint
E501,
# bare except, bad practice, to be removed in the future
E722,
# imported but unused, too many violations, to be removed in the future
F401,
# redefinition of unused, to be removed in the future
F811,
# code flow is too complex, too many violations, to be removed in the future
C901,
# line break before binary operator effect on readability is subjective
W503,
# line break after binary operator effect on readability is subjective
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to modify this file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter complained about the existing format (inline comments and missing commas), so it was modified to keep the linter happy. But you're right, this isn't our file to worry about, so I've reverted it to how it was.

W504
exclude =
*/vendored_sdks
docs
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@

/src/alb/ @jaishals

/src/aosm/ @sunnycarter

/src/managedccfs/ @msftsettiy

/src/acrquery/ @CarolineNB
Expand Down
10 changes: 10 additions & 0 deletions src/aosm/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.. :changelog:

Release History
===============

1.0.0b1
++++++++
* Initial release - beta quality
* `az aosm nfd|nsd generate-config` to generate an example config file to fill in for an NFD or NSD
* `az aosm nfd|nsd build|publish|delete` to prepare files for, publish or delete an NFD or NSD
203 changes: 203 additions & 0 deletions src/aosm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# Microsoft Azure CLI 'aosm' Extension

This package is for the 'aosm' extension to support Azure Operator Service Manager
functions.
i.e. `az aosm`

## Background

The `az aosm` extension is intended to provide support for working with AOSM
resources and definitions. Currently it only implements commands which aid the
process of publishing Network Function Definitions and Network Service Designs to
use with Azure Operator Service Manager or Network Function Manager.

## Installation

`az extension add --name aosm`

For CNFs you will also need helm, and possibly docker installed. See [CNFs](#cnfs) below for details.

# nfd and nsd commands

These commands help with the publishing of Network Function Definition and Network
Service Design resources.

## Overview of function
A generic workflow of using the tool would be:
- Find the pre-requisite items you require for your use-case
- Run a `generate-config` command to output an example JSON config file for subsequent commands
- Fill in the config file
- Run a `build` command to output one or more bicep templates for your Network Function Definition or Network Service Design
- Review the output of the build command, edit the output as necessary for your requirements
- Run a `publish` command to:
* Create all pre-requisite resources such as Resource Group, Publisher, Artifact Stores, Groups
* Deploy those bicep templates
* Upload artifacts to the artifact stores

### Pre-requisites

#### VNFs

For VNFs, you will need a single ARM template which would create the Azure resources
for your VNF, for example a Virtual Machine, disks and NICs. You'll also need a VHD
image that would be used for the VNF Virtual Machine.

#### CNFs

For CNFs you must have these packages installed on the machine you are running the CLI from:
- `helm` package installed . Instructions on how to do this can be found [here](https://helm.sh/docs/intro/install/).
- `docker` installed only in some circumstances, those being if the source image is in your local docker repository, or you do not have subscription-wide permissions required to push charts and images. See the remainder of this section for further details. Docker provides packages that easily configure docker on [Windows](https://docs.docker.com/docker-for-windows/), or [Linux](https://docs.docker.com/engine/install/#supported-platforms) systems.

For CNFs, you must provide:
* helm packages with an associated schema. These files must be on your disk and will be referenced in the `input.json` config file.
* images for your CNF. For these you have the following options:
- a reference to an existing Azure Container Registry which contains the images for your CNF. Currently, only one ACR and namespace is supported per CNF. The images to be copied from this ACR are populated automatically based on the helm package schema. You must have Reader/AcrPull permissions on this ACR. To use this option, fill in `source_registry` and optionally `source_registry_namespace` in the input.json file.
- or, the image name of the source docker image from local machine. This is for a limited use case where the CNF only requires a single docker image which exists in the local docker repository. To use this option, fill in `source_local_docker_image` in the input.json file. This requires docker to be installed.
* optionally, you can provide a file (on disk) path_to_mappings which is a copy of values.yaml with your chosen values replaced by deployment parameters, thus exposing them as parameters to the CNF. You can get this file auto-generated by leaving the value as a blank string, either having every value as a deployment parameter, or using `--interactive` to interactively choose.
When filling in the input.json file, you must list helm packages in the order they are to be deployed. For example, if A must be deployed before B, your input.json should look something like this:

"helm_packages": [
{
"name": "A",
"path_to_chart": "Path to package A",
"path_to_mappings": "Path to package A mappings",
"depends_on": [
"Names of the Helm packages this package depends on"
]
},
{
"name": "B",
"path_to_chart": "Path to package B",
"path_to_mappings": "Path to package B mappings",
"depends_on": [
"Names of the Helm packages this package depends on"
]
},

##### Permissions for publishing CNFs
If sourcing the CNF images from an existing ACR, you need to have `Reader`/`AcrPull` permissions
from this ACR, and ideally, `Contributor` role + `AcrPush` role (or a custom role that allows the `importImage` action and `AcrPush`) over the whole subscription in order to be able to import to the new Artifact store. If you have these, you
do not need docker to be installed locally, and the image copy is very quick.

If you do not have the subscription-wide permissions then you can run the `az aosm nfd publish` command using the `--no-subscription-permissions` flag to pull the image to your local machine and then push it to the Artifact Store using manifest credentials scoped only to the store. This requires docker to be installed locally.

#### NSDs
For NSDs, you will need to have a Resource Group with a deployed Publisher, Artifact Store, Network Function Definition and Network Function Definition Version. You can use the `az aosm nfd` commands to create all of these resources.


### Command examples

#### Before you start
`az login` to login to the Azure CLI.
`az account set --subscription <subscription>` to choose the subscription you will work on.

#### NFDs

Get help on command arguments

`az aosm -h`
`az aosm nfd -h`
`az aosm nfd build -h`
etc...

All these commands take a `--definition-type` argument of `vnf` or `cnf`

Create an example config file for building a definition

`az aosm nfd generate-config`

This will output a file called `input.json` which must be filled in.
Once the config file has been filled in the following commands can be run.

Build an nfd definition locally

`az aosm nfd build --config-file input.json`

More options on building an nfd definition locally:

Choose which of the VNF ARM template parameters you want to expose as NFD deploymentParameters, with the option of interactively choosing each one.

`az aosm nfd build --config-file input.json --definition_type vnf --order_params`
`az aosm nfd build --config-file input.json --definition_type vnf --order_params --interactive`

Choose which of the CNF Helm values parameters you want to expose as NFD deploymentParameters.

`az aosm nfd build --config-file input.json --definition_type cnf [--interactive]`

Publish a pre-built definition

`az aosm nfd publish --config-file input.json`

Delete a published definition

`az aosm nfd delete --config-file input.json`

Delete a published definition and the publisher, artifact stores and NFD group

`az aosm nfd delete --config-file input.json --clean`

#### NSDs

Get help on command arguments

`az aosm -h`
`az aosm nsd -h`
`az aosm nsd build -h`
etc...

Create an example config file for building a definition

`az aosm nsd generate-config`

This will output a file called `input.json` which must be filled in.
Once the config file has been filled in the following commands can be run.

Build an nsd locally

`az aosm nsd build --config-file input.json`

Publish a pre-built design

`az aosm nsd publish --config-file input.json`

Delete a published design

`az aosm nsd delete --config-file input.json`

Delete a published design and the publisher, artifact stores and NSD group

`az aosm nsd delete --config-file input.json --clean`

## Bug Reporting

It would be much appreciated if you could report these so that we're aware of them!

Please see [Logging](#logging) for how to view and collect logs.

Please describe what you are doing and if possible provide the input and output files.

The (Microsoft internal) process for bug reporting during development is here:
https://eng.ms/docs/strategic-missions-and-technologies/strategic-missions-and-technologies-organization/azure-for-operators/aiops/aiops-orchestration/aosm-product-docs/processes/bug_process

CLI issues should be tagged and triaged as UX bugs.

## Logging

The CLI uses the standard Azure CLI logging mechanism. To enable logging to the console, you can use the following flags depending on the desired level of logging:
- `--verbose` - This flag changes the logging level to Info and above.
- `--debug` - This flag changes the logging level to Debug and above.
- `--only-show-errors` - This flag changes the logging level to Error only, suppressing Warning.

It is also possible to enable logging to file by running the following command:
```
az config set logging.enable_log_file=true
```
This will create a log file in the `~/.azure/logs` directory.

**Note:** The above command will enable logging for all Azure CLI commands until the logging is disabled again by the user. Not disabling file logging could slow down the performance of the CLI. To disable file logging, run the following command:
```
az config set logging.enable_log_file=false
```

## Development
Information about setting up and maintaining a development environment for this extension can be found [here](./development.md).
30 changes: 30 additions & 0 deletions src/aosm/azext_aosm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader

from azext_aosm._help import helps # pylint: disable=unused-import


class AosmCommandsLoader(AzCommandsLoader):
def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType

aosm_custom = CliCommandType(operations_tmpl="azext_aosm.custom#{}")
super().__init__(cli_ctx=cli_ctx, custom_command_type=aosm_custom)

def load_command_table(self, args):
from azext_aosm.commands import load_command_table

load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_aosm._params import load_arguments

load_arguments(self, command)


COMMAND_LOADER_CLS = AosmCommandsLoader
39 changes: 39 additions & 0 deletions src/aosm/azext_aosm/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType
from azure.mgmt.containerregistry import ContainerRegistryManagementClient

from .vendored_sdks import HybridNetworkManagementClient


def cf_aosm(cli_ctx, *_) -> HybridNetworkManagementClient:
return get_mgmt_service_client(cli_ctx, HybridNetworkManagementClient)


def cf_resources(cli_ctx, subscription_id=None):
return get_mgmt_service_client(
cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, subscription_id=subscription_id
)


def cf_features(cli_ctx, subscription_id=None):
"""Return the client for checking feature enablement."""
return get_mgmt_service_client(
cli_ctx, ResourceType.MGMT_RESOURCE_FEATURES, subscription_id=subscription_id
)


def cf_acr_registries(cli_ctx, *_) -> ContainerRegistryManagementClient:
"""
Returns the client for managing container registries.

:param cli_ctx: CLI context
:return: ContainerRegistryManagementClient object
"""
return get_mgmt_service_client(
cli_ctx, ResourceType.MGMT_CONTAINERREGISTRY
).registries
Loading
Loading