E2AP Wrapper Implementation
[ric-app/hw.git] / test / test_cntrl.h
1 /*
2 ==================================================================================
3
4         Copyright (c) 2019-2020 AT&T Intellectual Property.
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 ==================================================================================
18 */
19 /*
20  * test_cntrl.h
21  *
22  *  Created on: Nov 4, 2020
23  *      Author: Shraboni Jana
24  */
25
26 #ifndef TEST_TEST_CNTRL_H_
27 #define TEST_TEST_CNTRL_H_
28
29 #include<iostream>
30 #include<gtest/gtest.h>
31
32 #include "e2ap_control_request.hpp"
33 #include "e2sm_control.hpp"
34
35
36 TEST(E2SM, ControlMessage)
37 {
38
39         unsigned char buff[1024];
40         size_t buf_len = 1024;
41
42         HWControlMessage msgObj;
43         msgObj.set_ricControlMessage("ControlMessage");
44
45         HWControlHeader headObj;
46         headObj.set_ricControlHeader(1);
47
48         E2APControlMessage<HWControlHeader,HWControlMessage>::ControlRequestIEs infoObj;
49         infoObj.set_ranFunctionID(1);
50         infoObj.set_ricRequestorID(1);
51         infoObj.set_ricControlHeader(headObj);
52         infoObj.set_ricControlMessage(msgObj);
53 //      infoObj.set_ricCallProcessID("ProcessID");
54
55         E2APControlMessage<HWControlHeader,HWControlMessage>  cntrlObj(infoObj);
56
57         bool res = cntrlObj.encode(buff, &buf_len);
58                 if(!res)
59                 {
60                         std::cout << cntrlObj.get_error() << std::endl;
61                 }
62                 ASSERT_TRUE(res);
63 }
64
65
66
67
68 #endif /* TEST_TEST_CNTRL_H_ */