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 the frame_types argument to bridge ports #135

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MagicMicky
Copy link

Very small commit from something I needed, I added the FramesTypes argument for Bridge ports

Let me know if I need to do anything more to get it merged upstream.

Copy link
Collaborator

@maksym-nazarenko maksym-nazarenko left a comment

Choose a reason for hiding this comment

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

Hi @MagicMicky , thanks for your contribution!
Please, see the comments and don't hesitate to call for help if needed

Interface string `mikrotik:"interface"`
PVId int `mikrotik:"pvid"`
Comment string `mikrotik:"comment"`
FrameTypes string `mikrotik:"frame-types"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

This field has value admit-all by default, but expected value does not populate it and TestBridgePort_basic fails.

Copy link
Author

@MagicMicky MagicMicky Mar 11, 2023

Choose a reason for hiding this comment

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

This should be updated, but I wasn't able to properly test unfortunately as I don't have a test environment ready to be used

Copy link
Collaborator

Choose a reason for hiding this comment

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

GithubActions will indicate success/failure once all conflicts are resolved.

@@ -46,6 +46,12 @@ func resourceBridgePort() *schema.Resource {
Optional: true,
Description: "Short description for this association.",
},
"frame_types": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you also add a validation function to allow only pre-defined values?
You can find more in the official docs

Copy link
Author

Choose a reason for hiding this comment

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

I've tried to implement but there's probably some improvement that could be discussed. I've used an inline function and used the official slices package to simplify implementation, not sure if it's something that matches your ways of working or not! Let me know. Tested it quickly and it seems to work as expected

Copy link
Collaborator

Choose a reason for hiding this comment

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

we could use a standard validation package provided by the Terraform plugin SDK so we don't bring new dependencies that are not really necessary.
You can find an example in resource_bridge_port - there is a StringInSlice() validation function.

@@ -16,13 +16,17 @@ github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C6
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
Copy link
Collaborator

Choose a reason for hiding this comment

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

is the a reason this files changed?
I don't see changes in packages/imports 🤔

Copy link
Author

Choose a reason for hiding this comment

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

when building it auto-updated, I've always found go.sum a bit weird. It's now updated I belive with an additional import.

Let me know your thoughts and I can have a look at solving conflicts there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you run go mod tidy before committing - it removes not used hashsums and should cleanup this file a bit.

Copy link
Collaborator

@maksym-nazarenko maksym-nazarenko left a comment

Choose a reason for hiding this comment

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

@MagicMicky left few minor comments, otherwise lgtm.
Could also merge/rebase your branch to match current master?

@@ -46,6 +46,12 @@ func resourceBridgePort() *schema.Resource {
Optional: true,
Description: "Short description for this association.",
},
"frame_types": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could use a standard validation package provided by the Terraform plugin SDK so we don't bring new dependencies that are not really necessary.
You can find an example in resource_bridge_port - there is a StringInSlice() validation function.

Interface string `mikrotik:"interface"`
PVId int `mikrotik:"pvid"`
Comment string `mikrotik:"comment"`
FrameTypes string `mikrotik:"frame-types"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

GithubActions will indicate success/failure once all conflicts are resolved.

@@ -16,13 +16,17 @@ github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C6
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you run go mod tidy before committing - it removes not used hashsums and should cleanup this file a bit.

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