xapp.Resource.InjectRoute("/ric/v1/get_xapp_rest_restsubscriptions/{xappServiceName}", c.GetAllXappRestSubscriptions, "GET")
xapp.Resource.InjectRoute("/ric/v1/get_e2subscriptions/{restId}", c.GetE2Subscriptions, "GET")
- xapp.Resource.InjectRoute("/ric/v1/delete_all_e2node_subscriptions/{ranName}", c.DeleteAllE2nodeSubscriptions, "GET")
- xapp.Resource.InjectRoute("/ric/v1/delete_all_xapp_subscriptions/{xappServiceName}", c.DeleteAllXappSubscriptions, "GET")
+ xapp.Resource.InjectRoute("/ric/v1/delete_all_e2node_subscriptions/{ranName}", c.DeleteAllE2nodeSubscriptions, "DELETE")
+ xapp.Resource.InjectRoute("/ric/v1/delete_all_xapp_subscriptions/{xappServiceName}", c.DeleteAllXappSubscriptions, "DELETE")
if readSubsFromDb == "true" {
// Read subscriptions from db
//-----------------------------------------------------------------------------
type RESTSubscription struct {
- Created time.Time
+ Created string
xAppServiceName string
xAppRmrEndPoint string
Meid string
r.mutex.Lock()
defer r.mutex.Unlock()
newRestSubscription := RESTSubscription{}
- newRestSubscription.Created = time.Now()
+ newRestSubscription.Created = time.Now().Format("2006-01-02 15:04:05.000")
newRestSubscription.xAppServiceName = *xappServiceName
newRestSubscription.xAppRmrEndPoint = *xAppRmrEndPoint
newRestSubscription.Meid = *maid
import (
"encoding/json"
"fmt"
- "time"
sdl "gerrit.o-ran-sc.org/r/ric-plt/sdlgo"
"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
const restSubSdlNs = "submgr_restSubsDb"
type RESTSubscriptionInfo struct {
- Created time.Time
+ Created string
XAppServiceName string
XAppRmrEndPoint string
Meid string
mc.TestLog(t, "Response status: %v", resp.Status)
mc.TestLog(t, "Response Headers: %v", resp.Header)
- if !strings.Contains(resp.Status, "204 No Content") {
+
+ // Note that xapp gets '204 No Content' response through Swagger generated delete route.
+ // Inject route returns '200 OK'
+ if !(strings.Contains(resp.Status, "204 No Content") || strings.Contains(resp.Status, "200 OK")) {
mc.TestError(t, "Wrong response status")
return
}
}
// Simulate deletion through REST test and debug interface
- mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName
+ mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName
delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
e2termConn1.SendSubsDelResp(t, delreq, delmsg)
assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList))
// Simulate deletion through REST test and debug interface
- mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName
+ mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName
delreq, delmsg := e2termConn1.RecvSubsDelReq(t)
e2termConn1.SendSubsDelResp(t, delreq, delmsg)