Skip to content

Commit 489d245

Browse files
dcasieroilbeater
authored andcommitted
Fix routeregexp ipv6 (#2395)
* Update ovn-nbctl-legacy.go * Update ovn-nbctl-legacy_test.go * Update ovn-nbctl-legacy.go (cherry picked from commit db435dc)
1 parent 8f045d7 commit 489d245

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pkg/ovs/ovn-nbctl-legacy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ func (c LegacyClient) GetStaticRouteList(router string) (routeList []*StaticRout
10831083
return parseLrRouteListOutput(output)
10841084
}
10851085

1086-
var routeRegexp = regexp.MustCompile(`^\s*((\d+(\.\d+){3})|(([a-f0-9:]*:+)+[a-f0-9]?))(/\d+)?\s+((\d+(\.\d+){3})|(([a-f0-9:]*:+)+[a-f0-9]?))\s+(dst-ip|src-ip)(\s+.+)?$`)
1086+
var routeRegexp = regexp.MustCompile(`^\s*((\d+(\.\d+){3})|(([a-f0-9:]*:+)+[a-f0-9]*?))(/\d+)?\s+((\d+(\.\d+){3})|(([a-f0-9:]*:+)+[a-f0-9]*?))\s+(dst-ip|src-ip)(\s+.+)?$`)
10871087

10881088
func parseLrRouteListOutput(output string) (routeList []*StaticRoute, err error) {
10891089
lines := strings.Split(output, "\n")

pkg/ovs/ovn-nbctl-legacy_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ func Test_parseLrRouteListOutput(t *testing.T) {
2121
output = `IPv6 Routes
2222
fc00:f853:ccd:e793::2 fd00:100:64::2 dst-ip
2323
fc00:f853:ccd:e793::3 fd00:100:64::3 dst-ip
24+
fc00:f853:ccd:e793::4 fd00:100:64::4444 dst-ip
2425
fd00:10:16::2 fd00:100:64::3 src-ip
2526
fd00:10:16::d fd00:100:64::2 src-ip
2627
fd00:11:15::/112 fd00:100:64::2 src-ip ecmp
2728
fd00:11:15::/112 fd00:100:64::3 src-ip ecmp`
2829
routeList, err = parseLrRouteListOutput(output)
2930
ast.Nil(err)
30-
ast.Equal(6, len(routeList))
31+
ast.Equal(7, len(routeList))
3132
}
3233

3334
func Test_parseLrPolicyRouteListOutput(t *testing.T) {

0 commit comments

Comments
 (0)