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

Adding Support for Nexus to the CLI #140

Closed
wants to merge 30 commits into from
Closed

Adding Support for Nexus to the CLI #140

wants to merge 30 commits into from

Conversation

jordlay
Copy link
Collaborator

@jordlay jordlay commented Feb 2, 2024


This PR includes:

  • Splitting VNF handlers class into Core and Nexus subclasses
  • Adding new input config class + generalising artifact.py upload config type to be NFD instead of VNF (to include both vnf types)
  • Adding a nexus flag to the commands
  • Adding functionality to NexusArmBuildProcessor (which was previously not implemented)
  • Creating a Nexus image input and processor object
  • Error handling for build and publish inputs (in case users run the command and forget the flag, it gives a sensible error)
  • Added conditions to vnf manifest and definition templates to handle both VNF types
  • Added new nexus base bicep template
  • Added nfvi type to nsds for nfvi type in nsdv

Extra Changes:

  • Moving 2 functions into common/utils from base handler: get_template_path and render_definition_bicep_contents
  • Generalising all render bicep functions to just one

UNIT TESTS PENDING!

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@jordlay jordlay requested a review from sunnycarter as a code owner February 2, 2024 15:41
Copy link
Collaborator

@Cyclam Cyclam left a comment

Choose a reason for hiding this comment

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

The main theme here is reducing duplication in the code. Happy to discuss and/or brainstorm solutions if you want.

super().__init__(name, input_artifact)
self.input_artifact: NexusImageFileInput = input_artifact

def get_artifact_manifest_list(self) -> List[ManifestArtifactFormat]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is almost identical to the VHDProcessor. Feels like it could be deduplicated.

)
return artifacts, file_builders

def generate_nf_application(self) -> AzureOperatorNexusNetworkFunctionImageApplication:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Almost identical to VHDProcessor. Worth deduplicating?


def build_all_parameters_json(self) -> JSONDefinitionElementBuilder:
"""Create object for all_parameters.json."""
params_content = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you pull out parameters common to Nexus handler to deduplicate?

default_config.update({"image_api_version": vhd.image_api_version})
return default_config

def _generate_type_specific_nf_application(self, processor) -> "tuple[list, list]":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Almost identical to Nexus handler. Can you generalise the method and put it in a parent class to deduplicate?

@@ -548,12 +547,12 @@ class BaseStorageAccountArtifact(BaseArtifact):

@abstractmethod
def upload(
self, config: BaseCommonParametersConfig, command_context: CommandContext
self, config: NFDCommonParametersConfig, command_context: CommandContext
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think mypy will allow this....

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed it back

* refactored base handler init to treat inputs from different commands separately; added better validation

* fixed error handling in base handler

* fixed error typing

---------

Co-authored-by: Jordan <jordan.layton@metaswitch.com>
@jordlay
Copy link
Collaborator Author

jordlay commented Mar 11, 2024

We merged this to a temp branch in order ot deliver to a customer. We then merged that to main, so these changes are in main and we can close this PR.

@jordlay jordlay closed this Mar 11, 2024
@jordlay jordlay deleted the jl/nexus-support branch March 11, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants