SDNRPassword string
}
-const rawSdnrPath = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=[O-DU-ID]/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=[O-RU-ID]"
-const unlockMessage = `{"o-ran-sc-du-hello-world:du-to-ru-connection": [{"name":"[O-RU-ID]","administrative-state":"UNLOCKED"}]}`
+const rawSdnrPath = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=[O-DU-ID]/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=[O-DU-ID]/radio-resource-management-policy-ratio=rrm-pol-1"
+const unlockMessage = `{"o-ran-sc-du-hello-world:radio-resource-management-policy-ratio":[{"id":"rrm-pol-1","radio-resource-management-policy-max-ratio":25,"radio-resource-management-policy-members":[{"mobile-country-code":"310","mobile-network-code":"150","slice-differentiator":1,"slice-service-type":1}],"radio-resource-management-policy-min-ratio":15,"user-label":"rrm-pol-1","resource-type":"prb","radio-resource-management-policy-dedicated-ratio":20,"administrative-state":"unlocked"}]}`
type LinkFailureHandler struct {
lookupService repository.LookupService
func (lfh LinkFailureHandler) sendUnlockMessage(oRuId string) {
if oDuId, err := lfh.lookupService.GetODuID(oRuId); err == nil {
- sdnrPath := getSdnrPath(oRuId, oDuId)
- unlockMessage := lfh.getUnlockMessage(oRuId)
+ sdnrPath := getSdnrPath(oDuId)
if error := restclient.Put(lfh.config.SDNRAddress+sdnrPath, unlockMessage, lfh.client, lfh.config.SDNRUser, lfh.config.SDNRPassword); error == nil {
log.Debugf("Sent unlock message for O-RU: %v to O-DU: %v.", oRuId, oDuId)
} else {
}
-func getSdnrPath(oRuId string, oDuId string) string {
- sdnrPath := strings.Replace(rawSdnrPath, "[O-DU-ID]", oDuId, 1)
- sdnrPath = strings.Replace(sdnrPath, "[O-RU-ID]", oRuId, 1)
+func getSdnrPath(oDuId string) string {
+ sdnrPath := strings.Replace(rawSdnrPath, "[O-DU-ID]", oDuId, -1)
return sdnrPath
}
-
-func (lfh LinkFailureHandler) getUnlockMessage(oRuId string) string {
- return strings.Replace(unlockMessage, "[O-RU-ID]", oRuId, 1)
-}
lookupServiceMock := mocks.LookupService{}
- lookupServiceMock.On("GetODuID", mock.Anything).Return("HCL-O-DU-1122", nil)
+ lookupServiceMock.On("GetODuID", mock.Anything).Return("O-DU-1122", nil)
handlerUnderTest := NewLinkFailureHandler(&lookupServiceMock, Configuration{
SDNRAddress: "http://localhost:9990",
assertions.Equal(http.MethodPut, actualRequest.Method)
assertions.Equal("http", actualRequest.URL.Scheme)
assertions.Equal("localhost:9990", actualRequest.URL.Host)
- expectedSdnrPath := "/rests/data/network-topology:network-topology/topology=topology-netconf/node=HCL-O-DU-1122/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=ERICSSON-O-RU-11220"
+ expectedSdnrPath := "/rests/data/network-topology:network-topology/topology=topology-netconf/node=O-DU-1122/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=O-DU-1122/radio-resource-management-policy-ratio=rrm-pol-1"
assertions.Equal(expectedSdnrPath, actualRequest.URL.Path)
assertions.Equal("application/json; charset=utf-8", actualRequest.Header.Get("Content-Type"))
tempRequest, _ := http.NewRequest("", "", nil)
tempRequest.SetBasicAuth("admin", "pwd")
assertions.Equal(tempRequest.Header.Get("Authorization"), actualRequest.Header.Get("Authorization"))
body, _ := ioutil.ReadAll(actualRequest.Body)
- expectedBody := []byte(`{"o-ran-sc-du-hello-world:du-to-ru-connection": [{"name":"ERICSSON-O-RU-11220","administrative-state":"UNLOCKED"}]}`)
+ expectedBody := []byte(`{"o-ran-sc-du-hello-world:radio-resource-management-policy-ratio":[{"id":"rrm-pol-1","radio-resource-management-policy-max-ratio":25,"radio-resource-management-policy-members":[{"mobile-country-code":"310","mobile-network-code":"150","slice-differentiator":1,"slice-service-type":1}],"radio-resource-management-policy-min-ratio":15,"user-label":"rrm-pol-1","resource-type":"prb","radio-resource-management-policy-dedicated-ratio":20,"administrative-state":"unlocked"}]}`)
assertions.Equal(expectedBody, body)
clientMock.AssertNumberOfCalls(t, "Do", 1)
logString := buf.String()
assertions.Contains(logString, "Sent unlock message")
assertions.Contains(logString, "O-RU: ERICSSON-O-RU-11220")
- assertions.Contains(logString, "O-DU: HCL-O-DU-1122")
+ assertions.Contains(logString, "O-DU: O-DU-1122")
}
func newRequest(method string, url string, bodyAsBytes []byte, t *testing.T) *http.Request {
lookupServiceMock := mocks.LookupService{}
- lookupServiceMock.On("GetODuID", mock.Anything).Return("HCL-O-DU-1122", nil)
+ lookupServiceMock.On("GetODuID", mock.Anything).Return("O-DU-1122", nil)
handlerUnderTest := NewLinkFailureHandler(&lookupServiceMock, Configuration{}, nil)
-ERICSSON-O-RU-11220,HCL-O-DU-1122
-ERICSSON-O-RU-11221,HCL-O-DU-1122
-ERICSSON-O-RU-11222,HCL-O-DU-1122
-ERICSSON-O-RU-11223,HCL-O-DU-1122
-ERICSSON-O-RU-11223,HCL-O-DU-1122
-ERICSSON-O-RU-11224,HCL-O-DU-1123
-ERICSSON-O-RU-11225,HCL-O-DU-1123
-ERICSSON-O-RU-11226,HCL-O-DU-1123
-ERICSSON-O-RU-11227,HCL-O-DU-1124
-ERICSSON-O-RU-11228,HCL-O-DU-1125
-ERICSSON-O-RU-11229,HCL-O-DU-1125
\ No newline at end of file
+ERICSSON-O-RU-11220,O-DU-1122
+ERICSSON-O-RU-11221,O-DU-1122
+ERICSSON-O-RU-11222,O-DU-1122
+ERICSSON-O-RU-11223,O-DU-1122
+ERICSSON-O-RU-11223,O-DU-1122
+ERICSSON-O-RU-11224,O-DU-1123
+ERICSSON-O-RU-11225,O-DU-1123
+ERICSSON-O-RU-11226,O-DU-1123
+ERICSSON-O-RU-11227,O-DU-1124
+ERICSSON-O-RU-11228,O-DU-1125
+ERICSSON-O-RU-11229,O-DU-1125
\ No newline at end of file
started = true
fmt.Println("Start pushing messages for job: ", id)
- startPushingMessages()
+ go startPushingMessages()
}
func deleteJobHandler(w http.ResponseWriter, r *http.Request) {
flag.Parse()
r := mux.NewRouter()
- r.HandleFunc("/rests/data/network-topology:network-topology/topology=topology-netconf/node={O-DU-ID}/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection={O-RU-ID}", handleData)
+ r.HandleFunc("/rests/data/network-topology:network-topology/topology=topology-netconf/node={O-DU-ID}/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions={O-DU-ID}/radio-resource-management-policy-ratio=rrm-pol-1", handleData)
fmt.Println("Starting SDNR on port: ", *port)
fmt.Println(http.ListenAndServe(fmt.Sprintf(":%v", *port), r))
import time
MR_PATH = "/events/[TOPIC]/users/test/"
-SDNR_PATH = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=[O-DU-ID]/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=[O-RU-ID]"
+SDNR_PATH = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=[O-DU-ID]/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=[O-DU-ID]/radio-resource-management-policy-ratio=rrm-pol-1"
FAUILT_ID = "28"
UNLOCK_MESSAGE = {
- "o-ran-sc-du-hello-world:du-to-ru-connection": [
+ "o-ran-sc-du-hello-world:radio-resource-management-policy-ratio":
+ [
{
- "name":"",
- "administrative-state":"UNLOCKED"
+ "id":"rrm-pol-1",
+ "radio-resource-management-policy-max-ratio":25,
+ "radio-resource-management-policy-members":
+ [
+ {
+ "mobile-country-code":"310",
+ "mobile-network-code":"150",
+ "slice-differentiator":1,
+ "slice-service-type":1
+ }
+ ],
+ "radio-resource-management-policy-min-ratio":15,
+ "user-label":"rrm-pol-1",
+ "resource-type":"prb",
+ "radio-resource-management-policy-dedicated-ratio":20,
+ "administrative-state":"unlocked"
}
]
}
o_du_id = o_ru_to_o_du_map[o_ru_id]
verboseprint("O-DU ID: " + o_du_id)
unlock_msg = json.loads(json.dumps(UNLOCK_MESSAGE))
- unlock_msg["o-ran-sc-du-hello-world:du-to-ru-connection"][0]["name"] = o_ru_id
- send_path = SDNR_PATH.replace("[O-DU-ID]", o_du_id).replace("[O-RU-ID]", o_ru_id)
+ send_path = SDNR_PATH.replace("[O-DU-ID]", o_du_id)
requests.put(sdnr_address + send_path, auth=(sdnr_user, sdnr_pwd), json=unlock_msg)
else:
print("ERROR: No mapping for O-RU ID: " + o_ru_id)
{
- "ERICSSON-O-RU-11220": "HCL-O-DU-1122",
- "ERICSSON-O-RU-11221": "HCL-O-DU-1122",
- "ERICSSON-O-RU-11222": "HCL-O-DU-1122",
- "ERICSSON-O-RU-11223": "HCL-O-DU-1122",
- "ERICSSON-O-RU-11223": "HCL-O-DU-1122",
- "ERICSSON-O-RU-11224": "HCL-O-DU-1123",
- "ERICSSON-O-RU-11225": "HCL-O-DU-1123",
- "ERICSSON-O-RU-11226": "HCL-O-DU-1123",
- "ERICSSON-O-RU-11227": "HCL-O-DU-1124",
- "ERICSSON-O-RU-11228": "HCL-O-DU-1125",
- "ERICSSON-O-RU-11229": "HCL-O-DU-1125",
+ "ERICSSON-O-RU-11220": "O-DU-1122",
+ "ERICSSON-O-RU-11221": "O-DU-1122",
+ "ERICSSON-O-RU-11222": "O-DU-1122",
+ "ERICSSON-O-RU-11223": "O-DU-1122",
+ "ERICSSON-O-RU-11223": "O-DU-1122",
+ "ERICSSON-O-RU-11224": "O-DU-1123",
+ "ERICSSON-O-RU-11225": "O-DU-1123",
+ "ERICSSON-O-RU-11226": "O-DU-1123",
+ "ERICSSON-O-RU-11227": "O-DU-1124",
+ "ERICSSON-O-RU-11228": "O-DU-1125",
+ "ERICSSON-O-RU-11229": "O-DU-1125",
}
\ No newline at end of file
# Server info
HOST_IP = "::"
HOST_PORT = 9990
-APP_URL = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=<string:o_du_id>/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=<string:o_ru_id>"
+APP_URL = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=<string:o_du_id>/yang-ext:mount/o-ran-sc-du-hello-world:network-function/distributed-unit-functions=<string:o_du_id2>/radio-resource-management-policy-ratio=rrm-pol-1"
USERNAME = "admin"
PASSWORD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
class AlarmClearThread (threading.Thread):
- def __init__(self, sleep_time, o_ru_id):
+ def __init__(self, sleep_time, o_du_id):
threading.Thread.__init__(self)
self.sleep_time = sleep_time
- self.o_ru_id = o_ru_id
+ self.o_du_id = o_du_id
def run(self):
- print(f'Sleeping: {self.sleep_time} before clearing O-DU: {self.o_ru_id}')
+ print(f'Sleeping: {self.sleep_time} before clearing O-DU: {self.o_du_id}')
time.sleep(self.sleep_time)
msg_as_json = json.loads(json.dumps(linkFailureMessage))
- msg_as_json["event"]["commonEventHeader"]["sourceName"] = self.o_ru_id
- print("Sedning alarm clear for O-RU: " + self.o_ru_id)
+ msg_as_json["event"]["commonEventHeader"]["sourceName"] = self.o_du_id
+ print("Sedning alarm clear for O-DU: " + self.o_du_id)
requests.post(mr_host + ":" + mr_port + MR_PATH, json=msg_as_json);
@app.route(APP_URL,
methods=['PUT'])
@auth.login_required
-def sendrequest(o_du_id, o_ru_id):
- print("Got request with O-DU ID: " + o_du_id + " and O-RU ID: " + o_ru_id)
+def sendrequest(o_du_id, o_du_id2):
+ print("Got request with O-DU ID: " + o_du_id)
random_time = int(10 * random.random())
- alarm_clear_thread = AlarmClearThread(random_time, o_ru_id)
+ alarm_clear_thread = AlarmClearThread(random_time, o_du_id)
alarm_clear_thread.start()
return Response(status=200)