Ai
5 Star 6 Fork 4

zstackio/zstack-vyos

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sys_test.go 871 Bytes
一键复制 编辑 原始数据 按行查看 历史
package server
import (
"testing"
"zstack-vyos/utils"
)
func XTestFindNicNameByMac(t *testing.T) {
text := `
interfaces {
ethernet eth0 {
address 172.20.14.209/16
description main
duplex auto
hw-id fa:da:21:1f:1a:00
smp_affinity auto
speed auto
}
ethernet eth1 {
hw-id fa:da:21:1f:1a:11
}
ethernet eth2 {
speed auto
}
loopback lo {
}
}`
ConfigurationSourceFunc = func() string {
return text
}
name, ok := FindNicNameByMac("fa:da:21:1f:1a:00")
utils.Assert(ok, "not found")
utils.Assert("eth0" == name, "fa:da:21:1f:1a:00 mismatch")
name, ok = FindNicNameByMac("fa:da:21:1f:1a:11")
utils.Assert(ok, "not found")
utils.Assert("eth1" == name, "fa:da:21:1f:1a:11 mismatch")
name, ok = FindNicNameByMac("fa:da:21:1f:fa:11")
utils.Assert(!ok, "wrong found")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zstackio/zstack-vyos.git
git@gitee.com:zstackio/zstack-vyos.git
zstackio
zstack-vyos
zstack-vyos
master

搜索帮助