Table of Contents

Alarm Sync - Remote Database Test Config Setup

Author: Andrew Kavanagh

Disclaimer This Wiki was created to facilitate the testing process of Database Alarm Sync Operations. This guide is only concerned with outlining the basic configuration that is necessary for testing the EMS's capabilities to retrieve raw alarm data by means of database query and make this data available to the RDF for further processing. This set-up configuration is NOT suitable for testing the capacity of the RDF to process this data to active alarms in our applications.

Basic Configuration Requirements For Testing

Remote Database Configuration

Holds relevant configuration information for estiablishing connections to remote databases for alarm sync. Such as driver information, connection URLs, usernames and password and login script. Represented by a domain class in the SNMP application. It provides convenient behaviours for establishing connections to targeted remote databases.

Schema

id
version
name
user_name
password
driver
connection_url_prefix
datasource_required
login_script_id
Test Entry Remote Database Configuration

INSERT INTO remote_database_configuration (version,name,user_name,password,driver,connection_url_prefix,datasource_required, login_script_id) VALUES ('1.72','TestRemoteDB','reader','ozzrules','com.mysql.jdbc.Driver','jdbc:mysql://', false, ${ID Of Your DB RDF Login Script});

Remote Discovery Scripts

In order to test alarm synchronisation through DB query requires a minimum of 4 basic remote discovery scripts. From the remote discovery script controller in the SNMP manager application create 4 scripts of the following types:

DB Login Script

/***************************************************************
 * Copyright (c) 2015 Errigal Inc.
 *
 * This software is the confidential and proprietary information
 * of Errigal, Inc.  You shall not disclose such confidential
 * information and shall use it only in accordance with the
 * license agreement you entered into with Errigal.
 *
 *************************************************************** */

/**
 *  variable is defined in RemoteElement Interface
 *  -- Variables --
 *  networkElement ... Grails domain class (com.errigal.snmpmanager)
 *  log ... SLF4J Logger in production, ScriptTestLogger during testing script
 *  -- Return Type --
 */

import com.errigal.snmpmanager.RemoteDatabaseConfiguration

final int MAX_QUERY_RUNNING_TIME = 300

def dbConfig = RemoteDatabaseConfiguration.findByName('TestRemoteDB')
def conn = dbConfig.getSQLConnection('qadb1.err:3306/snmp_manager')

return new Tuple(conn,MAX_QUERY_RUNNING_TIME)

Test Alarm Sync Path

/***************************************************************
 * Copyright (c) 2015 Errigal Inc.
 *
 * This software is the confidential and proprietary information
 * of Errigal, Inc.  You shall not disclose such confidential
 * information and shall use it only in accordance with the
 * license agreement you entered into with Errigal.
 *
 *************************************************************** */

/**
 *  variable is defined in RemoteElement Interface
 *  -- Variables --
 *  networkElement ... Grails domain class (com.errigal.snmpmanager)
 *  log ... SLF4J Logger in production, ScriptTestLogger during testing script
 *  -- Return Type --
 */


def paths = []

String current =  """
                  SELECT
                    ne.name,
                    ne.ne_type,
                    aa.alarm_identifier,
                    aa.status,
                    aa.created_date,
                    aa.context
                  FROM 
                    active_alarm aa
                      JOIN
                    network_element ne on aa.network_element_id = ne.id
                  WHERE aa.network_element_id in (select id from network_element where id = ${networkElement.id} or parent_id = ${networkElement.id})
                     AND aa.cleared = false
                  """

String disabled = 'SELECT 1'


switch(type) {
  case 'current': paths << [path: current]
    break;
  case 'disabled': paths << [path: disabled]
}

return paths

Test Current Alarm Parser(Log Results To Server Logs Is Sufficient For Testing Purposes)

/***************************************************************
 * Copyright (c) 2015 Errigal Inc.
 *
 * This software is the confidential and proprietary information
 * of Errigal, Inc.  You shall not disclose such confidential
 * information and shall use it only in accordance with the
 * license agreement you entered into with Errigal.
 *
 *************************************************************** */

/**
 *  variable is defined in RemoteElement Interface
 *  -- Variables --
 *  networkElement ... Grails domain class (com.errigal.snmpmanager)
 *  log ... SLF4J Logger in production, ScriptTestLogger during testing script
 *  -- Return Type --
 */

import com.errigal.snmpmanager.autodiscovery.DiscoveredAlarm

def alarmRows = pathResultMap.values().flatten()
def discoveredAlarms = []

if(alarmRows.size()) {
  alarmRows.each{ log.info "Alarm Rows: $it, alarm rows size: ${alarmRows.size()}" }
} else {
  log.info "No active alarms from this DB sync :("
}

return discoveredAlarms

Disabled Alarm Parser

/***************************************************************
 * Copyright (c) 2015 Errigal Inc.
 *
 * This software is the confidential and proprietary information
 * of Errigal, Inc.  You shall not disclose such confidential
 * information and shall use it only in accordance with the
 * license agreement you entered into with Errigal.
 *
 *************************************************************** */

/**
 *  variable is defined in RemoteElement Interface
 *  -- Variables --
 *  networkElement ... Grails domain class (com.errigal.snmpmanager)
 *  log ... SLF4J Logger in production, ScriptTestLogger during testing script
 *  -- Return Type --
 */

log.info networkElement.toString()
log.info "Test Disabled Alarm Parser....."
return []

Test Alarm Sync Setting

An alarm sync setting for database sync is necessary so it can be associated with Network Elements which support such operations. The relevant ID's of the test remote discovery script you created above are inserted into a test alarm sync setting entry. See query outline below:

INSERT INTO alarm_sync_setting (version,name,retrieve_path_script_id,current_alarm_get_type,current_alarm_mib_id,current_alarm_parse_script_id,disabled_alarm_get_type,disabled_alarm_mib_id,disabled_alarm_parse_script_id,disabled_alarm_cache_expiry_days,parameter_populate_script_id,max_running_time)
VALUES (0,'TestDBSync',${IDOfTestAlarmSyncPath},'DB_QUERY',null,${IDOfTestCurrentAlarmParser},'DB_QUERY',null,${IDOfTestDisabledAlarmParser},30,null,10);

Network Element

A test controller needs to be selected from the current QA server. Please ensure this controller has active alarms or at least - an active alarm history. This controller and its children need to be assigned the key of the Test remote database configuration entry which was created at the start of this Wiki. This is important as the SNMP manager application will use this key to instantiate a Remote Database Connection Manager which handles alarm sync DB tasks on the remote database server.

The test controller and its children also need to be assigned the key of the alarm sync setting which was created in the previous step of this wiki.

Network Element - Remote Database Connection Manager Assignment

update network_element set remote_database_manager_configuration_id = ${Id Of Remote Database Configuration} where id = ${controllerID} or parent_id = ${controllerID}

Network Element - Alarm Sync Setting Assignment

update network_element set alarm_sync_setting_id = {Id Of Test Alarm Sync Setting} where id = ${controllerID} or parent_id = ${controllerID}

Alarm Sync Setup Firebird Database(Connection Pooling)