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

feat(mvrp): Support Multiple VLAN Registration protocol (MVRP). #497

Merged
merged 4 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions routeros/resource_interface_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ func ResourceInterfaceBridge() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"disabled", "permanent", "temporary-query"}, false),
RequiredWith: []string{"igmp_snooping"},
},
"mvrp": {
Type: schema.TypeBool,
Optional: true,
//Default: false,
Description: "Enables MVRP for bridge (available since RouterOS 7.15). It ensures that the MAC address 01:80:C2:00:00:21 is trapped and not forwarded, the vlan-filtering must be enabled.",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
KeyName: PropNameForceNewRw,
"port_cost_mode": {
Type: schema.TypeString,
Expand Down
20 changes: 20 additions & 0 deletions routeros/resource_interface_bridge_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,26 @@ func ResourceInterfaceBridgePort() *schema.Resource {
DiffSuppressFunc: AlwaysPresentNotUserProvided,
ValidateFunc: validation.StringInSlice([]string{"disabled", "permanent", "temporary-query"}, false),
},
"mvrp_applicant_state": {
Type: schema.TypeString,
Optional: true,
//Default: "normal-participant",
Description: "MVRP applicant options (available since RouterOS 7.15): " +
"- non-participant - port does not send any MRP messages; " +
"- normal-participant - port participates normally in MRP exchanges.",
ValidateFunc: validation.StringInSlice([]string{"non-participant", "normal-participant"}, false),
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
"mvrp_registrar_state": {
Type: schema.TypeString,
Optional: true,
//Default: "normal",
Description: "MVRP registrar options (available since RouterOS 7.15): " +
"- fixed - port ignores all MRP messages, and remains Registered (IN) in all configured vlans. " +
"- normal - port receives MRP messages and handles them according to the standard.",
ValidateFunc: validation.StringInSlice([]string{"fixed", "normal"}, false),
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
// This field has a string value because on the x86 architecture there is no good way to validate
// values up to 4294967295. And in this case, an overflow occurs with an errors:
// "Cannot use 4294967295 (untyped int constant) as int value in argument to validation.IntBetween (overflows)"
Expand Down
9 changes: 9 additions & 0 deletions routeros/resource_interface_bridge_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ func ResourceInterfaceBridgeVlan() *schema.Resource {
},
KeyDisabled: PropDisabledRw,
KeyDynamic: PropDynamicRo,
"mvrp_forbidden": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Description: "Ports that ignore all MRP messages and remains Not Registered (MT), as well as disables applicant from declaring specific VLAN ID (available since RouterOS 7.15).",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
"tagged": {
Type: schema.TypeList,
Optional: true,
Expand Down
13 changes: 11 additions & 2 deletions routeros/resource_interface_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@ func ResourceInterfaceVlan() *schema.Resource {
KeyLoopProtectStatus: PropLoopProtectStatusRo,
KeyMacAddress: PropMacAddressRo,
KeyMtu: PropMtuRw(),
KeyName: PropNameForceNewRw,
KeyRunning: PropRunningRo,
"mvrp": {
Type: schema.TypeBool,
Optional: true,
//Default: false,
Description: "Specifies whether this VLAN should declare its attributes through Multiple VLAN Registration Protocol (MVRP) as an applicant (available since RouterOS 7.15). " +
"It can be used to register the VLAN with connected bridges that support MVRP. " +
"This property only has an effect when use-service-tag is disabled.",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
KeyName: PropNameForceNewRw,
KeyRunning: PropRunningRo,
"use_service_tag": {
Type: schema.TypeBool,
Optional: true,
Expand Down