2c33d55e6c34283bf6bf178081d2474b6f364e8a
[ric-app/hw.git] / test / test_subs.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 #ifndef TEST_TEST_SUBS_H_
20 #define TEST_TEST_SUBS_H_
21
22 #include<iostream>
23 #include<gtest/gtest.h>
24 #include "xapp.hpp"
25 #define BUFFER_SIZE 1024
26
27 using namespace std;
28 //generating a E2AP Subscription Message
29 TEST(SUBSCRIPTION, Request){
30
31
32         subscription_helper  din;
33         subscription_helper  dout;
34
35         subscription_request sub_req;
36         subscription_request sub_recv;
37
38         unsigned char buf[BUFFER_SIZE];
39         size_t buf_size = BUFFER_SIZE;
40         bool res;
41
42
43         //Random Data  for request
44         int request_id = 1;
45         int function_id = 0;
46         std::string event_def = "HelloWorld Event Definition";
47
48         din.set_request(request_id);
49         din.set_function_id(function_id);
50         din.set_event_def(event_def.c_str(), event_def.length());
51
52         std::string act_def = "HelloWorld Action Definition";
53
54         din.add_action(1,1,(void*)act_def.c_str(), act_def.length(), 0);
55
56         res = sub_req.encode_e2ap_subscription(&buf[0], &buf_size, din);
57         ASSERT_TRUE(res);
58
59
60
61 }
62
63
64 #endif /* TEST_TEST_SUBS_H_ */