From: Ashwin Sridharan Date: Wed, 25 Dec 2019 03:50:48 +0000 (-0500) Subject: Updated documentation for mock a1 tool X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fheads%2Fmaster;p=ric-app%2Fadmin.git Updated documentation for mock a1 tool Fixed missing docs in unit tests etc Fixed inline string for docs that was generating documenation error Signed-off-by: Ashwin Sridharan Change-Id: I136ef6cb4aece39fae8303b6340c1f4322c676e3 Signed-off-by: Ashwin Sridharan --- diff --git a/docs/installation-guide.rst b/docs/installation-guide.rst index cffd4e3..562e526 100755 --- a/docs/installation-guide.rst +++ b/docs/installation-guide.rst @@ -126,12 +126,12 @@ directory contains mock-ups for these three components which can be build and ex 2. **A1 Mediator** : The A1 mediator is responsible for sending policies to the xAPPs over RMR to configure their behaviour. A mock-up of the A1 mediator can be built and executed as follows : - - *make mock-a1-server* builds the executable. - - The executable can be run as *./mock-a1-server -p * where port number can be any port not conflicting with the xAPP and E2 Term. - - Note that the A1 mediator also uses RMR and hence the environment variable *RMR_SEED_RT* must also be set when executing *mock-a1-server* (if static routes are being used). - - On start up, the *mock-a1-mediator* will send a stream of valid/invalid JSON messages containing policies to test the xAPP. + - *make mock-a1-tool* builds the executable. + - The executable can be run as *./mock-a1-tool -p * where port number can be any port not conflicitng with the xAPP and E2 Term ports. + - Note that the A1 mediator also uses RMR and hence the environment variable *RMR_SEED_RT* must also be set when executing *mock-a1-tool* (if static routes are being used). + - Run ./mock-a1-tool -h to see various options. -3. **VES Collector** : This component is responsible for receiving metrics from xAPPs as JSON payloads. A simple mock-up is available under *test/* which is basically a *cherrypy* web-server that receives JSON and prints out relevant messages. It can be invoked as *python ./mock_ves_collector.py*. +3. **VES Collector** : This component is responsible for receiving metrics from xAPPs as JSON payloads. A simple mock-up is available under *test/* which is basically a *cherrypy* web-server that receives VES messages from the Admission Control Xapp and prints out relevant messages. It can be invoked as *python ./mock_ves_collector.py*. - Pre-requisites for the VES collector are the *cherrypy* and *requests* Python modules. They can be installed via pip : *pip install cherrypy requests*. diff --git a/test/mock_a1_mediator.cc b/test/mock_a1_mediator.cc index e94c92b..12f943e 100644 --- a/test/mock_a1_mediator.cc +++ b/test/mock_a1_mediator.cc @@ -61,11 +61,16 @@ bool rcv_message(rmr_mbuf_t *message){ void usage(char *command){ - std::cout <<"Usage : " << command << " "; - std::cout <<" --name[-n] xapp_instance_name "; - std::cout <<" --port[-p] port to listen on (default is tcp:4561) "; - std::cout <<"--schema[-s] schema file"; - + std::cout <<"Usage : " << command << " " << std::endl; + std::cout <<" --name[-n] xapp_instance_name " << std::endl; + std::cout <<" --port[-p] port to listen on (default is tcp:4561) " << std::endl; + std::cout << " --op[-o] operation mode from {0, 1, 2} : 0 is CREATE, 1 is UPDATE, 2 is DELETE" << std::endl; + std::cout << " --window [-w] window size in seconds (default is 60 seconds)" << std::endl; + std::cout << " --blockrate [-b] blocking rate percentage (default is 90%)" << std::endl; + std::cout << " --trigger[-t] trigger threshold (default is 40 requests in window)" << std::endl; + std::cout << " --enforce set policy to enforce if flag prvoided (default is 0 i.e not enforce)" << std::endl; + std::cout << " --class [-c] subscriber profile id to which policy must be applied (default is 5)" << std::endl; + std::cout << " --instance[-i] policy instance id (default is ac-xapp-1)" << std::endl; std::cout << std::endl; } diff --git a/test/run_tests.sh b/test/run_tests.sh index 13ba4bf..2908804 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -1,8 +1,7 @@ #! /bin/bash -#test_cases=( "TEST_MESSAGE_PROCESSOR" "TEST_ADMISSION" "TEST_PROTECTOR_PLUGIN" "TEST_SUBSCRIPTION_FLOW" "TEST_SUBSCRIPTION" "TEST_E2AP_INDICATION" "TEST_E2AP_CONTROL" "TEST_E2SM" "TEST_JSON" "TEST_X2_SGNB" "TEST_SLIDING_WINDOW" ) +test_cases=( "TEST_MESSAGE_PROCESSOR" "TEST_ADMISSION" "TEST_PROTECTOR_PLUGIN" "TEST_SUBSCRIPTION_FLOW" "TEST_SUBSCRIPTION" "TEST_E2AP_INDICATION" "TEST_E2AP_CONTROL" "TEST_E2SM" "TEST_XAPP" "TEST_X2_SGNB" "TEST_SLIDING_WINDOW" ) -test_cases=( "TEST_PROTECTOR_PLUGIN" ) # Run through test cases for((i = 0; i < ${#test_cases[@]}; i++)); do diff --git a/test/unit_test_xapp.cc b/test/unit_test_xapp.cc index e1d47f1..4e4b670 100644 --- a/test/unit_test_xapp.cc +++ b/test/unit_test_xapp.cc @@ -1,4 +1,6 @@ /* + // basically just set size to be larger than allowed even if actual + // message is small ================================================================================== Copyright (c) 2018-2019 AT&T Intellectual Property. @@ -61,12 +63,6 @@ void dropped_pkts(rmr_mbuf_t *send_msg){ num_dropped_pkts++; } -bool pong_a1(rmr_mbuf_t *rcv_msg){ - rcv_msg->mtype = A1_POLICY_RESP; - num_ping_pkts++; - return true; -} - bool pong_x(rmr_mbuf_t *rcv_msg){ rcv_msg->mtype = 102; //ping port @@ -268,38 +264,8 @@ TEST_CASE("Test xapp functionality", "[xapp]"){ REQUIRE(num_pong_pkts == NumPkts); - // Re-run experiment but now with A1 message type when - // ping responds - pong_xapp.StartThread(pong_a1); - sleep(1); - - failed_tx = 0; - num_ping_pkts = 0; - num_pong_pkts = 0; - - - for(i = 0; i < NumPkts; i++){ - clock_gettime(CLOCK_REALTIME, &(my_message.ts)); - snprintf(my_message.payload, MESSAGE_SIZE, "hello world %d", i); - bool res = ping_xapp.Send(101, sizeof(Test_message), (void *) (&my_message)); - if (!res){ - failed_tx ++; - } - } - - sleep(1); ping_xapp.Stop(); - pong_xapp.Stop(); - - std::cerr <<"Pong received ping pkts = " << num_ping_pkts << " Ping received a1 packets = " << num_pong_pkts << " failures = " << failed_tx << std::endl; - - REQUIRE(num_ping_pkts >= NumPkts); - REQUIRE(num_pong_pkts >= NumPkts); - REQUIRE(failed_tx == 0); - - - } } @@ -329,10 +295,12 @@ TEST_CASE(" Test out various transmission methods ..", "1"){ sleep(1); // Test sending a message of size larger than allowed + // basically just set size to be larger than allowed even if actual + // message is small res = test_xapp.Send(102, RMR_BUFFER_SIZE + 100, (void *)(&my_message)); REQUIRE(res == false); - res = test_xapp.Send(102, RMR_BUFFER_SIZE + 100, (void *)(&my_message), "id"); + res = test_xapp.Send(102, RMR_BUFFER_SIZE + 100, (void *)(&my_message), my_meid); REQUIRE(res == false); test_xapp.Stop();