@@ -251,11 +251,11 @@ func TestTopoSemanticsFdbUplinkParent(t *testing.T) {
251251 links [l .To ] = l
252252 }
253253 }
254- if got := links ["sw1" ]; got .From != "gw" || got .Port != "1" {
255- t .Fatalf ("uplink sw1: %+v, want from gw puerto 1" , got )
254+ if got := links ["sw1" ]; got .From != "gw" || got .Port != "1" || got . Evidence != "device" {
255+ t .Fatalf ("uplink sw1: %+v, want from gw puerto 1 evidencia device " , got )
256256 }
257- if got := links ["ap1" ]; got .From != "sw1" || got .Port != "5" {
258- t .Fatalf ("uplink ap1: %+v, want from sw1 puerto 5" , got )
257+ if got := links ["ap1" ]; got .From != "sw1" || got .Port != "5" || got . Evidence != "device" {
258+ t .Fatalf ("uplink ap1: %+v, want from sw1 puerto 5 evidencia device " , got )
259259 }
260260 // Las unidades de flota no duplican como chips de cliente.
261261 for _ , ring := range sem .Rings {
@@ -289,11 +289,11 @@ func TestTopoSemanticsFdbEvidenceSinDevices(t *testing.T) {
289289 links [l .To ] = l
290290 }
291291 }
292- if got := links ["ap1" ]; got .From != "sw1" || got .Port != "5" {
293- t .Fatalf ("uplink ap1: %+v, want from sw1 puerto 5" , got )
292+ if got := links ["ap1" ]; got .From != "sw1" || got .Port != "5" || got . Evidence != "fdb" {
293+ t .Fatalf ("uplink ap1: %+v, want from sw1 puerto 5 evidencia fdb " , got )
294294 }
295- if got := links ["sw1" ]; got .From != "gw" || got .Port != "1" {
296- t .Fatalf ("uplink sw1: %+v, want from gw puerto 1" , got )
295+ if got := links ["sw1" ]; got .From != "gw" || got .Port != "1" || got . Evidence != "fdb" {
296+ t .Fatalf ("uplink sw1: %+v, want from gw puerto 1 evidencia fdb " , got )
297297 }
298298}
299299
@@ -311,7 +311,7 @@ func TestTopoSemanticsDeviceEvidenceManda(t *testing.T) {
311311 sem := BuildTopoSemantics (routers , devices , WireGuardStats {}, nil , "" , ev , nil , nil )
312312 for _ , l := range sem .Links {
313313 if l .Kind == "uplink" && l .To == "ap1" {
314- if l .From != "gw" || l .Port != "4" {
314+ if l .From != "gw" || l .Port != "4" || l . Evidence != "device" {
315315 t .Fatalf ("la evidencia de device debe mandar: %+v" , l )
316316 }
317317 return
@@ -562,7 +562,7 @@ func TestTopoSemanticsLldpEvidenceWins(t *testing.T) {
562562 sem := BuildTopoSemantics (routers , nil , WireGuardStats {}, nil , "" , fdb , lldp , nil )
563563 for _ , l := range sem .Links {
564564 if l .Kind == "uplink" && l .To == "ap1" {
565- if l .From != "sw1" || l .Port != "two-gigabitEthernet 1/0/21" {
565+ if l .From != "sw1" || l .Port != "two-gigabitEthernet 1/0/21" || l . Evidence != "lldp" {
566566 t .Fatalf ("LLDP debe mandar sobre la FDB: %+v" , l )
567567 }
568568 return
@@ -584,11 +584,30 @@ func TestTopoSemanticsOverrideEvidenceWins(t *testing.T) {
584584 sem := BuildTopoSemantics (routers , nil , WireGuardStats {}, nil , "" , nil , lldp , ovr )
585585 for _ , l := range sem .Links {
586586 if l .Kind == "uplink" && l .To == "ap1" {
587- if l .From != "sw1" || l .Port != "lan4" {
587+ if l .From != "sw1" || l .Port != "lan4" || l . Evidence != "override" {
588588 t .Fatalf ("el override debe mandar conservando el puerto inferido: %+v" , l )
589589 }
590590 return
591591 }
592592 }
593593 t .Fatal ("falta el uplink de ap1" )
594594}
595+
596+ // #1325: sin evidencia de ninguna capa el uplink cae al gateway y no lleva
597+ // tag de evidencia (Evidence vacía). El fallback al gateway no es evidencia.
598+ func TestTopoSemanticsFallbackSinEvidencia (t * testing.T ) {
599+ routers := []Router {
600+ {ID : "gw" , Name : "gateway" , RoleBadge : "Principal" , MAC : "AA:BB:CC:00:00:01" },
601+ {ID : "ap1" , Name : "ap1" , MAC : "AA:BB:CC:00:00:03" },
602+ }
603+ sem := BuildTopoSemantics (routers , nil , WireGuardStats {}, nil , "" , nil , nil , nil )
604+ for _ , l := range sem .Links {
605+ if l .Kind == "uplink" && l .To == "ap1" {
606+ if l .From != "gw" || l .Evidence != "" {
607+ t .Fatalf ("uplink ap1 sin evidencia: %+v, want from gw y Evidence vacía" , l )
608+ }
609+ return
610+ }
611+ }
612+ t .Fatal ("falta el uplink de ap1" )
613+ }
0 commit comments