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

unknown parameter full-duplex Error on ethernet interfaces #326

Closed
jlpedrosa opened this issue Jan 8, 2024 · 14 comments · Fixed by #341 or #367
Closed

unknown parameter full-duplex Error on ethernet interfaces #326

jlpedrosa opened this issue Jan 8, 2024 · 14 comments · Fixed by #341 or #367
Assignees
Labels
bug Something isn't working released

Comments

@jlpedrosa
Copy link
Contributor

jlpedrosa commented Jan 8, 2024

Describe the bug
Ethernet SFP interfaces fail to apply on 7.13.1

╷
│ Error: from RouterOS device: unknown parameter full-duplex
│ 
│   with routeros_interface_ethernet.eths["core-link-1"],
│   on interfaces.tf line 108, in resource "routeros_interface_ethernet" "eths":

I see on: https://help.mikrotik.com/docs/display/ROS/Ethernet#Ethernet-Properties:

full-duplex (yes | no; Default: yes)	Defines whether the transmission of data appears in two directions simultaneously, only applies when auto-negotiation is disabled. Since RouterOS v7.12, the setting is replaced with new speed link modes.

So I guess the field is deprecated, not sure what are the options terraform has to manage those things.

To Reproduce

resource "routeros_interface_ethernet" "eths" {
  for_each                 = local.interfaces
  factory_name         = each.value.factory_name
  sfp_shutdown_temperature = local.sfp_shutdown_temperature
  name                     = each.key
  mtu                      = each.value.link_mtu
  l2mtu                    = each.value.link_l2mtu
}

This is the output of an interface in the router.

{
    ".id": "*A",
    "advertise": "10M-baseT-half,10M-baseT-full,100M-baseT-half,100M-baseT-full,1G-baseT-half,1G-baseT-full,1G-baseX,2.5G-baseT,2.5G-baseX,5G-baseT,10G-baseT,10G-baseSR-LR,10G-baseCR",
    "arp": "enabled",
    "arp-timeout": "auto",
    "auto-negotiation": "true",
    "bandwidth": "unlimited/unlimited",
    "default-name": "sfp-sfpplus9",
    "disabled": "false",
    "driver-rx-byte": "505144592",
    "driver-rx-packet": "1137485",
    "driver-tx-byte": "3961798969",
    "driver-tx-packet": "2838770",
    "l2mtu": "9000",
    "loop-protect": "default",
    "loop-protect-disable-time": "5m",
    "loop-protect-send-interval": "5s",
    "loop-protect-status": "off",
    "mac-address": "48:A9:8A:FD:8C:24",
    "mtu": "9000",
    "name": "sfp-sfpplus9",
    "orig-mac-address": "48:A9:8A:FD:8C:24",
    "running": "true",
    "rx-broadcast": "284231",
    "rx-bytes": "509692943",
    "rx-error-events": "0",
    "rx-fcs-error": "0",
    "rx-flow-control": "off",
    "rx-fragment": "0",
    "rx-jabber": "0",
    "rx-multicast": "2476",
    "rx-overflow": "0",
    "rx-pause": "0",
    "rx-too-long": "0",
    "rx-too-short": "0",
    "rx-unicast": "850763",
    "sfp-rate-select": "high",
    "sfp-shutdown-temperature": "95",
    "switch": "switch1",
    "tx-broadcast": "168",
    "tx-bytes": "3973147890",
    "tx-collision": "0",
    "tx-drop": "0",
    "tx-flow-control": "off",
    "tx-late-collision": "0",
    "tx-multicast": "365",
    "tx-pause": "0",
    "tx-queue0-packet": "2838773",
    "tx-queue1-packet": "0",
    "tx-queue2-packet": "0",
    "tx-queue3-packet": "0",
    "tx-queue4-packet": "0",
    "tx-queue5-packet": "0",
    "tx-queue6-packet": "0",
    "tx-queue7-packet": "0",
    "tx-rx-1024-max": "2932529",
    "tx-rx-128-255": "38144",
    "tx-rx-256-511": "9100",
    "tx-rx-512-1023": "12836",
    "tx-rx-64": "3416",
    "tx-rx-65-127": "980209",
    "tx-underrun": "0",
    "tx-unicast": "2838231"
}

Stack Trace
If applicable, add the stack trace the crash produced.

