// This source code is part of the near-RT RIC (RAN Intelligent Controller)
// platform project (RICP).
-
package tests
import (
"bytes"
"encoding/json"
- "fmt"
"net/http"
"strconv"
- "testing"
)
const (
}
func GetHttpRequest() *http.Request {
- data := map[string]interface{}{"ranIp": RanIp,
- "ranPort": RanPort, "ranName": RanName}
- b := new(bytes.Buffer)
- _ = json.NewEncoder(b).Encode(data)
- req, _ := http.NewRequest("POST", "https://localhost:3800/request", b)
- return req
-}
-
-func GetInvalidRequestDetails() *http.Request {
- data := map[string]interface{}{"ranIp": "256.0.0.0",
- "ranPort": RanPort, "ranName": RanName}
- b := new(bytes.Buffer)
- _ = json.NewEncoder(b).Encode(data)
- req, _ := http.NewRequest("POST", "https://localhost:3800/request", b)
- return req
-}
-
-func GetInvalidMessageType() *http.Request {
- data := map[string]interface{}{"ranIp": "1.2.3.4",
- "ranPort": RanPort, "ranName": RanName}
+ data := map[string]interface{}{
+ "ranIp": RanIp,
+ "ranPort": RanPort,
+ "ranName": RanName,
+ }
b := new(bytes.Buffer)
_ = json.NewEncoder(b).Encode(data)
req, _ := http.NewRequest("POST", "https://localhost:3800/request", b)
return req
-}
-
-func GetPackedPayload(t *testing.T) []byte {
- inputPayloadAsStr := "2006002a000002001500080002f82900007a8000140017000000630002f8290007ab50102002f829000001000133"
- payload := make([]byte, len(inputPayloadAsStr)/2)
- _, err := fmt.Sscanf(inputPayloadAsStr, "%x", &payload)
- if err != nil {
- t.Errorf("convert inputPayloadAsStr to payloadAsByte. Error: %v\n", err)
- }
- return payload
-}
+}
\ No newline at end of file