Commit 0c1d4ea7 authored by M. Rehan Abbasi's avatar M. Rehan Abbasi
Browse files

fix bugs in BWM test cases

parent 0e5f3103
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -300,10 +300,10 @@ func Init(bwmCfg InitCfg) (err error) {

	log.Info("BWM successfully initialized")

	err = intializeBwBuffer()
	err = IntializeBwBuffer()
	if err != nil {
		log.Error("Failed to initialize Bandwidth Buffer")
		//return err
		log.Error("Failed to initialize Bandwidth Buffer: ", err)
		return err
	}

	return nil
@@ -425,10 +425,10 @@ func stopRegistrationTicker() {
}

/**
* intializeBwBuffer initializes bandwidth buffer with maximum value and stores bandwidth buffer in redis
* IntializeBwBuffer initializes bandwidth buffer with maximum value and stores bandwidth buffer in redis
* @return {String} error error message
 */
func intializeBwBuffer() error {
func IntializeBwBuffer() error {

	//Convert value type to interface{} before storing bandwidth buffer information

@@ -1368,6 +1368,8 @@ func bandwidthAllocationPut(w http.ResponseWriter, r *http.Request) {
		NanoSeconds: int32(nanoseconds),
		Seconds:     int32(seconds),
	}
	bwInfoInput.AllocationId = bwInfoStored.AllocationId

	// validate and update the request changes in Allocation direction or Fixed Allocation (bps)
	if (bwInfoInput.AllocationDirection != "") && (bwInfoInput.FixedAllocation != "") {
		if (bwInfoInput.AllocationDirection == "00") || (bwInfoInput.AllocationDirection == "01") || (bwInfoInput.AllocationDirection == "10") {
+6 −0
Original line number Diff line number Diff line
@@ -1542,6 +1542,12 @@ func initialiseScenario(testScenario string) {
		log.Error("Failed to write appInstanceId to Redis DB")
		return
	}

	err = bwm.IntializeBwBuffer()
	if err != nil {
		log.Error("Failed to write BW Buffer to Redis DB")
		return
	}
}

func sendRequest(method string, url string, body io.Reader, vars map[string]string, query map[string]string, code int, f http.HandlerFunc) (string, error) {