Resetting E2Term connection flag after connection succes
[ric-plt/rtmgr.git] / pkg / nbi / httpgetter.go
index bdcc435..7de6b96 100644 (file)
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
+
+
+   This source code is part of the near-RT RIC (RAN Intelligent Controller)
+   platform project (RICP).
+
 ==================================================================================
 */
 /*
 ==================================================================================
 */
 /*
@@ -27,10 +32,12 @@ package nbi
 
 import (
        "encoding/json"
 
 import (
        "encoding/json"
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
        "net/http"
        "routing-manager/pkg/rpe"
        "routing-manager/pkg/rtmgr"
        "routing-manager/pkg/sdl"
        "net/http"
        "routing-manager/pkg/rpe"
        "routing-manager/pkg/rtmgr"
        "routing-manager/pkg/sdl"
+       "sync"
        "time"
 )
 
        "time"
 )
 
@@ -45,10 +52,10 @@ func NewHttpGetter() *HttpGetter {
        return instance
 }
 
        return instance
 }
 
-var myClient = &http.Client{Timeout: 5 * time.Second}
+var myClient = &http.Client{Timeout: 15 * time.Second}
 
 func fetchAllXApps(xmurl string) (*[]rtmgr.XApp, error) {
 
 func fetchAllXApps(xmurl string) (*[]rtmgr.XApp, error) {
-       rtmgr.Logger.Info("Invoked httpGetter.fetchXappList: " + xmurl)
+       xapp.Logger.Info("Invoked httpGetter.fetchXappList: " + xmurl)
        r, err := myClient.Get(xmurl)
        if err != nil {
                return nil, err
        r, err := myClient.Get(xmurl)
        if err != nil {
                return nil, err
@@ -56,22 +63,22 @@ func fetchAllXApps(xmurl string) (*[]rtmgr.XApp, error) {
        defer r.Body.Close()
 
        if r.StatusCode == 200 {
        defer r.Body.Close()
 
        if r.StatusCode == 200 {
-               rtmgr.Logger.Debug("http client raw response: %v", r)
+               xapp.Logger.Debug("http client raw response: %v", r)
                var xApps []rtmgr.XApp
                err = json.NewDecoder(r.Body).Decode(&xApps)
                if err != nil {
                var xApps []rtmgr.XApp
                err = json.NewDecoder(r.Body).Decode(&xApps)
                if err != nil {
-                       rtmgr.Logger.Warn("Json decode failed: " + err.Error())
+                       xapp.Logger.Warn("Json decode failed: " + err.Error())
                }
                }
-               rtmgr.Logger.Info("HTTP GET: OK")
-               rtmgr.Logger.Debug("httpGetter.fetchXappList returns: %v", xApps)
+               xapp.Logger.Info("HTTP GET: OK")
+               xapp.Logger.Debug("httpGetter.fetchXappList returns: %v", xApps)
                return &xApps, err
        }
                return &xApps, err
        }
-       rtmgr.Logger.Warn("httpGetter got an unexpected http status code: %v", r.StatusCode)
+       xapp.Logger.Warn("httpGetter got an unexpected http status code: %v", r.StatusCode)
        return nil, nil
 }
 
        return nil, nil
 }
 
-func (g *HttpGetter) Initialize(xmurl string, nbiif string, fileName string, configfile string,
-       sdlEngine sdl.Engine, rpeEngine rpe.Engine, triggerSBI chan<- bool) error {
+func (g *HttpGetter) Initialize(xmurl string, nbiif string, fileName string, configfile string, e2murl string,
+       sdlEngine sdl.Engine, rpeEngine rpe.Engine,  m *sync.Mutex) error {
        return nil
 }
 
        return nil
 }