Updated IP and Port configurations
[o-du/l2.git] / src / ric_stub / ric_stub.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /* This functions contains main() for ric_app */
20 #include "common_def.h"
21 #include "odu_common_codec.h"
22 #include "ric_stub.h"
23 #include "ric_stub_sctp.h"
24 #include "du_log.h"
25
26 #define RIC_ID 1
27 #define RIC_NAME "ORAN_OAM_RIC"
28 #define DU_IP_V4_ADDR "192.168.130.81"
29 #define RIC_IP_V4_ADDR "192.168.130.80"
30 #define DU_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0001"
31 #define RIC_IP_V6_ADDR "0000:0000:0000:0000:0000:0000:0000:0011"
32 #define DU_PORT 36422
33 #define RIC_PORT 36422
34 #define RRC_VER 0
35 #define EXT_RRC_VER 5
36 #define PLMN_MCC0 3
37 #define PLMN_MCC1 1
38 #define PLMN_MCC2 1
39 #define PLMN_MNC0 4
40 #define PLMN_MNC1 8
41 #define PLMN_MNC2 0
42
43 /*******************************************************************
44  *
45  * @brief Handles SCTP notification 
46  *
47  * @details
48  *
49  *    Function : sctpNtfyInd
50  *
51  *    Functionality:
52  *         Handles SCTP notification
53  *
54  * @params[in] sctp notification
55  * @return void
56  *
57  ******************************************************************/
58 void sctpNtfyInd(CmInetSctpNotification *ntfy)
59 {
60 //TODO
61 }
62
63 void init_log()
64 {
65         openlog("RIC_STUB",LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
66 }
67 /*******************************************************************
68  *
69  * @brief Main function of E2 APP
70  *
71  * @details
72  *
73  *    Function : main
74  *
75  *    Functionality:
76  *         - Reads RIC related configurations
77  *         - Initialize SCTP Parameters
78  *         - Start SCTP receiver thread
79  *
80  * @params[in] 
81  * @return ROK     - success
82  *         RFAILED - failure
83  *
84  * ****************************************************************/
85
86 S16 tst()
87 {
88    init_log();   
89  
90    DU_LOG("\nStarting RIC_STUB");
91    /* Read RIC configurations */
92    readRicCfg();
93
94    /* Start RIC-SCTP to listen on incoming connection */
95    sctpCfgReq();
96    sctpStartReq();
97
98    return ROK;
99 }
100 /*******************************************************************
101  *
102  * @brief Read RIC related configuration
103  *
104  * @details
105  *
106  *    Function : readRicCfg
107  *
108  *    Functionality:
109  *            - Read RIC related configuration
110  *
111  * @params[in] 
112  * @return ROK     - success
113  *         RFAILED - failure
114  *
115  * ****************************************************************/
116
117 void readRicCfg()
118 {
119    U32 ipv4_du, ipv4_ric;
120
121    DU_LOG("\nReading RIC configurations");
122
123    cmInetAddr((S8*)DU_IP_V4_ADDR, &ipv4_du);
124    cmInetAddr((S8*)RIC_IP_V4_ADDR, &ipv4_ric);
125  
126    ricCfgParams.ricId = RIC_ID;
127    strcpy(ricCfgParams.ricName, RIC_NAME);
128  
129    /* DU IP Address and Port*/
130    ricCfgParams.sctpParams.duIpAddr.ipV4Addr = ipv4_du;
131    ricCfgParams.sctpParams.duIpAddr.ipV6Pres = false;
132    ricCfgParams.sctpParams.duPort = DU_PORT;
133
134    /* RIC IP Address and Port*/
135    ricCfgParams.sctpParams.ricIpAddr.ipV4Addr = ipv4_ric;
136    ricCfgParams.sctpParams.ricIpAddr.ipV6Pres = false;
137    ricCfgParams.sctpParams.ricPort = RIC_PORT;
138
139    /*PLMN*/
140    ricCfgParams.plmn.mcc[0] = PLMN_MCC0;
141    ricCfgParams.plmn.mcc[1] = PLMN_MCC1;
142    ricCfgParams.plmn.mcc[2] = PLMN_MCC2;
143    ricCfgParams.plmn.mnc[0] = PLMN_MNC0;
144    ricCfgParams.plmn.mnc[1] = PLMN_MNC1;
145    ricCfgParams.plmn.mnc[2] = PLMN_MNC2;
146   
147 } /* End of readCuCfg */
148 /**********************************************************************
149          End of file
150 **********************************************************************/