Squash-merging e2ap-v2.0 branch
[ric-plt/e2mgr.git] / E2Manager / models / ric_service_query_message_test.go
index 3ed2fbc..281f679 100644 (file)
@@ -23,9 +23,10 @@ import (
        "e2mgr/models"
        "e2mgr/utils"
        "encoding/xml"
+       "testing"
+
        "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities"
        "github.com/stretchr/testify/assert"
-       "testing"
 )
 
 func getTestRicServiceQueryRanFunctions(t *testing.T) []*entities.RanFunction {
@@ -47,7 +48,15 @@ func TestRicServiceQueryMessageSuccess(t *testing.T) {
 
        serviceQuery := models.NewRicServiceQueryMessage(ranFunctionList)
        initMsg := serviceQuery.E2APPDU.InitiatingMessage
-       assert.Equal(t, "6", initMsg.ProcedureCode)
-       assert.Equal(t, "9", initMsg.Value.RICServiceQuery.ProtocolIEs.RICServiceQueryIEs[0].Id)
-       assert.Equal(t, 3, len(initMsg.Value.RICServiceQuery.ProtocolIEs.RICServiceQueryIEs[0].Value.RANFunctionIdList.ProtocolIESingleContainer))
+       assert.Equal(t, models.ProcedureCode_id_RICserviceQuery, initMsg.ProcedureCode)
+       assert.Equal(t, models.ProtocolIE_ID_id_TransactionID, initMsg.Value.RICServiceQuery.ProtocolIEs.RICServiceQueryIEs[0].Id)
+       assert.Equal(t, models.ProtocolIE_ID_id_RANfunctionsAccepted, initMsg.Value.RICServiceQuery.ProtocolIEs.RICServiceQueryIEs[1].Id)
+       assert.Equal(t, 3, len(initMsg.Value.RICServiceQuery.ProtocolIEs.RICServiceQueryIEs[1].Value.(models.RICServiceQueryRANFunctionIdList).RANFunctionIdList.ProtocolIESingleContainer))
+}
+
+func TestTransactionIdServiceQuery(t *testing.T) {
+       ranFunctionList := getTestRicServiceQueryRanFunctions(t)
+       serviceQuery := models.NewRicServiceQueryMessage(ranFunctionList)
+       txIE := serviceQuery.E2APPDU.InitiatingMessage.Value.RICServiceQuery.ProtocolIEs.RICServiceQueryIEs[0].Value.(models.RICServiceQueryTransactionID)
+       assert.NotEmpty(t, txIE.TransactionID, "transaction ID should not be empty")
 }