- xapp.Logger.Debug("%s ongoing", subRouteAction.String())
- var err error
- switch subRouteAction.Command {
- case CREATE:
- createData := rtmgr_models.XappSubscriptionData{&subRouteAction.EpList.Endpoints[0].Addr, &subRouteAction.EpList.Endpoints[0].Port, &subID}
- createHandle := rtmgrhandle.NewProvideXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
- createHandle.WithXappSubscriptionData(&createData)
- _, err = rc.rtClient.Handle.ProvideXappSubscriptionHandle(createHandle)
- case DELETE:
- deleteData := rtmgr_models.XappSubscriptionData{&subRouteAction.EpList.Endpoints[0].Addr, &subRouteAction.EpList.Endpoints[0].Port, &subID}
- deleteHandle := rtmgrhandle.NewDeleteXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
- deleteHandle.WithXappSubscriptionData(&deleteData)
- _, _, err = rc.rtClient.Handle.DeleteXappSubscriptionHandle(deleteHandle)
- case UPDATE:
- var updateData rtmgr_models.XappList
- for i := range subRouteAction.EpList.Endpoints {
- updateData = append(updateData, &rtmgr_models.XappElement{Address: &subRouteAction.EpList.Endpoints[i].Addr, Port: &subRouteAction.EpList.Endpoints[i].Port})
- }
- updateHandle := rtmgrhandle.NewUpdateXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
- updateHandle.WithSubscriptionID(subRouteAction.SubID)
- updateHandle.WithXappList(updateData)
- _, err = rc.rtClient.Handle.UpdateXappSubscriptionHandle(updateHandle)
-
- default:
- return fmt.Errorf("%s unknown", subRouteAction.String())
+ xapp.Logger.Debug("CREATE %s ongoing", subRouteAction.String())
+ createData := rtmgr_models.XappSubscriptionData{&subRouteAction.EpList.Endpoints[0].Addr, &subRouteAction.EpList.Endpoints[0].Port, &subID}
+ createHandle := rtmgrhandle.NewProvideXappSubscriptionHandleParamsWithTimeout(10 * time.Second)
+ createHandle.WithXappSubscriptionData(&createData)
+ _, err := rc.rtClient.Handle.ProvideXappSubscriptionHandle(createHandle)
+ if err != nil && !(strings.Contains(err.Error(), "status 200")) {
+ return fmt.Errorf("CREATE %s failed with error: %s", subRouteAction.String(), err.Error())