X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fusecases%2Foruclosedlooprecovery%2Fgoversion%2Finternal%2Flinkfailure%2Flinkfailurehandler.go;h=3aecf45cd69941b70277f8908c56aaaa4683fb99;hb=46a0fd717e5f49ebae6cb2c4fbcf54f0e329dc86;hp=c21371a362db37b4d3b13d83be247140b5db6e96;hpb=6ab9cd9df333ab3b5ed1ce6957dcea8f20d5c28d;p=nonrtric.git diff --git a/test/usecases/oruclosedlooprecovery/goversion/internal/linkfailure/linkfailurehandler.go b/test/usecases/oruclosedlooprecovery/goversion/internal/linkfailure/linkfailurehandler.go index c21371a3..3aecf45c 100644 --- a/test/usecases/oruclosedlooprecovery/goversion/internal/linkfailure/linkfailurehandler.go +++ b/test/usecases/oruclosedlooprecovery/goversion/internal/linkfailure/linkfailurehandler.go @@ -32,26 +32,25 @@ import ( ) type Configuration struct { - ConsumerAddress string - InfoCoordAddress string - SDNRAddress string - SDNRUser string - SDNRPassword string + SDNRAddress string + SDNRUser string + 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"}]}` type LinkFailureHandler struct { lookupService repository.LookupService config Configuration + client restclient.HTTPClient } -func NewLinkFailureHandler(ls repository.LookupService, conf Configuration) *LinkFailureHandler { +func NewLinkFailureHandler(ls repository.LookupService, conf Configuration, client restclient.HTTPClient) *LinkFailureHandler { return &LinkFailureHandler{ lookupService: ls, config: conf, + client: client, } } @@ -74,13 +73,13 @@ func (lfh LinkFailureHandler) sendUnlockMessage(oRuId string) { if oDuId, err := lfh.lookupService.GetODuID(oRuId); err == nil { sdnrPath := getSdnrPath(oRuId, oDuId) unlockMessage := lfh.getUnlockMessage(oRuId) - if error := restclient.Put(lfh.config.SDNRAddress+sdnrPath, unlockMessage, lfh.config.SDNRUser, lfh.config.SDNRPassword); error == nil { + 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 { - log.Warn(error) + log.Warn("Send of unlock message failed due to ", error) } } else { - log.Warn(err) + log.Warn("Send of unlock message failed due to ", err) } }