From: Anssi Mannila Date: Thu, 16 Jan 2020 06:08:49 +0000 (+0000) Subject: Merge "RICPLT-3008 Subscription register free id list" X-Git-Tag: 0.4.0~36 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=7e9c5e52615fef7cbc23de28505e1a7292cdf14f;hp=5c161a94ae1b291dd13ff951a4d852566e1e4d47;p=ric-plt%2Fsubmgr.git Merge "RICPLT-3008 Subscription register free id list" --- diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg.go b/e2ap/pkg/e2ap/e2ap_tests/msg.go index b94cacc..7502cf1 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg.go @@ -20,8 +20,10 @@ package e2ap_tests import ( + "encoding/hex" "fmt" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" + "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer" "github.com/google/go-cmp/cmp" "log" "os" @@ -76,6 +78,17 @@ type E2ApTests struct { packerif e2ap.E2APPackerIf } +func (testCtxt *E2ApTests) toPackedData(t *testing.T, buffer string) *packer.PackedData { + msg, err := hex.DecodeString(buffer) + if err != nil { + testCtxt.testError(t, "Hex DecodeString Failed: %s [%s]", err.Error(), buffer) + return nil + } + packedData := &packer.PackedData{} + packedData.Buf = msg + return packedData +} + func NewE2ApTests(name string, packerif e2ap.E2APPackerIf) *E2ApTests { testCtxt := &E2ApTests{} testCtxt.packerif = packerif @@ -101,4 +114,11 @@ func RunTests(t *testing.T, e2aptestctxt *E2ApTests) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteFailure(t) }) t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgIndication(t) }) + + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequestBuffers(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionResponseBuffers(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionFailureBuffers(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteRequestBuffers(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteResponseBuffers(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteFailureBuffers(t) }) } diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go index 348fe4e..10b2d12 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscription.go @@ -231,3 +231,92 @@ func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionFailure(t *testing.T) { } testCtxt.testValueEquality(t, "msg", &afailenc, afaildec) } + +func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionRequestBuffers(t *testing.T) { + + testfunc := func(buffer string) { + packedData := testCtxt.toPackedData(t, buffer) + if packedData == nil { + return + } + e2SubResp := testCtxt.packerif.NewPackerSubscriptionRequest() + err := e2SubResp.UnPack(packedData) + if err != nil { + testCtxt.testError(t, "UnPack() Failed: %s [%s]", err.Error(), buffer) + return + } + err, _ = e2SubResp.Get() + if err != nil { + testCtxt.testError(t, "Get() Failed: %s [%s]", err.Error(), buffer) + return + } + testCtxt.testPrint("OK [%s]", buffer) + } + + testCtxt.SetDesc("SubReqBuffer") + testfunc("00c9402c000003ea7e00050000010000ea6300020001ea810016000b00130051407b000000054000ea6b000420000000") +} + +func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionResponseBuffers(t *testing.T) { + + testfunc := func(buffer string) { + packedData := testCtxt.toPackedData(t, buffer) + if packedData == nil { + return + } + e2SubResp := testCtxt.packerif.NewPackerSubscriptionResponse() + err := e2SubResp.UnPack(packedData) + if err != nil { + testCtxt.testError(t, "UnPack() Failed: %s [%s]", err.Error(), buffer) + return + } + err, _ = e2SubResp.Get() + if err != nil { + testCtxt.testError(t, "Get() Failed: %s [%s]", err.Error(), buffer) + return + } + testCtxt.testPrint("OK [%s]", buffer) + } + + testCtxt.SetDesc("SubRespBuffer") + testfunc("20c9402a000004ea7e00050000018009ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106e7ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106e8ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106e9ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106eaea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106ebea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106ecea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106edea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106eeea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106efea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106f0ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106f4ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106f5ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + testfunc("20c9402a000004ea7e000500000106f6ea6300020001ea6c000700ea6d00020000ea6e000908ea6f000400000040") + +} + +func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionFailureBuffers(t *testing.T) { + + testfunc := func(buffer string) { + packedData := testCtxt.toPackedData(t, buffer) + if packedData == nil { + return + } + e2SubResp := testCtxt.packerif.NewPackerSubscriptionFailure() + err := e2SubResp.UnPack(packedData) + if err != nil { + testCtxt.testError(t, "UnPack() Failed: %s [%s]", err.Error(), buffer) + return + } + err, _ = e2SubResp.Get() + if err != nil { + testCtxt.testError(t, "Get() Failed: %s [%s]", err.Error(), buffer) + return + } + testCtxt.testPrint("OK [%s]", buffer) + } + + testCtxt.SetDesc("SubFailBuffer") + testfunc("40c94017000003ea7e000500000106f3ea6300020001ea6e000100") +} diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go index 4cae8cc..aa20637 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg_e2ap_subscriptiondelete.go @@ -167,3 +167,103 @@ func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteFailure(t *testing.T) { } testCtxt.testValueEquality(t, "msg", &afailenc, afaildec) } + +func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteRequestBuffers(t *testing.T) { + + testfunc := func(buffer string) { + packedData := testCtxt.toPackedData(t, buffer) + if packedData == nil { + return + } + e2SubResp := testCtxt.packerif.NewPackerSubscriptionDeleteRequest() + err := e2SubResp.UnPack(packedData) + if err != nil { + testCtxt.testError(t, "UnPack() Failed: %s [%s]", err.Error(), buffer) + return + } + err, _ = e2SubResp.Get() + if err != nil { + testCtxt.testError(t, "Get() Failed: %s [%s]", err.Error(), buffer) + return + } + testCtxt.testPrint("OK [%s]", buffer) + } + + testCtxt.SetDesc("SubDelReqBuffer") + + testfunc("00ca4012000002ea7e000500000106e7ea6300020001") + testfunc("00ca4012000002ea7e000500000106e8ea6300020001") + testfunc("00ca4012000002ea7e000500000106e9ea6300020001") + testfunc("00ca4012000002ea7e000500000106eaea6300020001") + testfunc("00ca4012000002ea7e000500000106ebea6300020001") + testfunc("00ca4012000002ea7e000500000106ecea6300020001") + testfunc("00ca4012000002ea7e000500000106edea6300020001") + testfunc("00ca4012000002ea7e000500000106eeea6300020001") + testfunc("00ca4012000002ea7e000500000106efea6300020001") + testfunc("00ca4012000002ea7e000500000106f0ea6300020001") + testfunc("00ca4012000002ea7e000500000106f4ea6300020001") + testfunc("00ca4012000002ea7e000500000106f5ea6300020001") + testfunc("00ca4012000002ea7e000500000106f6ea6300020001") +} + +func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteResponseBuffers(t *testing.T) { + + testfunc := func(buffer string) { + packedData := testCtxt.toPackedData(t, buffer) + if packedData == nil { + return + } + e2SubResp := testCtxt.packerif.NewPackerSubscriptionDeleteResponse() + err := e2SubResp.UnPack(packedData) + if err != nil { + testCtxt.testError(t, "UnPack() Failed: %s [%s]", err.Error(), buffer) + return + } + err, _ = e2SubResp.Get() + if err != nil { + testCtxt.testError(t, "Get() Failed: %s [%s]", err.Error(), buffer) + return + } + testCtxt.testPrint("OK [%s]", buffer) + } + + testCtxt.SetDesc("SubDelRespBuffer") + testfunc("20ca4012000002ea7e000500000106e7ea6300020001") + testfunc("20ca4012000002ea7e000500000106e8ea6300020001") + testfunc("20ca4012000002ea7e000500000106e9ea6300020001") + testfunc("20ca4012000002ea7e000500000106eaea6300020001") + testfunc("20ca4012000002ea7e000500000106ebea6300020001") + testfunc("20ca4012000002ea7e000500000106ecea6300020001") + testfunc("20ca4012000002ea7e000500000106edea6300020001") + testfunc("20ca4012000002ea7e000500000106eeea6300020001") + testfunc("20ca4012000002ea7e000500000106efea6300020001") + testfunc("20ca4012000002ea7e000500000106f0ea6300020001") + testfunc("20ca4012000002ea7e000500000106f1ea6300020001") + testfunc("20ca4012000002ea7e000500000106f4ea6300020001") + +} + +func (testCtxt *E2ApTests) E2ApTestMsgSubscriptionDeleteFailureBuffers(t *testing.T) { + + testfunc := func(buffer string) { + packedData := testCtxt.toPackedData(t, buffer) + if packedData == nil { + return + } + e2SubResp := testCtxt.packerif.NewPackerSubscriptionDeleteFailure() + err := e2SubResp.UnPack(packedData) + if err != nil { + testCtxt.testError(t, "UnPack() Failed: %s [%s]", err.Error(), buffer) + return + } + err, _ = e2SubResp.Get() + if err != nil { + testCtxt.testError(t, "Get() Failed: %s [%s]", err.Error(), buffer) + return + } + testCtxt.testPrint("OK [%s]", buffer) + } + + testCtxt.SetDesc("SubDelFailBuffer") + testfunc("40ca4017000003ea7e000500000106f6ea6300020001ea74000124") +}