diff --git a/routeros/resource_interface_bridge.go b/routeros/resource_interface_bridge.go index ff56055e..00923630 100644 --- a/routeros/resource_interface_bridge.go +++ b/routeros/resource_interface_bridge.go @@ -27,20 +27,20 @@ func ResourceInterfaceBridge() *schema.Resource { Description: "Static MAC address of the bridge. This property only has effect when auto-mac is set to no.", }, "ageing_time": { - Type: schema.TypeString, - Optional: true, - Default: "5m", - Description: "How long a host's information will be kept in the bridge database.", + Type: schema.TypeString, + Optional: true, + Description: "How long a host's information will be kept in the bridge database.", + DiffSuppressFunc: TimeEquall, }, KeyArp: PropArpRw, KeyArpTimeout: PropArpTimeoutRw, "auto_mac": { Type: schema.TypeBool, Optional: true, - Default: true, Description: "Automatically select one MAC address of bridge ports as a bridge MAC address, bridge MAC " + "will be chosen from the first added bridge port. After a device reboot, the bridge MAC " + "can change depending on the port-number.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, }, KeyComment: PropCommentRw, "dhcp_snooping": { @@ -49,11 +49,11 @@ func ResourceInterfaceBridge() *schema.Resource { }, KeyDisabled: PropDisabledRw, "ether_type": { - Type: schema.TypeString, - Optional: true, - Default: "0x8100", - Description: "This property only has effect when vlan-filtering is set to yes.", - ValidateFunc: validation.StringInSlice([]string{"0x9100", "0x8100", "0x88a8"}, false), + Type: schema.TypeString, + Optional: true, + Description: "This property only has effect when vlan-filtering is set to yes.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.StringInSlice([]string{"0x9100", "0x8100", "0x88a8"}, false), }, "fast_forward": { Type: schema.TypeBool, @@ -63,46 +63,46 @@ func ResourceInterfaceBridge() *schema.Resource { "forward_delay": { Type: schema.TypeString, Optional: true, - Default: "15s", Description: "Time which is spent during the initialization phase of the bridge interface " + "(i.e., after router startup or enabling the interface) in listening/learning state before the " + "bridge will start functioning normally.", + DiffSuppressFunc: TimeEquall, }, "frame_types": { Type: schema.TypeString, Optional: true, - Default: "admit-all", Description: "Specifies allowed frame types on a bridge port. This property only has effect when " + "vlan-filtering is set to yes.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, ValidateFunc: validation.StringInSlice([]string{"admit-all", "admit-only-untagged-and-priority-tagged", "admit-only-vlan-tagged"}, false), }, "igmp_snooping": { Type: schema.TypeBool, Optional: true, - Default: false, Description: "Enables multicast group and port learning to prevent multicast traffic from flooding all " + "interfaces in a bridge.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, }, "igmp_version": { Type: schema.TypeInt, Optional: true, - // Default: "2", Computed: true, Description: "Selects the IGMP version in which IGMP general membership queries will be generated. " + "This property only has effect when igmp-snooping is set to yes.", - ValidateFunc: validation.IntInSlice([]int{2, 3}), - RequiredWith: []string{"igmp_snooping"}, + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.IntInSlice([]int{2, 3}), + RequiredWith: []string{"igmp_snooping"}, }, "ingress_filtering": { Type: schema.TypeBool, Optional: true, - Default: false, Description: "Enables or disables VLAN ingress filtering, which checks if the ingress port is a member " + "of the received VLAN ID in the bridge VLAN table. Should be used with frame-types to specify if " + "the ingress traffic should be tagged or untagged. This property only has effect when " + "vlan-filtering is set to yes.", - RequiredWith: []string{"vlan_filtering"}, + DiffSuppressFunc: AlwaysPresentNotUserProvided, + RequiredWith: []string{"vlan_filtering"}, }, KeyL2Mtu: PropL2MtuRo, "last_member_interval": { @@ -118,33 +118,32 @@ func ResourceInterfaceBridge() *schema.Resource { "last_member_query_count": { Type: schema.TypeInt, Optional: true, - // Default: 2, Computed: true, Description: "How many times should last-member-interval pass until a IGMP Snooping bridge will stop " + "forwarding a certain multicast stream. This property only has effect when igmp-snooping is set to yes.", - RequiredWith: []string{"igmp_snooping"}, + DiffSuppressFunc: AlwaysPresentNotUserProvided, + RequiredWith: []string{"igmp_snooping"}, }, KeyMacAddress: PropMacAddressRo, "max_hops": { Type: schema.TypeInt, Optional: true, - // Default: 20, Computed: true, Description: "Bridge count which BPDU can pass in a MSTP enabled network in the same region before BPDU " + "is being ignored. This property only has effect when protocol-mode is set to mstp.", - ValidateFunc: validation.IntBetween(6, 40), + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.IntBetween(6, 40), }, "max_message_age": { Type: schema.TypeString, Optional: true, - Default: "20s", Description: "Changes the Max Age value in BPDU packets, which is transmitted by the root bridge. " + "This property only has effect when protocol-mode is set to stp or rstp. Value: 6s..40s", + DiffSuppressFunc: AlwaysPresentNotUserProvided, }, "membership_interval": { Type: schema.TypeString, Optional: true, - // Default: "4m20s", Computed: true, Description: "Amount of time after an entry in the Multicast Database (MDB) is removed if a IGMP membership " + "report is not received on a certain port. This property only has effect when igmp-snooping is set to yes.", @@ -154,22 +153,22 @@ func ResourceInterfaceBridge() *schema.Resource { "mld_version": { Type: schema.TypeInt, Optional: true, - // Default: 1, Computed: true, Description: "Selects the MLD version. Version 2 adds support for source-specific multicast. This " + "property only has effect when RouterOS IPv6 package is enabled and igmp-snooping is set to yes.", - ValidateFunc: validation.IntInSlice([]int{1, 2}), - RequiredWith: []string{"igmp_snooping"}, + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.IntInSlice([]int{1, 2}), + RequiredWith: []string{"igmp_snooping"}, }, "mtu": { Type: schema.TypeString, Optional: true, - Default: "auto", Description: "The default bridge MTU value without any bridge ports added is 1500. " + "The MTU value can be set manually, but it cannot exceed the bridge L2MTU or the lowest bridge " + "port L2MTU. If a new bridge port is added with L2MTU which is smaller than the actual-mtu " + "of the bridge (set by the mtu property), then manually set value will be ignored and the bridge " + "will act as if mtu=auto is set.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, }, "multicast_querier": { Type: schema.TypeBool, @@ -204,31 +203,30 @@ func ResourceInterfaceBridge() *schema.Resource { "priority": { Type: schema.TypeString, Optional: true, - Default: "0x8000", Description: "Bridge priority, used by STP to determine root bridge, used by MSTP to determine CIST " + "and IST regional root bridge. This property has no effect when protocol-mode is set to none.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, }, "protocol_mode": { Type: schema.TypeString, Optional: true, - Default: "rstp", Description: "Select Spanning tree protocol (STP) or Rapid spanning tree protocol (RSTP) to ensure a " + "loop-free topology for any bridged LAN.", - ValidateFunc: validation.StringInSlice([]string{"none", "rstp", "stp", "mstp"}, false), + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.StringInSlice([]string{"none", "rstp", "stp", "mstp"}, false), }, "pvid": { Type: schema.TypeInt, Optional: true, - Default: 1, Description: "Port VLAN ID (pvid) specifies which VLAN the untagged ingress traffic is assigned to. " + "It applies e.g. to frames sent from bridge IP and destined to a bridge port. " + "This property only has effect when vlan-filtering is set to yes.", - ValidateFunc: validation.IntBetween(1, 4094), + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.IntBetween(1, 4094), }, "querier_interval": { Type: schema.TypeString, Optional: true, - // Default: "4m15s", Computed: true, Description: "Used to change the interval how often a bridge checks if it is the active multicast " + "querier. This property only has effect when igmp-snooping and multicast-querier is set to yes.", @@ -238,7 +236,6 @@ func ResourceInterfaceBridge() *schema.Resource { "query_interval": { Type: schema.TypeString, Optional: true, - // Default: "2m5s", Computed: true, Description: "Used to change the interval how often IGMP general membership queries are sent out. " + "This property only has effect when igmp-snooping and multicast-querier is set to yes.", @@ -248,7 +245,6 @@ func ResourceInterfaceBridge() *schema.Resource { "query_response_interval": { Type: schema.TypeString, Optional: true, - // Default: "10s", Computed: true, Description: "Interval in which a IGMP capable device must reply to a IGMP query with a IGMP membership " + "report. This property only has effect when igmp-snooping and multicast-querier is set to yes.", @@ -270,17 +266,16 @@ func ResourceInterfaceBridge() *schema.Resource { "startup_query_count": { Type: schema.TypeInt, Optional: true, - // Default: 2, Computed: true, Description: "Specifies how many times must startup-query-interval pass until the bridge starts sending " + "out IGMP general membership queries periodically. This property only has effect when igmp-snooping " + "and multicast-querier is set to yes.", - RequiredWith: []string{"igmp_snooping", "multicast_querier"}, + DiffSuppressFunc: AlwaysPresentNotUserProvided, + RequiredWith: []string{"igmp_snooping", "multicast_querier"}, }, "startup_query_interval": { Type: schema.TypeString, Optional: true, - // Default: "31s250ms", Computed: true, Description: "Used to change the amount of time after a bridge starts sending out IGMP general membership " + "queries after the bridge is enabled. This property only has effect when igmp-snooping and " + @@ -289,17 +284,17 @@ func ResourceInterfaceBridge() *schema.Resource { RequiredWith: []string{"igmp_snooping", "multicast_querier"}, }, "transmit_hold_count": { - Type: schema.TypeInt, - Optional: true, - Default: 6, - Description: "The Transmit Hold Count used by the Port Transmit state machine to limit transmission rate.", - ValidateFunc: validation.IntBetween(1, 10), + Type: schema.TypeInt, + Optional: true, + Description: "The Transmit Hold Count used by the Port Transmit state machine to limit transmission rate.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, + ValidateFunc: validation.IntBetween(1, 10), }, "vlan_filtering": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Description: "Globally enables or disables VLAN functionality for bridge.", + Type: schema.TypeBool, + Optional: true, + Description: "Globally enables or disables VLAN functionality for bridge.", + DiffSuppressFunc: AlwaysPresentNotUserProvided, }, // Some properties are not implemented, see: https://wiki.mikrotik.com/wiki/Manual:Interface/Bridge } diff --git a/routeros/resource_interface_bridge_test.go b/routeros/resource_interface_bridge_test.go index a885d0aa..cfef88b2 100644 --- a/routeros/resource_interface_bridge_test.go +++ b/routeros/resource_interface_bridge_test.go @@ -49,12 +49,13 @@ resource "routeros_interface_bridge" "test_bridge" { } resource "routeros_interface_bridge" "test_bridge_w_space" { - name = "Main bridge" + name = "Main bridge" + ageing_time = "300s" ingress_filtering = true - protocol_mode = "rstp" - priority = "0x3000" - igmp_snooping = true - vlan_filtering = true + protocol_mode = "rstp" + priority = "0x3000" + igmp_snooping = true + vlan_filtering = true } `