echo "--> build_adapter_ubuntu.sh starts"
# Install RMR from deb packages at packagecloud.io
-rmr=rmr_3.2.4_amd64.deb
+rmr=rmr_3.6.3_amd64.deb
wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmr/download.deb
sudo dpkg -i $rmr
rm $rmr
-rmrdev=rmr-dev_3.2.4_amd64.deb
+rmrdev=rmr-dev_3.6.3_amd64.deb
wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/$rmrdev/download.deb
sudo dpkg -i $rmrdev
rm $rmrdev
# And for the Alarm Adapter
cd ../adapter && go test -v -p 1 -coverprofile cover.out ./cmd/ -c -o ./adapter_test && ./adapter_test
-echo "--> build_adapter_ubuntu.sh ends"
\ No newline at end of file
+echo "--> build_adapter_ubuntu.sh ends"
}
alarmer, _ = alarm.InitAlarm("my-pod", "my-app")
+ time.Sleep(time.Duration(5) * time.Second)
eventChan = make(chan string)
os.Exit(M.Run())
# By default this file is in the docker build directory,
# but the location can configured in the JJB template.
---
-tag: 0.4.3
+tag: 0.4.4
/*
#cgo CFLAGS: -I../
-#cgo LDFLAGS: -lrmr_nng -lnng
+#cgo LDFLAGS: -lrmr_si
#include "utils.h"
*/
// The MO and APP identities are given as a parameters.
// The identities are used when raising/clearing alarms, unless provided by the applications.
func InitAlarm(mo, id string) (*RICAlarm, error) {
- if ctx := C.rmrInit(); ctx != nil {
- r := &RICAlarm{
- moId: mo,
- appId: id,
- rmrCtx: ctx,
- }
-
- return r, nil
+ r := &RICAlarm{
+ moId: mo,
+ appId: id,
}
+ go InitRMR(r)
- return nil, errors.New("rmrInit failed!")
+ return r, nil
}
// Create a new Alarm instance
}
func (r *RICAlarm) sendAlarmUpdateReq(a AlarmMessage) error {
- log.Println("Sending alarm: ", r.AlarmString(a))
+ if r.rmrCtx == nil || !r.rmrReady {
+ return errors.New("RMR no ready yet!")
+ }
+ log.Println("Sending alarm: ", r.AlarmString(a))
payload, err := json.Marshal(a)
if err != nil {
return err
}
return errors.New("rmrRcv failed!")
}
+
+func InitRMR(r *RICAlarm) error {
+ if ctx := C.rmrInit(); ctx != nil {
+ r.rmrCtx = ctx
+ r.rmrReady = true
+ return nil
+ }
+
+ return errors.New("rmrInit failed!")
+}
assert.Equal(t, false, a == nil)
alarmer = a
+ time.Sleep(time.Duration(5 * time.Second))
}
func TestAlarmRaiseSuccess(t *testing.T) {
// RICAlarm is an alarm instance
type RICAlarm struct {
- moId string
- appId string
- rmrCtx unsafe.Pointer
- mutex sync.Mutex
+ moId string
+ appId string
+ rmrCtx unsafe.Pointer
+ rmrReady bool
+ mutex sync.Mutex
}
const (
// Must have a route table before we can send, so wait til RMR is ready
while(!rmr_ready(mrc)) {
- fprintf(stderr, "Waiting for RMR to be ready ...\n");
- sleep(1);
+ //fprintf(stderr, "Waiting for RMR to be ready ...\n");
+ sleep(2);
}
fprintf(stderr, "RMR is ready now ...\n");
replace gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm => ./alarm/
-replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.30
+replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.4.0
replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.5.2