Create relesae v1.1.1
[ric-app/hw-go.git] / hwApp.go
index b368db9..14dd4f6 100755 (executable)
--- a/hwApp.go
+++ b/hwApp.go
@@ -14,8 +14,6 @@
    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).
 ==================================================================================
 */
 package main
@@ -23,6 +21,7 @@ package main
 import (
        "encoding/json"
 
+       "gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm"
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel"
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
 )
@@ -160,6 +159,13 @@ func (e *HWApp) sendSubscription(meid string) {
 
        if err != nil {
                xapp.Logger.Error("subscription failed (%s) with error: %s", meid, err)
+
+               // subscription failed, raise alarm
+               err := xapp.Alarm.Raise(8086, alarm.SeverityCritical, meid, "subscriptionFailed")
+               if err != nil {
+                       xapp.Logger.Error("Raising alarm failed with error %v", err)
+               }
+
                return
        }
        xapp.Logger.Info("Successfully subcription done (%s), subscription id : %s", meid, *resp.SubscriptionID)
@@ -241,7 +247,7 @@ func main() {
        }
 
        hw := HWApp{
-               stats: xapp.Metric.RegisterCounterGroup(metrics, "hw-go"), // register counter
+               stats: xapp.Metric.RegisterCounterGroup(metrics, "hw_go"), // register counter
        }
        hw.Run()
 }