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

Migrate NETCONF junos_helper to provider. #35

Merged
merged 5 commits into from
Jul 26, 2023

Conversation

aaronchar
Copy link

The purpose of this pull request is to migrate the junos_helpers functionality from go-netconf to this project, it is still using the go-netconf library but instead of depending upon the junos_helpers from the library we simply implement it within this repo.

This should allow for easier changes to the NETCONF calls that are being used from this provider while preventing any unwanted changes to the underlying libraries helper such as adding in a bulk/batch mode etc.

To accomplish this I have made the following notable changes.

  • The terraform_providers directory now contains a netconf directory, this is essentially a like for like copy of the junos_helpers file from go-netconf with the exception that we now return an interface structure, the reason for this is so that we can add or remove more helper files as long as it satisfies the interface requirements.

  • The config.go library has been moved from the terraform_providers directory and is now a generated resource, the purpose for this is so that we can correctly import and use any subdirectories within the terraform_providers directory eg: the netconf directory

  • The function which copies files from the terraform_providers has been updated to also copy files within subdirectories while maintaining the proper pathing, I also added in some logging to the terminal around the files that have been copied over.

  • when generating the provider.go file it now has the pathing to the local netconf library added in.

aaronchar and others added 2 commits June 5, 2022 15:22
…copying go files in subdirectories well preserving the pathing during the stage where they are copied to the `providerDir`

moved the `config.go` from a file that is copying during processing to a file that is generated during the processing stage, this is so we can properly import subdirectories from the `terraform_providers` directory for example the new `netconf` folder

Added in the `netconf` folder, which contains a nearly identical mirror of the `junos_helper` function from `go-netconf`. With the one exception being that the type has been moved to an interface so the possibility of expanding/altering the `netconf` portion is more accessible, this changed
also required a change to the generated `provider.go` file to reference the new `netconf` helper.
@aaronchar
Copy link
Author

I know from comments made by @davedotdev that the idea is to keep this jtaf library as simple as possible,I think the added flexibility that is gained by moving a core dependency from an external library into the provider library allows greater flexibility as well as potential customization at a user level.

Right now, you are modifying multiple libraries if you want to implement a solution to #31 . This PR will make it so that we only need to alter the single jtaf NETCONF interface.

@aaronchar aaronchar marked this pull request as ready for review June 7, 2022 17:38
@aaronchar
Copy link
Author

This has been updated to work with the latest sdk changes.

…her quality of life issues

the main purprose of this commit is to simply remove functions from the  file that are not needed for the  provider

by doing this it allows for a clener ingreation and makes future changes easier to manage
@aaronchar
Copy link
Author

The latest changes to the PR clean up the NETCONF helper functions.

I have removed functions that are not needed for the operation of jtaf and I have condensed the destroy operations to a single function instead of destroyNoCommit and destory, this is now a single destroy function that takes a bool commit variables.

@aaronchar
Copy link
Author

@ydnath - Just tagging you on this for a review.

@ydnath ydnath requested a review from davedotdev July 18, 2022 08:27
@aburston aburston requested review from aburston and removed request for davedotdev and aburston July 26, 2023 17:16
@aburston aburston merged commit a8a16c2 into Juniper:master Jul 26, 2023
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.

4 participants