X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2ap%2Fpkg%2Fe2ap%2Fe2ap_tests%2Fmsg.go;h=f342321bcb3e002700285fb0138ac66712fef8b1;hb=bf583163d3f26548dbeafd5631f83a403313d52f;hp=b94cacc74cfc77be883bb24211619a4605306a48;hpb=ff8dccd02d76eebfccc0b509ce0b42a2c1760e12;p=ric-plt%2Fsubmgr.git diff --git a/e2ap/pkg/e2ap/e2ap_tests/msg.go b/e2ap/pkg/e2ap/e2ap_tests/msg.go index b94cacc..f342321 100644 --- a/e2ap/pkg/e2ap/e2ap_tests/msg.go +++ b/e2ap/pkg/e2ap/e2ap_tests/msg.go @@ -20,6 +20,7 @@ package e2ap_tests import ( + "encoding/hex" "fmt" "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" "github.com/google/go-cmp/cmp" @@ -76,6 +77,17 @@ type E2ApTests struct { packerif e2ap.E2APPackerIf } +func (testCtxt *E2ApTests) toPackedData(t *testing.T, buffer string) *e2ap.PackedData { + msg, err := hex.DecodeString(buffer) + if err != nil { + testCtxt.testError(t, "Hex DecodeString Failed: %s [%s]", err.Error(), buffer) + return nil + } + packedData := &e2ap.PackedData{} + packedData.Buf = msg + return packedData +} + func NewE2ApTests(name string, packerif e2ap.E2APPackerIf) *E2ApTests { testCtxt := &E2ApTests{} testCtxt.packerif = packerif @@ -88,17 +100,54 @@ func NewE2ApTests(name string, packerif e2ap.E2APPackerIf) *E2ApTests { //----------------------------------------------------------------------------- func RunTests(t *testing.T, e2aptestctxt *E2ApTests) { - t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequest(t) }) + + subMsgContent := &SubscriptionTestMsgContent{} + subMsgContent.NBNRTEventTriggerDefinitionPresent = true + subMsgContent.ActionDefinitionNRTFormat1Present = true + subMsgContent.RANParameterValueEnumPresent = true + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequest(t, subMsgContent) }) + + subMsgContent2 := &SubscriptionTestMsgContent{} + subMsgContent2.NBX2EventTriggerDefinitionPresent = true + subMsgContent2.ActionDefinitionX2Format1Present = true + subMsgContent2.ActionParameterValueBoolPresent = true + subMsgContent2.RANParameterValueBoolPresent = true + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequest(t, subMsgContent2) }) + + subMsgContent3 := &SubscriptionTestMsgContent{} + subMsgContent3.NBX2EventTriggerDefinitionPresent = true + subMsgContent3.ActionDefinitionX2Format2Present = true + subMsgContent3.ActionParameterValueBitSPresent = true + subMsgContent3.RANParameterValueBitSPresent = true + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequest(t, subMsgContent3) }) + + subMsgContent4 := &SubscriptionTestMsgContent{} + subMsgContent4.NBX2EventTriggerDefinitionPresent = true + subMsgContent4.ActionDefinitionX2Format2Present = true + subMsgContent4.ActionParameterValueOctSPresent = true + subMsgContent4.RANParameterValueOctSPresent = true + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequest(t, subMsgContent4) }) + + subMsgContent5 := &SubscriptionTestMsgContent{} + subMsgContent5.NBX2EventTriggerDefinitionPresent = true + subMsgContent5.ActionDefinitionX2Format2Present = true + subMsgContent5.ActionParameterValuePrtSPresent = true + subMsgContent5.RANParameterValuePrtSPresent = true + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionRequest(t, subMsgContent5) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionResponse(t) }) t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionFailure(t) }) - t.Run(e2aptestctxt.Name(), func(t *testing.T) { - e2aptestctxt.E2ApTestMsgSubscriptionDeleteRequest(t) - }) - t.Run(e2aptestctxt.Name(), func(t *testing.T) { - e2aptestctxt.E2ApTestMsgSubscriptionDeleteResponse(t) - }) - t.Run(e2aptestctxt.Name(), func(t *testing.T) { - e2aptestctxt.E2ApTestMsgSubscriptionDeleteFailure(t) - }) - t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgIndication(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteRequest(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteResponse(t) }) + t.Run(e2aptestctxt.Name(), func(t *testing.T) { e2aptestctxt.E2ApTestMsgSubscriptionDeleteFailure(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) }) + */ + }