Newer
Older
maxThroughput = float64(zone.EdgeFogThroughput)
latency = float64(zone.EdgeFogLatency)
jitter = float64(zone.EdgeFogLatencyVariation)
packetLoss = float64(zone.EdgeFogPacketLoss)
} else if domain, ok := node.(*ceModel.Domain); ok {
maxThroughput = float64(domain.InterZoneThroughput)
latency = float64(domain.InterZoneLatency)
jitter = float64(domain.InterZoneLatencyVariation)
packetLoss = float64(domain.InterZonePacketLoss)
} else if deployment, ok := node.(*ceModel.Deployment); ok {
maxThroughput = float64(deployment.InterDomainThroughput)
latency = float64(deployment.InterDomainLatency)
jitter = float64(deployment.InterDomainLatencyVariation)
packetLoss = float64(deployment.InterDomainPacketLoss)
} else {
log.Error("Error casting element: " + elemName)
}
// For compatiblity reasons, set to default value if 0
if maxThroughput == 0 {
maxThroughput = DEFAULT_THROUGHPUT_LINK
}
nc.Throughput = maxThroughput
nc.Latency = latency
nc.Jitter = jitter
nc.PacketLoss = packetLoss
return nc
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
}
// printFlowNamesFromList -
func printFlowNamesFromList(list []*SegAlgoFlow) string {
str := ""
for _, flow := range list {
str += flow.Name + "."
}
return str
}
// printFlows -
func printFlows(segment *SegAlgoSegment) {
log.Info("Flows on segment ", segment.Name)
for _, flow := range segment.Flows {
log.Info(printFlow(flow))
}
}
// printFlow -
func printFlow(flow *SegAlgoFlow) string {
s0 := fmt.Sprintf("%x", &flow)
s1 := flow.Name + "(" + s0 + ")"
s2t := fmt.Sprintf("%f", flow.ConfiguredNetChar.Throughput)
s2l := fmt.Sprintf("%f", flow.ConfiguredNetChar.Latency)
s2j := fmt.Sprintf("%f", flow.ConfiguredNetChar.Jitter)
s2p := fmt.Sprintf("%f", flow.ConfiguredNetChar.PacketLoss)
s3a := fmt.Sprintf("%f", flow.AllocatedThroughput)
s4a := fmt.Sprintf("%f", flow.AllocatedThroughputLowerBound)
s5a := fmt.Sprintf("%f", flow.AllocatedThroughputUpperBound)
s3m := fmt.Sprintf("%f", flow.MaxPlannedThroughput)
s4m := fmt.Sprintf("%f", flow.MaxPlannedLowerBound)
s5m := fmt.Sprintf("%f", flow.MaxPlannedUpperBound)
s3p := fmt.Sprintf("%f", flow.PlannedThroughput)
s4p := fmt.Sprintf("%f", flow.PlannedLowerBound)
s5p := fmt.Sprintf("%f", flow.PlannedUpperBound)
s6 := fmt.Sprintf("%f", flow.CurrentThroughput)
s7l := fmt.Sprintf("%f", flow.ComputedLatency)
s7j := fmt.Sprintf("%f", flow.ComputedJitter)
s7p := fmt.Sprintf("%f", flow.ComputedPacketLoss)
s8l := fmt.Sprintf("%f", flow.AppliedNetChar.Latency)
s8j := fmt.Sprintf("%f", flow.AppliedNetChar.Jitter)
s8p := fmt.Sprintf("%f", flow.AppliedNetChar.PacketLoss)
str := s1 + ": " + "Current: " + s6 + " - Configured: [" + s2t + "-" + s2l + "-" + s2j + "-" + s2p + "] Allocated: " + s3a + "[" + s4a + "-" + s5a + "]" + " - MaxPlanned: " + s3m + "[" + s4m + "-" + s5m + "]" + " - Planned: " + s3p + "[" + s4p + "-" + s5p + "] Computed Net Char: [" + s7l + "-" + s7j + "-" + s7p + "] Applied Net Char: [" + s8l + "-" + s8j + "-" + s8p + "]"
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
str += printPath(flow.Path)
return str
}
// printPath -
func printPath(path *SegAlgoPath) string {
str := ""
first := true
if path != nil {
str = "Path: "
for _, segment := range path.Segments {
if first {
str += segment.Name
first = false
} else {
str += "..." + segment.Name
}
}
}
return str
}
// printElement -
func printElement(elem *SegAlgoNetElem) string {
str := elem.Name + "-" + elem.Type + "-" + elem.PhyLocName + "-" + elem.PoaName + "-" + elem.ZoneName + "-" + elem.DomainName
return str
}