Additional context
Add any other context about the problem here.

@jlpedrosa jlpedrosa added the bug Something isn't working label Jan 8, 2024
@github-sylvain-tormena
Copy link

Hello,

I confirm the issue. It looks linked to a change in 7.12 (https://forum.mikrotik.com/viewtopic.php?t=201345)
!) ethernet - changed "advertise" and "speed" arguments, and removed "half-duplex" setting under "/interface ethernet" menu;

Not working starting 7.12 but once downgraded to 7.11.3, routeros_interface_ethernet resource is working properly.

@vaerh
Copy link
Collaborator

vaerh commented Jan 11, 2024

Hi all!
Microtik manage to change parameters faster than I can get to them 8-)
Please tell me, is the failure happening on the existing resource configuration or on the new one? Is the data from the state file involved?

@github-sylvain-tormena
Copy link

In my case, it was for resource creation on a brand-new bucket

@vaerh
Copy link
Collaborator

vaerh commented Jan 12, 2024

Ok, I'll experiment and see what's wrong.

@vaerh vaerh self-assigned this Jan 19, 2024
@benumbed
Copy link

This also occurs on pre-existing resources if you've upgraded RouterOS.

@benumbed
Copy link

For anyone looking for a quick fix, changing full_duplex in resource_interface_ethernet.go to:

"full_duplex": {
			Type:             schema.TypeBool,
			Description:      `Defines whether the transmission of data appears in two directions simultaneously, only applies when auto-negotiation is disabled.`,
			Optional:         true,
			DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return true },
		},

fixed the issue for me until @vaerh has a chance to fix it properly.

@vaerh
Copy link
Collaborator

vaerh commented Jan 20, 2024

I am sorry for taking so long to respond. I have some technical problems. I will try to release a fix next week.

vaerh added a commit that referenced this issue Jan 24, 2024
vaerh added a commit that referenced this issue Jan 24, 2024
@vaerh vaerh reopened this Jan 24, 2024
@vaerh
Copy link
Collaborator

vaerh commented Jan 24, 2024

🎉 This issue has been resolved in version 1.32.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@vaerh vaerh added the released label Jan 24, 2024
@durandguru
Copy link
Contributor

I did some basic testing. First creating an interface:
resource "routeros_interface_ethernet" "test2" {
factory_name = "ether4"
name = "ether4"
}

This works fine.

If I do an apply again. It gives an error about l2mtu.

routeros_interface_ethernet.test2 will be updated in-place

~ resource "routeros_interface_ethernet" "test2" {
+ comment = "test"
id = "*4"
- l2mtu = 1598 -> null
name = "ether4"
# (25 unchanged attributes hidden)
}

│ Error: PATCH 'https://172.22.10.208:443/rest/interface/ethernet/*4' returned response code: 400, message: 'Bad Request', details: 'failure: failed to change l2mtu'

│ with routeros_interface_ethernet.test2,
│ on test.tf line 9, in resource "routeros_interface_ethernet" "test2":
│ 9: resource "routeros_interface_ethernet" "test2" {

vaerh added a commit that referenced this issue Jan 25, 2024
@vaerh vaerh closed this as completed in 9260354 Jan 25, 2024
@vaerh
Copy link
Collaborator

vaerh commented Jan 25, 2024

🎉 This issue has been resolved in version 1.32.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@benumbed
Copy link

The change made in 9260354 breaks existing TF for devices which allow the adjustment of l2mtu. I have multiple devices I explicitly set l2mtu on and as of 1.32.5 all of my Terraform fails on those devices: Can't configure a value for "l2mtu": its value will be decided automatically based on the result of applying this configuration.

Not all devices support adjusting l2mtu, but many do. The more powerful routers and switches allow this value to be set manually,, and some network engineers need the ability to adjust the l2mtu on those devices rather than letting RouterOS calculate the value (as it does not take many variables into account).

@jlpedrosa
Copy link
Contributor Author

Yep, in my router (at least through winbox) seems setteable.
image

@vaerh
Copy link
Collaborator

vaerh commented Feb 28, 2024

Yes, I missed the fact that the property can be set. Sorry, corrected.

@vaerh
Copy link
Collaborator

vaerh commented Feb 28, 2024

🎉 This issue has been resolved in version 1.35.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
5 participants