From 53dbe7eafa69dcea736ba19c66581a80f374b51a Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Wed, 6 Oct 2021 14:21:48 +0300 Subject: [PATCH 01/16] Fix for xApp transction release place - xApp trasaction release is now done before REST notification is sent to xApp - This makes subscription deletion possible instantly after notification Change-Id: Ia076180aaff40a0b8f8f3c655895a5e37364c5bd Signed-off-by: Anssi Mannila --- pkg/control/control.go | 2 +- pkg/control/ut_messaging_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 1bcffc6..799a307 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -511,6 +511,7 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription subRespMsg, errorInfo, err := c.handleSubscriptionRequest(trans, &subReqMsg, meid, *restSubId, e2SubscriptionDirectives) xapp.Logger.Debug("Handled SubscriptionRequest index=%v, %s", index, idstring(nil, trans)) + trans.Release() if err != nil { c.sendUnsuccesfullResponseNotification(restSubId, restSubscription, xAppEventInstanceID, err, clientEndpoint, trans, errorInfo) @@ -521,7 +522,6 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription index, *restSubId, clientEndpoint.Host, *clientEndpoint.HTTPPort, xAppEventInstanceID, e2EventInstanceID, idstring(nil, trans)) c.sendSuccesfullResponseNotification(restSubId, restSubscription, xAppEventInstanceID, e2EventInstanceID, clientEndpoint, trans) } - trans.Release() } } diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 69e7c1f..9c2874b 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -6583,9 +6583,9 @@ func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) xappConn1.ExpectRESTNotification(t, restSubId) - // SubsResp is missing - e2SubsId = xappConn1.WaitRESTNotification(t, restSubId) - xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) + // SubsResp is missing, e2SubsId will be 0 + zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) // Del xappConn1.SendRESTSubsDelReq(t, &restSubId) -- 2.16.6 From f0bb66c95fa3f03ae956cc719cc776ed2f2f3bd4 Mon Sep 17 00:00:00 2001 From: Timo Tietavainen Date: Fri, 8 Oct 2021 09:16:20 +0300 Subject: [PATCH 02/16] Replace deprecated SDL APIs Replace deprecated SDL SdlInstance usage with xapp-frame's SdlStorage APIs, which have been built on top of the valid SDL SyncStorage APIs. Upgrade SDL version to v0.8.0. Issue-Id: RIC-805 Signed-off-by: Timo Tietavainen Change-Id: I04142853f74775ae40b71a0bef5431508acbb61a --- RELNOTES | 3 +++ go.mod | 7 +++++-- go.sum | 19 +++++-------------- pkg/control/sdl_e2SubsDb.go | 16 +++++++++------- pkg/control/sdl_e2SubsDb_test.go | 32 +++++++++++++++++++++++++++----- pkg/control/sdl_restSubsDb.go | 18 ++++++++++-------- pkg/control/sdl_restSubsDb_test.go | 32 +++++++++++++++++++++++++++----- pkg/control/types.go | 10 +++++----- 8 files changed, 91 insertions(+), 46 deletions(-) diff --git a/RELNOTES b/RELNOTES index 7aef394..5ca454a 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,3 +1,6 @@ +### v0.10.8 +* Replacing deprecated SDL APIs + ### v0.10.7 * Xapp-frame version update * Dockerfile correction for test applications diff --git a/go.mod b/go.mod index a53afa1..62a10a5 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module gerrit.o-ran-sc.org/r/ric-plt/submgr go 1.12 -replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0 +replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.9.3 @@ -12,10 +12,13 @@ replace gerrit.o-ran-sc.org/r/ric-plt/e2ap => ./e2ap/ require ( gerrit.o-ran-sc.org/r/ric-plt/e2ap v0.0.0-00010101000000-000000000000 - gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0 + gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.8.0 gerrit.o-ran-sc.org/r/ric-plt/xapp-frame v0.0.0-00010101000000-000000000000 + github.com/go-openapi/errors v0.19.3 github.com/go-openapi/runtime v0.19.4 github.com/go-openapi/strfmt v0.19.4 + github.com/go-openapi/swag v0.19.7 + github.com/go-openapi/validate v0.19.6 github.com/gorilla/mux v1.7.1 github.com/segmentio/ksuid v1.0.3 github.com/spf13/viper v1.4.0 diff --git a/go.sum b/go.sum index 6f01e50..a0fa7a9 100644 --- a/go.sum +++ b/go.sum @@ -4,24 +4,16 @@ gerrit.o-ran-sc.org/r/com/golog.git v0.0.2 h1:Ix6SgFuzd6yW6Ur6+qDlGhDO65UYs8PiIk gerrit.o-ran-sc.org/r/com/golog.git v0.0.2/go.mod h1:A7hUL52YQSO4dFIZNcj76XQ09C9PftAe3LyL7kqBnok= gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.0 h1:OKDsIDlttbaoHwleyjflIWVZPgPvYbDhim6gWF0zf5E= gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.0/go.mod h1:AdEWKtERGvOQy9ybLhyhrb9w9LLVn8i9xzTwoR5n4BY= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35 h1:TGXHb4DNY8on+ej4S9VUnk2HibIC/5chDy64OE+bQBQ= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.0.35/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1 h1:3FFbXx55BODThXfyWAiz6cPXVELXFICDQUmJi13EoxM= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1/go.mod h1:QJ1uPPZosGbhxUWpUpeM5fLqFHdnWTrVnvW2DgyOCes= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35 h1:tkM3yE8UzmuH4nf9TqAmiNBSuIZ2CtcMRH2eBIYIzpQ= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.0.35/go.mod h1:G+4sUBMbLfQ+RrGS65U15tKmbnP+/1b5oLTPmMfyfT4= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1 h1:8Z60JRsPgcS1Ona4fEh6d0/03nLq1WHoZcNnBsni5+g= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1/go.mod h1:YaQ+XEI4PcAoISxp9wUpUr2TP0J7JihpQTD0G1Lpd4A= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35 h1:LcxnUUDwsCzYEISKmkjkyYfg/lnLt8ofkPiGK69vNIA= -gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.0.35/go.mod h1:2bSaXTpECbZieB8bMnubTqMwF3n+mMBxlTaAXvcduNg= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1 h1:BG3kste8PLVTG0m8CRB/VP2tAV5JImKueBGuOsUNcR8= gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1/go.mod h1:zX8rW6YEsagHrRGVW5YO50Ku/Csrpzsuvblhr4DbYi4= -gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0 h1:mxlBo54jxwHHFmGYzFI+fBIkOGwarQP4dx2KBxQ8ln8= -gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo= -gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.8.3 h1:C5nhnmSZLdysSiQ7vMkpNaKrooPwiBZ79dcXWRVtZTU= -gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.8.3/go.mod h1:MRTeTBLROgTA2t91SXYjTbRsxoOhMMvvkK/ChLVRZUU= -gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.8.5 h1:PEc4Lv6cn8hQM1Ak3wE3MwhCa4v7triRjdhXwsTUMUw= -gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.8.5/go.mod h1:Z9SajRPqZ7N1/y+Lzp5lUzq24fvrcjQg3cMBXRQVkiM= +gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 h1:H7GtCRC+pGn6oOxYalUZr7LinQX5jQCVa+ConX7PB5Q= +gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0/go.mod h1:KCHu4JkWnw2Ro6P747wU9S2t7zxFLmBNCiYvGZo3CHo= +gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.9.3 h1:JokT2aaJkKjYFMayvZHvGb+/IhkqZdnxEdwOZVfzIpg= +gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.9.3/go.mod h1:foKMPQZ+RlM0Pos2GlEPAg6ux7Y9PRQmCUglYM7/Qt8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -155,8 +147,6 @@ github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -172,6 +162,7 @@ github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= diff --git a/pkg/control/sdl_e2SubsDb.go b/pkg/control/sdl_e2SubsDb.go index 2afa36e..3305e41 100644 --- a/pkg/control/sdl_e2SubsDb.go +++ b/pkg/control/sdl_e2SubsDb.go @@ -29,6 +29,8 @@ import ( "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) +const e2SubSdlNs = "submgr_e2SubsDb" + type SubscriptionInfo struct { Valid bool ReqId RequestId @@ -41,7 +43,7 @@ type SubscriptionInfo struct { } func CreateSdl() Sdlnterface { - return sdl.NewSdlInstance("submgr_e2SubsDb", sdl.NewDatabase()) + return sdl.NewSyncStorage() } func (c *Control) WriteSubscriptionToSdl(subId uint32, subs *Subscription) error { @@ -66,7 +68,7 @@ func (c *Control) WriteSubscriptionToSdl(subId uint32, subs *Subscription) error return fmt.Errorf("SDL: WriteSubscriptionToSdl() json.Marshal error: %s", err.Error()) } - if err = c.e2SubsDb.Set(strconv.FormatUint(uint64(subId), 10), jsonData); err != nil { + if err = c.e2SubsDb.Set(e2SubSdlNs, strconv.FormatUint(uint64(subId), 10), jsonData); err != nil { c.UpdateCounter(cSDLWriteFailure) return fmt.Errorf("SDL: WriteSubscriptionToSdl(): %s", err.Error()) } else { @@ -79,7 +81,7 @@ func (c *Control) ReadSubscriptionFromSdl(subId uint32) (*Subscription, error) { // This function is now just for testing purpose key := strconv.FormatUint(uint64(subId), 10) - retMap, err := c.e2SubsDb.Get([]string{key}) + retMap, err := c.e2SubsDb.Get(e2SubSdlNs, []string{key}) if err != nil { c.UpdateCounter(cSDLReadFailure) return nil, fmt.Errorf("SDL: ReadSubscriptionFromSdl(): %s", err.Error()) @@ -138,7 +140,7 @@ func (c *Control) CreateSubscription(subscriptionInfo *SubscriptionInfo, jsonSub func (c *Control) RemoveSubscriptionFromSdl(subId uint32) error { key := strconv.FormatUint(uint64(subId), 10) - if err := c.e2SubsDb.Remove([]string{key}); err != nil { + if err := c.e2SubsDb.Remove(e2SubSdlNs, []string{key}); err != nil { return fmt.Errorf("SDL: RemoveSubscriptionfromSdl(): %s\n", err.Error()) } else { xapp.Logger.Debug("SDL: Subscription removed from e2SubsDb. subId = %v", subId) @@ -157,7 +159,7 @@ func (c *Control) ReadAllSubscriptionsFromSdl() ([]uint32, map[uint32]*Subscript retMap := make(map[uint32]*Subscription) // Get all keys - keys, err := c.e2SubsDb.GetAll() + keys, err := c.e2SubsDb.GetAll(e2SubSdlNs) if err != nil { c.UpdateCounter(cSDLReadFailure) return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), GetAll(). Error while reading E2 subscriptions keys from DBAAS %s\n", err.Error()) @@ -168,7 +170,7 @@ func (c *Control) ReadAllSubscriptionsFromSdl() ([]uint32, map[uint32]*Subscript } // Get all subscriptionInfos - iSubscriptionMap, err := c.e2SubsDb.Get(keys) + iSubscriptionMap, err := c.e2SubsDb.Get(e2SubSdlNs, keys) if err != nil { c.UpdateCounter(cSDLReadFailure) return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), Get(): Error while reading E2 subscriptions from DBAAS %s\n", err.Error()) @@ -213,7 +215,7 @@ func removeNumber(s []uint32, removedNum uint32) ([]uint32, error) { } func (c *Control) RemoveAllSubscriptionsFromSdl() error { - if err := c.e2SubsDb.RemoveAll(); err != nil { + if err := c.e2SubsDb.RemoveAll(e2SubSdlNs); err != nil { c.UpdateCounter(cSDLRemoveFailure) return fmt.Errorf("SDL: RemoveAllSubscriptionsFromSdl(): %s\n", err.Error()) } else { diff --git a/pkg/control/sdl_e2SubsDb_test.go b/pkg/control/sdl_e2SubsDb_test.go index 2deb4b5..3175cc9 100644 --- a/pkg/control/sdl_e2SubsDb_test.go +++ b/pkg/control/sdl_e2SubsDb_test.go @@ -463,13 +463,17 @@ func TestRemoveAllSubscriptionsFromSdlFail(t *testing.T) { t.Log("TEST: All subscription removed from db") } -func (m *Mock) Set(pairs ...interface{}) error { +func (m *Mock) Set(ns string, pairs ...interface{}) error { var key string var val string m.marshalLock.Lock() defer m.marshalLock.Unlock() + if ns != e2SubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if sdlShouldReturnError == true { return GetSdlError() } @@ -507,8 +511,13 @@ func (m *Mock) Set(pairs ...interface{}) error { return nil } -func (m *Mock) Get(keys []string) (map[string]interface{}, error) { +func (m *Mock) Get(ns string, keys []string) (map[string]interface{}, error) { retMap := make(map[string]interface{}) + + if ns != e2SubSdlNs { + return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if len(keys) == 0 { return nil, fmt.Errorf("Get() error: len(key) == 0\n") } @@ -527,7 +536,11 @@ func (m *Mock) Get(keys []string) (map[string]interface{}, error) { return retMap, nil } -func (m *Mock) GetAll() ([]string, error) { +func (m *Mock) GetAll(ns string) ([]string, error) { + + if ns != e2SubSdlNs { + return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } if sdlShouldReturnError == true { return nil, GetSdlError() @@ -540,7 +553,12 @@ func (m *Mock) GetAll() ([]string, error) { return keys, nil } -func (m *Mock) Remove(keys []string) error { +func (m *Mock) Remove(ns string, keys []string) error { + + if ns != e2SubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if len(keys) == 0 { return fmt.Errorf("Remove() error: len(key) == 0\n") } @@ -560,7 +578,11 @@ func (m *Mock) Remove(keys []string) error { return nil } -func (m *Mock) RemoveAll() error { +func (m *Mock) RemoveAll(ns string) error { + + if ns != e2SubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } for key := range m.e2SubsDb { subId64, err := strconv.ParseUint(key, 10, 64) diff --git a/pkg/control/sdl_restSubsDb.go b/pkg/control/sdl_restSubsDb.go index f9d837b..e9a7d2f 100644 --- a/pkg/control/sdl_restSubsDb.go +++ b/pkg/control/sdl_restSubsDb.go @@ -27,6 +27,8 @@ import ( "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) +const restSubSdlNs = "submgr_restSubsDb" + type RESTSubscriptionInfo struct { XAppRmrEndPoint string Meid string @@ -38,7 +40,7 @@ type RESTSubscriptionInfo struct { } func CreateRESTSdl() Sdlnterface { - return sdl.NewSdlInstance("submgr_restSubsDb", sdl.NewDatabase()) + return sdl.NewSyncStorage() } func (c *Control) WriteRESTSubscriptionToSdl(restSubId string, restSubs *RESTSubscription) error { @@ -57,7 +59,7 @@ func (c *Control) WriteRESTSubscriptionToSdl(restSubId string, restSubs *RESTSub return fmt.Errorf("SDL: WriteSubscriptionToSdl() json.Marshal error: %s", err.Error()) } - if err = c.restSubsDb.Set(restSubId, jsonData); err != nil { + if err = c.restSubsDb.Set(restSubSdlNs, restSubId, jsonData); err != nil { c.UpdateCounter(cSDLWriteFailure) return fmt.Errorf("SDL: WriteSubscriptionToSdl(): %s", err.Error()) } else { @@ -70,7 +72,7 @@ func (c *Control) ReadRESTSubscriptionFromSdl(restSubId string) (*RESTSubscripti // This function is now just for testing purpose key := restSubId - retMap, err := c.restSubsDb.Get([]string{key}) + retMap, err := c.restSubsDb.Get(restSubSdlNs, []string{key}) if err != nil { c.UpdateCounter(cSDLReadFailure) return nil, fmt.Errorf("SDL: ReadSubscriptionFromSdl(): %s", err.Error()) @@ -116,7 +118,7 @@ func (c *Control) CreateRESTSubscription(restSubscriptionInfo *RESTSubscriptionI func (c *Control) RemoveRESTSubscriptionFromSdl(restSubId string) error { key := restSubId - if err := c.restSubsDb.Remove([]string{key}); err != nil { + if err := c.restSubsDb.Remove(restSubSdlNs, []string{key}); err != nil { return fmt.Errorf("SDL: RemoveSubscriptionfromSdl(): %s\n", err.Error()) } else { xapp.Logger.Debug("SDL: Subscription removed from restSubsDb. restSubId = %v", restSubId) @@ -128,7 +130,7 @@ func (c *Control) ReadAllRESTSubscriptionsFromSdl() (map[string]*RESTSubscriptio retMap := make(map[string]*RESTSubscription) // Get all keys - keys, err := c.restSubsDb.GetAll() + keys, err := c.restSubsDb.GetAll(restSubSdlNs) if err != nil { c.UpdateCounter(cSDLReadFailure) return nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), GetAll(). Error while reading REST subscriptions keys from DBAAS %s\n", err.Error()) @@ -139,7 +141,7 @@ func (c *Control) ReadAllRESTSubscriptionsFromSdl() (map[string]*RESTSubscriptio } // Get all subscriptionInfos - iRESTSubscriptionMap, err := c.restSubsDb.Get(keys) + iRESTSubscriptionMap, err := c.restSubsDb.Get(restSubSdlNs, keys) if err != nil { c.UpdateCounter(cSDLReadFailure) return nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), Get(): Error while reading REST subscriptions from DBAAS %s\n", err.Error()) @@ -166,11 +168,11 @@ func (c *Control) ReadAllRESTSubscriptionsFromSdl() (map[string]*RESTSubscriptio func (c *Control) RemoveAllRESTSubscriptionsFromSdl() error { - if err := c.restSubsDb.RemoveAll(); err != nil { + if err := c.restSubsDb.RemoveAll(restSubSdlNs); err != nil { c.UpdateCounter(cSDLRemoveFailure) return fmt.Errorf("SDL: RemoveAllSubscriptionsFromSdl(): %s\n", err.Error()) } else { - xapp.Logger.Debug("SDL: All subscriptions removed from e2SubsDb") + xapp.Logger.Debug("SDL: All subscriptions removed from restSubsDb") } return nil } diff --git a/pkg/control/sdl_restSubsDb_test.go b/pkg/control/sdl_restSubsDb_test.go index 12bf1eb..273a15e 100644 --- a/pkg/control/sdl_restSubsDb_test.go +++ b/pkg/control/sdl_restSubsDb_test.go @@ -369,13 +369,17 @@ func TestRemoveAllRESTSubscriptionsFromSdlFail(t *testing.T) { t.Log("TEST: All subscription removed from db") } -func (m *RestSubsDbMock) Set(pairs ...interface{}) error { +func (m *RestSubsDbMock) Set(ns string, pairs ...interface{}) error { var key string var val string m.marshalLock.Lock() defer m.marshalLock.Unlock() + if ns != restSubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if sdlRestShouldReturnError == true { return GetSdlRestError() } @@ -412,8 +416,13 @@ func (m *RestSubsDbMock) Set(pairs ...interface{}) error { return nil } -func (m *RestSubsDbMock) Get(keys []string) (map[string]interface{}, error) { +func (m *RestSubsDbMock) Get(ns string, keys []string) (map[string]interface{}, error) { retMap := make(map[string]interface{}) + + if ns != restSubSdlNs { + return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if len(keys) == 0 { return nil, fmt.Errorf("Get() error: len(key) == 0\n") } @@ -432,7 +441,11 @@ func (m *RestSubsDbMock) Get(keys []string) (map[string]interface{}, error) { return retMap, nil } -func (m *RestSubsDbMock) GetAll() ([]string, error) { +func (m *RestSubsDbMock) GetAll(ns string) ([]string, error) { + + if ns != restSubSdlNs { + return nil, fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } if sdlRestShouldReturnError == true { return nil, GetSdlRestError() @@ -445,7 +458,12 @@ func (m *RestSubsDbMock) GetAll() ([]string, error) { return keys, nil } -func (m *RestSubsDbMock) Remove(keys []string) error { +func (m *RestSubsDbMock) Remove(ns string, keys []string) error { + + if ns != restSubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } + if len(keys) == 0 { return fmt.Errorf("Remove() error: len(key) == 0\n") } @@ -460,7 +478,11 @@ func (m *RestSubsDbMock) Remove(keys []string) error { return nil } -func (m *RestSubsDbMock) RemoveAll() error { +func (m *RestSubsDbMock) RemoveAll(ns string) error { + + if ns != restSubSdlNs { + return fmt.Errorf("Unexpected namespace '%s' error\n", ns) + } for key := range m.restSubsDb { diff --git a/pkg/control/types.go b/pkg/control/types.go index 0123357..93cddb0 100644 --- a/pkg/control/types.go +++ b/pkg/control/types.go @@ -37,11 +37,11 @@ func (rid *RequestId) String() string { } type Sdlnterface interface { - Set(pairs ...interface{}) error - Get(keys []string) (map[string]interface{}, error) - GetAll() ([]string, error) - Remove(keys []string) error - RemoveAll() error + Set(ns string, pairs ...interface{}) error + Get(ns string, keys []string) (map[string]interface{}, error) + GetAll(ns string) ([]string, error) + Remove(ns string, keys []string) error + RemoveAll(ns string) error } type E2SubscriptionDirectives struct { -- 2.16.6 From 3cdd2e0c0d042b816f6d35f68a93f97fbbe7efc1 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Thu, 14 Oct 2021 12:35:41 +0300 Subject: [PATCH 03/16] Fix for Submgr crash added - Submgr crashed if it received REST Subscription Request while it was still starting Change-Id: Ie434333ccf2b269c9f8dcf7a82fd60f12fa87ebc Signed-off-by: Anssi Mannila --- pkg/control/control.go | 57 ++++++++++++++++++++------------------ pkg/control/duplicate.go | 24 ++++++++-------- pkg/control/duplicate_test.go | 12 ++++---- pkg/control/sdl_restSubsDb.go | 2 +- pkg/control/ut_ctrl_submgr_test.go | 2 +- pkg/control/ut_messaging_test.go | 2 +- 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 799a307..848b916 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -72,22 +72,22 @@ var waitRouteCleanup_ms time.Duration var e2tMaxSubReqTryCount uint64 // Initial try + retry var e2tMaxSubDelReqTryCount uint64 // Initial try + retry var readSubsFromDb string -var restDuplicateCtrl duplicateCtrl var dbRetryForever string var dbTryCount int type Control struct { *xapp.RMRClient - e2ap *E2ap - registry *Registry - tracker *Tracker - e2SubsDb Sdlnterface - restSubsDb Sdlnterface - CntRecvMsg uint64 - ResetTestFlag bool - Counters map[string]xapp.Counter - LoggerLevel int - UTTesting bool + e2ap *E2ap + registry *Registry + tracker *Tracker + restDuplicateCtrl *DuplicateCtrl + e2SubsDb Sdlnterface + restSubsDb Sdlnterface + CntRecvMsg uint64 + ResetTestFlag bool + Counters map[string]xapp.Counter + LoggerLevel int + UTTesting bool } type RMRMeid struct { @@ -133,13 +133,17 @@ func NewControl() *Control { tracker := new(Tracker) tracker.Init() + restDuplicateCtrl := new(DuplicateCtrl) + restDuplicateCtrl.Init() + c := &Control{e2ap: new(E2ap), - registry: registry, - tracker: tracker, - e2SubsDb: CreateSdl(), - restSubsDb: CreateRESTSdl(), - Counters: xapp.Metric.RegisterCounterGroup(GetMetricsOpts(), "SUBMGR"), - LoggerLevel: 3, + registry: registry, + tracker: tracker, + restDuplicateCtrl: restDuplicateCtrl, + e2SubsDb: CreateSdl(), + restSubsDb: CreateRESTSdl(), + Counters: xapp.Metric.RegisterCounterGroup(GetMetricsOpts(), "SUBMGR"), + LoggerLevel: 4, } c.ReadConfigParameters("") @@ -148,17 +152,16 @@ func NewControl() *Control { xapp.Resource.InjectRoute("/ric/v1/restsubscriptions", c.GetAllRestSubscriptions, "GET") xapp.Resource.InjectRoute("/ric/v1/symptomdata", c.SymptomDataHandler, "GET") - go xapp.Subscription.Listen(c.RESTSubscriptionHandler, c.RESTQueryHandler, c.RESTSubscriptionDeleteHandler) - if readSubsFromDb == "false" { return c } - restDuplicateCtrl.Init() - // Read subscriptions from db c.ReadE2Subscriptions() c.ReadRESTSubscriptions() + + go xapp.Subscription.Listen(c.RESTSubscriptionHandler, c.RESTQueryHandler, c.RESTSubscriptionDeleteHandler) + return c } @@ -325,7 +328,7 @@ func (c *Control) GetOrCreateRestSubscription(p *models.SubscriptionParams, md5s var restSubscription *RESTSubscription var err error - prevRestSubsId, exists := restDuplicateCtrl.GetLastKnownRestSubsIdBasedOnMd5sum(md5sum) + prevRestSubsId, exists := c.restDuplicateCtrl.GetLastKnownRestSubsIdBasedOnMd5sum(md5sum) if p.SubscriptionID == "" { // Subscription does not contain REST subscription Id if exists { @@ -340,7 +343,7 @@ func (c *Control) GetOrCreateRestSubscription(p *models.SubscriptionParams, md5s } } else { xapp.Logger.Debug("None existing restSubId %s referred by MD5sum %s for a request without subscription ID - deleting cached entry", prevRestSubsId, md5sum) - restDuplicateCtrl.DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum) + c.restDuplicateCtrl.DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum) } } @@ -416,13 +419,13 @@ func (c *Control) RESTSubscriptionHandler(params interface{}) (*models.Subscript err = c.e2ap.FillSubscriptionReqMsgs(params, &subReqList, restSubscription) if err != nil { xapp.Logger.Error("%s", err.Error()) - restDuplicateCtrl.DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum) + c.restDuplicateCtrl.DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum) c.registry.DeleteRESTSubscription(&restSubId) c.UpdateCounter(cRestSubFailToXapp) return nil, common.SubscribeBadRequestCode } - duplicate := restDuplicateCtrl.IsDuplicateToOngoingTransaction(restSubId, md5sum) + duplicate := c.restDuplicateCtrl.IsDuplicateToOngoingTransaction(restSubId, md5sum) if duplicate { err := fmt.Errorf("Retransmission blocker direct ACK for request of restSubsId %s restSubId MD5sum %s as retransmission", restSubId, md5sum) xapp.Logger.Debug("%s", err) @@ -491,7 +494,7 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription var e2EventInstanceID int64 errorInfo := &ErrorInfo{} - defer restDuplicateCtrl.SetMd5sumFromLastOkRequest(*restSubId, md5sum) + defer c.restDuplicateCtrl.SetMd5sumFromLastOkRequest(*restSubId, md5sum) for index := 0; index < len(subReqList.E2APSubscriptionRequests); index++ { subReqMsg := subReqList.E2APSubscriptionRequests[index] @@ -707,7 +710,7 @@ func (c *Control) RESTSubscriptionDeleteHandler(restSubId string) int { restSubscription.DeleteXappIdToE2Id(xAppEventInstanceID) restSubscription.DeleteE2InstanceId(instanceId) } - restDuplicateCtrl.DeleteLastKnownRestSubsIdBasedOnMd5sum(restSubscription.lastReqMd5sum) + c.restDuplicateCtrl.DeleteLastKnownRestSubsIdBasedOnMd5sum(restSubscription.lastReqMd5sum) c.registry.DeleteRESTSubscription(&restSubId) c.RemoveRESTSubscriptionFromDb(restSubId) }() diff --git a/pkg/control/duplicate.go b/pkg/control/duplicate.go index 2110f1f..345a6f8 100644 --- a/pkg/control/duplicate.go +++ b/pkg/control/duplicate.go @@ -30,24 +30,24 @@ import ( "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) -type retransEntry struct { +type RetransEntry struct { restSubsId string startTime time.Time } -type duplicateCtrl struct { +type DuplicateCtrl struct { mutex sync.Mutex - ongoingRequestMap map[string]retransEntry + ongoingRequestMap map[string]RetransEntry previousRequestMap map[string]string collCount int } -func (d *duplicateCtrl) Init() { - d.ongoingRequestMap = make(map[string]retransEntry) +func (d *DuplicateCtrl) Init() { + d.ongoingRequestMap = make(map[string]RetransEntry) d.previousRequestMap = make(map[string]string) } -func (d *duplicateCtrl) SetMd5sumFromLastOkRequest(restSubsId string, md5sum string) { +func (d *DuplicateCtrl) SetMd5sumFromLastOkRequest(restSubsId string, md5sum string) { d.mutex.Lock() defer d.mutex.Unlock() @@ -74,7 +74,7 @@ func (d *duplicateCtrl) SetMd5sumFromLastOkRequest(restSubsId string, md5sum str d.previousRequestMap[md5sum] = restSubsId } -func (d *duplicateCtrl) GetLastKnownRestSubsIdBasedOnMd5sum(md5sum string) (string, bool) { +func (d *DuplicateCtrl) GetLastKnownRestSubsIdBasedOnMd5sum(md5sum string) (string, bool) { d.mutex.Lock() defer d.mutex.Unlock() @@ -88,7 +88,7 @@ func (d *duplicateCtrl) GetLastKnownRestSubsIdBasedOnMd5sum(md5sum string) (stri return m, e } -func (d *duplicateCtrl) DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum string) { +func (d *DuplicateCtrl) DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum string) { d.mutex.Lock() defer d.mutex.Unlock() @@ -121,7 +121,7 @@ func CalculateRequestMd5sum(payload interface{}) (string, error) { return hex.EncodeToString(hash[:]), nil } -func (d *duplicateCtrl) IsDuplicateToOngoingTransaction(restSubsId string, md5sum string) bool { +func (d *DuplicateCtrl) IsDuplicateToOngoingTransaction(restSubsId string, md5sum string) bool { if md5sum == "" { return false @@ -138,7 +138,7 @@ func (d *duplicateCtrl) IsDuplicateToOngoingTransaction(restSubsId string, md5su return true } - entry = retransEntry{restSubsId: restSubsId, startTime: time.Now()} + entry = RetransEntry{restSubsId: restSubsId, startTime: time.Now()} xapp.Logger.Debug("No collision detected against ongoing transaction. Added md5sum %s for restSubsId %s at %s\n", md5sum, entry.restSubsId, entry.startTime) @@ -147,7 +147,7 @@ func (d *duplicateCtrl) IsDuplicateToOngoingTransaction(restSubsId string, md5su return false } -func (d *duplicateCtrl) TransactionComplete(md5sum string) error { +func (d *DuplicateCtrl) TransactionComplete(md5sum string) error { if md5sum == "" { return nil @@ -159,7 +159,7 @@ func (d *duplicateCtrl) TransactionComplete(md5sum string) error { return d.removeOngoingTransaction(md5sum) } -func (d *duplicateCtrl) removeOngoingTransaction(md5sum string) error { +func (d *DuplicateCtrl) removeOngoingTransaction(md5sum string) error { entry, present := d.ongoingRequestMap[md5sum] diff --git a/pkg/control/duplicate_test.go b/pkg/control/duplicate_test.go index f072881..1498af0 100644 --- a/pkg/control/duplicate_test.go +++ b/pkg/control/duplicate_test.go @@ -36,7 +36,7 @@ func TestDefaultUseCase(t *testing.T) { fmt.Println("##################### TestRetransmissionChecker #####################") - var retransCtrl duplicateCtrl + var retransCtrl DuplicateCtrl restSubdId := "898dfkjashntgkjasgho4" var name string = "yolo" var someVal int64 = 98765 @@ -61,7 +61,7 @@ func TestDuplicate(t *testing.T) { fmt.Println("##################### TestDuplicate #####################") - var retransCtrl duplicateCtrl + var retransCtrl DuplicateCtrl restSubdId := "898dfkjashntgkjasgho4" var name string = "yolo" var someVal int64 = 98765 @@ -101,7 +101,7 @@ func TestNoneDuplicate(t *testing.T) { fmt.Println("##################### TestNoneDuplicate #####################") - var retransCtrl duplicateCtrl + var retransCtrl DuplicateCtrl restSubdId := "898dfkjashntgkjasgho4" var name string = "yolo" var someVal int64 = 98765 @@ -142,7 +142,7 @@ func TestEncodingError(t *testing.T) { fmt.Println("##################### TestEncodingError #####################") - var retransCtrl duplicateCtrl + var retransCtrl DuplicateCtrl var data interface{} retransCtrl.Init() @@ -155,7 +155,7 @@ func TestRemovalError(t *testing.T) { fmt.Println("##################### TestRemovalError #####################") - var retransCtrl duplicateCtrl + var retransCtrl DuplicateCtrl restSubdId := "898dfkjashntgkjasgho4" var data testData @@ -179,7 +179,7 @@ func TestXappRestReqDuplicate(t *testing.T) { fmt.Println("##################### TestXappRestReqDuplicate #####################") - var retransCtrl duplicateCtrl + var retransCtrl DuplicateCtrl msg1 := new(models.SubscriptionParams) msg2 := new(models.SubscriptionParams) diff --git a/pkg/control/sdl_restSubsDb.go b/pkg/control/sdl_restSubsDb.go index f9d837b..2348303 100644 --- a/pkg/control/sdl_restSubsDb.go +++ b/pkg/control/sdl_restSubsDb.go @@ -94,7 +94,7 @@ func (c *Control) ReadRESTSubscriptionFromSdl(restSubId string) (*RESTSubscripti restSubs = c.CreateRESTSubscription(restSubscriptionInfo, &jsonSubscriptionInfo) - restDuplicateCtrl.SetMd5sumFromLastOkRequest(restSubId, restSubs.lastReqMd5sum) + c.restDuplicateCtrl.SetMd5sumFromLastOkRequest(restSubId, restSubs.lastReqMd5sum) } return restSubs, nil } diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index eb6d6d4..e514cb0 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -73,7 +73,7 @@ func (mc *testingSubmgrControl) SimulateRestart(t *testing.T) { mainCtrl.c.registry.subIds = nil // Initialize subIds slice and subscription map mainCtrl.c.registry.Initialize() - restDuplicateCtrl.Init() + mainCtrl.c.restDuplicateCtrl.Init() // Read subIds and subscriptions from database subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() if err != nil { diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 9c2874b..e10cdff 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -39,7 +39,7 @@ func TestSuiteSetup(t *testing.T) { SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) - restDuplicateCtrl.Init() + mainCtrl.c.restDuplicateCtrl.Init() } -- 2.16.6 From 24f80f45e026915e780626b33e87588147d66df8 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Wed, 20 Oct 2021 11:30:15 +0300 Subject: [PATCH 04/16] Improved fix for outdated base image problem Change-Id: Icf22a0e4ee6b7fe6fd8780a9afc00b49552b0d3b Signed-off-by: Anssi Mannila --- Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 09d9279..721f158 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,9 +25,15 @@ ########################################################### FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as submgrcore -ARG GOVERSION=1.14 - -ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/opt/go/${GOVERSION}/bin:/root/go/bin +ARG g14="1.14.4" +ARG GOVERSION="1.14" +RUN wget -nv https://dl.google.com/go/go${g14}.linux-amd64.tar.gz \ + && tar -xf go${g14}.linux-amd64.tar.gz \ + && mv go /opt/go/${GOVERSION} \ + && rm -f go*.gz + +ENV DEFAULTPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV PATH=$DEFAULTPATH:/usr/local/go/bin:/opt/go/${GOVERSION}/bin:/root/go/bin # Update CA certificates RUN apt update && apt install --reinstall -y \ -- 2.16.6 From c7da4ee19c2b2a96c1eeccd8da944902fcd9323f Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Fri, 22 Oct 2021 09:52:02 +0300 Subject: [PATCH 05/16] E2 restart handling added - Implementation and unit test are ready Change-Id: I7b5c52826910a4dcafff8938d414d7e9f57fa2ed Signed-off-by: Anssi Mannila --- config/submgr-config.yaml | 1 + container-tag.yaml | 2 +- docs/user-guide.rst | 6 + go.mod | 3 +- go.sum | 78 ------- pkg/control/control.go | 96 +++++++-- pkg/control/e2if_state.go | 176 ++++++++++++++++ pkg/control/e2if_state_test.go | 247 ++++++++++++++++++++++ pkg/control/metrics.go | 11 + pkg/control/registry.go | 49 ++++- pkg/control/subscription.go | 2 + pkg/control/types.go | 8 + pkg/control/ut_ctrl_submgr_test.go | 17 +- pkg/control/ut_messaging_test.go | 277 ++++++++++++++++++++++++- pkg/teststube2ap/stubE2.go | 22 +- releases/container-release-ric-plt-submgr.yaml | 2 +- 16 files changed, 886 insertions(+), 111 deletions(-) create mode 100644 pkg/control/e2if_state.go create mode 100644 pkg/control/e2if_state_test.go diff --git a/config/submgr-config.yaml b/config/submgr-config.yaml index 53d2161..4851734 100644 --- a/config/submgr-config.yaml +++ b/config/submgr-config.yaml @@ -22,6 +22,7 @@ "e2tRecvMsgTimeout_ms": 2000 "e2tMaxSubReqTryCount": 2 "e2tMaxSubDelReqTryCount": 2 + "checkE2State:" "true" "readSubsFromDb": "true" "dbTryCount": 200 "dbRetryForever": "true" diff --git a/container-tag.yaml b/container-tag.yaml index 1f7b321..8832f84 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -2,4 +2,4 @@ # By default this file is in the docker build directory, # but the location can configured in the JJB template. --- -tag: "0.7.1" +tag: "0.7.2" diff --git a/docs/user-guide.rst b/docs/user-guide.rst index b376654..2fc08ec 100755 --- a/docs/user-guide.rst +++ b/docs/user-guide.rst @@ -358,6 +358,12 @@ Architecture Restoring subscriptions from db can be disable via submgr-config.yaml file by setting "readSubsFromDb": "false". + * E2 connection break + + Subscription Manager subscribes E2 connection status notifications from RNIB. Whenever E2 interface goes up or down Subscription Manager gets notifies. When interface is down + subscription is not possible. Subscription Manager rejects new request for the E2 node. Http Reject cause is 503 Subscribe Service Unavailable. When interface goes down + Subscription Manager deletes all subscriptions related to the RanName from its memory and database. E2 node and XApp are expected to do the same. + Metrics ------- Subscription Manager adds following statistic counters: diff --git a/go.mod b/go.mod index 62a10a5..c8f8b02 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module gerrit.o-ran-sc.org/r/ric-plt/submgr -go 1.12 +go 1.14 replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.8.0 @@ -12,6 +12,7 @@ replace gerrit.o-ran-sc.org/r/ric-plt/e2ap => ./e2ap/ require ( gerrit.o-ran-sc.org/r/ric-plt/e2ap v0.0.0-00010101000000-000000000000 + gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1 gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.8.0 gerrit.o-ran-sc.org/r/ric-plt/xapp-frame v0.0.0-00010101000000-000000000000 github.com/go-openapi/errors v0.19.3 diff --git a/go.sum b/go.sum index a0fa7a9..c36348a 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= gerrit.o-ran-sc.org/r/com/golog.git v0.0.2 h1:Ix6SgFuzd6yW6Ur6+qDlGhDO65UYs8PiIkeAL1VaQ2o= gerrit.o-ran-sc.org/r/com/golog.git v0.0.2/go.mod h1:A7hUL52YQSO4dFIZNcj76XQ09C9PftAe3LyL7kqBnok= @@ -16,22 +15,16 @@ gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.9.3 h1:JokT2aaJkKjYFMayvZHvGb+/I gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.9.3/go.mod h1:foKMPQZ+RlM0Pos2GlEPAg6ux7Y9PRQmCUglYM7/Qt8= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/agnivade/levenshtein v1.0.1 h1:3oJU7J3FGFmyhn8KHjmVaZCN5hxTr7GxgRue+sxIXdQ= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 h1:G1bPvciwNyF7IUmKXNt9Ak3m6u9DE1rF+RmtIkBpVdA= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= @@ -39,45 +32,30 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:l github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954 h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -87,7 +65,6 @@ github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOX github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.2 h1:a2kIyV3w+OS3S97zxUndRVD46+FhGOUBDFY7nmu4CsY= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= github.com/go-openapi/errors v0.19.3 h1:7MGZI1ibQDLasvAz8HuhvYk9eNJbJkCOXWsSjjMS+Zc= github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= @@ -137,13 +114,9 @@ github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8w github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef h1:veQD95Isof8w9/WXiA+pa3tz3fJXkt5B7QaRBrM62gk= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -154,13 +127,10 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -169,36 +139,24 @@ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.7.1 h1:Dw4jY2nghMMRsh1ol8dv1axHkDwMQK2DHerMNJsIpJU= github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0 h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/julienschmidt/httprouter v1.2.0 h1:TDTW5Yz1mjftljbcKqRcrYhd4XeOoI98t+9HbQbYf7g= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0 h1:ZqfnKyx9KGpRcW04j5nnPDgRgoXUeLh2YFBeFzphcA0= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5 h1:hyz3dwM5QLc1Rfoz4FuWJQG5BN7tc6K1MndAUnGpQr4= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -214,11 +172,9 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= @@ -227,7 +183,6 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -248,21 +203,14 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/segmentio/ksuid v1.0.3 h1:FoResxvleQwYiPAVKe1tMUlEirodZqlqglIuFsdDntY= github.com/segmentio/ksuid v1.0.3/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -285,36 +233,25 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/vektah/gqlparser v1.1.2 h1:ZsyLGn7/7jDNI+y4SEhI4yAxRChlv15pUHMjijT+e68= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 h1:ESFSdwYZvkeru3RtdrYueztKhOBCSAAzS4Gf+k0tEow= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.etcd.io/bbolt v1.3.2 h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2 h1:jxcFYjlkl8xaERsgLo+RNquI0epW6zuy/ZRQs6jnrFA= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56 h1:ZpKuNIejY8P0ExLOVyKhb0WsgG8UdvHXe6TWjY7eL6k= golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -326,16 +263,13 @@ golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -345,7 +279,6 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -356,7 +289,6 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -364,16 +296,12 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190617190820-da514acc4774 h1:CQVOmarCBFzTx0kbOU0ru54Cvot8SdSrNYjZPhQl+gk= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -382,27 +310,21 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099 h1:XJP7lxbSxWLOMNdBE4B/STaqVy6L73o0knwj2vIlxnw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/klog/v2 v2.0.0 h1:Foj74zO6RbjjP4hBEKjnYtjjAhGg4jNynUdYF6fJrok= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= diff --git a/pkg/control/control.go b/pkg/control/control.go index 848b916..87c81ff 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -71,6 +71,7 @@ var e2tRecvMsgTimeout time.Duration var waitRouteCleanup_ms time.Duration var e2tMaxSubReqTryCount uint64 // Initial try + retry var e2tMaxSubDelReqTryCount uint64 // Initial try + retry +var checkE2State string var readSubsFromDb string var dbRetryForever string var dbTryCount int @@ -81,6 +82,8 @@ type Control struct { registry *Registry tracker *Tracker restDuplicateCtrl *DuplicateCtrl + e2IfState *E2IfState + e2IfStateDb XappRnibInterface e2SubsDb Sdlnterface restSubsDb Sdlnterface CntRecvMsg uint64 @@ -136,15 +139,21 @@ func NewControl() *Control { restDuplicateCtrl := new(DuplicateCtrl) restDuplicateCtrl.Init() + e2IfState := new(E2IfState) + c := &Control{e2ap: new(E2ap), registry: registry, tracker: tracker, restDuplicateCtrl: restDuplicateCtrl, + e2IfState: e2IfState, + e2IfStateDb: CreateXappRnibIfInstance(), e2SubsDb: CreateSdl(), restSubsDb: CreateRESTSdl(), Counters: xapp.Metric.RegisterCounterGroup(GetMetricsOpts(), "SUBMGR"), LoggerLevel: 4, } + + e2IfState.Init(c) c.ReadConfigParameters("") // Register REST handler for testing support @@ -229,64 +238,83 @@ func (c *Control) ReadRESTSubscriptions() error { //------------------------------------------------------------------- func (c *Control) ReadConfigParameters(f string) { + xapp.Logger.Debug("ReadConfigParameters") + c.LoggerLevel = int(xapp.Logger.GetLevel()) - xapp.Logger.Debug("LoggerLevel %v", c.LoggerLevel) + xapp.Logger.Debug("LoggerLevel= %v", c.LoggerLevel) // viper.GetDuration returns nanoseconds e2tSubReqTimeout = viper.GetDuration("controls.e2tSubReqTimeout_ms") * 1000000 if e2tSubReqTimeout == 0 { e2tSubReqTimeout = 2000 * 1000000 + xapp.Logger.Debug("WARNING: Using hard coded default value for e2tSubReqTimeout") } - xapp.Logger.Debug("e2tSubReqTimeout %v", e2tSubReqTimeout) + xapp.Logger.Debug("e2tSubReqTimeout= %v", e2tSubReqTimeout) e2tSubDelReqTime = viper.GetDuration("controls.e2tSubDelReqTime_ms") * 1000000 if e2tSubDelReqTime == 0 { e2tSubDelReqTime = 2000 * 1000000 + xapp.Logger.Debug("WARNING: Using hard coded default value for e2tSubDelReqTime") } - xapp.Logger.Debug("e2tSubDelReqTime %v", e2tSubDelReqTime) + xapp.Logger.Debug("e2tSubDelReqTime= %v", e2tSubDelReqTime) + e2tRecvMsgTimeout = viper.GetDuration("controls.e2tRecvMsgTimeout_ms") * 1000000 if e2tRecvMsgTimeout == 0 { e2tRecvMsgTimeout = 2000 * 1000000 + xapp.Logger.Debug("WARNING: Using hard coded default value for e2tRecvMsgTimeout") } - xapp.Logger.Debug("e2tRecvMsgTimeout %v", e2tRecvMsgTimeout) + xapp.Logger.Debug("e2tRecvMsgTimeout= %v", e2tRecvMsgTimeout) e2tMaxSubReqTryCount = viper.GetUint64("controls.e2tMaxSubReqTryCount") if e2tMaxSubReqTryCount == 0 { e2tMaxSubReqTryCount = 1 + xapp.Logger.Debug("WARNING: Using hard coded default value for e2tMaxSubReqTryCount") } - xapp.Logger.Debug("e2tMaxSubReqTryCount %v", e2tMaxSubReqTryCount) + xapp.Logger.Debug("e2tMaxSubReqTryCount= %v", e2tMaxSubReqTryCount) e2tMaxSubDelReqTryCount = viper.GetUint64("controls.e2tMaxSubDelReqTryCount") if e2tMaxSubDelReqTryCount == 0 { e2tMaxSubDelReqTryCount = 1 + xapp.Logger.Debug("WARNING: Using hard coded default value for e2tMaxSubDelReqTryCount") + } + xapp.Logger.Debug("e2tMaxSubDelReqTryCount= %v", e2tMaxSubDelReqTryCount) + + checkE2State = viper.GetString("controls.checkE2State") + if checkE2State == "" { + checkE2State = "true" + xapp.Logger.Debug("WARNING: Using hard coded default value for checkE2State") } - xapp.Logger.Debug("e2tMaxSubDelReqTryCount %v", e2tMaxSubDelReqTryCount) + xapp.Logger.Debug("checkE2State= %v", checkE2State) readSubsFromDb = viper.GetString("controls.readSubsFromDb") if readSubsFromDb == "" { readSubsFromDb = "true" + xapp.Logger.Debug("WARNING: Using hard coded default value for readSubsFromDb") } - xapp.Logger.Debug("readSubsFromDb %v", readSubsFromDb) + xapp.Logger.Debug("readSubsFromDb= %v", readSubsFromDb) dbTryCount = viper.GetInt("controls.dbTryCount") if dbTryCount == 0 { dbTryCount = 200 + xapp.Logger.Debug("WARNING: Using hard coded default value for dbTryCount") } - xapp.Logger.Debug("dbTryCount %v", dbTryCount) + xapp.Logger.Debug("dbTryCount= %v", dbTryCount) dbRetryForever = viper.GetString("controls.dbRetryForever") if dbRetryForever == "" { dbRetryForever = "true" + xapp.Logger.Debug("WARNING: Using hard coded default value for dbRetryForever") } - xapp.Logger.Debug("dbRetryForever %v", dbRetryForever) + xapp.Logger.Debug("dbRetryForever= %v", dbRetryForever) // Internal cfg parameter, used to define a wait time for RMR route clean-up. None default // value 100ms used currently only in unittests. waitRouteCleanup_ms = viper.GetDuration("controls.waitRouteCleanup_ms") * 1000000 if waitRouteCleanup_ms == 0 { waitRouteCleanup_ms = 5000 * 1000000 + xapp.Logger.Debug("WARNING: Using hard coded default value for waitRouteCleanup_ms") } - xapp.Logger.Debug("waitRouteCleanup %v", waitRouteCleanup_ms) + xapp.Logger.Debug("waitRouteCleanup= %v", waitRouteCleanup_ms) } //------------------------------------------------------------------- @@ -389,6 +417,12 @@ func (c *Control) RESTSubscriptionHandler(params interface{}) (*models.Subscript c.PrintRESTSubscriptionRequest(p) } + if c.e2IfState.IsE2ConnectionUp(p.Meid) == false { + xapp.Logger.Error("No E2 connection for ranName %v", *p.Meid) + c.UpdateCounter(cRestReqRejDueE2Down) + return nil, common.SubscribeServiceUnavailableCode + } + if p.ClientEndpoint == nil { err := fmt.Errorf("ClientEndpoint == nil") xapp.Logger.Error("%v", err) @@ -566,15 +600,25 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e // // Wake subs request // + subs.OngoingReqCount++ go c.handleSubscriptionCreate(subs, trans, e2SubscriptionDirectives) event, _ := trans.WaitEvent(0) //blocked wait as timeout is handled in subs side + subs.OngoingReqCount-- err = nil if event != nil { switch themsg := event.(type) { case *e2ap.E2APSubscriptionResponse: trans.Release() - return themsg, &errorInfo, nil + if c.e2IfState.IsE2ConnectionUp(meid) == true { + return themsg, &errorInfo, nil + } else { + c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c) + c.RemoveSubscriptionFromDb(subs) + err = fmt.Errorf("E2 interface down") + errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") + return nil, &errorInfo, err + } case *e2ap.E2APSubscriptionFailure: err = fmt.Errorf("E2 SubscriptionFailure received") errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") @@ -638,6 +682,11 @@ func (c *Control) sendUnsuccesfullResponseNotification(restSubId *string, restSu c.UpdateCounter(cRestSubFailNotifToXapp) xapp.Subscription.Notify(resp, *clientEndpoint) + + if c.e2IfState.IsE2ConnectionUp(&restSubscription.Meid) == false && restSubscription.SubReqOngoing == false { + c.registry.DeleteRESTSubscription(restSubId) + c.RemoveRESTSubscriptionFromDb(*restSubId) + } } //------------------------------------------------------------------- @@ -667,6 +716,11 @@ func (c *Control) sendSuccesfullResponseNotification(restSubId *string, restSubs c.UpdateCounter(cRestSubNotifToXapp) xapp.Subscription.Notify(resp, *clientEndpoint) + + if c.e2IfState.IsE2ConnectionUp(&restSubscription.Meid) == false && restSubscription.SubReqOngoing == false { + c.registry.DeleteRESTSubscription(restSubId) + c.RemoveRESTSubscriptionFromDb(*restSubId) + } } //------------------------------------------------------------------- @@ -684,14 +738,17 @@ func (c *Control) RESTSubscriptionDeleteHandler(restSubId string) int { xapp.Logger.Error("%s", err.Error()) if restSubscription == nil { // Subscription was not found + c.UpdateCounter(cRestSubDelRespToXapp) return common.UnsubscribeNoContentCode } else { if restSubscription.SubReqOngoing == true { err := fmt.Errorf("Handling of the REST Subscription Request still ongoing %s", restSubId) xapp.Logger.Error("%s", err.Error()) + c.UpdateCounter(cRestSubDelFailToXapp) return common.UnsubscribeBadRequestCode } else if restSubscription.SubDelReqOngoing == true { // Previous request for same restSubId still ongoing + c.UpdateCounter(cRestSubDelFailToXapp) return common.UnsubscribeBadRequestCode } } @@ -716,7 +773,6 @@ func (c *Control) RESTSubscriptionDeleteHandler(restSubId string) int { }() c.UpdateCounter(cRestSubDelRespToXapp) - return common.UnsubscribeNoContentCode } @@ -750,8 +806,10 @@ func (c *Control) SubscriptionDeleteHandler(restSubId *string, endPoint *string, // // Wake subs delete // + subs.OngoingDelCount++ go c.handleSubscriptionDelete(subs, trans) trans.WaitEvent(0) //blocked wait as timeout is handled in subs side + subs.OngoingDelCount-- xapp.Logger.Debug("XAPP-SubDelReq: Handling event %s ", idstring(nil, trans, subs)) @@ -891,6 +949,11 @@ func (c *Control) handleXAPPSubscriptionRequest(params *xapp.RMRParams) { xapp.Logger.Debug("MSG from XAPP: %s", params.String()) c.UpdateCounter(cSubReqFromXapp) + if c.e2IfState.IsE2ConnectionUp(¶ms.Meid.RanName) == false { + xapp.Logger.Error("No E2 connection for ranName %v", params.Meid.RanName) + return + } + subReqMsg, err := c.e2ap.UnpackSubscriptionRequest(params.Payload) if err != nil { xapp.Logger.Error("XAPP-SubReq: %s", idstring(err, params)) @@ -925,8 +988,10 @@ func (c *Control) handleXAPPSubscriptionRequest(params *xapp.RMRParams) { func (c *Control) wakeSubscriptionRequest(subs *Subscription, trans *TransactionXapp) { e2SubscriptionDirectives, _ := c.GetE2SubscriptionDirectives(nil) + subs.OngoingReqCount++ go c.handleSubscriptionCreate(subs, trans, e2SubscriptionDirectives) event, _ := trans.WaitEvent(0) //blocked wait as timeout is handled in subs side + subs.OngoingReqCount-- var err error if event != nil { switch themsg := event.(type) { @@ -961,6 +1026,11 @@ func (c *Control) handleXAPPSubscriptionDeleteRequest(params *xapp.RMRParams) { xapp.Logger.Debug("MSG from XAPP: %s", params.String()) c.UpdateCounter(cSubDelReqFromXapp) + if c.e2IfState.IsE2ConnectionUp(¶ms.Meid.RanName) == false { + xapp.Logger.Error("No E2 connection for ranName %v", params.Meid.RanName) + return + } + subDelReqMsg, err := c.e2ap.UnpackSubscriptionDeleteRequest(params.Payload) if err != nil { xapp.Logger.Error("XAPP-SubDelReq %s", idstring(err, params)) @@ -989,8 +1059,10 @@ func (c *Control) handleXAPPSubscriptionDeleteRequest(params *xapp.RMRParams) { // // Wake subs delete // + subs.OngoingDelCount++ go c.handleSubscriptionDelete(subs, trans) trans.WaitEvent(0) //blocked wait as timeout is handled in subs side + subs.OngoingDelCount-- xapp.Logger.Debug("XAPP-SubDelReq: Handling event %s ", idstring(nil, trans, subs)) diff --git a/pkg/control/e2if_state.go b/pkg/control/e2if_state.go new file mode 100644 index 0000000..0f43056 --- /dev/null +++ b/pkg/control/e2if_state.go @@ -0,0 +1,176 @@ +/* +================================================================================== + Copyright (c) 2019 AT&T Intellectual Property. + Copyright (c) 2019 Nokia + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +================================================================================== +*/ + +package control + +import ( + "fmt" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" + "strings" + "sync" +) + +type XappRnibIf struct { + XappRnibInterface +} + +func (x *XappRnibIf) XappRnibSubscribe(NotificationCb func(string, ...string), channel string) error { + return xapp.Rnib.Subscribe(NotificationCb, channel) +} + +func (x *XappRnibIf) XappRnibGetListGnbIds() ([]*xapp.RNIBNbIdentity, xapp.RNIBIRNibError) { + return xapp.Rnib.GetListGnbIds() +} +func (x *XappRnibIf) XappRnibGetNodeb(inventoryName string) (*xapp.RNIBNodebInfo, xapp.RNIBIRNibError) { + nodeInfo, err := xapp.Rnib.GetNodeb(inventoryName) + return nodeInfo, err +} + +func CreateXappRnibIfInstance() XappRnibInterface { + return new(XappRnibIf) +} + +type E2IfState struct { + mutex sync.Mutex + control *Control + NbIdMap map[string]string +} + +func (e *E2IfState) Init(c *Control) { + e.control = c + e.NbIdMap = make(map[string]string, 0) + e.ReadE2ConfigurationFromRnib() + e.SubscribeChannels() +} + +func (e *E2IfState) NotificationCb(ch string, events ...string) { + + xapp.Logger.Debug("SDL notification received from channel=%s, event=%v", ch, events[0]) + if len(events) == 0 { + xapp.Logger.Error("Invalid SDL notification received: %d", len(events)) + return + } + + if strings.Contains(events[0], "_CONNECTED") { + nbId, err := ExtractNbiIdFromString(events[0]) + if err != nil { + xapp.Logger.Error("NotificationCb CONNECTED len(nbId) == 0 ") + return + } + xapp.Logger.Debug("E2 CONNECTED. NbId=%s", nbId) + e.NbIdMap[nbId] = nbId + } else if strings.Contains(events[0], "_DISCONNECTED") { + nbId, err := ExtractNbiIdFromString(events[0]) + if err != nil { + xapp.Logger.Error("NotificationCb DISCONNECTED len(nbId) == 0 ") + return + } + xapp.Logger.Debug("E2 DISCONNECTED. NbId=%s", nbId) + if _, ok := e.NbIdMap[nbId]; ok { + delete(e.NbIdMap, nbId) + e.control.registry.DeleteAllE2Subscriptions(nbId, e.control) + } + } +} + +func (e *E2IfState) SubscribeChannels() error { + + if err := e.control.e2IfStateDb.XappRnibSubscribe(e.NotificationCb, "RAN_CONNECTION_STATUS_CHANGE"); err != nil { + xapp.Logger.Error("Sdl.SubscribeChannel failed: %v", err) + return err + } + xapp.Logger.Debug("Subscription to RAN state changes done!") + return nil +} + +func (e *E2IfState) ReadE2ConfigurationFromRnib() { + + xapp.Logger.Debug("ReadE2ConfigurationFromRnib()") + nbIdentities, err := e.control.e2IfStateDb.XappRnibGetListGnbIds() + if err != nil || len(nbIdentities) == 0 { + xapp.Logger.Debug("There are no active NodeBs available: %v", err) + e.NbIdMap = make(map[string]string, 0) + return + } + + for _, nbIdentity := range nbIdentities { + if e.isNodeBActive(nbIdentity.InventoryName) == false { + if _, ok := e.NbIdMap[nbIdentity.InventoryName]; ok { + delete(e.NbIdMap, nbIdentity.InventoryName) + e.control.UpdateCounter(cE2StateChangedToDown) + xapp.Logger.Debug("E2 connection DISCONNETED: %v", nbIdentity.InventoryName) + + // Delete all subscriptions related to InventoryName/nbId + e.control.registry.DeleteAllE2Subscriptions(nbIdentity.InventoryName, e.control) + } + continue + } + + if _, ok := e.NbIdMap[nbIdentity.InventoryName]; !ok { + e.NbIdMap[nbIdentity.InventoryName] = nbIdentity.InventoryName + e.control.UpdateCounter(cE2StateChangedToDown) + xapp.Logger.Debug("E2 connection CONNECTED: %v", nbIdentity.InventoryName) + } + } +} + +func (e *E2IfState) isNodeBActive(inventoryName string) bool { + nodeInfo, err := e.control.e2IfStateDb.XappRnibGetNodeb(inventoryName) + if err != nil { + xapp.Logger.Error("GetNodeb() failed for inventoryName=%s: %v", inventoryName, err) + return false + } + xapp.Logger.Debug("NodeB['%s'] connection status = %d", inventoryName, nodeInfo.ConnectionStatus) + return nodeInfo.ConnectionStatus == 1 +} + +func (e *E2IfState) IsE2ConnectionUp(nbId *string) bool { + + if checkE2State == "false" { + return true + } + + if _, ok := e.NbIdMap[*nbId]; ok { + return true + } else { + return false + } +} + +func ExtractNbiIdFromString(s string) (string, error) { + + // Expected string formats are below + // gnb_208_092_303030_CONNECTED + // gnb_208_092_303030_DISCONNECTED + // ... + + var nbId string + var err error + if strings.Contains(s, "_CONNECTED") { + splitStringTbl := strings.Split(s, "_CONNECTED") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_DISCONNECTED") { + splitStringTbl := strings.Split(s, "_DISCONNECTED") + nbId = splitStringTbl[0] + } + if len(nbId) == 0 { + return "", fmt.Errorf("ExtractNbiIdFromString(): len(nbId) == 0 ") + } + return nbId, err +} diff --git a/pkg/control/e2if_state_test.go b/pkg/control/e2if_state_test.go new file mode 100644 index 0000000..e4ee848 --- /dev/null +++ b/pkg/control/e2if_state_test.go @@ -0,0 +1,247 @@ +/* +================================================================================== + Copyright (c) 2019 AT&T Intellectual Property. + Copyright (c) 2019 Nokia + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +================================================================================== +*/ + +package control + +import ( + "fmt" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" + "strings" + "sync" + "testing" +) + +var xappRnibMock *XappRnibMock + +type XappRnibMock struct { + Mutex sync.Mutex + nbIdentityMap map[string]xapp.RNIBNbIdentity + RNIBNodebInfoMap map[string]xapp.RNIBNodebInfo + RnibSubscription RnibSubscription // Submgr can have only one subscription +} + +type RnibSubscription struct { + Channel string // Subscribed channel/topic "RAN_CONNECTION_STATUS_CHANGE" + cb func(ch string, events ...string) // Submgr's call back function +} + +func CreateXappRnibIfMock() *XappRnibMock { + fmt.Println("XappRnibMock: CreateXappRnibIfMock()") + xappRnibMock = new(XappRnibMock) + xappRnibMock.Init() + return xappRnibMock +} + +func (x *XappRnibMock) Init() { + x.nbIdentityMap = make(map[string]xapp.RNIBNbIdentity, 0) + x.RNIBNodebInfoMap = make(map[string]xapp.RNIBNodebInfo, 0) +} + +func TestMock(t *testing.T) { + + // Current UT test cases use these ran names + xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_CONNECTED) + xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_CONNECTED) + xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_CONNECTED) + + xappRnibMock.CreateGnb("gnb_208_092_303030", entities.ConnectionStatus_CONNECTED) // This same value is used in gnb simulator! + xappRnibMock.CreateGnb("gnb_208_092_303030", entities.ConnectionStatus_DISCONNECTED) + + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_UNKNOWN_CONNECTION_STATUS) + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_CONNECTED_SETUP_FAILED) + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_CONNECTING) + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_CONNECTED) + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_SHUTTING_DOWN) + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_SHUT_DOWN) + xappRnibMock.CreateGnb("gnb_369_11105_aaaaa3", entities.ConnectionStatus_DISCONNECTED) + + mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() + mainCtrl.c.e2IfState.SubscribeChannels() + if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_UNKNOWN_CONNECTION_STATUS", "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } + if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_CONNECTED_SETUP_FAILED", "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } + if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_CONNECTING", "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } + if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_CONNECTED", "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } + if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_SHUTTING_DOWN", "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } + if err := xappRnibMock.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", "gnb_369_11105_aaaaa3_DISCONNECTED", "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } +} + +func (x *XappRnibMock) CreateGnb(gnbId string, connectionStatus entities.ConnectionStatus) { + + xapp.Logger.Debug("XappRnibMock: CreateGnb() gnbId=%v, ConnectionStatus=%v", gnbId, connectionStatus) + nb := xapp.RNIBNodebInfo{} + nb.NodeType = xapp.RNIBNodeGNB + nb.ConnectionStatus = connectionStatus + if nb.ConnectionStatus < 0 || nb.ConnectionStatus > 6 { + xapp.Logger.Error("XappRnibMock: CreateGnb() Incorrect connectionStatus=%v", nb.ConnectionStatus) + return + } + nb.Ip = "localhost" + nb.Port = 5656 + gnb := xapp.RNIBGnb{} + + gnb.ServedNrCells = nil + nb.Configuration = &xapp.RNIBNodebInfoGnb{Gnb: &gnb} + nbIdentity := &xapp.RNIBNbIdentity{ + InventoryName: gnbId, + GlobalNbId: &xapp.RNIBGlobalNbId{ + PlmnId: "001EF5", + NbId: "0045FE50", + }, + } + + err := xappRnibMock.XappRnibSaveNodeb(nbIdentity, &nb) + if err != nil { + xapp.Logger.Error("XappRnibMock: XappRnibSaveNodeb() failed. Error: %v", err) + } +} + +func (x *XappRnibMock) XappRnibSaveNodeb(nbIdentity *xapp.RNIBNbIdentity, nodeb *xapp.RNIBNodebInfo) xapp.RNIBIRNibError { + + xapp.Logger.Debug("XappRnibMock: XappRnibSaveNodeb() inventoryName=%v, ConnectionStatus=%v", nbIdentity.InventoryName, nodeb.ConnectionStatus) + x.Mutex.Lock() + defer x.Mutex.Unlock() + x.nbIdentityMap[nbIdentity.InventoryName] = *nbIdentity + x.RNIBNodebInfoMap[nbIdentity.InventoryName] = *nodeb + return nil +} + +func (x *XappRnibMock) XappRnibGetNodeb(inventoryName string) (*xapp.RNIBNodebInfo, xapp.RNIBIRNibError) { + + x.Mutex.Lock() + defer x.Mutex.Unlock() + xapp.Logger.Debug("XappRnibMock: XappRnibGetNodeb() inventoryName=%v", inventoryName) + nodebInfo, ok := x.RNIBNodebInfoMap[inventoryName] + if ok { + return &nodebInfo, nil + } else { + return nil, fmt.Errorf("XappRnibMock: XappRnibGetNodeb() failed: inventoryName=%s:", inventoryName) + } +} + +func (x *XappRnibMock) XappRnibSubscribe(cb func(string, ...string), channel string) error { + + if x.RnibSubscription.Channel == "RAN_CONNECTION_STATUS_CHANGE" { + xapp.Logger.Debug("XappRnibMock: RAN_CONNECTION_STATUS_CHANGE channel already subscribed") + return nil + } + if x.RnibSubscription.Channel == "" { + x.RnibSubscription.cb = cb + x.RnibSubscription.Channel = channel + xapp.Logger.Debug("XappRnibMock: RAN_CONNECTION_STATUS_CHANGE subscribed") + return nil + } else { + return fmt.Errorf("XappRnibMock: Invalid channel/topic to subscribe: channel = %s", channel) + } +} + +func (x *XappRnibMock) XappRnibGetListGnbIds() ([]*xapp.RNIBNbIdentity, xapp.RNIBIRNibError) { + + xapp.Logger.Debug("XappRnibMock: XappRnibGetListGnbIds()") + x.Mutex.Lock() + defer x.Mutex.Unlock() + var nbIdentities []*xapp.RNIBNbIdentity + for _, nbIdentity := range x.nbIdentityMap { + newNbIdentity := entities.NbIdentity{} + newNbIdentity = nbIdentity + nbIdentities = append(nbIdentities, &newNbIdentity) + } + xapp.Logger.Debug("XappRnibMock: XappRnibGetListGnbIds(). len(nbIdentities) = %v", len(nbIdentities)) + return nbIdentities, nil +} + +func (x *XappRnibMock) XappRnibStoreAndPublish(channel string, event string, pairs ...interface{}) error { + + x.Mutex.Lock() + defer x.Mutex.Unlock() + xapp.Logger.Debug("XappRnibMock: Change published. channel=%s, event=%s", channel, event) + if channel != "RAN_CONNECTION_STATUS_CHANGE" || channel == "" || event == "" { + xapp.Logger.Debug("XappRnibMock: Invalid change published. channel=%s, event=%s", channel, event) + } + + nbId, connectionStatus, err := ExtratNbIdAndConnectionStatus(event) + if err != nil { + xapp.Logger.Error("XappRnibMock: ExtratNbIdAndConnectionStatus. Err=%s", err) + } + + nbIdentity, ok := x.nbIdentityMap[nbId] + if ok { + nbIdentity.ConnectionStatus = connectionStatus + } + + if x.RnibSubscription.cb != nil { + x.RnibSubscription.cb(channel, event) + } else { + xapp.Logger.Error("XappRnibMock: x.RnibSubscription.cb == nil") + } + return nil +} + +func ExtratNbIdAndConnectionStatus(s string) (string, entities.ConnectionStatus, error) { + + var connectionStatus entities.ConnectionStatus + var nbId string + if strings.Contains(s, "_UNKNOWN_CONNECTION_STATUS") { + connectionStatus = entities.ConnectionStatus_UNKNOWN_CONNECTION_STATUS + splitStringTbl := strings.Split(s, "_UNKNOWN_CONNECTION_STATUS") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_CONNECTED") { + connectionStatus = entities.ConnectionStatus_CONNECTED + splitStringTbl := strings.Split(s, "_CONNECTED") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_DISCONNECTED") { + connectionStatus = entities.ConnectionStatus_DISCONNECTED + splitStringTbl := strings.Split(s, "_DISCONNECTED") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_CONNECTED_SETUP_FAILED") { + connectionStatus = entities.ConnectionStatus_CONNECTED_SETUP_FAILED + splitStringTbl := strings.Split(s, "_CONNECTED_SETUP_FAILED") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_CONNECTING") { + connectionStatus = entities.ConnectionStatus_CONNECTING + splitStringTbl := strings.Split(s, "_CONNECTING") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_SHUTTING_DOWN") { + connectionStatus = entities.ConnectionStatus_SHUTTING_DOWN + splitStringTbl := strings.Split(s, "_SHUTTING_DOWN") + nbId = splitStringTbl[0] + } else if strings.Contains(s, "_SHUT_DOWN") { + connectionStatus = entities.ConnectionStatus_SHUT_DOWN + splitStringTbl := strings.Split(s, "_SHUT_DOWN") + nbId = splitStringTbl[0] + } else { + return "", 0, fmt.Errorf("XappRnibMock: Invalid connection status. %s", s) + } + if len(nbId) == 0 { + return "", 0, fmt.Errorf("ExtractNbiIdFromString(): len(nbId) == 0 ") + } + return nbId, connectionStatus, nil +} diff --git a/pkg/control/metrics.go b/pkg/control/metrics.go index 0f514b4..8493379 100644 --- a/pkg/control/metrics.go +++ b/pkg/control/metrics.go @@ -11,6 +11,7 @@ const ( cSubRespToXapp string = "SubRespToXapp" cRestSubRespToXapp string = "RestSubRespToXapp" cRestSubFailToXapp string = "RestSubFailToXapp" + cRestReqRejDueE2Down string = "RestReqRejDueE2Down" cRestSubNotifToXapp string = "RestSubNotifToXapp" cRestSubFailNotifToXapp string = "RestSubFailNotifToXapp" cSubReqToE2 string = "SubReqToE2" @@ -26,6 +27,7 @@ const ( cSubDelRespToXapp string = "SubDelRespToXapp" cRestSubDelReqFromXapp string = "RestSubDelReqFromXapp" cRestSubDelRespToXapp string = "RestSubDelRespToXapp" + cRestSubDelFailToXapp string = "RestSubDelFailToXapp" cSubDelReqToE2 string = "SubDelReqToE2" cSubDelReReqToE2 string = "SubDelReReqToE2" cSubDelRespFromE2 string = "SubDelRespFromE2" @@ -37,6 +39,8 @@ const ( cSDLWriteFailure string = "SDLWriteFailure" cSDLReadFailure string = "SDLReadFailure" cSDLRemoveFailure string = "SDLRemoveFailure" + cE2StateChangedToUp string = "E2StateChangedToUp" + cE2StateChangedToDown string = "E2StateChangedToDown" ) func GetMetricsOpts() []xapp.CounterOpts { @@ -49,6 +53,7 @@ func GetMetricsOpts() []xapp.CounterOpts { {Name: cRestSubReqFromXapp, Help: "The total number of Rest SubscriptionRequest messages received from xApp"}, {Name: cRestSubRespToXapp, Help: "The total number of Rest SubscriptionResponse messages sent to xApp"}, {Name: cRestSubFailToXapp, Help: "The total number of Rest SubscriptionFailure messages sent to xApp"}, + {Name: cRestReqRejDueE2Down, Help: "The total number of Rest SubscriptionRequest messages rejected due E2 Interface down"}, {Name: cRestSubNotifToXapp, Help: "The total number of successful Rest SubscriptionNotification messages sent to xApp"}, {Name: cRestSubFailNotifToXapp, Help: "The total number of failure Rest SubscriptionNotification messages sent to xApp"}, {Name: cSubReqToE2, Help: "The total number of SubscriptionRequest messages sent to E2Term"}, @@ -66,6 +71,7 @@ func GetMetricsOpts() []xapp.CounterOpts { {Name: cSubDelRespToXapp, Help: "The total number of SubscriptionDeleteResponse messages sent to xApp"}, {Name: cRestSubDelReqFromXapp, Help: "The total number of Rest SubscriptionDeleteRequest messages received from xApp"}, {Name: cRestSubDelRespToXapp, Help: "The total number of Rest SubscriptionDeleteResponse messages sent to xApp"}, + {Name: cRestSubDelFailToXapp, Help: "The total number of Rest SubscriptionDeleteFailure messages sent to xApp"}, {Name: cSubDelReqToE2, Help: "The total number of SubscriptionDeleteRequest messages sent to E2Term"}, {Name: cSubDelReReqToE2, Help: "The total number of SubscriptionDeleteRequest messages resent to E2Term"}, {Name: cSubDelRespFromE2, Help: "The total number of SubscriptionDeleteResponse messages from E2Term"}, @@ -79,9 +85,14 @@ func GetMetricsOpts() []xapp.CounterOpts { {Name: cSDLWriteFailure, Help: "The total number of SDL write failures"}, {Name: cSDLReadFailure, Help: "The total number of SDL read failures"}, {Name: cSDLRemoveFailure, Help: "The total number of SDL read failures"}, + + // E2 interface state counters + {Name: cE2StateChangedToUp, Help: "The total number of E2 interface change connected state"}, + {Name: cE2StateChangedToDown, Help: "The total number of E2 interface change disconnected state"}, } } func (c *Control) UpdateCounter(counterName string) { + xapp.Logger.Debug("Add counterName=%v", counterName) c.Counters[counterName].Inc() } diff --git a/pkg/control/registry.go b/pkg/control/registry.go index 4b48687..8c79540 100644 --- a/pkg/control/registry.go +++ b/pkg/control/registry.go @@ -181,6 +181,8 @@ func (r *Registry) allocateSubs(trans *TransactionXapp, subReqMsg *e2ap.E2APSubs Meid: trans.Meid, RMRRouteCreated: rmrRoutecreated, SubReqMsg: subReqMsg, + OngoingReqCount: 0, + OngoingDelCount: 0, valid: true, PolicyUpdate: false, RetryFromXapp: false, @@ -405,7 +407,6 @@ func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction delStatus := subs.EpList.DelEndpoint(trans.GetEndpoint()) epamount := subs.EpList.Size() subId := subs.ReqId.InstanceId - if delStatus == false { return nil } @@ -518,3 +519,49 @@ func (r *Registry) SetResetTestFlag(resetTestFlag bool, subs *Subscription) { xapp.Logger.Debug("resetTestFlag == false") } } + +func (r *Registry) DeleteAllE2Subscriptions(ranName string, c *Control) { + + xapp.Logger.Debug("Registry: DeleteAllE2Subscriptions()") + for subId, subs := range r.register { + if subs.Meid.RanName == ranName { + if subs.OngoingReqCount != 0 || subs.OngoingDelCount != 0 { + // Subscription creation or deletion processes need to be processed gracefully till the end. + // Subscription is deleted at end of the process in both cases. + xapp.Logger.Debug("Registry: E2 subscription under prosessing ongoing cannot delete it yet. subId=%v, OngoingReqCount=%v, OngoingDelCount=%v", subId, subs.OngoingReqCount, subs.OngoingDelCount) + continue + } else { + // Delete route + if subs.RMRRouteCreated == true { + for _, ep := range subs.EpList.Endpoints { + tmpList := xapp.RmrEndpointList{} + tmpList.AddEndpoint(&ep) + subRouteAction := SubRouteInfo{tmpList, uint16(subs.ReqId.InstanceId)} + if err := r.rtmgrClient.SubscriptionRequestDelete(subRouteAction); err != nil { + c.UpdateCounter(cRouteDeleteFail) + } + } + } + // Delete E2 subscription from registry and db + xapp.Logger.Debug("Registry: Subscription delete. subId=%v", subId) + delete(r.register, subId) + r.subIds = append(r.subIds, subId) + c.RemoveSubscriptionFromDb(subs) + } + } + } + + // Delete REST subscription from registry and db + for restSubId, restSubs := range r.restSubscriptions { + if restSubs.Meid == ranName && restSubs.SubReqOngoing == true || restSubs.SubDelReqOngoing == true { + // Subscription creation or deletion processes need to be processed gracefully till the end. + // Subscription is deleted at end of the process in both cases. + xapp.Logger.Debug("Registry: REST subscription under prosessing ongoing cannot delete it yet. RestSubId=%v, SubReqOngoing=%v, SubDelReqOngoing=%v", restSubId, restSubs.SubReqOngoing, restSubs.SubDelReqOngoing) + continue + } else { + xapp.Logger.Debug("Registry: REST subscription delete. subId=%v", restSubId) + delete(r.restSubscriptions, restSubId) + c.RemoveRESTSubscriptionFromDb(restSubId) + } + } +} diff --git a/pkg/control/subscription.go b/pkg/control/subscription.go index 1152520..58f0adf 100644 --- a/pkg/control/subscription.go +++ b/pkg/control/subscription.go @@ -41,6 +41,8 @@ type Subscription struct { TheTrans TransactionIf // Ongoing transaction SubReqMsg *e2ap.E2APSubscriptionRequest // Subscription information SubRFMsg interface{} // Subscription information + OngoingReqCount int // Subscription create process is ongoing. In merge case it can ongoing for more than one endpoint + OngoingDelCount int // Subscription delete process is ongoing. In merge case it can ongoing for more than one endpoint PolicyUpdate bool // This is true when policy subscrition is being updated. Used not to send delete for update after timeout or restart RetryFromXapp bool // Retry form xApp for subscription that already exist SubRespRcvd bool // Subscription response received diff --git a/pkg/control/types.go b/pkg/control/types.go index 93cddb0..22c8bc4 100644 --- a/pkg/control/types.go +++ b/pkg/control/types.go @@ -23,6 +23,7 @@ import ( "time" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" ) //----------------------------------------------------------------------------- @@ -71,3 +72,10 @@ func (e *ErrorInfo) SetInfo(errorCause string, errorSource string, timeoutType s e.ErrorSource = errorSource e.TimeoutType = timeoutType } + +type XappRnibInterface interface { + XappRnibSubscribe(cb func(string, ...string), channel string) error + XappRnibGetListGnbIds() ([]*xapp.RNIBNbIdentity, xapp.RNIBIRNibError) + XappRnibStoreAndPublish(channel string, event string, pairs ...interface{}) error + XappRnibGetNodeb(inventoryName string) (*xapp.RNIBNodebInfo, xapp.RNIBIRNibError) +} diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index e514cb0..8d559bd 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -59,8 +59,9 @@ func createSubmgrControl(srcId teststub.RmrSrcId, rtgSvc teststub.RmrRtgSvc) *te mainCtrl.c.LoggerLevel = int(xapp.Logger.GetLevel()) xapp.Logger.Debug("Test: LoggerLevel %v", mainCtrl.c.LoggerLevel) xapp.Logger.Debug("Replacing real db with test db") - mainCtrl.c.e2SubsDb = CreateMock() // This overrides real E2 Subscription database for testing - mainCtrl.c.restSubsDb = CreateRestSubsDbMock() // This overrides real REST Subscription database for testing + mainCtrl.c.e2SubsDb = CreateMock() // This overrides real E2 Subscription database for testing + mainCtrl.c.restSubsDb = CreateRestSubsDbMock() // This overrides real REST Subscription database for testing + mainCtrl.c.e2IfStateDb = CreateXappRnibIfMock() // This overrides real RNIB database for testing xapp.SetReadyCB(mainCtrl.ReadyCB, nil) go xapp.RunWithParams(mainCtrl.c, false) mainCtrl.WaitCB() @@ -337,7 +338,7 @@ func (mc *testingSubmgrControl) VerifyCounterValues(t *testing.T) { } } - // Check that not any unexpected counter are added + // Check that not any unexpected counter are added (this is not working correctly!) for _, currentCounter := range currentCountersMap { if _, ok := toBeAddedCountersMap[currentCounter.Name]; ok == false { if beforeCounter, ok := countersBeforeMap[currentCounter.Name]; ok == true { @@ -455,3 +456,13 @@ func (mc *testingSubmgrControl) sendPostRequest(t *testing.T, addr string, path mc.TestLog(t, "%s", respBody) return } + +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +func (mc *testingSubmgrControl) SetE2State(t *testing.T, ranNameState string) { + + if err := mc.c.e2IfStateDb.XappRnibStoreAndPublish("RAN_CONNECTION_STATUS_CHANGE", ranNameState, "key1", "data1"); err != nil { + t.Errorf("XappRnibStoreAndPublish failed: %v", err) + } +} diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index e10cdff..fd411bf 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -20,28 +20,299 @@ package control import ( + //"os" "strings" "testing" "time" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" + "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" "github.com/stretchr/testify/assert" ) func TestSuiteSetup(t *testing.T) { - // The effect of this call shall endure thgough the UT suite! - // If this causes any issues, the previout interface can be restored + // The effect of this call shall endure though the UT suite! + // If this causes any issues, the previous interface can be restored // like this:git log // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) - mainCtrl.c.restDuplicateCtrl.Init() } +func TestRanStatusChangeViaSDLNotification(t *testing.T) { + + // Current UT test cases use these ran names + xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) + xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) + xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) + + mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() + mainCtrl.c.e2IfState.SubscribeChannels() + + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") + mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqAfterE2ConnBreak +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | [E2 Conn. DOWN] | +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubFail | | +// |<----------------| | +// | | | +// +//----------------------------------------------------------------------------- + +func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { + CaseBegin("TestRESTSubReqAfterE2ConnBreak") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestReqRejDueE2Down, 1}, + }) + + // E2 disconnect after E2term has received response + mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") + // Req + const subReqCount int = 1 + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + xappConn1.SendRESTSubsReq(t, params) + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + mainCtrl.VerifyCounterValues(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubReqE2ConnBreak +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | RESTSubReq | | +// |---------------->| | +// | RESTSubResp | | +// |<----------------| | +// | | SubReq | +// | |------------->| +// | | SubResp | +// | |<-------------| +// | | | +// | [E2 Conn. DOWN] | +// | [Int. SUBS DELETE] | +// | | | +// | RESTNotif(unsuccessful) | +// |<----------------| | +// | | | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubReqE2ConnBreak(t *testing.T) { + CaseBegin("TestRESTSubReqE2ConnBreak") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, + }) + + // Req + const subReqCount int = 1 + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + + crereq, cremsg := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + + // E2 disconnect after E2term has received response + mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") + + e2termConn1.SendSubsResp(t, crereq, cremsg) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + + <-time.After(time.Second * 1) + assert.Equal(t, 0, len(mainCtrl.c.registry.register)) + assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) + + subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 + assert.Equal(t, 0, len(register)) + } + + restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 0, len(restSubscriptions)) + } + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + // Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + mainCtrl.VerifyCounterValues(t) +} + +//----------------------------------------------------------------------------- +// TestRESTSubscriptionDeleteAfterE2ConnectionBreak +// +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | [SUBS CREATE] | +// | | | +// | [E2 Conn. DOWN] | +// | | | +// | RESTSubDelReq | | +// |---------------->| | +// | | | +// | RESTSubDelResp | | +// |<----------------| | +// | | | +// | [No valid subscription found] | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { + xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + // Req + var params *teststube2ap.RESTSubsReqParams = nil + restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) + + // E2 disconnect after E2term has received response + mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + + <-time.After(time.Second * 1) + assert.Equal(t, 0, len(mainCtrl.c.registry.register)) + assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) + + subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 + assert.Equal(t, 0, len(register)) + } + + restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() + if err != nil { + xapp.Logger.Error("%v", err) + } else { + assert.Equal(t, 0, len(restSubscriptions)) + } + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + // Wait that subs is cleaned + mainCtrl.wait_subs_clean(t, e2SubsId, 10) + + xappConn1.TestMsgChanEmpty(t) + e2termConn1.TestMsgChanEmpty(t) + mainCtrl.wait_registry_empty(t, 10) + mainCtrl.VerifyCounterValues(t) +} + +//----------------------------------------------------------------------------- +// TestRESTOtherE2ConnectionChanges +// + +// stub stub +// +-------+ +---------+ +---------+ +// | xapp | | submgr | | e2term | +// +-------+ +---------+ +---------+ +// | | | +// | [SUBS CREATE] | +// | | | +// | [E2 CONNECTED_SETUP_FAILED] | +// | [E2 CONNECTING] | +// | [E2 SHUTTING_DOWN] | +// | [E2 SHUT_DOWN] | +// | | | +// | [SUBS DELETE] | +// | | | +// +//----------------------------------------------------------------------------- +func TestRESTOtherE2ConnectionChanges(t *testing.T) { + xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") + + mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ + Counter{cRestSubReqFromXapp, 1}, + Counter{cRestSubRespToXapp, 1}, + Counter{cSubReqToE2, 1}, + Counter{cSubRespFromE2, 1}, + Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelRespToXapp, 1}, + }) + + // Req + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) + restSubId := xappConn1.SendRESTSubsReq(t, params) + + crereq, cremsg := e2termConn1.RecvSubsReq(t) + xappConn1.ExpectRESTNotification(t, restSubId) + e2termConn1.SendSubsResp(t, crereq, cremsg) + e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) + + // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") + mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") + mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") + + // Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + delreq, delmsg := e2termConn1.RecvSubsDelReq(t) + e2termConn1.SendSubsDelResp(t, delreq, delmsg) + + // Restore E2 connection for following test cases + mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") + + // Wait that subs is cleaned + waitSubsCleanup(t, e2SubsId, 10) + mainCtrl.VerifyCounterValues(t) +} //----------------------------------------------------------------------------- // TestRESTSubReqAndDeleteOkWithE2apUtWrapper diff --git a/pkg/teststube2ap/stubE2.go b/pkg/teststube2ap/stubE2.go index 719f214..d6421e5 100644 --- a/pkg/teststube2ap/stubE2.go +++ b/pkg/teststube2ap/stubE2.go @@ -705,25 +705,25 @@ func (tc *E2Stub) expectNotification(t *testing.T, restSubsId string, expectErro tc.restSubsIdList = []string{restSubsId} xapp.Subscription.SetResponseCB(tc.ListedRestNotifHandler) if tc.requestCount == 0 { - tc.TestError(t, "### NO REST notifications SET received for endpoint=%s, request zount ZERO! (%v)", tc.clientEndpoint, tc) + tc.TestError(t, "### NO REST notifications SET received for endpoint=%s, request zount ZERO! (%v)", tc.clientEndpoint, *tc) } go func() { select { case e2Ids := <-tc.CallBackListedNotifications: if tc.requestCount == 0 { - tc.TestError(t, "### REST notification count unexpectedly ZERO for %s (%v)", restSubsId, tc) + tc.TestError(t, "### REST notification count unexpectedly ZERO for %s (%v)", restSubsId, *tc) } else if e2Ids.RestSubsId != restSubsId { - tc.TestError(t, "### Unexpected REST notifications received, expected %s bunt got %s instead| (%v)", e2Ids.RestSubsId, restSubsId, tc) + tc.TestError(t, "### Unexpected REST notifications received, expected %s bunt got %s instead| (%v)", e2Ids.RestSubsId, restSubsId, *tc) } else if e2Ids.ErrorCause == "" && expectError == "allFail" { - tc.TestError(t, "### Unexpected ok cause received from REST notifications |%s:%s| (%v)", e2Ids.RestSubsId, restSubsId, tc) + tc.TestError(t, "### Unexpected ok cause received from REST notifications |%s:%s| (%v)", e2Ids.RestSubsId, restSubsId, *tc) } else if e2Ids.ErrorCause != "" && expectError == "allOk" { - tc.TestError(t, "### Unexpected ErrorCause: (%s), ErrorSource: (%s), TimeoutType: (%s) received from REST notifications |%s:%s| (%v)", e2Ids.ErrorCause, e2Ids.ErrorSource, e2Ids.TimeoutType, e2Ids.RestSubsId, restSubsId, tc) + tc.TestError(t, "### Unexpected ErrorCause: (%s), ErrorSource: (%s), TimeoutType: (%s) received from REST notifications |%s:%s| (%v)", e2Ids.ErrorCause, e2Ids.ErrorSource, e2Ids.TimeoutType, e2Ids.RestSubsId, restSubsId, *tc) } else { tc.requestCount-- if tc.requestCount == 0 { - tc.Debug("### All expected REST notifications received for %s (%v)", e2Ids.RestSubsId, tc) + tc.Debug("### All expected REST notifications received for %s (%v)", e2Ids.RestSubsId, *tc) } else { - tc.Debug("### Expected REST notifications received for %s, (%v)", e2Ids.RestSubsId, tc) + tc.Debug("### Expected REST notifications received for %s, (%v)", e2Ids.RestSubsId, *tc) } if e2Ids.ErrorCause != "" && expectError == "allFail" { tc.Debug("### REST Notification: RestSubsId: %s, ErrorCause: %s, ErrorSource: (%s), TimeoutType: (%s)", e2Ids.RestSubsId, e2Ids.ErrorCause, e2Ids.ErrorSource, e2Ids.TimeoutType) @@ -748,10 +748,10 @@ func (tc *E2Stub) WaitRESTNotification(t *testing.T, restSubsId string) uint32 { select { case e2SubsId := <-tc.ListedRESTNotifications: if e2SubsId.RestSubsId == restSubsId { - tc.Debug("### Expected REST notifications received %s, e2SubsId %v for endpoint=%s, (%v)", e2SubsId.RestSubsId, e2SubsId.E2SubsId, tc.clientEndpoint, tc) + tc.Debug("### Expected REST notifications received %s, e2SubsId %v for endpoint=%v, (%v)", e2SubsId.RestSubsId, e2SubsId.E2SubsId, tc.clientEndpoint, *tc) return e2SubsId.E2SubsId } else { - tc.TestError(t, "### Unexpected REST notification %s received, expected %s for endpoint=%s, (%v)", e2SubsId.RestSubsId, restSubsId, tc.clientEndpoint, tc) + tc.TestError(t, "### Unexpected REST notification %s received, expected %v for endpoint=%v, (%v)", e2SubsId.RestSubsId, restSubsId, tc.clientEndpoint, *tc) xapp.Logger.Debug("CALL STACK:\n %s", stack) return 0 } @@ -796,7 +796,7 @@ func (tc *E2Stub) WaitAnyRESTNotification(t *testing.T) uint32 { func (tc *E2Stub) ListedRestNotifHandler(resp *clientmodel.SubscriptionResponse) { if len(tc.restSubsIdList) == 0 { - tc.Error("Unexpected listed REST notifications received for endpoint=%s, expected restSubsId list size was ZERO!", tc.clientEndpoint) + tc.Error("Unexpected listed REST notifications received for endpoint=%v, expected restSubsId list size was ZERO!", tc.clientEndpoint) } else { for i, subsId := range tc.restSubsIdList { if *resp.SubscriptionID == subsId { @@ -813,7 +813,7 @@ func (tc *E2Stub) ListedRestNotifHandler(resp *clientmodel.SubscriptionResponse) // } if len(tc.restSubsIdList) == 0 { - tc.Debug("All listed REST notifications received for endpoint=%s", tc.clientEndpoint) + tc.Debug("All listed REST notifications received for endpoint=%v", tc.clientEndpoint) } return diff --git a/releases/container-release-ric-plt-submgr.yaml b/releases/container-release-ric-plt-submgr.yaml index 3afa1fc..5c2143e 100644 --- a/releases/container-release-ric-plt-submgr.yaml +++ b/releases/container-release-ric-plt-submgr.yaml @@ -7,4 +7,4 @@ project: ric-plt/submgr ref: 6c63019f4daa458507decc19f2d742681e2053b4 containers: - name: ric-plt-submgr - version: 0.7.1 + version: 0.7.2 -- 2.16.6 From 3e55f47e491d71e28e4bd587751d66c5d5c62409 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Fri, 5 Nov 2021 09:58:04 +0200 Subject: [PATCH 06/16] Fix for E2 SubscriptionFailure message handling - Submgr sent SubscriptionReleteRequest to E2 node as response to failure - There is no need for that and now sending of delete has been removed Change-Id: I4787ce1dbc1e05eabfed6d255c52f092e0cbdb5f Signed-off-by: Anssi Mannila --- pkg/control/control.go | 1 - pkg/control/ut_messaging_test.go | 62 ++-------------------------------------- 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 87c81ff..a3d9cdb 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -1112,7 +1112,6 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran removeSubscriptionFromDb = true subRfMsg, valid = subs.SetCachedResponse(event, false) xapp.Logger.Debug("SUBS-SubReq: internal delete due failure event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) - c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) case *SubmgrRestartTestEvent: // This simulates that no response has been received and after restart subscriptions are restored from db xapp.Logger.Debug("Test restart flag is active. Dropping this transaction to test restart case") diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index fd411bf..5cc7458 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -1446,12 +1446,6 @@ func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // | | SubFail | // | |<-------------| // | | | -// | | SubDelReq | -// | |------------->| -// | | | -// | | SubDelResp | -// | |<-------------| -// | | | // | SubFail | | // |<-------------| | // | | | @@ -1477,10 +1471,6 @@ func TestSubReqSubFailRespInSubmgr(t *testing.T) { fparams1.Set(crereq1) e2termConn1.SendSubsFail(t, fparams1, cremsg1) - // E2t: Receive SubsDelReq and send SubsDelResp (internal first) - delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) - // Xapp: Receive SubsFail e2SubsId := xappConn1.RecvSubsFail(t, cretrans) @@ -1755,8 +1745,6 @@ func TestSubReqAndSubDelOkSameAction(t *testing.T) { rparams2 := &teststube2ap.E2StubSubsReqParams{} rparams2.Init() cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) - //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) - //e2termConn1.SendSubsResp(t, crereq2, cremsg2) e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) resp, _ := xapp.Subscription.QuerySubscriptions() @@ -1766,11 +1754,7 @@ func TestSubReqAndSubDelOkSameAction(t *testing.T) { //Del1 deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) - //e2termConn1.RecvSubsDelReq(t) - //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) xappConn1.RecvSubsDelResp(t, deltrans1) - //Wait that subs is cleaned - //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) //Del2 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) @@ -1892,11 +1876,6 @@ func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { // | | | SubFail1 | // | | |<-------------| // | | | | -// | | | SubDelReq | -// | | |------------->| -// | | | SubDelResp | -// | | |<-------------| -// | | | | // | | SubFail1 | | // | |<-------------| | // | | | | @@ -1927,10 +1906,6 @@ func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { fparams1.Set(crereq1) e2termConn1.SendSubsFail(t, fparams1, cremsg1) - // E2t: internal delete - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - //Fail1 e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) //Fail2 @@ -2834,7 +2809,6 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { deleteXapp2Subscription(t, &restSubId2) waitSubsCleanup(t, e2SubsId2, 10) - mainCtrl.VerifyCounterValues(t) } @@ -3923,12 +3897,6 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { // | | SubFail | // | |<-------------| // | | | -// | | SubDelReq | -// | |------------->| -// | | | -// | | SubDelResp | -// | |<-------------| -// | | | // | RESTNotif | | // | unsuccess | | // |<----------------| | @@ -3961,11 +3929,9 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) fparams1 := &teststube2ap.E2StubSubsFailParams{} fparams1.Set(crereq1) + xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") e2termConn1.SendSubsFail(t, fparams1, cremsg1) - delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) - xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") - e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) @@ -4490,12 +4456,8 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { // | RESTNotif2 | | // | | unsuccess | | // |<------------------------------| | -// | | | SubDelReq | -// | | |------------->| -// | | | SubDelResp | -// | | |<-------------| // | | | | -// | | RESTSubDelReq1 | | +// | | RESTSubDelReq1 | | There is no need for xApp to send delete for failed subscriptions but some xApp might do so. // | |---------------->| | // | | | | // | | RESTSubDelResp1 | | @@ -4518,8 +4480,6 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { Counter{cSubFailFromE2, 1}, Counter{cRestSubFailNotifToXapp, 2}, Counter{cRestSubDelReqFromXapp, 2}, - Counter{cSubDelReqToE2, 1}, - Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 2}, }) @@ -4542,11 +4502,7 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { fparams1.Set(crereq1) e2termConn1.SendSubsFail(t, fparams1, cremsg1) - // E2t: internal delete - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - e2SubsIdA := <-xappConn1.ListedRESTNotifications xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) e2SubsIdB := <-xappConn1.ListedRESTNotifications @@ -5962,11 +5918,7 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { // | |<-------------| // | RESTNotif (fail)| | // |<----------------| | -// | | SubDelReq | -// | |------------->| // | | | -// | | SubDelResp | -// | |<-------------| // //----------------------------------------------------------------------------- @@ -5992,9 +5944,6 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action e2termConn1.SendSubsFail(t, fparams, cremsg) - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) @@ -6190,11 +6139,7 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { // | |<-------------| // | RESTNotif (fail)| | // |<----------------| | -// | | SubDelReq | -// | |------------->| // | | | -// | | SubDelResp | -// | |<-------------| // //----------------------------------------------------------------------------- func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { @@ -6220,9 +6165,6 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action e2termConn1.SendSubsFail(t, fparams, cremsg) - delreq, delmsg := e2termConn1.RecvSubsDelReq(t) - e2termConn1.SendSubsDelResp(t, delreq, delmsg) - instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) -- 2.16.6 From 0a8051975b2b55aec0e1cecd987e3576018663e5 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Wed, 10 Nov 2021 10:19:54 +0200 Subject: [PATCH 07/16] Document update - Somes counters and parameters were added - Some fixes added in the document Change-Id: Ibf334a22ee840c908a008e7ad2a57cc992765048 Signed-off-by: Anssi Mannila --- docs/user-guide.rst | 82 +++++++++++++++++++++++++++++++------------------- pkg/control/metrics.go | 2 +- 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/docs/user-guide.rst b/docs/user-guide.rst index 2fc08ec..74dcf3e 100755 --- a/docs/user-guide.rst +++ b/docs/user-guide.rst @@ -344,25 +344,25 @@ Architecture * xApp restart - When xApp is restarted for any reason it may resend REST subscription requests for subscriptions which have already been subscribed. If REPORT or INSERT type - subscription already exists and RMR endpoint of requesting xApp is attached to subscription then successful response is sent to xApp directly without - updating Routing Manager and E2 Node. If POLICY type subscription already exists, request is forwarded to E2 Node and successful response is sent to xApp. - E2 Node is expected to accept duplicate POLICY type requests. In restart IP address of the xApp may change but domain service address name does not. - RMR message routing uses domain service address name. + When xApp is restarted for any reason it may resend REST subscription requests for subscriptions which have already been subscribed. If REPORT or INSERT type + subscription already exists and RMR endpoint of requesting xApp is attached to subscription then successful response is sent to xApp directly without + updating Routing Manager and E2 Node. If POLICY type subscription already exists, request is forwarded to E2 Node and successful response is sent to xApp. + E2 Node is expected to accept duplicate POLICY type requests. In restart IP address of the xApp may change but domain service address name does not. + RMR message routing uses domain service address name. * Subscription Manager restart - Subscription Manager stores REST request ids, E2 subscriptions and their mapping to REST request ids in db (SDL). In start up Subscription Manager restores REST request - ids, E2 subscriptions and their mapping from db. For E2 subscriptions which were not successfully completed, Subscription Manager sends delete request to E2 Node and - removes routes created for those. In restart case xApp may need to resend the same REST request to get all E2 subscriptions completed. + Subscription Manager stores REST request ids, E2 subscriptions and their mapping to REST request ids in db (SDL). In start up Subscription Manager restores REST request + ids, E2 subscriptions and their mapping from db. For E2 subscriptions which were not successfully completed, Subscription Manager sends delete request to E2 Node and + removes routes created for those. In restart case xApp may need to resend the same REST request to get all E2 subscriptions completed. - Restoring subscriptions from db can be disable via submgr-config.yaml file by setting "readSubsFromDb": "false". + Restoring subscriptions from db can be disabled via submgr-config.yaml file by setting "readSubsFromDb": "false". * E2 connection break - Subscription Manager subscribes E2 connection status notifications from RNIB. Whenever E2 interface goes up or down Subscription Manager gets notifies. When interface is down - subscription is not possible. Subscription Manager rejects new request for the E2 node. Http Reject cause is 503 Subscribe Service Unavailable. When interface goes down - Subscription Manager deletes all subscriptions related to the RanName from its memory and database. E2 node and XApp are expected to do the same. + Subscription Manager subscribes E2 connection status notifications from RNIB. Whenever E2 interface goes up or down Subscription Manager gets notifies. When interface is down + subscription is not possible. Subscription Manager rejects new request for the E2 node. Http Reject cause is 503 Subscribe Service Unavailable. When interface goes down + Subscription Manager deletes all subscriptions related to the RanName from its memory and database. E2 node and XApp are expected to do the same. Metrics ------- @@ -372,6 +372,12 @@ Metrics - SubReqFromXapp: The total number of SubscriptionRequest messages received from xApp - SubRespToXapp: The total number of SubscriptionResponse messages sent to xApp - SubFailToXapp: The total number of SubscriptionFailure messages sent to xApp + - RestSubReqFromXapp: The total number of Rest SubscriptionRequest messages received from xApp, + - RestSubRespToXapp: The total number of Rest SubscriptionResponse messages sent to xApp, + - RestSubFailToXapp: The total number of Rest SubscriptionFailure messages sent to xApp + - RestReqRejDueE2Down: The total number of Rest SubscriptionRequest messages rejected due E2 Interface down + - RestSubNotifToXapp: The total number of successful Rest SubscriptionNotification messages sent to xApp + - RestSubFailNotifToXapp: The total number of failure Rest SubscriptionNotification messages sent to xApp - SubReqToE2: The total number of SubscriptionRequest messages sent to E2Term - SubReReqToE2: The total number of SubscriptionRequest messages resent to E2Term - SubRespFromE2: The total number of SubscriptionResponse messages from E2Term @@ -380,10 +386,14 @@ Metrics - RouteCreateFail: The total number of subscription route create failure - RouteCreateUpdateFail: The total number of subscription route create update failure - MergedSubscriptions: The total number of merged Subscriptions + - DuplicateE2SubReq: The total number of same E2 SubscriptionRequest messages from same xApp, Subscription delete counters: - SubDelReqFromXapp: The total number of SubscriptionDeleteResponse messages received from xApp - SubDelRespToXapp: The total number of SubscriptionDeleteResponse messages sent to xApp + - RestSubDelReqFromXapp: The total number of Rest SubscriptionDeleteRequest messages received from xApp + - RestSubDelRespToXapp: The total number of Rest SubscriptionDeleteResponse messages sent to xApp + - RestSubDelFailToXapp: The total number of Rest SubscriptionDeleteFailure messages sent to xApp - SubDelReqToE2: The total number of SubscriptionDeleteRequest messages sent to E2Term - SubDelReReqToE2: The total number of SubscriptionDeleteRequest messages resent to E2Term - SubDelRespFromE2: The total number of SubscriptionDeleteResponse messages from E2Term @@ -396,7 +406,11 @@ Metrics SDL failure counters: - SDLWriteFailure: The total number of SDL write failures - SDLReadFailure: The total number of SDL read failures - - SDLRemoveFailure: The total number of SDL read failures + - SDLRemoveFailure: The total number of SDL remove failures + + E2 interface state counters + - E2StateChangedToUp: The total number of E2 interface change connected state + - E2StateChangedToDown: The total number of E2 interface change disconnected state Configurable parameters ----------------------- @@ -416,14 +430,24 @@ Configurable parameters - Try count for RIC Subscription Delete Request message - e2tMaxSubDelReqTryCount: 2 is the default value + - Shall Subscription Manager check is E2 interface up before new SubscriptionRequest is processed + - checkE2State: true is the default value + - Are subscriptions read from database in Subscription Manager startup - - readSubsFromDb: "true" is the default value - + - readSubsFromDb: "true" is the default value + + - How many times Subscription Manager tries to read database in start up before it continues startup procedure + - dbTryCount: 200 is the default value + + - Shall Subscription Manager try to read data base forever in start up before it continues startup procedure + - dbRetryForever: true is the default value + + The parameters can be changed on the fly via Kubernetes Configmap. Default parameters values are defined in Helm chart Use following command to open Subscription Manager's Configmap in Nano editor. First change parameter and then store the change by pressing first Ctrl + o. Close editor by pressing the Ctrl + x. The change is visible in Subscription Manager's - log after some 20 - 30 seconds. + log after some 20 - 30 seconds. Note that some of the parameters maybe be useful just for testing purpose. .. code-block:: none @@ -435,15 +459,9 @@ REST interface for debugging and testing .. code-block:: none - kubectl get pods -A | grep submgr - - ricplt submgr-75bccb84b6-n9vnt 1/1 Running 0 81m - - Syntax: kubectl exec -t -n ricplt -- cat /etc/hosts | grep submgr | awk '{print $1}' - - Example: kubectl exec -t -n ricplt submgr-75bccb84b6-n9vnt -- cat /etc/hosts | grep submgr | awk '{print $1}' + kubectl get pods -A -o wide | grep submgr + ricplt submgr-6d5f487777-2bc4t 1/1 Running 0 6d13h 10.244.0.181 my-ubuntu-18 - 10.244.0.181 Get metrics @@ -451,19 +469,20 @@ REST interface for debugging and testing Example: curl -s GET "http://10.244.0.181:8080/ric/v1/metrics" - Get REST subscriptions + Get REST subscriptions. .. code-block:: none Example: curl -X GET "http://10.244.0.181:8080/ric/v1/restsubscriptions" - Get E2 subscriptions + Get E2 subscriptions. .. code-block:: none Example: curl -X GET "http://10.244.0.181:8088/ric/v1/subscriptions" - Delete single E2 subscription from db + Delete single E2 subscription from db. Note that the subscription is not deleted from Subscription Manager's RAM memory! + Subscription Manager pod restart is required for that. .. code-block:: none @@ -471,25 +490,26 @@ REST interface for debugging and testing Example: curl -X POST "http://10.244.0.181:8080/ric/v1/test/deletesubid=1" - Remove all subscriptions from db + Remove all subscriptions from db. Note that the subscription is not deleted from Subscription Manager's RAM memory! + Subscription Manager pod restart is required for that. .. code-block:: none Example: curl -X POST "http://10.244.0.181:8080/ric/v1/test/emptydb" - Make Subscription Manager restart + Make Subscription Manager restart. .. code-block:: none Example: curl -X POST "http://10.244.0.181:8080/ric/v1/test/restart" - Use this command to get Subscription Manager's log writings + Use this command to get Subscription Manager's log writings. .. code-block:: none Example: kubectl logs -n ricplt submgr-75bccb84b6-n9vnt - Logger level in configmap.yaml file in Helm chart is by default 2. It means that only info logs are printed. + Logger level in configmap.yaml file in Helm chart is by default 1. It means that only info logs are printed. To see debug log writings it has to be changed to 4. .. code-block:: none diff --git a/pkg/control/metrics.go b/pkg/control/metrics.go index 8493379..991437d 100644 --- a/pkg/control/metrics.go +++ b/pkg/control/metrics.go @@ -84,7 +84,7 @@ func GetMetricsOpts() []xapp.CounterOpts { // SDL failure counters {Name: cSDLWriteFailure, Help: "The total number of SDL write failures"}, {Name: cSDLReadFailure, Help: "The total number of SDL read failures"}, - {Name: cSDLRemoveFailure, Help: "The total number of SDL read failures"}, + {Name: cSDLRemoveFailure, Help: "The total number of SDL remove failures"}, // E2 interface state counters {Name: cE2StateChangedToUp, Help: "The total number of E2 interface change connected state"}, -- 2.16.6 From e1af87f0759201f64804eff5911c4e6c0e859be9 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Wed, 10 Nov 2021 13:10:54 +0200 Subject: [PATCH 08/16] ASN.1 debug printouts hided by default - ASN.1 debug printouts are made now on logger level >= 4 Change-Id: I2b3072825c16742c1cea9a8b1612d65c53b1bd3a Signed-off-by: Anssi Mannila --- e2ap/libe2ap_wrapper/E2AP_if.c | 20 +++++++++----------- e2ap/libe2ap_wrapper/E2AP_if.h | 2 ++ e2ap/pkg/e2ap_wrapper/packer_e2ap.go | 13 +++++++++++++ pkg/control/control.go | 14 ++++++-------- pkg/control/e2ap.go | 7 +++++++ pkg/control/ut_ctrl_submgr_test.go | 3 ++- 6 files changed, 39 insertions(+), 20 deletions(-) diff --git a/e2ap/libe2ap_wrapper/E2AP_if.c b/e2ap/libe2ap_wrapper/E2AP_if.c index 8686908..fe0d5d5 100644 --- a/e2ap/libe2ap_wrapper/E2AP_if.c +++ b/e2ap/libe2ap_wrapper/E2AP_if.c @@ -27,12 +27,7 @@ #include "asn_constant.h" #include "E2AP_if.h" - -#ifdef DEBUG - static const bool debug = true; -#else - static const bool debug = true; //false; -#endif +static bool debugPrints = false; const int64_t cMaxNrOfErrors = 256; const uint64_t cMaxSizeOfOctetString = 1024; @@ -74,6 +69,11 @@ typedef union { uint8_t octets[4]; } IdOctects_t; +////////////////////////////////////////////////////////////////////// +void allowASN1DebugPrints(bool allowASN1DebugPrints) { + debugPrints = allowASN1DebugPrints; +} + ////////////////////////////////////////////////////////////////////// const char* getE2ErrorString(uint64_t errorCode) { @@ -83,8 +83,7 @@ const char* getE2ErrorString(uint64_t errorCode) { ///////////////////////////////////////////////////////////////////// bool E2encode(E2AP_PDU_t* pE2AP_PDU, size_t* dataBufferSize, byte* dataBuffer, char* pLogBuffer) { - // Debug print - if (debug) + if (debugPrints) asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU); asn_enc_rval_t rval; @@ -100,7 +99,7 @@ bool E2encode(E2AP_PDU_t* pE2AP_PDU, size_t* dataBufferSize, byte* dataBuffer, c return false; } else { - if (debug) + if (debugPrints) sprintf(pLogBuffer,"Successfully encoded %s. Buffer size %zu, encoded size %zu",asn_DEF_E2AP_PDU.name, *dataBufferSize, rval.encoded); ASN_STRUCT_FREE(asn_DEF_E2AP_PDU, pE2AP_PDU); @@ -653,8 +652,7 @@ e2ap_pdu_ptr_t* unpackE2AP_pdu(const size_t dataBufferSize, const byte* dataBuff rval = asn_decode(0, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, (void **)&pE2AP_PDU, dataBuffer, dataBufferSize); switch (rval.code) { case RC_OK: - // Debug print - if (debug) { + if (debugPrints) { sprintf(pLogBuffer,"Successfully decoded E2AP-PDU"); asn_fprint(stdout, &asn_DEF_E2AP_PDU, pE2AP_PDU); } diff --git a/e2ap/libe2ap_wrapper/E2AP_if.h b/e2ap/libe2ap_wrapper/E2AP_if.h index aab8aaa..c52db2b 100644 --- a/e2ap/libe2ap_wrapper/E2AP_if.h +++ b/e2ap/libe2ap_wrapper/E2AP_if.h @@ -429,6 +429,8 @@ typedef struct { ////////////////////////////////////////////////////////////////////// // Function declarations +void allowASN1DebugPrints(bool); + const char* getE2ErrorString(uint64_t); typedef void* e2ap_pdu_ptr_t; diff --git a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go index dafac42..dcf84ab 100644 --- a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go +++ b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go @@ -1115,6 +1115,19 @@ func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) String() string { return b.String() } +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +func SetASN1DebugPrintStatus(logLevel int) { + if logLevel >= 4 { + fmt.Println("Setting ASN1 debug prints ON") + C.allowASN1DebugPrints(true) + } else { + fmt.Println("Setting ASN1 debug prints OFF") + C.allowASN1DebugPrints(false) + } +} + //----------------------------------------------------------------------------- // Public E2AP packer creators //----------------------------------------------------------------------------- diff --git a/pkg/control/control.go b/pkg/control/control.go index a3d9cdb..08000b0 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -150,7 +150,7 @@ func NewControl() *Control { e2SubsDb: CreateSdl(), restSubsDb: CreateRESTSdl(), Counters: xapp.Metric.RegisterCounterGroup(GetMetricsOpts(), "SUBMGR"), - LoggerLevel: 4, + LoggerLevel: 1, } e2IfState.Init(c) @@ -161,16 +161,13 @@ func NewControl() *Control { xapp.Resource.InjectRoute("/ric/v1/restsubscriptions", c.GetAllRestSubscriptions, "GET") xapp.Resource.InjectRoute("/ric/v1/symptomdata", c.SymptomDataHandler, "GET") - if readSubsFromDb == "false" { - return c + if readSubsFromDb == "true" { + // Read subscriptions from db + c.ReadE2Subscriptions() + c.ReadRESTSubscriptions() } - // Read subscriptions from db - c.ReadE2Subscriptions() - c.ReadRESTSubscriptions() - go xapp.Subscription.Listen(c.RESTSubscriptionHandler, c.RESTQueryHandler, c.RESTSubscriptionDeleteHandler) - return c } @@ -242,6 +239,7 @@ func (c *Control) ReadConfigParameters(f string) { c.LoggerLevel = int(xapp.Logger.GetLevel()) xapp.Logger.Debug("LoggerLevel= %v", c.LoggerLevel) + c.e2ap.SetASN1DebugPrintStatus(c.LoggerLevel) // viper.GetDuration returns nanoseconds e2tSubReqTimeout = viper.GetDuration("controls.e2tSubReqTimeout_ms") * 1000000 diff --git a/pkg/control/e2ap.go b/pkg/control/e2ap.go index 0aa5ebe..0d763e6 100644 --- a/pkg/control/e2ap.go +++ b/pkg/control/e2ap.go @@ -47,6 +47,13 @@ func SetPackerIf(iface e2ap.E2APPackerIf) { type E2ap struct { } +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +func (c *E2ap) SetASN1DebugPrintStatus(logLevel int) { + e2ap_wrapper.SetASN1DebugPrintStatus(logLevel) +} + //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index 8d559bd..3a11983 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -56,7 +56,8 @@ func createSubmgrControl(srcId teststub.RmrSrcId, rtgSvc teststub.RmrRtgSvc) *te mainCtrl.RmrControl.Init("SUBMGRCTL", srcId, rtgSvc) mainCtrl.c = NewControl() mainCtrl.c.UTTesting = true - mainCtrl.c.LoggerLevel = int(xapp.Logger.GetLevel()) + mainCtrl.c.LoggerLevel = 4 + mainCtrl.c.e2ap.SetASN1DebugPrintStatus(mainCtrl.c.LoggerLevel) xapp.Logger.Debug("Test: LoggerLevel %v", mainCtrl.c.LoggerLevel) xapp.Logger.Debug("Replacing real db with test db") mainCtrl.c.e2SubsDb = CreateMock() // This overrides real E2 Subscription database for testing -- 2.16.6 From 3d80b72cb374aec809740f3bec895d4b37a4fc2f Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Fri, 12 Nov 2021 13:17:15 +0200 Subject: [PATCH 09/16] Unut test counter check code fixed - Missing counters added in UT cases to be checked - One Bug fix added in code. Incorrect response in repeated delete request from xApp. Change-Id: I83599d3db6f130451d9c33a0732274bb5ab51d50 Signed-off-by: Anssi Mannila --- config/submgr-config.yaml | 2 +- e2ap/pkg/e2ap_wrapper/packer_e2ap.go | 4 ++-- pkg/control/control.go | 9 +++++--- pkg/control/metrics_test.go | 6 +++++ pkg/control/registry.go | 1 + pkg/control/ut_ctrl_submgr_test.go | 43 ++++++++++++++++++++++------------- pkg/control/ut_messaging_test.go | 44 ++++++++++++++++++++++++++---------- 7 files changed, 75 insertions(+), 34 deletions(-) diff --git a/config/submgr-config.yaml b/config/submgr-config.yaml index 4851734..87bffbf 100644 --- a/config/submgr-config.yaml +++ b/config/submgr-config.yaml @@ -22,7 +22,7 @@ "e2tRecvMsgTimeout_ms": 2000 "e2tMaxSubReqTryCount": 2 "e2tMaxSubDelReqTryCount": 2 - "checkE2State:" "true" + "checkE2State": "true" "readSubsFromDb": "true" "dbTryCount": 200 "dbRetryForever": "true" diff --git a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go index dcf84ab..73d121f 100644 --- a/e2ap/pkg/e2ap_wrapper/packer_e2ap.go +++ b/e2ap/pkg/e2ap_wrapper/packer_e2ap.go @@ -1120,10 +1120,10 @@ func (e2apMsg *e2apMsgPackerSubscriptionDeleteFailure) String() string { //----------------------------------------------------------------------------- func SetASN1DebugPrintStatus(logLevel int) { if logLevel >= 4 { - fmt.Println("Setting ASN1 debug prints ON") + //fmt.Println("ASN1 debug prints ON") C.allowASN1DebugPrints(true) } else { - fmt.Println("Setting ASN1 debug prints OFF") + //fmt.Println("ASN1 debug prints OFF") C.allowASN1DebugPrints(false) } } diff --git a/pkg/control/control.go b/pkg/control/control.go index 08000b0..7de724e 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -238,7 +238,7 @@ func (c *Control) ReadConfigParameters(f string) { xapp.Logger.Debug("ReadConfigParameters") c.LoggerLevel = int(xapp.Logger.GetLevel()) - xapp.Logger.Debug("LoggerLevel= %v", c.LoggerLevel) + xapp.Logger.Info("LoggerLevel = %v", c.LoggerLevel) c.e2ap.SetASN1DebugPrintStatus(c.LoggerLevel) // viper.GetDuration returns nanoseconds @@ -633,6 +633,7 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e break } } else { + // Timer expiry err = fmt.Errorf("E2 subscription response timeout") errorInfo.SetInfo(err.Error(), "", models.SubscriptionInstanceTimeoutTypeE2Timeout) if subs.PolicyUpdate == true { @@ -641,6 +642,7 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e } xapp.Logger.Error("XAPP-SubReq E2 subscription failed %s", idstring(err, trans, subs)) + c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c) return nil, &errorInfo, err } @@ -746,8 +748,8 @@ func (c *Control) RESTSubscriptionDeleteHandler(restSubId string) int { return common.UnsubscribeBadRequestCode } else if restSubscription.SubDelReqOngoing == true { // Previous request for same restSubId still ongoing - c.UpdateCounter(cRestSubDelFailToXapp) - return common.UnsubscribeBadRequestCode + c.UpdateCounter(cRestSubDelRespToXapp) + return common.UnsubscribeNoContentCode } } } @@ -1116,6 +1118,7 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran case *PackSubscriptionRequestErrortEvent, *SDLWriteErrortEvent: subRfMsg, valid = subs.SetCachedResponse(event, false) default: + // Timer expiry if subs.PolicyUpdate == false { xapp.Logger.Debug("SUBS-SubReq: internal delete due default event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) removeSubscriptionFromDb = true diff --git a/pkg/control/metrics_test.go b/pkg/control/metrics_test.go index b72a9ce..313811c 100644 --- a/pkg/control/metrics_test.go +++ b/pkg/control/metrics_test.go @@ -33,6 +33,7 @@ func TestAddAllCountersOnce(t *testing.T) { Counter{cRestSubReqFromXapp, 1}, Counter{cRestSubRespToXapp, 1}, Counter{cRestSubFailToXapp, 1}, + Counter{cRestReqRejDueE2Down, 1}, Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubReqToE2, 1}, @@ -59,6 +60,8 @@ func TestAddAllCountersOnce(t *testing.T) { Counter{cSDLWriteFailure, 1}, Counter{cSDLReadFailure, 1}, Counter{cSDLRemoveFailure, 1}, + Counter{cE2StateChangedToUp, 1}, + Counter{cE2StateChangedToDown, 1}, }) mainCtrl.c.UpdateCounter(cSubReqFromXapp) @@ -67,6 +70,7 @@ func TestAddAllCountersOnce(t *testing.T) { mainCtrl.c.UpdateCounter(cRestSubReqFromXapp) mainCtrl.c.UpdateCounter(cRestSubRespToXapp) mainCtrl.c.UpdateCounter(cRestSubFailToXapp) + mainCtrl.c.UpdateCounter(cRestReqRejDueE2Down) mainCtrl.c.UpdateCounter(cRestSubNotifToXapp) mainCtrl.c.UpdateCounter(cRestSubFailNotifToXapp) mainCtrl.c.UpdateCounter(cSubReqToE2) @@ -93,6 +97,8 @@ func TestAddAllCountersOnce(t *testing.T) { mainCtrl.c.UpdateCounter(cSDLWriteFailure) mainCtrl.c.UpdateCounter(cSDLReadFailure) mainCtrl.c.UpdateCounter(cSDLRemoveFailure) + mainCtrl.c.UpdateCounter(cE2StateChangedToUp) + mainCtrl.c.UpdateCounter(cE2StateChangedToDown) mainCtrl.VerifyCounterValues(t) } diff --git a/pkg/control/registry.go b/pkg/control/registry.go index 8c79540..07affbd 100644 --- a/pkg/control/registry.go +++ b/pkg/control/registry.go @@ -455,6 +455,7 @@ func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction } func (r *Registry) RouteDelete(subs *Subscription, trans *TransactionXapp, c *Control) { + tmpList := xapp.RmrEndpointList{} tmpList.AddEndpoint(trans.GetEndpoint()) subRouteAction := SubRouteInfo{tmpList, uint16(subs.ReqId.InstanceId)} diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index 3a11983..8727904 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -48,7 +48,9 @@ type Counter struct { type CountersToBeAdded []Counter -var countersBeforeMap map[string]Counter +var allCountersMap map[string]Counter +var allCountersBeforeMap map[string]Counter +var toBeAddedCountersBeforeMap map[string]Counter var toBeAddedCountersMap map[string]Counter func createSubmgrControl(srcId teststub.RmrSrcId, rtgSvc teststub.RmrRtgSvc) *testingSubmgrControl { @@ -302,6 +304,17 @@ func (mc *testingSubmgrControl) GetMetrics(t *testing.T) (string, error) { return string(respBody[:]), nil } +func (mc *testingSubmgrControl) InitAllCounterMap() { + counterOpts := GetMetricsOpts() + + allCountersMap = make(map[string]Counter) + for _, counterOpt := range counterOpts { + //fmt.Printf("counterOpt.Name: '%v'\n", counterOpt.Name) + counter := Counter{counterOpt.Name, 0} + allCountersMap[counterOpt.Name] = counter + } +} + func (mc *testingSubmgrControl) CounterValuesToBeVeriefied(t *testing.T, countersToBeAdded CountersToBeAdded) { if len(toBeAddedCountersMap) == 0 { @@ -314,25 +327,26 @@ func (mc *testingSubmgrControl) CounterValuesToBeVeriefied(t *testing.T, counter } func (mc *testingSubmgrControl) GetCounterValuesBefore(t *testing.T) { - countersBeforeMap = make(map[string]Counter) - countersBeforeMap = mc.GetCurrentCounterValues(t, toBeAddedCountersMap) + toBeAddedCountersBeforeMap = make(map[string]Counter) + toBeAddedCountersBeforeMap = mc.GetCurrentCounterValues(t, toBeAddedCountersMap) + allCountersBeforeMap = make(map[string]Counter) + allCountersBeforeMap = mc.GetCurrentCounterValues(t, allCountersMap) } func (mc *testingSubmgrControl) VerifyCounterValues(t *testing.T) { // Check that expected counters are added ok + // Get current values of counters exected to be added currentCountersMap := mc.GetCurrentCounterValues(t, toBeAddedCountersMap) for _, toBeAddedCounter := range toBeAddedCountersMap { if currentCounter, ok := currentCountersMap[toBeAddedCounter.Name]; ok == true { - if beforeCounter, ok := countersBeforeMap[toBeAddedCounter.Name]; ok == true { + if beforeCounter, ok := toBeAddedCountersBeforeMap[toBeAddedCounter.Name]; ok == true { if currentCounter.Value != beforeCounter.Value+toBeAddedCounter.Value { mc.TestError(t, "Error in expected counter value: counterName %v, current value %v, expected value %v", currentCounter.Name, currentCounter.Value, beforeCounter.Value+toBeAddedCounter.Value) - - //fmt.Printf("beforeCounter.Value=%v, toBeAddedCounter.Value=%v, \n",beforeCounter.Value, toBeAddedCounter.Value) } } else { - mc.TestError(t, "Counter %v not in countersBeforeMap", toBeAddedCounter.Name) + mc.TestError(t, "Counter %v not in toBeAddedCountersBeforeMap", toBeAddedCounter.Name) } } else { mc.TestError(t, "Counter %v not in currentCountersMap", toBeAddedCounter.Name) @@ -340,24 +354,22 @@ func (mc *testingSubmgrControl) VerifyCounterValues(t *testing.T) { } // Check that not any unexpected counter are added (this is not working correctly!) + // Get current values of all counters + currentCountersMap = mc.GetCurrentCounterValues(t, allCountersMap) for _, currentCounter := range currentCountersMap { if _, ok := toBeAddedCountersMap[currentCounter.Name]; ok == false { - if beforeCounter, ok := countersBeforeMap[currentCounter.Name]; ok == true { + if beforeCounter, ok := allCountersBeforeMap[currentCounter.Name]; ok == true { if currentCounter.Value != beforeCounter.Value { - mc.TestError(t, "Error: unexpected counter value added: counterName %v, current value %v, expected value %v", - currentCounter.Name, beforeCounter.Value, beforeCounter.Value) - - //fmt.Printf("beforeCounter.Value=%v, toBeAddedCounter.Value=%v, \n",beforeCounter.Value, toBeAddedCounter.Value) + mc.TestError(t, "Error: unexpected counter added: counterName %v, current value %v, expected value %v", + currentCounter.Name, currentCounter.Value, beforeCounter.Value) } - } else { - mc.TestError(t, "Counter %v not in countersBeforeMap", beforeCounter.Name) } } } // Make map empty - //fmt.Printf("toBeAddedCountersMap=%v\n",toBeAddedCountersMap) toBeAddedCountersMap = make(map[string]Counter) + allCountersBeforeMap = make(map[string]Counter) } func (mc *testingSubmgrControl) GetCurrentCounterValues(t *testing.T, chekedCountersMap map[string]Counter) map[string]Counter { @@ -388,7 +400,6 @@ func (mc *testingSubmgrControl) GetCurrentCounterValues(t *testing.T, chekedCoun if len(retCounterMap) != len(chekedCountersMap) { mc.TestError(t, "Error: len(retCounterMap) != len(chekedCountersMap)") - } return retCounterMap } diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 5cc7458..19680e8 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -39,6 +39,7 @@ func TestSuiteSetup(t *testing.T) { // like this:git log // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) + mainCtrl.InitAllCounterMap() SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) mainCtrl.c.restDuplicateCtrl.Init() @@ -95,6 +96,7 @@ func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") mainCtrl.VerifyCounterValues(t) + //os.Exit(1) } //----------------------------------------------------------------------------- @@ -726,6 +728,7 @@ func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { // Init counter check mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cSubRespToXapp, 2}, @@ -734,6 +737,7 @@ func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cSubDelRespToXapp, 2}, + Counter{cUnmergedSubscriptions, 1}, }) //Req1 @@ -1260,6 +1264,7 @@ func TestSubReqRetryInSubmgr(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cSubReqFromXapp, 1}, Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cSubRespToXapp, 1}, @@ -2777,6 +2782,7 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, @@ -2786,6 +2792,7 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 2}, + Counter{cUnmergedSubscriptions, 1}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -2941,6 +2948,7 @@ func TestRESTSubReqRetransmissionV2(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, Counter{cRestSubRespToXapp, 3}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, @@ -3025,6 +3033,7 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, Counter{cRestSubRespToXapp, 3}, Counter{cSubReqToE2, 1}, Counter{cSubRespFromE2, 1}, @@ -3129,6 +3138,7 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, Counter{cRestSubRespToXapp, 3}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, @@ -3250,6 +3260,7 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 2}, Counter{cRestSubRespToXapp, 3}, Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 2}, @@ -3382,6 +3393,7 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 3}, + Counter{cDuplicateE2SubReq, 1}, Counter{cRestSubRespToXapp, 3}, Counter{cSubReqToE2, 3}, Counter{cSubRespFromE2, 3}, @@ -3453,7 +3465,7 @@ func TestRESTSubDelReqRetransmission(t *testing.T) { Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cRestSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 2}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -3517,6 +3529,7 @@ func TestRESTSubReqDelReq(t *testing.T) { Counter{cSubRespFromE2, 1}, Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 2}, + Counter{cRestSubDelFailToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, @@ -3641,7 +3654,6 @@ func TestRESTSameSubsDiffRan(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - } func TestRESTSubReqRetryInSubmgr(t *testing.T) { @@ -3652,6 +3664,7 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { Counter{cRestSubReqFromXapp, 1}, Counter{cRestSubRespToXapp, 1}, Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubRespFromE2, 1}, Counter{cRestSubNotifToXapp, 1}, @@ -3737,10 +3750,10 @@ func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { Counter{cSubReqToE2, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubReqTimerExpiry, 2}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, }) - params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) @@ -3772,10 +3785,11 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { Counter{cSubReqToE2, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubReqTimerExpiry, 2}, + Counter{cSubDelReReqToE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelReqTimerExpiry, 2}, }) - params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) @@ -3849,6 +3863,7 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { Counter{cSubReqToE2, 1}, Counter{cSubReReqToE2, 1}, Counter{cSubReqTimerExpiry, 2}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelReqTimerExpiry, 2}, @@ -3915,6 +3930,7 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { Counter{cSubFailFromE2, 1}, Counter{cRestSubFailNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 @@ -3983,6 +3999,7 @@ func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, @@ -4043,6 +4060,7 @@ func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, + Counter{cSubDelReqTimerExpiry, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, @@ -4339,7 +4357,7 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { // | RESTSubReq2 | | // |------------------------------>| | // | | | | -// | RESTSubDelResp2 | | +// | RESTSubResp2 | | // |<------------------------------| | // | | | SubReq1 | // | | |------------->| @@ -4375,15 +4393,17 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, + Counter{cSubReqTimerExpiry, 2}, + Counter{cSubReReqToE2, 1}, Counter{cRestSubFailNotifToXapp, 2}, Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 2}, }) - const subReqCount int = 1 // Req1 @@ -4475,6 +4495,7 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ Counter{cRestSubReqFromXapp, 2}, + Counter{cMergedSubscriptions, 1}, Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 1}, Counter{cSubFailFromE2, 1}, @@ -4971,6 +4992,7 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubFailNotifToXapp, 1}, }) const subReqCount int = 1 @@ -5054,9 +5076,9 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, }) - // Remove possible existing subscription mainCtrl.removeExistingSubscriptions(t) @@ -6759,6 +6781,7 @@ func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { Counter{cRestSubReqFromXapp, 2}, Counter{cRestSubRespToXapp, 2}, Counter{cSubReqToE2, 2}, + Counter{cSubReqTimerExpiry, 1}, Counter{cSubRespFromE2, 1}, Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubFailNotifToXapp, 1}, @@ -6865,9 +6888,10 @@ func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 1}, Counter{cRestSubNotifToXapp, 1}, - Counter{cRestSubNotifToXapp, 1}, + Counter{cRestSubFailNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, + Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, }) @@ -6914,10 +6938,6 @@ func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { // Check subscription queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) - xapp.Logger.Debug("Here 1") - //<-time.After(3 * time.Second) - xapp.Logger.Debug("Here 2") - // Delete subscription xappConn1.SendRESTSubsDelReq(t, &restSubId) delreq, delmsg := e2termConn1.RecvSubsDelReq(t) -- 2.16.6 From 989d584ada9e40aa97848700bd26c9b7af72b91d Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Fri, 12 Nov 2021 13:58:55 +0200 Subject: [PATCH 10/16] Ubuntu base image change - bldr-ubuntu18-c-go:1.9.0 -> bldr-ubuntu20-c-go:1.0.0 - Last build phase FROM ubuntu:18.04 -> FROM ubuntu:20.04 Change-Id: I08abb36c9497daae25702eaf1d5f27e43769e830 Signed-off-by: Anssi Mannila --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 721f158..7f75fa6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ ########################################################### # ########################################################### -FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as submgrcore +FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0 as submgrcore ARG g14="1.14.4" ARG GOVERSION="1.14" @@ -211,7 +211,7 @@ RUN test -z "$(gofmt -l pkg/teststube2ap/*.go)" ########################################################### # ########################################################### -FROM ubuntu:18.04 +FROM ubuntu:20.04 RUN apt update && apt install -y iputils-ping net-tools curl tcpdump -- 2.16.6 From afadb6df033657afef927964aa637ba7c8fc0880 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Mon, 15 Nov 2021 15:03:12 +0200 Subject: [PATCH 11/16] Verify all clean function added for unit tests Change-Id: Iee26580a1e34c51bc2c32f0bacc14cb1d16ae61e Signed-off-by: Anssi Mannila --- pkg/control/sdl_e2SubsDb.go | 11 +++++ pkg/control/sdl_e2SubsDb_test.go | 11 +++++ pkg/control/sdl_restSubsDb.go | 11 +++++ pkg/control/sdl_restSubsDb_test.go | 11 +++++ pkg/control/ut_ctrl_submgr_test.go | 9 ++++ pkg/control/ut_messaging_test.go | 85 +++++++++++++++++++++++++++++++------- 6 files changed, 124 insertions(+), 14 deletions(-) diff --git a/pkg/control/sdl_e2SubsDb.go b/pkg/control/sdl_e2SubsDb.go index 3305e41..d1830de 100644 --- a/pkg/control/sdl_e2SubsDb.go +++ b/pkg/control/sdl_e2SubsDb.go @@ -223,3 +223,14 @@ func (c *Control) RemoveAllSubscriptionsFromSdl() error { } return nil } + +func (c *Control) GetE2KeyCount() (int, error) { + + // Get all keys + keys, err := c.e2SubsDb.GetAll(e2SubSdlNs) + if err != nil { + c.UpdateCounter(cSDLReadFailure) + return 0, fmt.Errorf("SDL: GetE2KeyCount(), GetAll(). Error while reading E2 subscriptions keys from DBAAS %s\n", err.Error()) + } + return len(keys), nil +} diff --git a/pkg/control/sdl_e2SubsDb_test.go b/pkg/control/sdl_e2SubsDb_test.go index 3175cc9..df0d060 100644 --- a/pkg/control/sdl_e2SubsDb_test.go +++ b/pkg/control/sdl_e2SubsDb_test.go @@ -198,6 +198,17 @@ func TestWriteSubscriptionToSdl(t *testing.T) { if err != nil { t.Errorf("TEST: %s", err.Error()) } + verifyE2KeyCount(t, 1) +} + +func verifyE2KeyCount(t *testing.T, expectedCount int) { + + count, err := mainCtrl.c.GetE2KeyCount() + if err != nil { + t.Errorf("TEST: %s", err.Error()) + } else { + assert.Equal(t, expectedCount, count) + } } func TestReadSubscriptionFromSdl(t *testing.T) { diff --git a/pkg/control/sdl_restSubsDb.go b/pkg/control/sdl_restSubsDb.go index 9178cb6..a0afbc0 100644 --- a/pkg/control/sdl_restSubsDb.go +++ b/pkg/control/sdl_restSubsDb.go @@ -176,3 +176,14 @@ func (c *Control) RemoveAllRESTSubscriptionsFromSdl() error { } return nil } + +func (c *Control) GetRESTKeyCount() (int, error) { + + // Get all keys + keys, err := c.restSubsDb.GetAll(restSubSdlNs) + if err != nil { + c.UpdateCounter(cSDLReadFailure) + return 0, fmt.Errorf("SDL: GetRESTKeyCount(), GetAll(). Error while reading E2 subscriptions keys from DBAAS %s\n", err.Error()) + } + return len(keys), nil +} diff --git a/pkg/control/sdl_restSubsDb_test.go b/pkg/control/sdl_restSubsDb_test.go index 273a15e..3db8a2d 100644 --- a/pkg/control/sdl_restSubsDb_test.go +++ b/pkg/control/sdl_restSubsDb_test.go @@ -120,6 +120,17 @@ func TestWriteRESTSubscriptionToSdl(t *testing.T) { t.Errorf("TEST: %s", err.Error()) } restSubsDbMock.AddRestSubIdsInDb(restSubId) + verifyRESTKeyCount(t, 1) +} + +func verifyRESTKeyCount(t *testing.T, expectedCount int) { + + count, err := mainCtrl.c.GetRESTKeyCount() + if err != nil { + t.Errorf("TEST: %s", err.Error()) + } else { + assert.Equal(t, expectedCount, count) + } } func TestReadRESTSubscriptionFromSdl(t *testing.T) { diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index 8727904..65edd1b 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -21,6 +21,7 @@ package control import ( "fmt" + "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "strconv" @@ -285,6 +286,14 @@ func (mc *testingSubmgrControl) wait_msgcounter_change(t *testing.T, orig uint64 return 0, false } +func (mc *testingSubmgrControl) VerifyAllClean(t *testing.T) { + // Verify that all resources are freed + assert.Equal(t, 0, len(mainCtrl.c.registry.register)) + assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) + verifyRESTKeyCount(t, 0) + verifyE2KeyCount(t, 0) +} + func (mc *testingSubmgrControl) GetMetrics(t *testing.T) (string, error) { req, err := http.NewRequest("GET", "http://localhost:8080/ric/v1/metrics", nil) if err != nil { diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 19680e8..99ceafc 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -96,6 +96,7 @@ func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) //os.Exit(1) } @@ -175,6 +176,7 @@ func TestRESTSubReqE2ConnBreak(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -251,6 +253,7 @@ func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -314,6 +317,7 @@ func TestRESTOtherE2ConnectionChanges(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -363,6 +367,7 @@ func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { deleteSubscription(t, xappConn1, e2termConn1, &restSubId) waitSubsCleanup(t, e2SubsId, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -409,6 +414,7 @@ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) waitSubsCleanup(t, e2SubsId, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -471,6 +477,7 @@ func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) waitSubsCleanup(t, e2SubsId, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2692,6 +2699,7 @@ func TestRESTSubReqAndRouteNok(t *testing.T) { mainCtrl.wait_subs_clean(t, newSubsId, 10) waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { @@ -2740,6 +2748,7 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) //This test case is not working correctly } func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { @@ -2775,6 +2784,7 @@ func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + ////mainCtrl.VerifyAllClean(t) This test case is not working correctly } func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { @@ -2817,6 +2827,7 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2899,6 +2910,7 @@ func TestRESTSubReqRetransmission(t *testing.T) { mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2985,6 +2997,7 @@ func TestRESTSubReqRetransmissionV2(t *testing.T) { //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3074,6 +3087,7 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3196,6 +3210,7 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3320,6 +3335,7 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3451,6 +3467,7 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqRetransmission(t *testing.T) { @@ -3488,6 +3505,7 @@ func TestRESTSubDelReqRetransmission(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3559,7 +3577,7 @@ func TestRESTSubReqDelReq(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqCollision(t *testing.T) { @@ -3617,7 +3635,7 @@ func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSameSubsDiffRan(t *testing.T) { @@ -3654,6 +3672,7 @@ func TestRESTSameSubsDiffRan(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqRetryInSubmgr(t *testing.T) { @@ -3698,7 +3717,7 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3773,6 +3792,7 @@ func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestREST2eTermNotRespondingToSubReq(t *testing.T) { @@ -3812,7 +3832,7 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3891,6 +3911,7 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3958,7 +3979,7 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4022,6 +4043,7 @@ func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4084,6 +4106,7 @@ func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4140,6 +4163,7 @@ func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4241,6 +4265,7 @@ func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4335,6 +4360,7 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4443,6 +4469,7 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4540,6 +4567,7 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { @@ -4575,6 +4603,7 @@ func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4669,6 +4698,7 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4750,6 +4780,7 @@ func TestRESTSubReqPolicyChangeNOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4853,6 +4884,7 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4952,6 +4984,7 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5024,6 +5057,7 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5104,6 +5138,7 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5218,6 +5253,7 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5311,6 +5347,7 @@ func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } /* @@ -5358,6 +5395,7 @@ func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { @@ -5392,6 +5430,7 @@ func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { @@ -5423,6 +5462,7 @@ func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { @@ -5457,6 +5497,7 @@ func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { @@ -5491,6 +5532,7 @@ func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { @@ -5525,6 +5567,7 @@ func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { @@ -5571,7 +5614,7 @@ func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { @@ -5623,7 +5666,7 @@ func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { @@ -5669,7 +5712,7 @@ func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqDiffActionType(t *testing.T) { @@ -5720,7 +5763,7 @@ func TestRESTSubReqDiffActionType(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { @@ -5771,7 +5814,7 @@ func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { @@ -5818,7 +5861,7 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { @@ -5865,7 +5908,7 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { @@ -5910,7 +5953,7 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5975,6 +6018,7 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6049,6 +6093,7 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6131,7 +6176,7 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6196,6 +6241,7 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6268,6 +6314,7 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6345,6 +6392,7 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6406,6 +6454,7 @@ func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6467,6 +6516,7 @@ func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6529,6 +6579,7 @@ func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6589,6 +6640,7 @@ func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6650,6 +6702,7 @@ func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6712,6 +6765,7 @@ func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6772,6 +6826,7 @@ func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { @@ -6831,6 +6886,7 @@ func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6947,6 +7003,7 @@ func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) + //mainCtrl.VerifyAllClean(t) } //////////////////////////////////////////////////////////////////////////////////// -- 2.16.6 From b43397e236303243729347b327d9ace8262469d9 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Tue, 16 Nov 2021 12:06:16 +0200 Subject: [PATCH 12/16] Verify all clean function taken in use in all unit test cases. Two merge related test cases commented out as they did not pass and require code fix. Change-Id: Ib716f5f62d57227b3c4318f03e55ba671fddc62c Signed-off-by: Anssi Mannila --- pkg/control/control.go | 16 +-- pkg/control/ut_ctrl_submgr_test.go | 9 +- pkg/control/ut_messaging_test.go | 242 ++++++++++++++++++++----------------- 3 files changed, 151 insertions(+), 116 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 7de724e..4c09ee2 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -461,6 +461,7 @@ func (c *Control) RESTSubscriptionHandler(params interface{}) (*models.Subscript if duplicate { err := fmt.Errorf("Retransmission blocker direct ACK for request of restSubsId %s restSubId MD5sum %s as retransmission", restSubId, md5sum) xapp.Logger.Debug("%s", err) + c.registry.DeleteRESTSubscription(&restSubId) c.UpdateCounter(cRestSubRespToXapp) return &subResp, common.SubscribeCreatedCode } @@ -469,6 +470,7 @@ func (c *Control) RESTSubscriptionHandler(params interface{}) (*models.Subscript e2SubscriptionDirectives, err := c.GetE2SubscriptionDirectives(p) if err != nil { xapp.Logger.Error("%s", err) + c.registry.DeleteRESTSubscription(&restSubId) return nil, common.SubscribeBadRequestCode } go c.processSubscriptionRequests(restSubscription, &subReqList, p.ClientEndpoint, p.Meid, &restSubId, xAppRmrEndpoint, md5sum, e2SubscriptionDirectives) @@ -520,7 +522,7 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription clientEndpoint *models.SubscriptionParamsClientEndpoint, meid *string, restSubId *string, xAppRmrEndpoint string, md5sum string, e2SubscriptionDirectives *E2SubscriptionDirectives) { c.SubscriptionProcessingStartDelay() - xapp.Logger.Debug("Subscription Request count=%v ", len(subReqList.E2APSubscriptionRequests)) + xapp.Logger.Debug("E2 SubscriptionRequest count =%v ", len(subReqList.E2APSubscriptionRequests)) var xAppEventInstanceID int64 var e2EventInstanceID int64 @@ -615,18 +617,16 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e c.RemoveSubscriptionFromDb(subs) err = fmt.Errorf("E2 interface down") errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") - return nil, &errorInfo, err } case *e2ap.E2APSubscriptionFailure: err = fmt.Errorf("E2 SubscriptionFailure received") errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") - return nil, &errorInfo, err case *PackSubscriptionRequestErrortEvent: err = fmt.Errorf("E2 SubscriptionRequest pack failure") - return nil, &themsg.ErrorInfo, err + errorInfo = themsg.ErrorInfo case *SDLWriteErrortEvent: err = fmt.Errorf("SDL write failure") - return nil, &themsg.ErrorInfo, err + errorInfo = themsg.ErrorInfo default: err = fmt.Errorf("Unexpected E2 subscription response received") errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") @@ -642,7 +642,6 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e } xapp.Logger.Error("XAPP-SubReq E2 subscription failed %s", idstring(err, trans, subs)) - c.registry.RemoveFromSubscription(subs, trans, waitRouteCleanup_ms, c) return nil, &errorInfo, err } @@ -683,6 +682,7 @@ func (c *Control) sendUnsuccesfullResponseNotification(restSubId *string, restSu c.UpdateCounter(cRestSubFailNotifToXapp) xapp.Subscription.Notify(resp, *clientEndpoint) + // E2 is down. Delete completely processed request safely now if c.e2IfState.IsE2ConnectionUp(&restSubscription.Meid) == false && restSubscription.SubReqOngoing == false { c.registry.DeleteRESTSubscription(restSubId) c.RemoveRESTSubscriptionFromDb(*restSubId) @@ -717,6 +717,7 @@ func (c *Control) sendSuccesfullResponseNotification(restSubId *string, restSubs c.UpdateCounter(cRestSubNotifToXapp) xapp.Subscription.Notify(resp, *clientEndpoint) + // E2 is down. Delete completely processed request safely now if c.e2IfState.IsE2ConnectionUp(&restSubscription.Meid) == false && restSubscription.SubReqOngoing == false { c.registry.DeleteRESTSubscription(restSubId) c.RemoveRESTSubscriptionFromDb(*restSubId) @@ -1116,6 +1117,7 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran // This simulates that no response has been received and after restart subscriptions are restored from db xapp.Logger.Debug("Test restart flag is active. Dropping this transaction to test restart case") case *PackSubscriptionRequestErrortEvent, *SDLWriteErrortEvent: + removeSubscriptionFromDb = true subRfMsg, valid = subs.SetCachedResponse(event, false) default: // Timer expiry @@ -1189,7 +1191,7 @@ func (c *Control) sendE2TSubscriptionRequest(subs *Subscription, trans *Transact subReqMsg.RequestId.Id = ricRequestorId trans.Mtype, trans.Payload, err = c.e2ap.PackSubscriptionRequest(subReqMsg) if err != nil { - xapp.Logger.Error("SUBS-SubReq: %s", idstring(err, trans, subs, parentTrans)) + xapp.Logger.Error("SUBS-SubReq ASN1 pack error: %s", idstring(err, trans, subs, parentTrans)) return &PackSubscriptionRequestErrortEvent{ ErrorInfo{ ErrorSource: models.SubscriptionInstanceErrorSourceASN1, diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index 65edd1b..ea3ffd9 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -21,7 +21,6 @@ package control import ( "fmt" - "github.com/stretchr/testify/assert" "io/ioutil" "net/http" "strconv" @@ -29,6 +28,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststub" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" @@ -289,7 +290,13 @@ func (mc *testingSubmgrControl) wait_msgcounter_change(t *testing.T, orig uint64 func (mc *testingSubmgrControl) VerifyAllClean(t *testing.T) { // Verify that all resources are freed assert.Equal(t, 0, len(mainCtrl.c.registry.register)) + if len(mainCtrl.c.registry.register) > 0 { + fmt.Printf("registry.register: %v\n", mainCtrl.c.registry.register) + } assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) + if len(mainCtrl.c.registry.restSubscriptions) > 0 { + fmt.Printf("registry.restSubscriptions: %v\n", mainCtrl.c.registry.restSubscriptions) + } verifyRESTKeyCount(t, 0) verifyE2KeyCount(t, 0) } diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 99ceafc..6ce7b51 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -96,7 +96,7 @@ func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) //os.Exit(1) } @@ -176,7 +176,7 @@ func TestRESTSubReqE2ConnBreak(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -253,7 +253,7 @@ func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -317,7 +317,7 @@ func TestRESTOtherE2ConnectionChanges(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -367,7 +367,7 @@ func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { deleteSubscription(t, xappConn1, e2termConn1, &restSubId) waitSubsCleanup(t, e2SubsId, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -414,7 +414,7 @@ func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) waitSubsCleanup(t, e2SubsId, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -477,7 +477,7 @@ func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) waitSubsCleanup(t, e2SubsId, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2699,7 +2699,7 @@ func TestRESTSubReqAndRouteNok(t *testing.T) { mainCtrl.wait_subs_clean(t, newSubsId, 10) waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { @@ -2714,10 +2714,10 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { Counter{cRestSubNotifToXapp, 1}, Counter{cRestSubFailNotifToXapp, 1}, Counter{cRouteCreateUpdateFail, 1}, - Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cRestSubDelRespToXapp, 1}, + Counter{cRestSubDelRespToXapp, 2}, }) var params *teststube2ap.RESTSubsReqParams = nil @@ -2736,19 +2736,19 @@ func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") waiter.WaitResult(t) - // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete xappConn2.WaitRESTNotification(t, restSubId2) queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) deleteSubscription(t, xappConn1, e2termConn1, &restSubId) + xappConn2.SendRESTSubsDelReq(t, &restSubId2) mainCtrl.wait_subs_clean(t, newSubsId, 10) //Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) //This test case is not working correctly + mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { @@ -2782,9 +2782,8 @@ func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { waiter.WaitResult(t) waitSubsCleanup(t, e2SubsId, 10) - mainCtrl.VerifyCounterValues(t) - ////mainCtrl.VerifyAllClean(t) This test case is not working correctly + mainCtrl.VerifyAllClean(t) } func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { @@ -2827,7 +2826,7 @@ func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2883,34 +2882,32 @@ func TestRESTSubReqRetransmission(t *testing.T) { // Subs Create const subReqCount int = 1 - // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create - // gets into execution before the rtmgrg responds for the first one. - waiter := rtmgrHttp.AllocNextSleep(10, true) params := xappConn1.GetRESTSubsReqReportParams(subReqCount) - restSubId1 := xappConn1.SendRESTSubsReq(t, params) - xappConn2.SendRESTSubsReq(t, params) + restSubId := xappConn1.SendRESTSubsReq(t, params) - waiter.WaitResult(t) + xappConn1.SendRESTSubsReq(t, params) + <-time.After(time.Second * 1) - xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) + xappConn1.WaitListedRestNotifications(t, []string{restSubId}) // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus - // the order is not significant he6re. + // the order is not significant here. crereq, cremsg := e2termConn1.RecvSubsReq(t) e2termConn1.SendSubsResp(t, crereq, cremsg) - e2SubsIdA := <-xappConn1.ListedRESTNotifications - xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) + e2SubsId := <-xappConn1.ListedRESTNotifications + + xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) // Del1 - xappConn1.SendRESTSubsDelReq(t, &restSubId1) + xappConn1.SendRESTSubsDelReq(t, &restSubId) delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) - mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) + mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -2994,10 +2991,8 @@ func TestRESTSubReqRetransmissionV2(t *testing.T) { deleteSubscription(t, xappConn1, e2termConn1, &restSubId) waitSubsCleanup(t, e2SubsId, 10) - - //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3084,10 +3079,8 @@ func TestRESTSubReqRetransmissionV3(t *testing.T) { deleteSubscription(t, xappConn1, e2termConn1, &restSubId) waitSubsCleanup(t, e2SubsId, 10) - - //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3207,10 +3200,8 @@ func TestRESTSubReqRetransmissionV4(t *testing.T) { sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) waitSubsCleanup(t, e2SubsId, 10) - - //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3332,10 +3323,8 @@ func TestRESTSubReqRetransmissionV5(t *testing.T) { sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) waitSubsCleanup(t, e2SubsId, 10) - - //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3464,10 +3453,8 @@ func TestRESTSubReqRetransmissionV6(t *testing.T) { deleteSubscription(t, xappConn1, e2termConn1, &restSubId) waitSubsCleanup(t, e2SubsId, 10) - - //Wait that subs is cleaned mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqRetransmission(t *testing.T) { @@ -3503,9 +3490,8 @@ func TestRESTSubDelReqRetransmission(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq, delmsg) waitSubsCleanup(t, e2SubsId, 10) - mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3577,7 +3563,7 @@ func TestRESTSubReqDelReq(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubDelReqCollision(t *testing.T) { @@ -3635,7 +3621,7 @@ func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSameSubsDiffRan(t *testing.T) { @@ -3672,7 +3658,7 @@ func TestRESTSameSubsDiffRan(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqRetryInSubmgr(t *testing.T) { @@ -3717,7 +3703,7 @@ func TestRESTSubReqRetryInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3772,7 +3758,10 @@ func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) @@ -3788,11 +3777,12 @@ func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq, delmsg) xappConn1.WaitRESTNotification(t, restSubId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) - mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestREST2eTermNotRespondingToSubReq(t *testing.T) { @@ -3809,7 +3799,10 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { Counter{cRestSubFailNotifToXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelReqTimerExpiry, 2}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) + params := xappConn1.GetRESTSubsReqReportParams(subReqCount) restSubId := xappConn1.SendRESTSubsReq(t, params) xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) @@ -3829,10 +3822,11 @@ func TestREST2eTermNotRespondingToSubReq(t *testing.T) { e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - waitSubsCleanup(t, e2SubsId, 10) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3887,6 +3881,8 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { Counter{cSubDelReqToE2, 1}, Counter{cSubDelReReqToE2, 1}, Counter{cSubDelReqTimerExpiry, 2}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) params := xappConn1.GetRESTSubsReqReportParams(subReqCount) @@ -3908,10 +3904,11 @@ func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - waitSubsCleanup(t, e2SubsId, 10) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -3979,7 +3976,7 @@ func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4043,7 +4040,7 @@ func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4106,7 +4103,7 @@ func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4163,7 +4160,7 @@ func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4263,9 +4260,8 @@ func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { //Wait that subs is cleaned waitSubsCleanup(t, e2SubsId2, 10) - mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4358,11 +4354,11 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) waitSubsCleanup(t, e2SubsId2, 10) - mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } +/* //----------------------------------------------------------------------------- // TestRESTSubReqAndSubDelNoAnswerSameActionParallel // @@ -4467,9 +4463,8 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { //Wait that subs is cleaned waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) - mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4565,11 +4560,10 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { //Wait that subs is cleaned waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) - mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } - +*/ func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { CaseBegin("TestRESTSubReqPolicyAndSubDelOk") @@ -4603,7 +4597,7 @@ func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4698,7 +4692,7 @@ func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4780,7 +4774,7 @@ func TestRESTSubReqPolicyChangeNOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4884,7 +4878,7 @@ func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4984,7 +4978,7 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -4998,6 +4992,8 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { // | RESTSubReq | | // |------------->| | // | | | +// | RESTSubResp | | +// |<-------------| | // | | SubReq | // | |------------->| // | | | @@ -5013,6 +5009,15 @@ func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { // | | SubDelResp | // | |<-------------| // | | | +// | RESTNotif | | +// | unsuccess | | +// |<-------------| | +// | | | +// | RESTSubDelReq| | +// |------------->| | +// | | | +// |RESTSubDelResp| | +// |<-------------| | // //----------------------------------------------------------------------------- func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { @@ -5026,6 +5031,8 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 @@ -5047,17 +5054,19 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") - //Del + // Deleletion of uncompleted subscription delreq, delmsg := e2termConn1.RecvSubsDelReq(t) e2termConn1.SendSubsDelResp(t, delreq, delmsg) + //Del + xappConn1.SendRESTSubsDelReq(t, &restSubId) + xappConn1.TestMsgChanEmpty(t) - xappConn2.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5138,7 +5147,7 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5253,7 +5262,7 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -5347,7 +5356,7 @@ func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } /* @@ -5395,7 +5404,7 @@ func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { @@ -5430,7 +5439,7 @@ func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { @@ -5462,7 +5471,7 @@ func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { @@ -5497,7 +5506,7 @@ func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { @@ -5532,7 +5541,7 @@ func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { @@ -5567,7 +5576,7 @@ func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { mainCtrl.wait_registry_empty(t, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { @@ -5614,7 +5623,7 @@ func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { @@ -5666,7 +5675,7 @@ func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { @@ -5712,7 +5721,7 @@ func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqDiffActionType(t *testing.T) { @@ -5763,7 +5772,7 @@ func TestRESTSubReqDiffActionType(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { @@ -5814,7 +5823,7 @@ func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { @@ -5861,7 +5870,7 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { @@ -5908,7 +5917,7 @@ func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { @@ -5953,7 +5962,7 @@ func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { waitSubsCleanup(t, e2SubsId2, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6012,13 +6021,15 @@ func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6087,13 +6098,15 @@ func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, orgInstanceId, 10) xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6170,13 +6183,15 @@ func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6235,13 +6250,15 @@ func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6308,13 +6325,15 @@ func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6386,13 +6405,15 @@ func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { instanceId := xappConn1.WaitRESTNotification(t, restSubId) xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6454,7 +6475,7 @@ func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6516,7 +6537,7 @@ func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6579,7 +6600,7 @@ func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6640,7 +6661,7 @@ func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6702,7 +6723,7 @@ func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6765,7 +6786,7 @@ func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { xappConn1.TestMsgChanEmpty(t) e2termConn1.TestMsgChanEmpty(t) mainCtrl.wait_registry_empty(t, 10) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -6804,6 +6825,8 @@ func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { Counter{cRestSubReqFromXapp, 1}, Counter{cRestSubRespToXapp, 1}, Counter{cRestSubFailNotifToXapp, 1}, + Counter{cRestSubDelReqFromXapp, 1}, + Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 @@ -6823,10 +6846,13 @@ func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) + + xappConn1.SendRESTSubsDelReq(t, &restSubId) + // Wait that subs is cleaned waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { @@ -6886,7 +6912,7 @@ func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //----------------------------------------------------------------------------- @@ -7003,7 +7029,7 @@ func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { waitSubsCleanup(t, e2SubsId, 10) mainCtrl.VerifyCounterValues(t) - //mainCtrl.VerifyAllClean(t) + mainCtrl.VerifyAllClean(t) } //////////////////////////////////////////////////////////////////////////////////// -- 2.16.6 From 54838ed6fb79821c3711f92876993264d358f2c3 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Fri, 19 Nov 2021 11:25:01 +0200 Subject: [PATCH 13/16] Fixes for subscription merge release cases - Code fixes - UT cases fixes and improvements Change-Id: I97c295d51029888b41ae0dacac76d366eaeb3c54 Signed-off-by: Anssi Mannila --- pkg/control/control.go | 61 +++++++++++++++++------- pkg/control/registry.go | 98 ++++++++++++++++---------------------- pkg/control/ut_ctrl_submgr_test.go | 60 +++++++++++++---------- pkg/control/ut_messaging_test.go | 76 +++++++++++++++++------------ 4 files changed, 166 insertions(+), 129 deletions(-) diff --git a/pkg/control/control.go b/pkg/control/control.go index 4c09ee2..68688e2 100755 --- a/pkg/control/control.go +++ b/pkg/control/control.go @@ -25,6 +25,7 @@ import ( "os" "strconv" "strings" + "sync" "time" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" @@ -213,6 +214,8 @@ func (c *Control) ReadE2Subscriptions() error { // //------------------------------------------------------------------- func (c *Control) ReadRESTSubscriptions() error { + + xapp.Logger.Debug("ReadRESTSubscriptions()") var err error var restSubscriptions map[string]*RESTSubscription for i := 0; dbRetryForever == "true" || i < dbTryCount; i++ { @@ -222,6 +225,12 @@ func (c *Control) ReadRESTSubscriptions() error { xapp.Logger.Error("%v", err) <-time.After(1 * time.Second) } else { + // Fix REST subscriptions ongoing status after restart + for restSubId, restSubscription := range restSubscriptions { + restSubscription.SubReqOngoing = false + restSubscription.SubDelReqOngoing = false + c.WriteRESTSubscriptionToSdl(restSubId, restSubscription) + } c.registry.restSubscriptions = restSubscriptions return nil } @@ -522,7 +531,7 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription clientEndpoint *models.SubscriptionParamsClientEndpoint, meid *string, restSubId *string, xAppRmrEndpoint string, md5sum string, e2SubscriptionDirectives *E2SubscriptionDirectives) { c.SubscriptionProcessingStartDelay() - xapp.Logger.Debug("E2 SubscriptionRequest count =%v ", len(subReqList.E2APSubscriptionRequests)) + xapp.Logger.Debug("E2 SubscriptionRequest count = %v ", len(subReqList.E2APSubscriptionRequests)) var xAppEventInstanceID int64 var e2EventInstanceID int64 @@ -551,6 +560,10 @@ func (c *Control) processSubscriptionRequests(restSubscription *RESTSubscription trans.Release() if err != nil { + if err.Error() == "TEST: restart event received" { + // This is just for UT cases. Stop here subscription processing + return + } c.sendUnsuccesfullResponseNotification(restSubId, restSubscription, xAppEventInstanceID, err, clientEndpoint, trans, errorInfo) } else { e2EventInstanceID = (int64)(subRespMsg.RequestId.InstanceId) @@ -601,7 +614,7 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e // Wake subs request // subs.OngoingReqCount++ - go c.handleSubscriptionCreate(subs, trans, e2SubscriptionDirectives) + go c.handleSubscriptionCreate(subs, trans, e2SubscriptionDirectives, 0) event, _ := trans.WaitEvent(0) //blocked wait as timeout is handled in subs side subs.OngoingReqCount-- @@ -627,6 +640,10 @@ func (c *Control) handleSubscriptionRequest(trans *TransactionXapp, subReqMsg *e case *SDLWriteErrortEvent: err = fmt.Errorf("SDL write failure") errorInfo = themsg.ErrorInfo + case *SubmgrRestartTestEvent: + err = fmt.Errorf("TEST: restart event received") + xapp.Logger.Debug("%s", err) + return nil, &errorInfo, err default: err = fmt.Errorf("Unexpected E2 subscription response received") errorInfo.SetInfo(err.Error(), models.SubscriptionInstanceErrorSourceE2Node, "") @@ -759,7 +776,7 @@ func (c *Control) RESTSubscriptionDeleteHandler(restSubId string) int { go func() { xapp.Logger.Debug("Deleteting handler: processing instances = %v", restSubscription.InstanceIds) for _, instanceId := range restSubscription.InstanceIds { - xAppEventInstanceID, err := c.SubscriptionDeleteHandler(&restSubId, &xAppRmrEndPoint, &restSubscription.Meid, instanceId) + xAppEventInstanceID, err := c.SubscriptionDeleteHandler(&restSubId, &xAppRmrEndPoint, &restSubscription.Meid, instanceId, 0) if err != nil { xapp.Logger.Error("%s", err.Error()) @@ -780,7 +797,7 @@ func (c *Control) RESTSubscriptionDeleteHandler(restSubId string) int { //------------------------------------------------------------------- // //------------------------------------------------------------------- -func (c *Control) SubscriptionDeleteHandler(restSubId *string, endPoint *string, meid *string, instanceId uint32) (int64, error) { +func (c *Control) SubscriptionDeleteHandler(restSubId *string, endPoint *string, meid *string, instanceId uint32, waitRouteCleanupTime time.Duration) (int64, error) { var xAppEventInstanceID int64 subs, err := c.registry.GetSubscriptionFirstMatch([]uint32{instanceId}) @@ -808,7 +825,7 @@ func (c *Control) SubscriptionDeleteHandler(restSubId *string, endPoint *string, // Wake subs delete // subs.OngoingDelCount++ - go c.handleSubscriptionDelete(subs, trans) + go c.handleSubscriptionDelete(subs, trans, waitRouteCleanupTime) trans.WaitEvent(0) //blocked wait as timeout is handled in subs side subs.OngoingDelCount-- @@ -990,7 +1007,7 @@ func (c *Control) wakeSubscriptionRequest(subs *Subscription, trans *Transaction e2SubscriptionDirectives, _ := c.GetE2SubscriptionDirectives(nil) subs.OngoingReqCount++ - go c.handleSubscriptionCreate(subs, trans, e2SubscriptionDirectives) + go c.handleSubscriptionCreate(subs, trans, e2SubscriptionDirectives, waitRouteCleanup_ms) event, _ := trans.WaitEvent(0) //blocked wait as timeout is handled in subs side subs.OngoingReqCount-- var err error @@ -1061,7 +1078,7 @@ func (c *Control) handleXAPPSubscriptionDeleteRequest(params *xapp.RMRParams) { // Wake subs delete // subs.OngoingDelCount++ - go c.handleSubscriptionDelete(subs, trans) + go c.handleSubscriptionDelete(subs, trans, waitRouteCleanup_ms) trans.WaitEvent(0) //blocked wait as timeout is handled in subs side subs.OngoingDelCount-- @@ -1091,7 +1108,7 @@ func (c *Control) handleXAPPSubscriptionDeleteRequest(params *xapp.RMRParams) { //------------------------------------------------------------------- // SUBS CREATE Handling //------------------------------------------------------------------- -func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *TransactionXapp, e2SubscriptionDirectives *E2SubscriptionDirectives) { +func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *TransactionXapp, e2SubscriptionDirectives *E2SubscriptionDirectives, waitRouteCleanupTime time.Duration) { var event interface{} = nil var removeSubscriptionFromDb bool = false @@ -1110,38 +1127,43 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran subRfMsg, valid = subs.SetCachedResponse(event, true) subs.SubRespRcvd = true case *e2ap.E2APSubscriptionFailure: - removeSubscriptionFromDb = true subRfMsg, valid = subs.SetCachedResponse(event, false) xapp.Logger.Debug("SUBS-SubReq: internal delete due failure event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) case *SubmgrRestartTestEvent: - // This simulates that no response has been received and after restart subscriptions are restored from db + // This is used to simulate that no response has been received and after restart, subscriptions are restored from db xapp.Logger.Debug("Test restart flag is active. Dropping this transaction to test restart case") + subRfMsg, valid = subs.SetCachedResponse(event, false) + parentTrans.SendEvent(subRfMsg, 0) + return case *PackSubscriptionRequestErrortEvent, *SDLWriteErrortEvent: - removeSubscriptionFromDb = true subRfMsg, valid = subs.SetCachedResponse(event, false) default: // Timer expiry if subs.PolicyUpdate == false { xapp.Logger.Debug("SUBS-SubReq: internal delete due default event(%s) %s", typeofSubsMessage(event), idstring(nil, trans, subs, parentTrans)) - removeSubscriptionFromDb = true subRfMsg, valid = subs.SetCachedResponse(nil, false) c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) + } else { + subRfMsg, valid = subs.SetCachedResponse(nil, true) } } xapp.Logger.Debug("SUBS-SubReq: Handling (e2t response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans)) } else { xapp.Logger.Debug("SUBS-SubReq: Handling (cached response %s) %s", typeofSubsMessage(subRfMsg), idstring(nil, trans, subs, parentTrans)) } + if valid == false { + removeSubscriptionFromDb = true + } err := c.UpdateSubscriptionInDB(subs, removeSubscriptionFromDb) if err != nil { - subRfMsg, valid = subs.SetCachedResponse(event, false) + valid = false c.sendE2TSubscriptionDeleteRequest(subs, trans, parentTrans) } //Now RemoveFromSubscription in here to avoid race conditions (mostly concerns delete) if valid == false { - c.registry.RemoveFromSubscription(subs, parentTrans, waitRouteCleanup_ms, c) + c.registry.RemoveFromSubscription(subs, parentTrans, waitRouteCleanupTime, c) } parentTrans.SendEvent(subRfMsg, 0) @@ -1151,7 +1173,7 @@ func (c *Control) handleSubscriptionCreate(subs *Subscription, parentTrans *Tran // SUBS DELETE Handling //------------------------------------------------------------------- -func (c *Control) handleSubscriptionDelete(subs *Subscription, parentTrans *TransactionXapp) { +func (c *Control) handleSubscriptionDelete(subs *Subscription, parentTrans *TransactionXapp, waitRouteCleanupTime time.Duration) { trans := c.tracker.NewSubsTransaction(subs) subs.WaitTransactionTurn(trans) @@ -1172,8 +1194,7 @@ func (c *Control) handleSubscriptionDelete(subs *Subscription, parentTrans *Tran //Now RemoveFromSubscription in here to avoid race conditions (mostly concerns delete) // If parallel deletes ongoing both might pass earlier sendE2TSubscriptionDeleteRequest(...) if // RemoveFromSubscription locates in caller side (now in handleXAPPSubscriptionDeleteRequest(...)) - c.registry.RemoveFromSubscription(subs, parentTrans, waitRouteCleanup_ms, c) - c.registry.UpdateSubscriptionToDb(subs, c) + c.registry.RemoveFromSubscription(subs, parentTrans, waitRouteCleanupTime, c) parentTrans.SendEvent(nil, 0) } @@ -1298,6 +1319,7 @@ func (c *Control) handleE2TSubscriptionResponse(params *xapp.RMRParams) { xapp.Logger.Error("MSG-SubResp: %s", idstring(err, params, subs)) return } + xapp.Logger.Debug("SUBS-SubResp: Sending event, trans= %v", trans) sendOk, timedOut := trans.SendEvent(subRespMsg, e2tRecvMsgTimeout) if sendOk == false { err = fmt.Errorf("Passing event to transaction failed: sendOk(%t) timedOut(%t)", sendOk, timedOut) @@ -1501,6 +1523,11 @@ func (c *Control) RemoveRESTSubscriptionFromDb(restSubId string) { func (c *Control) SendSubscriptionDeleteReq(subs *Subscription) { + if c.UTTesting == true { + // Reqistry mutex is not locked after real restart but it can be when restart is simulated in unit tests + c.registry.mutex = new(sync.Mutex) + } + const ricRequestorId = 123 xapp.Logger.Debug("Sending subscription delete due to restart. subId = %v", subs.ReqId.InstanceId) diff --git a/pkg/control/registry.go b/pkg/control/registry.go index 07affbd..36e9b4c 100644 --- a/pkg/control/registry.go +++ b/pkg/control/registry.go @@ -89,7 +89,7 @@ func (r *RESTSubscription) SetProcessed(err error) { } type Registry struct { - mutex sync.Mutex + mutex *sync.Mutex register map[uint32]*Subscription subIds []uint32 rtmgrClient *RtmgrClient @@ -97,6 +97,7 @@ type Registry struct { } func (r *Registry) Initialize() { + r.mutex = new(sync.Mutex) r.register = make(map[uint32]*Subscription) r.restSubscriptions = make(map[string]*RESTSubscription) @@ -396,9 +397,9 @@ func (r *Registry) CheckActionTypes(subReqMsg *e2ap.E2APSubscriptionRequest) (ui return e2ap.E2AP_ActionTypeInvalid, fmt.Errorf("Invalid action type in RICactions-ToBeSetup-List") } -// TODO: Works with concurrent calls, but check if can be improved func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *TransactionXapp, waitRouteClean time.Duration, c *Control) error { + xapp.Logger.Debug("RemoveFromSubscription %s", idstring(nil, trans, subs, trans)) r.mutex.Lock() defer r.mutex.Unlock() subs.mutex.Lock() @@ -406,56 +407,59 @@ func (r *Registry) RemoveFromSubscription(subs *Subscription, trans *Transaction delStatus := subs.EpList.DelEndpoint(trans.GetEndpoint()) epamount := subs.EpList.Size() + subId := subs.ReqId.InstanceId if delStatus == false { return nil } - go func() { - if waitRouteClean > 0 { - xapp.Logger.Debug("Pending %v in order to wait route cleanup", waitRouteClean) - time.Sleep(waitRouteClean) - } + if waitRouteClean > 0 { + // Wait here that response is delivered to xApp via RMR before route is cleaned + xapp.Logger.Debug("Pending %v in order to wait route cleanup", waitRouteClean) + time.Sleep(waitRouteClean) + } - subs.mutex.Lock() - defer subs.mutex.Unlock() - xapp.Logger.Debug("CLEAN %s", subs.String()) + xapp.Logger.Debug("CLEAN %s", subs.String()) - if epamount == 0 { - // - // Subscription route delete - // - if subs.RMRRouteCreated == true { - r.RouteDelete(subs, trans, c) - } + if epamount == 0 { + // + // Subscription route delete + // + if subs.RMRRouteCreated == true { + r.RouteDelete(subs, trans, c) + } - // - // Subscription release - // - r.mutex.Lock() - defer r.mutex.Unlock() + // Not merged subscription is being deleted + xapp.Logger.Debug("Subscription route delete RemoveSubscriptionFromDb") + c.RemoveSubscriptionFromDb(subs) - if _, ok := r.register[subId]; ok { - xapp.Logger.Debug("RELEASE %s", subs.String()) - delete(r.register, subId) - xapp.Logger.Debug("Registry: substable=%v", r.register) - } - r.subIds = append(r.subIds, subId) - } else if subs.EpList.Size() > 0 { - // - // Subscription route update - // - if subs.RMRRouteCreated == true { - r.RouteDeleteUpdate(subs, c) - } + // + // Subscription release + // + + if _, ok := r.register[subId]; ok { + xapp.Logger.Debug("RELEASE %s", subs.String()) + delete(r.register, subId) + xapp.Logger.Debug("Registry: substable=%v", r.register) + } + r.subIds = append(r.subIds, subId) + } else if subs.EpList.Size() > 0 { + // + // Subscription route update + // + if subs.RMRRouteCreated == true { + r.RouteDeleteUpdate(subs, c) } - }() + // Endpoint of merged subscription is being deleted + xapp.Logger.Debug("Subscription route update WriteSubscriptionToDb") + c.WriteSubscriptionToDb(subs) + c.UpdateCounter(cUnmergedSubscriptions) + } return nil } func (r *Registry) RouteDelete(subs *Subscription, trans *TransactionXapp, c *Control) { - tmpList := xapp.RmrEndpointList{} tmpList.AddEndpoint(trans.GetEndpoint()) subRouteAction := SubRouteInfo{tmpList, uint16(subs.ReqId.InstanceId)} @@ -471,26 +475,6 @@ func (r *Registry) RouteDeleteUpdate(subs *Subscription, c *Control) { } } -func (r *Registry) UpdateSubscriptionToDb(subs *Subscription, c *Control) { - r.mutex.Lock() - defer r.mutex.Unlock() - subs.mutex.Lock() - defer subs.mutex.Unlock() - - epamount := subs.EpList.Size() - if epamount == 0 { - if _, ok := r.register[subs.ReqId.InstanceId]; ok { - // Not merged subscription is being deleted - c.RemoveSubscriptionFromDb(subs) - - } - } else if subs.EpList.Size() > 0 { - // Endpoint of merged subscription is being deleted - c.WriteSubscriptionToDb(subs) - c.UpdateCounter(cUnmergedSubscriptions) - } -} - func (r *Registry) GetSubscription(subId uint32) *Subscription { r.mutex.Lock() defer r.mutex.Unlock() diff --git a/pkg/control/ut_ctrl_submgr_test.go b/pkg/control/ut_ctrl_submgr_test.go index ea3ffd9..31eed31 100644 --- a/pkg/control/ut_ctrl_submgr_test.go +++ b/pkg/control/ut_ctrl_submgr_test.go @@ -76,37 +76,30 @@ func createSubmgrControl(srcId teststub.RmrSrcId, rtgSvc teststub.RmrRtgSvc) *te func (mc *testingSubmgrControl) SimulateRestart(t *testing.T) { mc.TestLog(t, "Simulating submgr restart") - mainCtrl.c.registry.subIds = nil + // Initialize subIds slice and subscription map + mainCtrl.c.registry.subIds = nil mainCtrl.c.registry.Initialize() mainCtrl.c.restDuplicateCtrl.Init() + // Read subIds and subscriptions from database - subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() - if err != nil { - mc.TestError(t, "%v", err) - } else { - mainCtrl.c.registry.subIds = subIds - mainCtrl.c.registry.register = register - mc.TestLog(t, "mainCtrl.c.registry.register:") + go mainCtrl.c.ReadE2Subscriptions() // This needs to be run in own go routine when called from here <<--- improve this + mc.TestLog(t, "mainCtrl.c.registry.register:") + /* for subId, subs := range mainCtrl.c.registry.register { mc.TestLog(t, " subId=%v", subId) mc.TestLog(t, " subs.SubRespRcvd=%v", subs.SubRespRcvd) mc.TestLog(t, " subs=%v\n", subs) } - } - restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() - if err != nil { - mc.TestError(t, "%v", err) - } else { - mainCtrl.c.registry.restSubscriptions = restSubscriptions - mc.TestLog(t, "mainCtrl.c.registry.restSubscriptions:") - for restSubId, restSubs := range mainCtrl.c.registry.restSubscriptions { - mc.TestLog(t, " restSubId=%v", restSubId) - mc.TestLog(t, " restSubs=%v\n", restSubs) - } - } - - go mainCtrl.c.HandleUncompletedSubscriptions(mainCtrl.c.registry.register) + */ + // Read REST subIds and REST subscriptions from database + mainCtrl.c.ReadRESTSubscriptions() + mc.TestLog(t, "mainCtrl.c.registry.restSubscriptions:") + for restSubId, restSubs := range mainCtrl.c.registry.restSubscriptions { + mc.TestLog(t, " restSubId=%v", restSubId) + mc.TestLog(t, " restSubs=%v\n", restSubs) + } + //go mainCtrl.c.HandleUncompletedSubscriptions(mainCtrl.c.registry.register) // This needs to be run in own go routine when called from here } func (mc *testingSubmgrControl) MakeTransactionNil(t *testing.T, subId uint32) { @@ -288,7 +281,26 @@ func (mc *testingSubmgrControl) wait_msgcounter_change(t *testing.T, orig uint64 } func (mc *testingSubmgrControl) VerifyAllClean(t *testing.T) { - // Verify that all resources are freed + + // Verify that all resources are freed. Wait cleaning up to 10 seconds + for i := 0; i < 100; i++ { + if len(mainCtrl.c.registry.register) == 0 && len(mainCtrl.c.registry.restSubscriptions) == 0 { + RESTKeyCount, err := mainCtrl.c.GetRESTKeyCount() + if err != nil { + t.Errorf("TEST: %s", err.Error()) + } + E2KeyCount, err := mainCtrl.c.GetE2KeyCount() + if err != nil { + t.Errorf("TEST: %s", err.Error()) + } + if RESTKeyCount == 0 && E2KeyCount == 0 { + break + } + } + <-time.After(time.Millisecond * 100) + mc.TestLog(t, "VerifyAllClean delay plus 100ms") + } + assert.Equal(t, 0, len(mainCtrl.c.registry.register)) if len(mainCtrl.c.registry.register) > 0 { fmt.Printf("registry.register: %v\n", mainCtrl.c.registry.register) @@ -369,7 +381,7 @@ func (mc *testingSubmgrControl) VerifyCounterValues(t *testing.T) { } } - // Check that not any unexpected counter are added (this is not working correctly!) + // Check that not any unexpected counter are added // Get current values of all counters currentCountersMap = mc.GetCurrentCounterValues(t, allCountersMap) for _, currentCounter := range currentCountersMap { diff --git a/pkg/control/ut_messaging_test.go b/pkg/control/ut_messaging_test.go index 6ce7b51..7d7f67b 100644 --- a/pkg/control/ut_messaging_test.go +++ b/pkg/control/ut_messaging_test.go @@ -97,7 +97,7 @@ func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) - //os.Exit(1) + //os.Exit(0) } //----------------------------------------------------------------------------- @@ -2375,9 +2375,6 @@ func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") - // Remove possible existing subscrition - mainCtrl.removeExistingSubscriptions(t) - mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription xappConn1.SendSubsReq(t, nil, nil) e2termConn1.RecvSubsReq(t) @@ -2459,6 +2456,10 @@ func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // That needs to be completed before successful subscription query is possible + <-time.After(time.Second * 1) + // Check that subscription is restored correctly after restart resp, _ = xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) @@ -2553,7 +2554,7 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) // Check subscription - resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// + resp, _ := xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) assert.Equal(t, resp[0].Meid, "RAN_NAME_1") assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) @@ -2561,6 +2562,10 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // That needs to be completed before successful subscription query is possible + <-time.After(time.Second * 1) + // Check that subscription is restored correctly after restart resp, _ = xapp.Subscription.QuerySubscriptions() assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) @@ -2576,6 +2581,10 @@ func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // Submgr need be ready before successful subscription deletion is possible + <-time.After(time.Second * 1) + //Del2 deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) @@ -4358,7 +4367,6 @@ func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { mainCtrl.VerifyAllClean(t) } -/* //----------------------------------------------------------------------------- // TestRESTSubReqAndSubDelNoAnswerSameActionParallel // @@ -4421,6 +4429,7 @@ func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { Counter{cSubReqTimerExpiry, 2}, Counter{cSubReReqToE2, 1}, Counter{cRestSubFailNotifToXapp, 2}, + Counter{cUnmergedSubscriptions, 1}, Counter{cRestSubDelReqFromXapp, 2}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, @@ -4522,6 +4531,7 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { Counter{cSubReqToE2, 1}, Counter{cSubFailFromE2, 1}, Counter{cRestSubFailNotifToXapp, 2}, + Counter{cUnmergedSubscriptions, 1}, Counter{cRestSubDelReqFromXapp, 2}, Counter{cRestSubDelRespToXapp, 2}, }) @@ -4563,7 +4573,7 @@ func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { mainCtrl.VerifyCounterValues(t) mainCtrl.VerifyAllClean(t) } -*/ + func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { CaseBegin("TestRESTSubReqPolicyAndSubDelOk") @@ -5030,16 +5040,12 @@ func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, - Counter{cRestSubFailNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cRestSubDelRespToXapp, 1}, }) const subReqCount int = 1 - // Remove possible existing subscription - mainCtrl.removeExistingSubscriptions(t) - params := xappConn1.GetRESTSubsReqReportParams(subReqCount) //Req @@ -5122,12 +5128,9 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, }) - // Remove possible existing subscription - mainCtrl.removeExistingSubscriptions(t) - - var params *teststube2ap.RESTSubsReqParams = nil // Create subscription + var params *teststube2ap.RESTSubsReqParams = nil restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) @@ -5137,6 +5140,10 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // That needs to be completed before successful subscription query is possible + <-time.After(time.Second * 1) + // Check subscription queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) @@ -5204,7 +5211,6 @@ func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { // | | | | // //----------------------------------------------------------------------------- - func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") @@ -5222,12 +5228,8 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { Counter{cRestSubDelRespToXapp, 2}, }) - // Remove possible existing subscription - mainCtrl.removeExistingSubscriptions(t) - - var params *teststube2ap.RESTSubsReqParams = nil - // Create subscription 1 + var params *teststube2ap.RESTSubsReqParams = nil restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) @@ -5244,15 +5246,27 @@ func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) mainCtrl.SimulateRestart(t) - xapp.Logger.Debug("mainCtrl.SimulateRestart done") + xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") + + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // That needs to be completed before successful subscription delete is possible + <-time.After(time.Second * 1) // Delete subscription 1, and wait until it has removed the first endpoint subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) xappConn1.SendRESTSubsDelReq(t, &restSubId1) mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) + // Above wait does not work correctly anymore as this delay makes this test case work + //<-time.After(time.Second * 1) + mainCtrl.SimulateRestart(t) - xapp.Logger.Debug("mainCtrl.SimulateRestart done") + xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") + + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // That needs to be completed before successful subscription query is possible + <-time.After(time.Second * 1) + queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) // Delete subscription 2 @@ -5360,7 +5374,7 @@ func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { } /* -func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { +func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { was in comments already CaseBegin("TestRESTPolicySubReqAndSubDelOk") subReqCount := 2 @@ -6970,16 +6984,12 @@ func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { Counter{cSubReqToE2, 2}, Counter{cSubRespFromE2, 1}, Counter{cRestSubNotifToXapp, 1}, - Counter{cRestSubFailNotifToXapp, 1}, Counter{cRestSubDelReqFromXapp, 1}, Counter{cSubDelReqToE2, 1}, Counter{cSubDelRespFromE2, 1}, Counter{cRestSubDelRespToXapp, 1}, }) - // Remove possible existing subscription - mainCtrl.removeExistingSubscriptions(t) - const e2Timeout int64 = 1 const e2RetryCount int64 = 0 const routingNeeded bool = false @@ -7017,6 +7027,10 @@ func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { mainCtrl.SimulateRestart(t) xapp.Logger.Debug("mainCtrl.SimulateRestart done") + // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) + // That needs to be completed before successful subscription query is possible + <-time.After(time.Second * 1) + // Check subscription queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) @@ -7123,9 +7137,9 @@ func deleteXapp2Subscription(t *testing.T, restSubId *string) { func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { resp, _ := xapp.Subscription.QuerySubscriptions() - assert.Equal(t, resp[0].SubscriptionID, e2SubsId) - assert.Equal(t, resp[0].Meid, meid) - assert.Equal(t, resp[0].ClientEndpoint, endpoint) + assert.Equal(t, e2SubsId, resp[0].SubscriptionID) + assert.Equal(t, meid, resp[0].Meid) + assert.Equal(t, endpoint, resp[0].ClientEndpoint) } func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { -- 2.16.6 From 35554b7400e4b827f22fec3e295c1c1f7fbca43d Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Thu, 2 Dec 2021 12:47:32 +0200 Subject: [PATCH 14/16] Preparing for E release Change-Id: If14797bcd7780e55658ae63eaed6fa5bfa520c6b Signed-off-by: Anssi Mannila --- container-tag.yaml | 2 +- docs/release-notes.rst | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index 8832f84..fbf559b 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -2,4 +2,4 @@ # By default this file is in the docker build directory, # but the location can configured in the JJB template. --- -tag: "0.7.2" +tag: "0.8.0" diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 9eda1f4..90e9764 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -47,7 +47,10 @@ Version history | 2020-12-11 | v0.5.8 | Juha Hyttinen | Cherry Release | | | | | | +--------------------+--------------------+--------------------+--------------------+ -| 2020-12-11 | v0.7.0 | Anssi Mannila | Dawn Release | +| 2020-01-16 | v0.7.0 | Anssi Mannila | Dawn Release | +| | | | | ++--------------------+--------------------+--------------------+--------------------+ +| 2020-12-02 | v0.8.0 | Anssi Mannila | E Release | | | | | | +--------------------+--------------------+--------------------+--------------------+ @@ -55,12 +58,31 @@ Version history Summary ------- - - The Bronze release of Subscription Manager supports newer E2 specs + - Bronze release added support for new E2 specs + - Dawn release added support for REST subscription interface + - E release added support for E2 restart and improved error handling in REST subscription interface Release Data ------------ ++--------------------------------------+--------------------------------------+ +| **Project** | Subscription Manager | +| | | ++--------------------------------------+--------------------------------------+ +| **Repo/commit-ID** | ric-plt/submgr | +| | | ++--------------------------------------+--------------------------------------+ +| **Release designation** | E | +| | | ++--------------------------------------+--------------------------------------+ +| **Release date** | 2021-06-16 | +| | | ++--------------------------------------+--------------------------------------+ +| **Purpose of the delivery** | New Release | +| | | ++--------------------------------------+--------------------------------------+ + +--------------------------------------+--------------------------------------+ | **Project** | Subscription Manager | | | | -- 2.16.6 From 7b629a410cba222679ed89f9bbca472f87374f96 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Thu, 2 Dec 2021 13:24:30 +0200 Subject: [PATCH 15/16] E release Change-Id: If838271daa8e3639758a7d2f8662c30952290326 Signed-off-by: Anssi Mannila --- releases/container-release-ric-plt-submgr.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/releases/container-release-ric-plt-submgr.yaml b/releases/container-release-ric-plt-submgr.yaml index 5c2143e..207e214 100644 --- a/releases/container-release-ric-plt-submgr.yaml +++ b/releases/container-release-ric-plt-submgr.yaml @@ -1,10 +1,10 @@ --- distribution_type: container -container_release_tag: 0.7.1 +container_release_tag: 0.8.0 container_pull_registry: nexus3.o-ran-sc.org:10004 container_push_registry: nexus3.o-ran-sc.org:10002 project: ric-plt/submgr -ref: 6c63019f4daa458507decc19f2d742681e2053b4 +ref: 35554b7400e4b827f22fec3e295c1c1f7fbca43d containers: - name: ric-plt-submgr - version: 0.7.2 + version: 0.8.0 -- 2.16.6 From e42efedffc650788bd1b1573c9bf7e4d16161562 Mon Sep 17 00:00:00 2001 From: Anssi Mannila Date: Fri, 3 Dec 2021 11:21:39 +0200 Subject: [PATCH 16/16] RMR version upgrade 4.7.4 -> 4.8.0 Change-Id: Id8d2150036c3bc76a1293a9d05eab91a1b63432d Signed-off-by: Anssi Mannila --- Dockerfile | 2 +- container-tag.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f75fa6..1d13c48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,7 +73,7 @@ RUN export GOBIN=/usr/local/bin/ ; \ # # RMR # -ARG RMRVERSION=4.7.4 +ARG RMRVERSION=4.8.0 ARG RMRLIBURL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb ARG RMRDEVURL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb RUN wget --content-disposition ${RMRLIBURL} && dpkg -i rmr_${RMRVERSION}_amd64.deb diff --git a/container-tag.yaml b/container-tag.yaml index fbf559b..e48a046 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -2,4 +2,4 @@ # By default this file is in the docker build directory, # but the location can configured in the JJB template. --- -tag: "0.8.0" +tag: "0.8.1" -- 2.16.6