diff options
author | Srikanth Naidu <sn8492@att.com> | 2018-08-14 21:29:31 +0530 |
---|---|---|
committer | Srikanth Naidu <sn8492@att.com> | 2018-08-14 21:30:57 +0530 |
commit | 822c418921c5abf96a48decf81c7bdf595b76c16 (patch) | |
tree | 89bda5874cb4b7941475a0e67596e64677c0b46a /vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c | |
parent | b2c608a794d454fffc738e691919fddf5ca1578b (diff) |
C library update for VES5.4.1
Keyword vNicUsageArray is replaced by vNicPerformanceArray and other C library updates for VES5.4.1
Change-Id: I21611b6680ca732562fb9984a5fcd9679f8376e9
Issue-ID: CERT-15
Signed-off-by: Srikanth Naidu <sn8492@att.com>
Diffstat (limited to 'vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c')
-rw-r--r-- | vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c index 4e4383e4..488e073a 100644 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.c @@ -64,9 +64,13 @@ char *functional_role = NULL; * * @param fqdn The API's FQDN or IP address. * @param port The API's port. + * @param bakup_fqdn The API's Backup FQDN or IP address. + * @param bakup_port The API's Backup port. * @param path The optional path (may be NULL). * @param topic The optional topic part of the URL (may be NULL). + * @param ring buf size Ring buffer size * @param secure Whether to use HTTPS (0=HTTP, 1=HTTPS) + * @param activmode Whether to use ActivStandby(0) collectors or ActiveStandby(1) * @param cert_file_path Path to client certificate file * @param key_file_path Path to client key file * @param ca_info Path to CA cert file @@ -75,7 +79,10 @@ char *functional_role = NULL; * @param verify_host SSL verification of host 0 or 1 * @param username Username for Basic Authentication of requests. * @param password Password for Basic Authentication of requests. - * @param source_ip The ip of node we represent (NULL for default ip). + * @param bakup_username Username for Basic Authentication of Bakup FQDN. + * @param bakup_password Password for Basic Authentication of Bakup FQDN. + * @param source_ip The ip of node we represent.(NULL for default ip) + * @param bakup_source_ip The ip bakup fqdn interface.(NULL for default ip) * @param source_type The kind of node we represent. * @param role The role this node undertakes. * @param verbosity 0 for normal operation, positive values for chattier @@ -87,10 +94,13 @@ char *functional_role = NULL; *****************************************************************************/ EVEL_ERR_CODES evel_initialize(const char * const fqdn, int port, + const char * const bakup_fqdn, + int bakup_port, const char * const path, const char * const topic, int ring_buf_size, int secure, + int activmode, const char * const cert_file_path, const char * const key_file_path, const char * const ca_info, @@ -99,7 +109,10 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, long verify_host, const char * const username, const char * const password, + const char * const bakup_username, + const char * const bakup_password, const char * const source_ip, + const char * const bakup_source_ip, EVEL_SOURCE_TYPES source_type, const char * const role, int verbosity @@ -108,11 +121,13 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, EVEL_ERR_CODES rc = EVEL_SUCCESS; char base_api_url[EVEL_MAX_URL_LEN + 1] = {0}; char event_api_url[EVEL_MAX_URL_LEN + 1] = {0}; + char bakup_api_url[EVEL_MAX_URL_LEN + 1] = {0}; char throt_api_url[EVEL_MAX_URL_LEN + 1] = {0}; char path_url[EVEL_MAX_URL_LEN + 1] = {0}; char topic_url[EVEL_MAX_URL_LEN + 1] = {0}; char version_string[10] = {0}; int offset; + char * bakup_coll = NULL; /***************************************************************************/ /* Check assumptions. */ @@ -122,10 +137,17 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, assert(source_type < EVEL_MAX_SOURCE_TYPES); assert(role != NULL); + if( bakup_fqdn != NULL ) { + assert(bakup_port > 0 && bakup_port <= 65535); + } + /***************************************************************************/ /* Start logging so we can report on progress. */ /***************************************************************************/ - log_initialize(verbosity == 0 ? EVEL_LOG_INFO : EVEL_LOG_DEBUG, "EVEL"); + if( verbosity >= EVEL_LOG_MIN && verbosity <= EVEL_LOG_MAX) + log_initialize(verbosity, "EVEL"); + else + log_initialize(EVEL_LOG_MIN, "EVEL"); EVEL_INFO("EVEL started"); EVEL_INFO("API server is: %s", fqdn); EVEL_INFO("API port is: %d", port); @@ -238,6 +260,36 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, EVEL_INFO("Vendor Event Listener API is located at: %s", event_api_url); /***************************************************************************/ + /* Build a common base of the Backup API URLs. */ + /***************************************************************************/ + if( bakup_fqdn != NULL ) + { + strcpy(path_url, "/"); + snprintf(base_api_url, + EVEL_MAX_URL_LEN, + "%s://%s:%d%s/eventListener/v%s", + secure ? "https" : "http", + bakup_fqdn, + bakup_port, + (((path != NULL) && (strlen(path) > 0)) ? + strncat(path_url, path, EVEL_MAX_URL_LEN) : ""), + version_string); + + /***************************************************************************/ + /* Build the URL to the event API. */ + /***************************************************************************/ + strcpy(topic_url, "/"); + snprintf(bakup_api_url, + EVEL_MAX_URL_LEN, + "%s%s", + base_api_url, + (((topic != NULL) && (strlen(topic) > 0)) ? + strncat(topic_url, topic, EVEL_MAX_URL_LEN) : "")); + EVEL_INFO("Vendor Backup Event Listener API is located at: %s", bakup_api_url); + bakup_coll = bakup_api_url; + } + + /***************************************************************************/ /* Build the URL to the throttling API. */ /***************************************************************************/ snprintf(throt_api_url, @@ -250,10 +302,13 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, /* Spin-up the event-handler, which gets cURL readied for use. */ /***************************************************************************/ rc = event_handler_initialize(event_api_url, + bakup_coll, throt_api_url, source_ip, + bakup_source_ip, ring_buf_size, secure, + activmode, cert_file_path, key_file_path, ca_info, @@ -262,6 +317,8 @@ EVEL_ERR_CODES evel_initialize(const char * const fqdn, verify_host, username, password, + bakup_username, + bakup_password, verbosity); if (rc != EVEL_SUCCESS) { |