Initial commit of Admission Control xAPP and E2AP/X2AP definitions
[ric-app/admin.git] / src / adm-ctrl-xapp.hpp
1 /*
2 ==================================================================================
3
4         Copyright (c) 2018-2019 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 /* Author : Ashwin Sridharan
20    Date    : Feb 2019
21 */
22
23 #pragma once
24 #ifndef ADM_CTRL_XAPP_
25 #define ADM_CTRL_XAPP_
26
27 #include <limits>
28 #include <map>
29 #include <getopt.h>
30 #include <csignal>
31 #include <cstdlib>
32 #include <time.h>
33 #include <errno.h>
34 #include <xapp_utils.hpp>
35 #include <rmr/RIC_message_types.h>
36 #include <curl_interface.hpp>
37 #include <e2sm.hpp>
38 #include "admission_policy.hpp"
39 #include "message_processor_class.hpp"
40
41 #define MAX_SLEEP 86400
42 #define DEFAULT_A1_SCHEMA_FILE "/etc/xapp/a1-schema.json"
43 #define DEFAULT_VES_SCHEMA_FILE "/etc/xapp/ves-schema.json"
44 #define DEFAULT_SAMPLE_FILE "/etc/xapp/samples.json"
45 #define DEFAULT_VES_COLLECTOR_URL "127.0.0.1:6350"
46 #define DEFAULT_VES_MEASUREMENT_INTERVAL 10
47 #define MAX_SUBSCRIPTION_ATTEMPTS 10
48 //================================================
49
50
51 // configuration parameters 
52 struct configuration {
53   
54   char name[128] = "xapp_adm_ctrl";
55   char port[16] = "tcp:4560";
56   
57   int num_threads = 1;
58   std::unique_ptr<XaPP> my_xapp;
59   std::string a1_schema_file ;
60   std::string sample_file ;
61   std::string ves_schema_file ;
62   std::string ves_collector_url;
63   unsigned int measurement_interval = 0;
64   int log_level = MDCLOG_WARN;
65   int test_mode = 0;
66   std::string operating_mode = "REPORT";
67
68   void fill_gnodeb_list(char * gNodeB_string){
69     gNodeB_list.clear();
70     char * gnb = strtok(gNodeB_string, ",");
71     while(gnb != NULL){
72       gNodeB_list.push_back(gnb);
73       gnb = strtok(NULL, ",");
74     }
75     
76   };
77   
78   std::vector<string> gNodeB_list;
79
80 };
81
82 void usage(char *command);
83 void get_environment_config(configuration & config_instance);
84 void get_command_line_config(int argc, char **argv, configuration &config_instance);
85 extern bool report_mode_only;
86 #endif