Loading go-packages/meep-net-char-mgr/algo-segment.go +23 −2 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ type SegAlgoFlow struct { CurrentThroughput float64 //measured CurrentThroughputEgress float64 //measured Path *SegAlgoPath UpdateRequired bool } // SegAlgoPath - Loading Loading @@ -403,7 +404,27 @@ func (algo *SegmentAlgorithm) populateFlow(flowName string, srcElement *SegAlgoN flow.ConfiguredNetChar.Jitter = 0 flow.ConfiguredNetChar.PacketLoss = 0 // Create a new path for this flow oldPath := flow.Path flow.Path = algo.createPath(flowName, srcElement, destElement, model) flow.UpdateRequired = algo.comparePath(oldPath, flow.Path) } func (algo *SegmentAlgorithm) comparePath(oldPath *SegAlgoPath, newPath *SegAlgoPath) bool { if oldPath == nil { return true } if len(oldPath.Segments) != len(newPath.Segments) { return true } for index, newSegment := range newPath.Segments { if newSegment.Name != oldPath.Segments[index].Name { return true } } return false } // createPath - Loading Loading @@ -714,6 +735,7 @@ func (algo *SegmentAlgorithm) createSegment(segmentName string, flowName string, // Retrieve max throughput from model using model scenario element name nc := getNetChars(elemName, model) segment.ConfiguredNetChar = nc maxThroughput := nc.Throughput // Initialize segment-specific BW attributes from Algo config if algo.Config.IsPercentage { Loading Loading @@ -938,8 +960,7 @@ func needToReevaluate(segment *SegAlgoSegment) (unusedBw float64, list []*SegAlg //how many active connections that needs to be taken into account for _, flow := range segment.Flows { if flow.CurrentThroughput < flow.AllocatedThroughputLowerBound || flow.CurrentThroughput > flow.AllocatedThroughputUpperBound || flow.CurrentThroughput >= segment.MaxFairShareBwPerFlow { // resetFlowMaxPlannedThroughput(flow) if flow.CurrentThroughput < flow.AllocatedThroughputLowerBound || flow.CurrentThroughput > flow.AllocatedThroughputUpperBound || flow.CurrentThroughput >= segment.MaxFairShareBwPerFlow || flow.UpdateRequired { list = append(list, flow) } else { //no need to reevalute algo one, so removing its allocated bw from the available one Loading go-packages/meep-net-char-mgr/algo-segment_test.go +6 −6 Original line number Diff line number Diff line Loading @@ -91,8 +91,8 @@ func TestSegAlgoSegmentation(t *testing.T) { // Validate algorithm Calculations fmt.Println("Test algo calculation with some flows updated with metrics") updatedNetCharList = algo.CalculateNetChar() if len(updatedNetCharList) != 58 { t.Errorf("Updated net char list not partially filled") if len(updatedNetCharList) != 90 { t.Errorf("Updated net char list not fully filled") } fmt.Println("Test algo calculation without changes in metrics") Loading Loading @@ -251,8 +251,8 @@ func TestSegAlgoCalculation(t *testing.T) { // Validate algorithm Calculations fmt.Println("Test algorithm calculations with & without metrics") updatedNetCharList := algo.CalculateNetChar() if len(updatedNetCharList) != 58 { t.Errorf("Updated net char list not filled properly") if len(updatedNetCharList) != 90 { t.Errorf("Updated net char list not fully filled") } // Update metrics & recalculate Loading Loading @@ -335,7 +335,7 @@ func TestSegAlgoCalculation(t *testing.T) { t.Errorf("Error updating metrics") } updatedNetCharList = algo.CalculateNetChar() if len(updatedNetCharList) != 15 { if len(updatedNetCharList) != 19 { t.Errorf("Invalid net char update list") } if !validateNetCharUpdate(updatedNetCharList, "zone1-fog1-iperf", "ue1-iperf", 41, 9, 0, 10) { Loading Loading @@ -394,7 +394,7 @@ func TestSegAlgoCalculation(t *testing.T) { t.Errorf("Error updating metrics") } updatedNetCharList = algo.CalculateNetChar() if len(updatedNetCharList) != 15 { if len(updatedNetCharList) != 19 { t.Errorf("Invalid net char update list") } if !validateNetCharUpdate(updatedNetCharList, "zone2-edge1-iperf", "ue1-iperf", 41, 9, 0, 23) { Loading Loading
go-packages/meep-net-char-mgr/algo-segment.go +23 −2 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ type SegAlgoFlow struct { CurrentThroughput float64 //measured CurrentThroughputEgress float64 //measured Path *SegAlgoPath UpdateRequired bool } // SegAlgoPath - Loading Loading @@ -403,7 +404,27 @@ func (algo *SegmentAlgorithm) populateFlow(flowName string, srcElement *SegAlgoN flow.ConfiguredNetChar.Jitter = 0 flow.ConfiguredNetChar.PacketLoss = 0 // Create a new path for this flow oldPath := flow.Path flow.Path = algo.createPath(flowName, srcElement, destElement, model) flow.UpdateRequired = algo.comparePath(oldPath, flow.Path) } func (algo *SegmentAlgorithm) comparePath(oldPath *SegAlgoPath, newPath *SegAlgoPath) bool { if oldPath == nil { return true } if len(oldPath.Segments) != len(newPath.Segments) { return true } for index, newSegment := range newPath.Segments { if newSegment.Name != oldPath.Segments[index].Name { return true } } return false } // createPath - Loading Loading @@ -714,6 +735,7 @@ func (algo *SegmentAlgorithm) createSegment(segmentName string, flowName string, // Retrieve max throughput from model using model scenario element name nc := getNetChars(elemName, model) segment.ConfiguredNetChar = nc maxThroughput := nc.Throughput // Initialize segment-specific BW attributes from Algo config if algo.Config.IsPercentage { Loading Loading @@ -938,8 +960,7 @@ func needToReevaluate(segment *SegAlgoSegment) (unusedBw float64, list []*SegAlg //how many active connections that needs to be taken into account for _, flow := range segment.Flows { if flow.CurrentThroughput < flow.AllocatedThroughputLowerBound || flow.CurrentThroughput > flow.AllocatedThroughputUpperBound || flow.CurrentThroughput >= segment.MaxFairShareBwPerFlow { // resetFlowMaxPlannedThroughput(flow) if flow.CurrentThroughput < flow.AllocatedThroughputLowerBound || flow.CurrentThroughput > flow.AllocatedThroughputUpperBound || flow.CurrentThroughput >= segment.MaxFairShareBwPerFlow || flow.UpdateRequired { list = append(list, flow) } else { //no need to reevalute algo one, so removing its allocated bw from the available one Loading
go-packages/meep-net-char-mgr/algo-segment_test.go +6 −6 Original line number Diff line number Diff line Loading @@ -91,8 +91,8 @@ func TestSegAlgoSegmentation(t *testing.T) { // Validate algorithm Calculations fmt.Println("Test algo calculation with some flows updated with metrics") updatedNetCharList = algo.CalculateNetChar() if len(updatedNetCharList) != 58 { t.Errorf("Updated net char list not partially filled") if len(updatedNetCharList) != 90 { t.Errorf("Updated net char list not fully filled") } fmt.Println("Test algo calculation without changes in metrics") Loading Loading @@ -251,8 +251,8 @@ func TestSegAlgoCalculation(t *testing.T) { // Validate algorithm Calculations fmt.Println("Test algorithm calculations with & without metrics") updatedNetCharList := algo.CalculateNetChar() if len(updatedNetCharList) != 58 { t.Errorf("Updated net char list not filled properly") if len(updatedNetCharList) != 90 { t.Errorf("Updated net char list not fully filled") } // Update metrics & recalculate Loading Loading @@ -335,7 +335,7 @@ func TestSegAlgoCalculation(t *testing.T) { t.Errorf("Error updating metrics") } updatedNetCharList = algo.CalculateNetChar() if len(updatedNetCharList) != 15 { if len(updatedNetCharList) != 19 { t.Errorf("Invalid net char update list") } if !validateNetCharUpdate(updatedNetCharList, "zone1-fog1-iperf", "ue1-iperf", 41, 9, 0, 10) { Loading Loading @@ -394,7 +394,7 @@ func TestSegAlgoCalculation(t *testing.T) { t.Errorf("Error updating metrics") } updatedNetCharList = algo.CalculateNetChar() if len(updatedNetCharList) != 15 { if len(updatedNetCharList) != 19 { t.Errorf("Invalid net char update list") } if !validateNetCharUpdate(updatedNetCharList, "zone2-edge1-iperf", "ue1-iperf", 41, 9, 0, 23) { Loading