-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add aosm extension #6426
Changes from 245 commits
1eaa34f
21809b2
89636e5
715c925
0f50403
fbba297
f92435c
0b1266f
599ac38
5437fac
2efdba6
c80ced8
dfd5790
4747224
58d525d
3188399
30921b8
3501b82
7064890
ae4f8fe
2604a71
961daad
8274996
d4fbc16
671fb64
b3573e8
eb3c1a5
1a29b43
13f72f4
6099b7a
3c52481
8c94905
aa0b061
c988938
9d15f95
1853cba
c6d6680
13c27cc
ff1793c
651ba78
5bde597
a79ef57
168c265
e43cb92
9694c9b
9efa296
2d19e34
a40cc3d
e63f199
c26369a
2dee8c4
bb6302a
d5b03c6
f43f313
276d3ca
d7f1b7a
938b02e
ab95a7c
65ac401
371a1ea
dda5957
cdfde0f
25d05b1
6ed8ffa
5b1e3aa
a1035f7
77e2e95
1c642bb
b557b7f
a7d7574
6d0520d
4c1a2ee
8e8db34
44299e6
e38d425
6cda523
d0f1276
a6c292c
649ace6
5f7b608
09be248
e680931
a087421
4c54367
70c7346
126c68c
cbf8f67
93fb6af
b19dcc3
c57e4c5
63b4346
a88e757
9e67219
93840e8
6c9a478
3adcb80
1c0dbe1
85ae247
0f2fb35
7719df2
077531d
9419ef9
d7a4abf
4013895
689acf4
a403856
c492fae
aad112f
f06efc3
31672ae
f8b317f
53e7729
51eb04b
9d21900
716737e
0f86392
ad88098
9f4f269
de248c1
0497ec7
91b7f39
ea3fd77
e994c60
95af0fc
b5b70b9
09f6a45
21154ff
d02bc45
a299eba
ebb5b46
1f18b8d
64e9a44
7460892
8a05139
71ae242
44344ff
60140e2
ab98755
3199a57
607b2d1
5da563b
b40b62c
3241761
5388f19
68e11cc
b28e5f5
64c645b
d11e82c
dc9deca
bfdb6dc
ed20b35
0a7dc2d
17147d7
980ebc2
55a2320
e286c17
e9925a1
6c6ec80
100a844
9483466
6c5bea2
ea6e507
c087b45
7a4154d
12a2179
d39d584
687d506
b192027
5646f52
aaf2e39
430f57c
8827e75
1ebce61
28096d2
cf6b144
2d89e7a
6276a13
d1c7b8b
63ebf43
9250046
bfe1cfb
2a9407d
b5372aa
485a119
df1ca06
a28cbc5
dbc2aca
28e3262
535aa95
c98ea0d
362dad8
2f0df1e
703ec23
445c220
bfaf93b
86c3e1e
e5a6e44
1e5fd22
479ba54
0e5b739
d5e51ff
db5b384
b9a8997
0e4d0e7
c2e58e1
98b412f
0d63c7c
246ff48
96c3187
ea7a7b4
c172f41
3ef7042
ceeeb2d
c699258
84eff1f
b4f07e4
f5fe6af
4ebc39d
634447c
9bf49a2
b96e7d2
8795b87
4ee9ab9
5f0e04f
68132c5
b9dc90a
2e426fb
2779e8e
68f6458
bf13498
848ee2e
c756deb
759727e
c42157b
c745388
ba4c4c3
07273b8
f4b278e
744d415
907e27e
69e03d1
24c9849
17f2e6a
8d35266
bd1274f
171a873
288c8f8
793adcd
84c22ed
cf4bc47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.. :changelog: | ||
|
||
Release History | ||
=============== | ||
|
||
upcoming | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it should be a new version instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-release versions have been removed, version is now 1.0.0b1. |
||
++++++++++ | ||
* Added a `--clean` flag to the NSD `delete` command. This flag will delete the NSDG on top of the other resources deleted by the `delete` command. | ||
* Added integration tests for `publish` and `delete` commands. | ||
* Added a `--force` flag to the aosm `build` and `delete` commands. This command will force the `build` or `delete` commands to proceed without waiting on user input to confirm. | ||
* `az aosm nfd build` options `--order-params` and `--interactive` to help users choose which NF parameters to expose as deployParameters. Feature added that allows CNF value mappings file to be generated if none is supplied. | ||
* NFDV version exposed as a CGV on an SNS. | ||
* `az aosm nfd publish` option added for `--definition-type cnf` to publish the CNF bicep templates, upload helm charts from disk to the ACR and copy the images from a source ACR to the target ACR. | ||
* Managed Identity added to VNF NF templates - requires subscription to be registered for the feature flag. | ||
* Various fixes to NFD build of deployParameters schema and interactive mode create of deployParameters mappings file. | ||
* Fix CNF NFD publish so that it doesn't render the ACR unuseable for future Artifact publishing. | ||
* Allow CNF NFD image copy from a source ACR using a namespace. | ||
* Fix - Add new CGSchema parameters not from the NFD to the `required` section of the schema. | ||
* Add the ability to skip bicep publish or artifact upload during publish commands. | ||
* Fix Manifest name for NSDs so it isn't the same as that for NFDs | ||
* Add validation of source_registry_id format for CNF configuration | ||
* Workaround Oras client bug (#90) on Windows for Artifact upload to ACR | ||
* Take Oras 0.1.18 so above Workaround could be removed | ||
* Take Oras 0.1.19 to fix NSD Artifact upload on Windows | ||
* Support deploying multiple instances of the same NF in an SNS | ||
* Fix CNF publish on Windows by using Linux style paths in rendered NFD bicep templates (bicep always requires Linux style paths). | ||
* Re-order publish steps so that artifacts are uploaded before the NFD/NSD is published. | ||
* Add progress information for VHD upload | ||
* Change optional argument from `manifest_parameters_json_file` to `manifest_params_file` to appease linter. | ||
* NB CHANGE TO PREVIOUS CONFIG FILE FORMAT FOR NFDS | ||
- Add options for CNF image upload. By default CNF images are copied from a source ACR using `az acr import` which is fast but requires subscription-wide permissions. | ||
- If permissions are not available then CNF images can be copies from the source ACR using `docker pull` then `docker push`, which is slower and requires Docker to be installed. This is governed by a new --no-subscription-permissions flag. | ||
- Also, if only a single image is required, it can be specified in the config file and uploaded from local docker registry using `docker push` | ||
- CNF image config has been moved into an `images` section of the config file. Please run `az aosm nfd generate-config --definition-type cnf` to generate a new config file. | ||
- Remove pre-deploy check to check source ACR exists. This will be found at the time that images are copied / accessed. | ||
- Change from using ContainerRegistryManagementClient to `az acr import` subprocess call, so that we don't need to know the Resource Group. | ||
|
||
0.2.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this extension has never been officially released, the release history should only contain one version (i.e. 1.0.0b1). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-release versions have been removed, version is now 1.0.0b1. |
||
++++++ | ||
Breaking change to commands - now use `nfd` instead of `definition`. Publish option removed from build. | ||
* `az aosm nfd generate-config` for vnf and cnf. This is for NFDVs | ||
* `az aosm nfd build|publish|delete --definition-type vnf|cnf` for vnf and `build` only for cnf. This is for NFDVs | ||
|
||
0.1.0 | ||
++++++ | ||
* Initial release - alpha quality | ||
* `az aosm definition generate-config` for vnf and cnf. This is for NFDVs | ||
* `az aosm definition build|publish|delete` for vnf and `build` only for cnf. This is for NFDVs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# 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 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/). | ||
|
||
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. | ||
* a reference to an existing Azure Container Registry which contains the images for your CNF. Currently, only one ACR is supported per CNF. The images to be copied from this ACR are populated automatically based on the helm package schema. | ||
* 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" | ||
] | ||
}, | ||
|
||
#### 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). |
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 |
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.