X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fsbi%2Fnngpush.go;h=140431961eef58851df3499545660bd80c1a8707;hb=cb93dbf2fac19dd49332847327b364be27d8bb71;hp=ac61c0bccad2f96b1fece6d0c1ac91fe81d0c0dd;hpb=d2563ed2763e3333e7ce94904a7bade4180d007f;p=ric-plt%2Frtmgr.git diff --git a/pkg/sbi/nngpush.go b/pkg/sbi/nngpush.go index ac61c0b..1404319 100644 --- a/pkg/sbi/nngpush.go +++ b/pkg/sbi/nngpush.go @@ -28,6 +28,20 @@ package sbi +/* +#include +#include +#include +#include +#include +#include + + +#cgo CFLAGS: -I../ +#cgo LDFLAGS: -lrmr_nng -lnng +*/ +import "C" + import ( "errors" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" @@ -36,12 +50,14 @@ import ( _ "nanomsg.org/go/mangos/v2/transport/all" "routing-manager/pkg/rtmgr" "strconv" - "time" ) + + type NngPush struct { Sbi NewSocket CreateNewNngSocketHandler + rcChan chan *xapp.RMRParams } func NewNngPush() *NngPush { @@ -130,40 +146,14 @@ func (c *NngPush) dial(ep *rtmgr.Endpoint) error { return nil } -/* func (c *NngPush) DistributeAll(policies *[]string) error { xapp.Logger.Debug("Invoked: sbi.DistributeAll") xapp.Logger.Debug("args: %v", *policies) for _, ep := range rtmgr.Eps { - if ep.IsReady { - go c.send(ep, policies) - } else { - xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready") - } - } - } - return nil -} - -*/ - -/* - Temporary solution for R3 - E2M -> E2T issue -*/ -func (c *NngPush) DistributeAll(policies *[]string) error { - xapp.Logger.Debug("Invoked: sbi.DistributeAll") - xapp.Logger.Debug("args: %v", *policies) - for _, ep := range rtmgr.Eps { - i := 1 - for i< 5 { - if ep.IsReady { - go c.send(ep, policies) - break - } else { - xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready" + " Retry count " + strconv.Itoa(i)) - time.Sleep(10 * time.Millisecond) - i++ - } + if ep.IsReady { + go c.send(ep, policies) + } else { + xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready") } } return nil