Skip to content

Commit dde4c47

Browse files
committed
routeimport: account for CUDN network name prefix
Route import for CUDNs with names <= 15 characters would fail. In that case the VRF name is the same as the CUDN name but the logic did not account for the "cluster_udn_" prefix that is added to the network name. Signed-off-by: Jaime Caamaño Ruiz <[email protected]>
1 parent 752b7b2 commit dde4c47

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

go-controller/pkg/ovn/routeimport/route_import.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ func (c *controller) syncLinkUpdate(update *netlink.LinkUpdate) {
264264
c.Lock()
265265
defer c.Unlock()
266266

267-
// for CUDNs, VRF name equals network name
268-
network := c.networks[vrf.Name]
267+
// for CUDNs, VRF name equals network name sans prefix
268+
network := c.networks[util.GenerateCUDNNetworkName(vrf.Name)]
269269
// but if we got an ID, this can't be a CUDN, it's a UDN.
270270
if networkID != types.InvalidID {
271271
network = c.networks[c.networkIDs[networkID]]

go-controller/pkg/ovn/routeimport/route_import_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func Test_controller_syncLinkUpdate(t *testing.T) {
369369
expectTables: map[int]int{1000: 1},
370370
},
371371
{
372-
name: "does reconcile on link updates with actual changes",
372+
name: "does reconcile on link updates with actual changes for generated VRF names",
373373
fields: fields{
374374
networkIDs: map[int]string{1: "udn"},
375375
networks: map[string]util.NetInfo{"udn": udn},
@@ -382,6 +382,20 @@ func Test_controller_syncLinkUpdate(t *testing.T) {
382382
expectTables: map[int]int{1001: 1},
383383
expectReconciles: []string{"udn"},
384384
},
385+
{
386+
name: "does reconcile on link updates with actual changes for network VRF names",
387+
fields: fields{
388+
networkIDs: map[int]string{1: types.CUDNPrefix + "udn"},
389+
networks: map[string]util.NetInfo{types.CUDNPrefix + "udn": udn},
390+
tables: map[int]int{1000: 1},
391+
},
392+
args: args{&netlink.LinkUpdate{
393+
Header: unix.NlMsghdr{Type: unix.RTM_NEWLINK},
394+
Link: &netlink.Vrf{LinkAttrs: netlink.LinkAttrs{Name: "udn"}, Table: 1001}},
395+
},
396+
expectTables: map[int]int{1001: 1},
397+
expectReconciles: []string{types.CUDNPrefix + "udn"},
398+
},
385399
}
386400
for _, tt := range tests {
387401
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)