Skip to content

Commit

Permalink
fix: Add missing attributes, add fields to ignore. Fix wrong `new_dst…
Browse files Browse the repository at this point in the history
…_ports` type

Fixes #538
  • Loading branch information
vaerh committed Aug 12, 2024
1 parent e7d0356 commit c570002
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
12 changes: 10 additions & 2 deletions routeros/resource_interface_ethernet_switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,25 @@ func ResourceInterfaceEthernetSwitch() *schema.Resource {
"mirror_source": {
Type: schema.TypeString,
Optional: true,
Default: "none",
Description: "Selects a single mirroring source port. Ingress and egress traffic will be sent to the " +
"mirror-target port. Note that mirror-target port has to belong to the same switch (see which port " +
"belongs to which switch in /interface ethernet menu).",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
"mirror_target": {
Type: schema.TypeString,
Optional: true,
Default: "none",
Description: "Selects a single mirroring target port. Mirrored packets from mirror-source and mirror " +
"(see the property in rule and host table) will be sent to the selected port.",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
"mirror_egress_target": {
Type: schema.TypeString,
Optional: true,
Description: "Selects a single mirroring egress target port, only available on 88E6393X, 88E6191X and " +
"88E6190 switch chips. Mirrored packets from `mirror-egress` (see the property in port menu) will be sent " +
"to the selected port.",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
KeyName: PropName("Name of the switch."),
"switch_id": {
Expand Down
25 changes: 24 additions & 1 deletion routeros/resource_interface_ethernet_switch_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ func ResourceInterfaceEthernetSwitchPort() *schema.Resource {
"rx_pause", "rx_too_long", "rx_too_short", "tx_1024_1518", "tx_128_255", "tx_1519_max", "tx_256_511", "tx_512_1023", "tx_64",
"tx_65_127", "tx_broadcast", "tx_bytes", "tx_collision", "tx_deferred", "tx_excessive_collision", "tx_excessive_deferred",
"tx_late_collision", "tx_multicast", "tx_multiple_collision", "tx_pause", "tx_single_collision", "tx_too_long", "tx_underrun",
"driver_tx_byte", "driver_rx_packet", "driver_rx_byte", "driver_tx_packet", "tx_carrier_sense_error"),
"driver_tx_byte", "driver_rx_packet", "driver_rx_byte", "driver_tx_packet", "tx_carrier_sense_error",
"rx_jabber", "tx_rx_65_127", "tx_rx_512_1023", "rx_unicast", "tx_fcs_error", "tx_rx_128_255", "tx_unicast",
"tx_rx_1024_max", "tx_rx_256_511", "rx_error_events", "tx_rx_64",
),

"default_vlan_id": {
Type: schema.TypeString,
Expand All @@ -83,7 +86,27 @@ func ResourceInterfaceEthernetSwitchPort() *schema.Resource {
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
KeyInvalid: PropInvalidRo,
"mirror_egress": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to send egress packet copy to the `mirror-egress-target` port, only available on " +
"88E6393X, 88E6191X and 88E6190 switch chips.",
},
"mirror_ingress": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to send ingress packet copy to the `mirror-ingress-target` port, only available on " +
"88E6393X, 88E6191X and 88E6190 switch chips.",
},
"mirror_ingress_target": {
Type: schema.TypeString,
Optional: true,
Description: "Selects a single mirroring ingress target port, only available on 88E6393X, 88E6191X and " +
"88E6190 switch chips. Mirrored packets from `mirror-ingress` will be sent to the selected port.",
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
KeyName: PropName("Port name."),
KeyRunning: PropRunningRo,
"switch": {
Type: schema.TypeString,
Computed: true,
Expand Down
11 changes: 10 additions & 1 deletion routeros/resource_interface_ethernet_switch_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,17 @@ func ResourceInterfaceEthernetSwitchRule() *schema.Resource {
Description: "Whether to send a frame copy to mirror-target port from a frame with matching MAC destination address " +
"(matching destination or source address for CRS3xx series switches).",
},
"mirror_ports": {
Type: schema.TypeSet,
Optional: true,
Description: "Selects multiple mirroring target ports, only available on 88E6393X switch chip. " +
"Matched packets in the ACL rule will be copied and sent to selected ports.",
Elem: &schema.Schema{
Type: schema.TypeString,
DiffSuppressFunc: AlwaysPresentNotUserProvided,
}},
"new_dst_ports": {
Type: schema.TypeString,
Type: schema.TypeSet,
Optional: true,
Description: "Changes the destination port as specified, multiple ports allowed, including a switch CPU port. An empty " +
"setting will drop the packet. When the parameter is not used, the packet will be accepted.",
Expand Down

0 comments on commit c570002

Please sign in to comment.