Skip to content

Commit

Permalink
chore: Add a helper for the MAC address property
Browse files Browse the repository at this point in the history
  • Loading branch information
vaerh committed May 14, 2023
1 parent a6fdcf8 commit 13a006d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
6 changes: 6 additions & 0 deletions routeros/provider_schema_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
KeyInterface = "interface"
KeyInvalid = "invalid"
KeyL2Mtu = "l2mtu"
KeyMacAddress = "mac_address"
KeyMtu = "mtu"
KeyName = "name"
KeyPlaceBefore = "place_before"
Expand Down Expand Up @@ -157,6 +158,11 @@ var (
Computed: true,
Description: "Layer2 Maximum transmission unit.",
}
PropMacAddressRo = &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Current mac address.",
}
PropNameForceNewRw = &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down
5 changes: 1 addition & 4 deletions routeros/resource_interface_bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ func ResourceInterfaceBridge() *schema.Resource {
"forwarding a certain multicast stream. This property only has effect when igmp-snooping is set to yes.",
RequiredWith: []string{"igmp_snooping"},
},
"mac_address": {
Type: schema.TypeString,
Computed: true,
},
KeyMacAddress: PropMacAddressRo,
"max_hops": {
Type: schema.TypeInt,
Optional: true,
Expand Down
11 changes: 4 additions & 7 deletions routeros/resource_interface_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ func ResourceInterfaceVlan() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"mac_address": {
Type: schema.TypeString,
Computed: true,
},
KeyMtu: PropMtuRw(),
KeyName: PropNameForceNewRw,
KeyRunning: PropRunningRo,
KeyMacAddress: PropMacAddressRo,
KeyMtu: PropMtuRw(),
KeyName: PropNameForceNewRw,
KeyRunning: PropRunningRo,
"use_service_tag": {
Type: schema.TypeBool,
Optional: true,
Expand Down
9 changes: 3 additions & 6 deletions routeros/resource_interface_vrrp.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ func ResourceInterfaceVrrp() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"mac_address": {
Type: schema.TypeString,
Computed: true,
},
KeyMtu: PropMtuRw(),
KeyName: PropNameForceNewRw,
KeyMacAddress: PropMacAddressRo,
KeyMtu: PropMtuRw(),
KeyName: PropNameForceNewRw,
"on_fail": {
Type: schema.TypeString,
Optional: true,
Expand Down
1 change: 1 addition & 0 deletions routeros/resource_ovpn_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func ResourceOpenVPNServer() *schema.Resource {
"disconnected",
DiffSuppressFunc: TimeEquall,
},
// Computed only???
"mac_address": {
Type: schema.TypeString,
Optional: true,
Expand Down

0 comments on commit 13a006d

Please sign in to comment.