| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package l2topology |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/stretchr/testify/require" |
| 9 | ) |
| 10 | |
| 11 | func TestIsMACCompatibleWithDevice_NormalizesRemoteMAC(t *testing.T) { |
| 12 | state := newL2BuildState(1) |
| 13 | state.devices["known-device"] = Device{ |
| 14 | ID: "known-device", |
| 15 | Hostname: "switch-a", |
| 16 | ChassisID: "00:11:22:33:44:55", |
| 17 | } |
| 18 | |
| 19 | require.True(t, state.isMACCompatibleWithDevice("known-device", "0011.2233.4455")) |
| 20 | require.True(t, state.isMACCompatibleWithDevice("known-device", "0x001122334455")) |
| 21 | require.False(t, state.isMACCompatibleWithDevice("known-device", "00-11-22-33-44-66")) |
| 22 | } |