Adding UT test cases for Multiple E2T 11/2211/1 0.4.9
authorwahidw <abdulwahid.w@nokia.com>
Tue, 14 Jan 2020 05:20:39 +0000 (05:20 +0000)
committerwahidw <abdulwahid.w@nokia.com>
Tue, 14 Jan 2020 05:20:45 +0000 (05:20 +0000)
Change-Id: Id20c52b2e1023c4d34906653a6cd57dd71cfd559
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
container-tag.yaml
pkg/nbi/httprestful_test.go
pkg/rpe/rmr_test.go
pkg/sbi/sbi_test.go
pkg/stub/stub.go
tst/robot/Multiple_E2T_tests.txt

index 7286906..556f988 100644 (file)
@@ -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.4.8
+tag: 0.4.9
index e0bfb28..e73f303 100644 (file)
@@ -81,6 +81,13 @@ func TestValidateXappCallbackData_1(t *testing.T) {
        }
 }
 
+func TestValidateXappCallbackDataInvalid (t *testing.T) {
+       data := models.XappCallbackData{}
+       err := validateXappCallbackData(&data)
+       t.Log(err)
+}
+
+
 func TestValidateXappSubscriptionsData(t *testing.T) {
 
        ep := make(map[string]*rtmgr.Endpoint)
@@ -138,6 +145,14 @@ func TestValidateE2tDataEmpty(t *testing.T) {
        t.Log(err)
 }
 
+func TestValidateE2tDataDNSLookUPfails(t *testing.T) {
+       data := models.E2tData{
+               E2TAddress: swag.String("e2t.1com:1234"),
+       }
+       err := validateE2tData(&data)
+       t.Log(err)
+}
+
 func TestValidateE2tDataInvalid(t *testing.T) {
        data := models.E2tData{
                E2TAddress: swag.String("10.101.01.1"),
@@ -439,6 +454,7 @@ func TestAddSubscriptions(t *testing.T) {
        t.Log(yes_no)
 }
 
+
 func TestHttpInstance(t *testing.T) {
        sdlEngine, _ := sdl.GetSdl("file")
        rpeEngine, _ := rpe.GetRpe("rmrpush")
@@ -474,7 +490,8 @@ func TestXappCallbackDataChannelNodata(t *testing.T) {
 
 func TestE2TChannelwithData(t *testing.T) {
        data2 := models.E2tData{
-               E2TAddress: swag.String(""),
+               E2TAddress: swag.String("1.2.3.4"),
+               RanNamelist: []string{"ran1","ran2"},
        }
        dataChannel := make(chan *models.E2tData, 10)
        go func() { _, _,_ = recvNewE2Tdata(dataChannel) }()
@@ -582,6 +599,10 @@ func TestProvideXappHandleHandlerImpl(t *testing.T) {
                        }
                }
        }
+
+       //Empty XappCallbackdata
+       data1 := models.XappCallbackData{}
+       err = httpRestful.(*HttpRestful).ProvideXappHandleHandlerImpl(datach, &data1)
 }
 
 func TestValidateXappCallbackData(t *testing.T) {
@@ -632,6 +653,8 @@ func TestHttpGetXAppsWithValidData(t *testing.T) {
                }
        }
 }
+
+
 func TestRetrieveStartupDataTimeout(t *testing.T) {
        sdlEngine, _ := sdl.GetSdl("file")
        createMockPlatformComponents()
@@ -673,3 +696,8 @@ func TestRetrieveStartupDataWithInvalidSubResp(t *testing.T) {
        os.Remove("rt.json")
        os.Remove("config.json")
 }
+
+func TestInvalidarguments(t *testing.T) {
+       _ = PostSubReq("\n","nbifinterface")
+       _ = PostSubReq("xmurl","\n")
+}
index 02f2608..da469fa 100644 (file)
@@ -76,3 +76,11 @@ func TestRmrGetRpe(t *testing.T) {
        _, _ = GetRpe("")
        _, _ = GetRpe("rmrpush")
 }
+
+/*
+generateRouteTable with empty Platform components
+*/
+func TestGenerateRouteTableRmrGetRpe(t *testing.T) {
+       rpe := Rpe{}
+       _ = rpe.generateRouteTable(stub.ValidEndPointsEmpty)
+}
index 52436ed..7cb350c 100644 (file)
@@ -30,8 +30,8 @@ package sbi
 import (
        "errors"
        "reflect"
-       "testing"
        "routing-manager/pkg/rtmgr"
+       "testing"
 )
 
 func TestGetSbi(t *testing.T) {
@@ -62,23 +62,27 @@ func TestUpdateE2TendPoint(t *testing.T) {
        var E2map = make(map[string]rtmgr.E2TInstance)
 
        E2map["1.2.3.4:100"] = rtmgr.E2TInstance{
-                Name: "E2Tinstance1",
-               Fqdn: "1.2.3.4:100",
-               Ranlist: []string{"1","2"},
+               Name:    "E2Tinstance1",
+               Fqdn:    "1.2.3.4:100",
+               Ranlist: []string{"1", "2"},
        }
 
-       sbi.updateE2TEndpoints(&E2map,sbii)
+       sbi.updateE2TEndpoints(&E2map, sbii)
        t.Log(err)
 }
 
-func TestpruneEndpointList(t *testing.T) {
+func TestPruneEndpointList(t *testing.T) {
        var sbi = Sbi{}
        var err error
-        sbii, err := GetSbi("nngpush")
-
+       sbii, err := GetSbi("nngpush")
        var EP = make(map[string]*rtmgr.Endpoint)
-       EP["10.0.0.1:0"] = &rtmgr.Endpoint{Uuid: "10.0.0.1:0", Name: "E2TERM", XAppType: "app1", Ip: "", Port: 0, TxMessages: []string{"", ""}, RxMessages: []string{"", ""}, Socket: nil, IsReady: true, Keepalive: true}
+       EP["10.0.0.1:0"] = &rtmgr.Endpoint{Uuid: "10.0.0.1:0", Name: "E2TERM", XAppType: "app1", Ip: "10.20.30.40", Port: 1234, TxMessages: []string{"", ""}, RxMessages: []string{"", ""}, Socket: nil, IsReady: true, Keepalive: false}
        rtmgr.Eps = EP
+
+       var nngpush = NngPush{}
+       nngpush.NewSocket = createNewStubPushSocket
+       nngpush.AddEndpoint(rtmgr.Eps["10.0.0.1:0"])
+
        sbi.pruneEndpointList(sbii)
        t.Log(err)
 }
index 97730a7..87923b5 100644 (file)
 package stub
 
 import (
-       "routing-manager/pkg/rtmgr"
-       "routing-manager/pkg/models"
        "github.com/go-openapi/swag"
+       "routing-manager/pkg/models"
+       "routing-manager/pkg/rtmgr"
 )
 
-
 var ValidXApps = &[]rtmgr.XApp{
        {Name: "app1", Status: "", Version: "", Instances: []rtmgr.XAppInstance{{Name: "E2TERM", Status: "unknown", Ip: "10.0.0.1", Port: 0, TxMessages: []string{"HandoverPreparation", "HandoverCancel"}, RxMessages: []string{"HandoverPreparation", "HandoverCancel"}}}},
        {Name: "app2", Status: "", Version: "", Instances: []rtmgr.XAppInstance{{Name: "SUBMAN", Status: "unknown", Ip: "192.168.0.1", Port: 0, TxMessages: []string{"HandoverCancel", "HandoverPreparation"}, RxMessages: []string{"HandoverPreparation", "HandoverCancel"}}}},
@@ -65,9 +64,10 @@ var ValidE2TInstance = rtmgr.E2TInstance{
 
 var E2map = make(map[string]rtmgr.E2TInstance)
 
+var ValidEndPointsEmpty = rtmgr.Endpoints{}
 
 var ValidRicComponents = rtmgr.RicComponents{
-       XApps: *ValidXApps, Pcs: *ValidPlatformComponents, E2Ts: E2map,
+       XApps: *ValidXApps, Pcs: *ValidPlatformComponents, E2Ts: E2map, MeidMap: []string{"mme_ar|e2t.com:1234"},
 }
 
 var ValidPolicies = &[]string{"", ""}
@@ -79,22 +79,21 @@ var ValidSubscriptions = &[]rtmgr.Subscription{
        {SubID: 1237, Fqdn: "10.2.2.1", Port: 0},
 }
 
-var DummyRoutes = &rtmgr.PlatformRoutes {
-       {MessageType: "12000",SenderEndPoint: "SUBMAN",SubscriptionId: 123,EndPoint: "UEMAN", Meid: ""},
-        {MessageType: "12001",SenderEndPoint: "RSM",SubscriptionId: 123,EndPoint: "A1MEDIATOR", Meid: ""},
-        {MessageType: "12002",SenderEndPoint: "E2MAN",SubscriptionId: 123,EndPoint: "E2TERMINST", Meid: ""},
-        {MessageType: "12003",SenderEndPoint: "E2TERMINST",SubscriptionId: 123,EndPoint: "E2MAN", Meid: ""},
-        {MessageType: "12004",SenderEndPoint: "A1MEDIATOR",SubscriptionId: 123,EndPoint: "RSM", Meid: ""},
-        {MessageType: "12005",SenderEndPoint: "UEMAN",SubscriptionId: 123,EndPoint: "SUBMAN", Meid: ""},
+var DummyRoutes = &rtmgr.PlatformRoutes{
+       {MessageType: "12000", SenderEndPoint: "SUBMAN", SubscriptionId: 123, EndPoint: "UEMAN", Meid: ""},
+       {MessageType: "12001", SenderEndPoint: "RSM", SubscriptionId: 123, EndPoint: "A1MEDIATOR", Meid: ""},
+       {MessageType: "12002", SenderEndPoint: "E2MAN", SubscriptionId: 123, EndPoint: "E2TERMINST", Meid: ""},
+       {MessageType: "12003", SenderEndPoint: "E2TERMINST", SubscriptionId: 123, EndPoint: "E2MAN", Meid: ""},
+       {MessageType: "12004", SenderEndPoint: "A1MEDIATOR", SubscriptionId: 123, EndPoint: "RSM", Meid: ""},
+       {MessageType: "12005", SenderEndPoint: "UEMAN", SubscriptionId: 123, EndPoint: "SUBMAN", Meid: ""},
 }
 
 var Rane2tmap = models.RanE2tMap{
-        {E2TAddress: swag.String("10.10.10.10:100"),RanNamelist: []string{"1","2"}},
-        {E2TAddress: swag.String("11.11.11.11:101"),RanNamelist: []string{"3","4"}},
-        {E2TAddress: swag.String("12.12.12.12:101"),RanNamelist: []string{}},
+       {E2TAddress: swag.String("10.10.10.10:100"), RanNamelist: []string{"1", "2"}},
+       {E2TAddress: swag.String("11.11.11.11:101"), RanNamelist: []string{"3", "4"}},
+       {E2TAddress: swag.String("12.12.12.12:101"), RanNamelist: []string{}},
 }
 
 var Rane2tmaponlyE2t = models.RanE2tMap{
-        {E2TAddress: swag.String("10.10.10.10:100"),RanNamelist: []string{}},
+       {E2TAddress: swag.String("10.10.10.10:100"), RanNamelist: []string{}},
 }
-
index 45fe861..e5d21bd 100644 (file)
@@ -388,10 +388,59 @@ r3_multiple_e2t_instances_support_scenario6
     ##1: Create one E2T Instnace
     Log    "1. Create E2T instances "
     ##Delete If it exists already
-    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -i POST "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"dummy.e2t.com:12345\\" }"
+    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -i -X POST "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"dummy.e2t.com:12345\\" }"
     log    ${cmd_output}
     Run Keyword    Should Contain    ${cmd_output}    400 Bad Request 
 
+r3_multiple_e2t_instances_support_scenario7
+    [Documentation]    This Test case covers the checks of Multiple E2T instance support feature
+    ...
+    ...    Scenario 7 [ Positive Case] :
+    ...
+    ...    Step1 : \ Create of  10 E2T instance 
+       ...
+    [Tags]    RICPLT_MultipleE2T
+    ##Scenario1 execution
+    ##1: Create one E2T Instance
+    Log    "1. Create E2T instances "
+    ##Delete If it exists already
+       :FOR     ${INDEX}    IN RANGE     1    11
+    \    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -i -X POST "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"10.20.30.${INDEX}:12345\\" }"
+    \    log    ${cmd_output}
+    \    Run Keyword    Should Contain    ${cmd_output}    201  
+    ##2: Delete the created E2T instances
+       :FOR     ${INDEX}    IN RANGE     1    11
+    \    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -i -X DELETE "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"10.20.30.${INDEX}:12345\\" }"
+    \    log    ${cmd_output}
+    \    Run Keyword    Should Contain    ${cmd_output}    201  
+
+
+r3_multiple_e2t_instances_support_scenario8
+    [Documentation]    This Test case covers the checks of Multiple E2T instance support feature
+    ...
+    ...    Scenario 8 [ Positive Case] :
+    ...
+    ...    Step1 : \ Create of  10 E2T instance 
+       ...
+    [Tags]    RICPLT_MultipleE2T
+    ##Scenario1 execution
+    ##1: Create one E2T Instance
+    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -X DELETE "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"10.105.143.108:38000\\"}"
+    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -X POST "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"10.105.143.108:38000\\" }"
+    log    ${cmd_output}
+    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} -- curl -X POST "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/associate-ran-to-e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "[ { \\"E2TAddress\\": \\"10.105.143.108:38000\\", \\"ranNamelist\\": [ \\"R1\\", \\"R2\\", \\"R3\\", \\"R4\\", \\"R5\\", \\"R6\\", \\"R7\\", \\"R8\\", \\"R9\\", \\"R10\\"] }]"
+    log    ${cmd_output}
+    ${cmd_output1}    Execute command    kubectl logs -n ricplt ${NEAR_RT_RIC_PLT_RTMGR_POD_NAME} --tail=12 | grep meid
+    log    ${cmd_output1}
+    Run Keyword    Should Contain    ${cmd_output1}    mme_ar|10.105.143.108:38000|R1 R2 R3 R4 R5 R6 R7 R8 R9 R10
+    Run Keyword    Should Contain    ${cmd_output1}    meid_map|end|1
+    ${cmd_output}    Execute command    kubectl exec -n ricplt ${NEAR_RT_RIC_PLT_E2MGR_POD_NAME} \ -- curl -i -X DELETE "http://service-ricplt-rtmgr-http:3800/ric/v1/handles/e2t" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \\"E2TAddress\\": \\"10.105.143.108:38000\\" }"
+    ${cmd_output1}    Execute command    kubectl logs -n ricplt ${NEAR_RT_RIC_PLT_RTMGR_POD_NAME} --tail=12 | grep meid
+    log    ${cmd_output1}
+    Run Keyword    Should Contain    ${cmd_output}    201  
+    Run Keyword    Should Contain    ${cmd_output1}   mme_del|R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 
+
+
 *** Keywords ***
 Login_RIC_Platform_VM
     [Arguments]    ${alias_name}=ricplt