Newer
Older
//no need to reevalute algo one, so removing its allocated bw from the available one
if flow.CurrentThroughput >= segment.MinActivityThreshold {
unusedBw -= flow.AllocatedThroughput
}
}
}
return unusedBw, list
}
// updateMaxFairShareBwPerFlow -
func updateMaxFairShareBwPerFlow(segment *SegAlgoSegment) {
nbActiveConnections := 0
for _, flow := range segment.Flows {
if flow.CurrentThroughput >= segment.MinActivityThreshold {
nbActiveConnections++
}
}
if nbActiveConnections >= 1 {
segment.MaxFairShareBwPerFlow = segment.ConfiguredNetChar.Throughput / float64(nbActiveConnections)
} else {
segment.MaxFairShareBwPerFlow = MAX_THROUGHPUT
}
}
// getNetChars - Retrieve all network characteristics from model for provided element name
func getNetChars(elemName string, model *mod.Model) (*dataModel.NetworkCharacteristics) {
nc := new(dataModel.NetworkCharacteristics)
// Get Node
node := model.GetNode(elemName)
if node == nil {
log.Error("Error finding element: " + elemName)
}
// Get max throughput based on Node Type, as well as other netcharse
if p, ok := node.(*dataModel.Process); ok {
} else if pl, ok := node.(*dataModel.PhysicalLocation); ok {
} else if nl, ok := node.(*dataModel.NetworkLocation); ok {
} else if zone, ok := node.(*dataModel.Zone); ok {
} else if domain, ok := node.(*dataModel.Domain); ok {
} else if deployment, ok := node.(*dataModel.Deployment); ok {
} else {
log.Error("Error casting element: " + elemName)
}
// For compatiblity reasons, set to default value if 0
if nc.ThroughputUl == 0 {
nc.ThroughputUl = DEFAULT_THROUGHPUT_LINK
if nc.ThroughputDl == 0 {
nc.ThroughputDl = DEFAULT_THROUGHPUT_LINK
}
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
}
// 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)
s2d := flow.ConfiguredNetChar.Distribution
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)
s8d := flow.AppliedNetChar.Distribution
str := s1 + ": " + "Current: " + s6 + " - Configured: [" + s2t + "-" + s2l + "-" + s2j + "-" + s2p + "-" + s2d + "] Allocated: " + s3a + "[" + s4a + "-" + s5a + "]" + " - MaxPlanned: " + s3m + "[" + s4m + "-" + s5m + "]" + " - Planned: " + s3p + "[" + s4p + "-" + s5p + "] Computed Net Char: [" + s7l + "-" + s7j + "-" + s7p + "] Applied Net Char: [" + s8l + "-" + s8j + "-" + s8p + "-" + s8d + "]"
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
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
}
Kevin Di Lallo
committed
// // printElement -
// func printElement(elem *SegAlgoNetElem) string {
// str := elem.Name + "-" + elem.Type + "-" + elem.PhyLocName + "-" + elem.PoaName + "-" + elem.ZoneName + "-" + elem.DomainName
// return str
// }