# ============LICENSE_START===============================================
# Copyright (C) 2023 Nordix Foundation. All rights reserved.
+# Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.
# ========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
ALWAYS_RETURN: /ne-files/pm.xml.gz
GENERATED_FILE_START_TIME: "${START_TIME}"
GENERATED_FILE_TIMEZONE: "+0100"
+ RANDOM_MIN_NUMBER: "2"
+ RANDOM_MAX_NUMBER: "20"
volumes:
- ./ne-files:/ne-files:rw
- ./config/https/template-files:/template-files
- GENERATED_FILE_TIMEZONE - Time zone to be used for requested files from the url `/generatedfiles/<file-id>`. Example: "+0100"
+- RANDOM_MIN_NUMBER - Minimum possible random number to generate random number
+
+- RANDOM_MAX_NUMBER - Maximum possible random number to generate random number
+
If generated files shall be used, load the file pm-template.xml.gz to the /template-files dir in the container.
Configure the following for desired behaviour
## License
Copyright (C) 2023 Nordix Foundation. All rights reserved.
+Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
// ============LICENSE_START===============================================
// Copyright (C) 2023 Nordix Foundation. All rights reserved.
+// Copyright (C) 2023-2024 OpenInfra Foundation Europe. All rights reserved.
// ========================================================================
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
"bytes"
"compress/gzip"
"io"
+ "math/rand"
"net/http"
"os"
"runtime"
var always_return_file = os.Getenv("ALWAYS_RETURN")
var generated_files_start_time = os.Getenv("GENERATED_FILE_START_TIME")
var generated_files_timezone = os.Getenv("GENERATED_FILE_TIMEZONE")
+var random_min_value, min_value_error = strconv.Atoi(os.Getenv("RANDOM_MIN_NUMBER"))
+var random_max_value, max_value_error = strconv.Atoi(os.Getenv("RANDOM_MAX_NUMBER"))
var unzipped_template = ""
nodename := id[30:]
nodename = strings.Split(nodename, ".")[0]
+ //Generating random number
+ random_value := rand.Intn(random_max_value-random_min_value+1) + random_min_value
+
template_string := strings.Clone(unzipped_template)
log.Debug("Replacing BEGINTIME with: ", begintime)
log.Debug("Replacing ENDTIME with: ", endtime)
+ log.Debug("Replacing RANDOM_CTR_VALUE with: ", strconv.Itoa(int(random_value)))
log.Debug("Replacing CTR_VALUE with: ", strconv.Itoa(int(file_index)))
log.Debug("Replacing NODE_NAME with: ", nodename)
template_string = strings.Replace(template_string, "BEGINTIME", begintime, -1)
template_string = strings.Replace(template_string, "ENDTIME", endtime, -1)
+ template_string = strings.Replace(template_string, "RANDOM_CTR_VALUE", strconv.Itoa(int(random_value)), -1)
template_string = strings.Replace(template_string, "CTR_VALUE", strconv.Itoa(int(file_index)), -1)
template_string = strings.Replace(template_string, "NODE_NAME", nodename, -1)
log.Info("Server starting...")
+ if min_value_error != nil {
+ random_min_value = 1
+ }
+ if max_value_error != nil {
+ random_max_value = 10
+ }
+
rtr := mux.NewRouter()
rtr.HandleFunc("/files/{fileid}", files)
rtr.HandleFunc("/generatedfiles/{fileid}", generatedfiles)
<measType p="162">pmCounterNumber252Qos</measType>
<measType p="163">pmCounterNumber254</measType>
<measType p="164">pmCounterNumber254Qos</measType>
+ <measType p="165">pmRadioThpVolUl</measType>
<measValue measObjLdn="ManagedElement=NODE_NAME,GNBDUFunction=1,NRCellDU=32">
<r p="1">CTR_VALUE</r>
<r p="2">CTR_VALUE</r>
<r p="162">CTR_VALUE</r>
<r p="163">CTR_VALUE</r>
<r p="164">CTR_VALUE</r>
+ <r p="165">RANDOM_CTR_VALUE</r>
</measValue>
<measValue measObjLdn="ManagedElement=NODE_NAME,GNBDUFunction=1,NRCellDU=31">
<r p="1">CTR_VALUE</r>
<r p="162">CTR_VALUE</r>
<r p="163">CTR_VALUE</r>
<r p="164">CTR_VALUE</r>
+ <r p="165">RANDOM_CTR_VALUE</r>
</measValue>
<measValue measObjLdn="ManagedElement=NODE_NAME,GNBDUFunction=1,NRCellDU=2">
<r p="1">CTR_VALUE</r>
<r p="162">CTR_VALUE</r>
<r p="163">CTR_VALUE</r>
<r p="164">CTR_VALUE</r>
+ <r p="165">RANDOM_CTR_VALUE</r>
</measValue>
<measValue measObjLdn="ManagedElement=NODE_NAME,GNBDUFunction=1,NRCellDU=1">
<r p="1">CTR_VALUE</r>
<r p="162">CTR_VALUE</r>
<r p="163">CTR_VALUE</r>
<r p="164">CTR_VALUE</r>
+ <r p="165">RANDOM_CTR_VALUE</r>
</measValue>
</measInfo>
<measInfo measInfoId="PM=1,PmGroup=NRSectorCarrier_GNBDU">