Skip to content

Commit

Permalink
feat(mvrp): Support Multiple VLAN Registration protocol (MVRP).
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmets committed Jun 19, 2024
1 parent 6bb0fdd commit ece9fd7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
6 changes: 6 additions & 0 deletions routeros/resource_interface_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ 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. It ensures that the MAC address 01:80:C2:00:00:21 is trapped and not forwarded, the vlan-filtering must be enabled.",
},
KeyName: PropNameForceNewRw,
"port_cost_mode": {
Type: schema.TypeString,
Expand Down
18 changes: 18 additions & 0 deletions routeros/resource_interface_bridge_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,24 @@ 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: " +
"- 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),
},
"mvrp_registrar_state": {
Type: schema.TypeString,
Optional: true,
Default: "normal",
Description: "MVRP registrar options: " +
"- 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),
},
// 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
8 changes: 8 additions & 0 deletions routeros/resource_interface_bridge_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ func ResourceInterfaceBridgeVlan() *schema.Resource {
},
KeyDisabled: PropDisabledRw,
KeyDynamic: PropDynamicRo,
"mvrp_forbiden": {
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.",
},
"tagged": {
Type: schema.TypeList,
Optional: true,
Expand Down
12 changes: 10 additions & 2 deletions routeros/resource_interface_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ 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. " +
"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.",
},
KeyName: PropNameForceNewRw,
KeyRunning: PropRunningRo,
"use_service_tag": {
Type: schema.TypeBool,
Optional: true,
Expand Down

0 comments on commit ece9fd7

Please sign in to comment.