Issue-ID: NONRTRIC-807
Change-Id: Ib0f0b0c68e149e3dbf74c77c212eae40dd7c306d
Signed-off-by: aravind.est <aravindhan.a@est.tech>
SDNPassword string
Polltime int
LogLevel log.Level
SDNPassword string
Polltime int
LogLevel log.Level
SDNPassword: getEnv("SDNR_PASSWORD", "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"),
Polltime: getEnvAsInt("Polltime", 30),
LogLevel: getLogLevel(),
SDNPassword: getEnv("SDNR_PASSWORD", "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"),
Polltime: getEnvAsInt("Polltime", 30),
LogLevel: getLogLevel(),
+ NodeId: getEnv("NODE_ID", ""),
}
}
func (c Config) String() string {
}
}
func (c Config) String() string {
- return fmt.Sprintf("[MRHost: %v, MRPort: %v, SDNRAddress: %v, SDNRUser: %v, SDNRPassword: %v, PollTime: %v, LogLevel: %v]", c.MRHost, c.MRPort, c.SDNRAddress, c.SDNRUser, c.SDNPassword, c.Polltime, c.LogLevel)
+ return fmt.Sprintf("[MRHost: %v, MRPort: %v, SDNRAddress: %v, SDNRUser: %v, SDNRPassword: %v, PollTime: %v, LogLevel: %v, NodeId: %v]", c.MRHost, c.MRPort, c.SDNRAddress, c.SDNRUser, c.SDNPassword, c.Polltime, c.LogLevel, c.NodeId)
}
func getEnv(key string, defaultVal string) string {
}
func getEnv(key string, defaultVal string) string {
os.Setenv("SDNR_PASSWORD", "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U")
os.Setenv("Polltime", "30")
os.Setenv("LOG_LEVEL", "Debug")
os.Setenv("SDNR_PASSWORD", "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U")
os.Setenv("Polltime", "30")
os.Setenv("LOG_LEVEL", "Debug")
+ os.Setenv("NODE_ID", "o-du-1122")
t.Cleanup(func() {
os.Clearenv()
})
t.Cleanup(func() {
os.Clearenv()
})
SDNPassword: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
Polltime: 30,
LogLevel: log.DebugLevel,
SDNPassword: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
Polltime: 30,
LogLevel: log.DebugLevel,
SDNPassword: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
Polltime: 30,
LogLevel: log.InfoLevel,
SDNPassword: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
Polltime: 30,
LogLevel: log.InfoLevel,
SDNPassword: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
Polltime: 30,
LogLevel: log.InfoLevel,
SDNPassword: "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
Polltime: 30,
LogLevel: log.InfoLevel,
}
got := New()
assertions.Equal(&wantConfig, got)
}
got := New()
assertions.Equal(&wantConfig, got)
THRESHOLD_TPUT = 7000
DEFAULT_DEDICATED_RATIO = 15
NEW_DEDICATED_RATIO = 25
THRESHOLD_TPUT = 7000
DEFAULT_DEDICATED_RATIO = 15
NEW_DEDICATED_RATIO = 25
var sDNRUrl string
var sDNRUsername string
var sDNRPassword string
var sDNRUrl string
var sDNRUsername string
var sDNRPassword string
func (a *App) Initialize(config *config.Config) {
dmaapMRUrl = config.MRHost + ":" + config.MRPort
sDNRUrl = config.SDNRAddress
sDNRUsername = config.SDNRUser
sDNRPassword = config.SDNPassword
func (a *App) Initialize(config *config.Config) {
dmaapMRUrl = config.MRHost + ":" + config.MRPort
sDNRUrl = config.SDNRAddress
sDNRUsername = config.SDNRUser
sDNRPassword = config.SDNPassword
a.client = restclient.New(&http.Client{}, false)
a.metricsPolicies = structures.NewSliceAssuranceMeas()
a.client = restclient.New(&http.Client{}, false)
a.metricsPolicies = structures.NewSliceAssuranceMeas()
var duRRMPolicyRatio messages.ORanDuRestConf
log.Infof("Get RRM Information from SDNR url: %v", sDNRUrl)
var duRRMPolicyRatio messages.ORanDuRestConf
log.Infof("Get RRM Information from SDNR url: %v", sDNRUrl)
- if error := a.client.Get(getUrlForDistributedUnitFunctions(sDNRUrl, duid), &duRRMPolicyRatio, sDNRUsername, sDNRPassword); error == nil {
+ if error := a.client.Get(getUrlForDistributedUnitFunctions(sDNRUrl, duid, nodeId), &duRRMPolicyRatio, sDNRUsername, sDNRPassword); error == nil {
prettyPrint(duRRMPolicyRatio.DistributedUnitFunction)
} else {
log.Warn("Send of Get RRM Information failed! ", error)
prettyPrint(duRRMPolicyRatio.DistributedUnitFunction)
} else {
log.Warn("Send of Get RRM Information failed! ", error)
//TODO What happened if dedicated ratio is already higher that default and threshold is exceed?
if check && policy.PolicyDedicatedRatio <= DEFAULT_DEDICATED_RATIO {
log.Infof("Send Request to update DedicatedRatio for DU id: %v Policy id: %v", metric.DUId, policy.PolicyRatioId)
//TODO What happened if dedicated ratio is already higher that default and threshold is exceed?
if check && policy.PolicyDedicatedRatio <= DEFAULT_DEDICATED_RATIO {
log.Infof("Send Request to update DedicatedRatio for DU id: %v Policy id: %v", metric.DUId, policy.PolicyRatioId)
- path := getUrlUpdatePolicyDedicatedRatio(sDNRUrl, metric.DUId, policy.PolicyRatioId)
+ path := getUrlUpdatePolicyDedicatedRatio(sDNRUrl, metric.DUId, policy.PolicyRatioId, nodeId)
updatePolicyMessage := policy.GetUpdateDedicatedRatioMessage(metric.SliceDiff, metric.SliceServiceType, NEW_DEDICATED_RATIO)
prettyPrint(updatePolicyMessage)
if error := a.client.Put(path, updatePolicyMessage, nil, sDNRUsername, sDNRPassword); error == nil {
updatePolicyMessage := policy.GetUpdateDedicatedRatioMessage(metric.SliceDiff, metric.SliceServiceType, NEW_DEDICATED_RATIO)
prettyPrint(updatePolicyMessage)
if error := a.client.Put(path, updatePolicyMessage, nil, sDNRUsername, sDNRPassword); error == nil {
-func getUrlForDistributedUnitFunctions(host string, duid string) string {
- return host + "/rests/data/network-topology:network-topology/topology=topology-netconf/node=" + NODE_ID + "/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=" + duid
+func getUrlForDistributedUnitFunctions(host string, duid string, nodeid string) string {
+ return host + "/rests/data/network-topology:network-topology/topology=topology-netconf/node=" + nodeid + "/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=" + duid
-func getUrlUpdatePolicyDedicatedRatio(host string, duid string, policyid string) string {
- return host + "/rests/data/network-topology:network-topology/topology=topology-netconf/node=" + NODE_ID + "/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=" + duid + "/radio-resource-management-policy-ratio=" + policyid
+func getUrlUpdatePolicyDedicatedRatio(host string, duid string, policyid string, nodeid string) string {
+ return host + "/rests/data/network-topology:network-topology/topology=topology-netconf/node=" + nodeid + "/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=" + duid + "/radio-resource-management-policy-ratio=" + policyid
}
func prettyPrint(jsonStruct interface{}) {
}
func prettyPrint(jsonStruct interface{}) {
func validateConfiguration(configuration *config.Config) error {
if configuration.MRHost == "" || configuration.MRPort == "" {
return fmt.Errorf("message router host and port must be provided")
func validateConfiguration(configuration *config.Config) error {
if configuration.MRHost == "" || configuration.MRPort == "" {
return fmt.Errorf("message router host and port must be provided")
+ } else if configuration.NodeId == "" {
+ return fmt.Errorf("NodeId must be provided")