Merge "[VVP] update heat templates for vLBMS"
[demo.git] / vnfs / readme.md
1 # ECOMP Vendor Event Listener Library
2
3
4 This project contains a C library that supports interfacing to AT&T's ECOMP
5 Vendor Event Listener. For an overview of ECOMP, see the 
6 [ECOMP White Paper](http://att.com/ECOMP).
7
8 Developed in 2016 for AT&T by:
9  * Alok Gupta (https://github.com/ag1367)
10  * Paul Potochniak (https://github.com/pp8491)
11  * Gayathri Patrachari(https://github.com/gp2421)
12
13 Current Maintainers: 
14  * Alok Gupta (https://github.com/ag1367)
15  * Paul Potochniak (https://github.com/pp8491)
16  * Gayathri Patrachari(https://github.com/gp2421)
17
18 #The description about important directories are given here
19
20  VES5.0 - This contains the code for VES library for VES5.4.1, sample agents
21
22  VESreporting_vFW5.0 - This is the sample virtual firewall agent
23
24  VESreporting_vLB5.0 - This is the sample virtual load balancer agent
25
26  VES5.0/evel/evel-library/code/evel_library - Code for VES library 'evel'
27
28  VES5.0/evel/evel-library/code/VESreporting_HB - Sample json based heartbeat event generated periodically
29
30  VES5.0/evel/evel-library/code/VESreporting_fault - Sample json based fault event based on low byte/packet count on interface.
31
32  VES5.0/evel/evel-library/code/VESreporting_syslog - Sample json based syslog event based on pattern being logged into any file
33
34  VES5.0/evel/evel-library/code/VESreporting_vFW - Sample json based Firewall application that generates measurement event periodically. 
35
36 # Info on evel Library
37 This library supports following events. The corresponding factory functions to generate that event is also mentioned against it
38 - Faults  - ::evel_new_fault
39 - Heartbeat - ::evel_new_heartbeat
40 - Measurements - ::evel_new_measurement
41 - State Change - ::evel_new_state_change
42 - Syslog - ::evel_new_syslog
43 - Other - ::evel_new_other
44 - Mobile Flow - ::evel_new_mobile_flow
45 - Sipsingnaling - ::evel_new_signaling
46 - Threshold Crossing Alert - ::evel_new_threshold_cross
47 - Voice Quality - ::evel_new_voice_quality
48
49 # Setting the environment
50 Install gcc, libcurl3-dev packages as below
51
52   sudo apt-get install gcc
53   sudo apt-get install libcurl3-dev
54
55 Clone the code from demo repository
56
57 #Compile VES library
58  Go to /demo/vnfs/VES5.0/evel/evel-library/bldjobs directory and run the below commands
59    make all ==> to create the VES library
60    make package ==> to create the VES package if needed
61
62    FYI - 'make install' can also be given to make a package and install the package in another machine - see /demo/vnfs/VES5.0/evel/evel-library/bldjobs/Makefile for more details 
63
64  After compilation VES libraries are generated and are available at below location
65    /demo/vnfs/VES5.0/evel/evel-library/libs/x86_64
66
67 #Loading VES the library
68  Go to /demo/vnfs/VES5.0/evel/evel-library/libs/x86_64 directory and run below commands
69    sudo cp libevel.so /usr/lib
70    sudo ldconfig
71
72 #Compiling agent code
73  After successful compiling of VES library and loading the library, go to agent directory and run 'make all'
74 For json heartbeat agent
75  > cd /demo/vnfs/VES5.0/evel/evel-library/VESreporting_HB
76  > make all
77
78 For all other jason based agents (VESreporting_fault, VESreporting_syslog and VESreporting_vFW) also, the compilation to be carried out in the same manner as mentioned above. 
79
80 But for agents in VESreporting_vFW5.0 and VESreporting_vLB5.0, special care to be taken as below
81  - Copy the contents of the directory into ~/demo/vnfs/VES5.0/evel/evel-library/VESreporting directory
82  - run 'make all' to create an executable (alternatively, this agent gets compiled during compilation of evel library when VESreporting directory has the agent code.
83
84 #Run the agent
85  - run the application using go-client.sh command in the agent directory as below
86     > sudo chmod +x go-client.sh
87     > sudo ./go-client.sh
88
89 # Agent building guide
90
91 Each application that wants to send events would call evel_initialize() function to initialize the parameter with evel library. For more details about the parameters passed, see the VES5.0/evel/evel-library/code/evel_library/evel.h file. The public APIs to the library are defined in evel.h
92
93 EVEL_ERR_CODES evel_initialize(const char * const fqdn,
94                                int port,
95                                const char * const bakup_fqdn,
96                                int bakup_port,
97                                const char * const path,
98                                const char * const topic,
99                                int ring_buf_size,
100                                int secure,
101                                const char * const cert_file_path,
102                                const char * const key_file_path,
103                                const char * const ca_info,
104                                const char * const ca_file_path,
105                                long verify_peer,
106                                long verify_host,
107                                const char * const username,
108                                const char * const password,
109                                const char * const bakup_username,
110                                const char * const bakup_password,
111                                const char * const source_ip,
112                                const char * const bakup_source_ip,
113                                EVEL_SOURCE_TYPES source_type,
114                                const char * const role,
115                                int verbosity
116                                )  {
117     fprintf(stderr, "Failed to initialize the EVEL library!!!");
118     exit(-1);
119   }
120
121 After successful running of evel_initialize() API, call the APIs to generate the events.
122
123 For fault event generation, below APIs would be called. For other events see the APIs listed in VES5.0/evel/evel-library/code/evel_library/evel.h
124
125   EVENT_FAULT * fault = evel_new_fault("Fault_vFW-ATT-LinkdownError",
126                                        "fault0001",
127                                        "My alarm condition",
128                                        "It broke very badly",
129                                        EVEL_PRIORITY_NORMAL,
130                                        EVEL_SEVERITY_MAJOR,
131                                         EVEL_SOURCE_HOST,
132                              EVEL_VF_STATUS_PREP_TERMINATE);
133   if (fault != NULL)
134   {
135     evel_fault_type_set(fault, "Bad things happen...");
136     evel_fault_interface_set(fault, "My Interface Card");
137     evel_fault_addl_info_add(fault, "name1", "value1");
138     evel_fault_addl_info_add(fault, "name2", "value2");
139     evel_rc = evel_post_event((EVENT_HEADER *)fault);
140     if (evel_rc != EVEL_SUCCESS)
141     {
142       EVEL_ERROR("Post failed %d (%s)", evel_rc, evel_error_string());
143     }
144   }
145