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
fix parsing logical router static routes #2443
Conversation
可以再跟 @bobz965 确认下 |
--- FAIL: Test_parseLrRouteListOutput (0.00s)
panic: runtime error: index out of range [4] with length 4 [recovered]
panic: runtime error: index out of range [4] with length 4
goroutine 1237 [running]:
testing.tRunner.func1.2({0x16[450](https://github.com/kubeovn/kube-ovn/actions/runs/4360712653/jobs/7623900996#step:7:451)00, 0xc000887128})
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1529 +0x39f
panic({0x1645000, 0xc000887128})
/opt/hostedtoolcache/go/1.20.1/x64/src/runtime/panic.go:884 +0x213
github.com/kubeovn/kube-ovn/pkg/ovs.parseLrRouteListOutput({0x17d0894?, 0x1523d40?})
/home/runner/work/kube-ovn/kube-ovn/pkg/ovs/ovn-nbctl-legacy.go:1199 +0x41d
github.com/kubeovn/kube-ovn/pkg/ovs.Test_parseLrRouteListOutput(0xc000a231e0?)
/home/runner/work/kube-ovn/kube-ovn/pkg/ovs/ovn-nbctl-legacy_test.go:29 +0xac
testing.tRunner(0xc000a23380, 0x1818e98)
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
/opt/hostedtoolcache/go/1.20.1/x64/src/testing/testing.go:1629 +0x3ea |
[root@pc-node-1 pc-3-node-test-eip-snat]# k ko nbctl lr-route-list ovn-cluster
IPv4 Routes
Route Table <main>:
0.0.0.0/0 10.5.204.254 dst-ip
[root@pc-node-1 pc-3-node-test-eip-snat]#
[root@pc-node-1 pc-3-node-test-eip-snat]# k ko nbctl lr-route-list vpc1
IPv4 Routes
Route Table <main>:
192.168.0.0/24 10.5.204.103 src-ip ecmp ecmp-symmetric-reply bfd
192.168.0.0/24 10.5.204.104 src-ip ecmp ecmp-symmetric-reply bfd
192.168.0.0/24 10.5.204.105 src-ip ecmp ecmp-symmetric-reply bfd
在bfd 静态路由的场景中,目的要取第5个值,也就是序列为4. 此时长度应该为6 |
According to the OVN source code, the output format of the command <PREFIX> <NEXT_HOP> <POLICY> [OUTPUT_PORT] [(learned)] [ecmp] [ecmp-symmetric-reply] [bfd] |
如果有类似数据库字段的读取方式就好了,目前的命令行式输出的结果不太好确定总长度。 可能需要穷举当前的静态路由的使用场景才可以有效确定需要的值在哪一位次。如果后续引入新的使用场景,可能还得调整。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What type of this PR
Which issue(s) this PR fixes:
Fixes #(issue-number)