in cmd/ziffy/node/print.go [86:128]
func debugPrint(routes []PathInfo) {
var notTCEnabled []SwitchTrafficInfo
tested := make(map[string]bool)
enabled := 0
for _, route := range routes {
for swIndex, swh := range route.switches {
if swIndex == len(route.switches)-1 {
continue
}
corrField := route.switches[swIndex+1].corrField - route.switches[swIndex].corrField
if corrField == ptp.Correction(0) && !tested[swh.ip] {
notTCEnabled = append(notTCEnabled, swh)
}
tested[swh.ip] = true
enabled++
}
}
log.Debugf("%v switches tested: %v TC enabled | %v TC not enabled", len(tested), enabled, len(notTCEnabled))
for _, brkSw := range notTCEnabled {
log.Debugf("%v: PTP TC not enabled", getLookUpName(brkSw.ip))
for index, swh := range routes[brkSw.routeIdx].switches {
if index != len(routes[brkSw.routeIdx].switches)-1 {
log.Debugf(" | %v", getLookUpName(swh.ip))
} else {
log.Debugf(" V %v", getLookUpName(swh.ip))
}
}
}
log.Debugf("TESTED:")
var aux []string
for key := range tested {
aux = append(aux, getLookUpName(key))
}
sort.Slice(aux, func(i, j int) bool {
return aux[i] > aux[j]
})
for index, element := range aux {
log.Debugf("%v %v", index, element)
}
}