Community string list in Smarts can get reshuffled when adding via GUI.
search cancel

Community string list in Smarts can get reshuffled when adding via GUI.

book

Article ID: 304045

calendar_today

Updated On:

Products

VMware

Issue/Introduction

Symptoms:


Community string list in Smarts can get reshuffled when adding via GUI.

Environment

VMware Smart Assurance - SMARTS

Cause

The reshuffling can happen at certain points when the system has a large number of community strings and a new string is being added via the GUI.  We do not have any logic to intentionally always keep order.  This will be added as an ehancement request for Product Management to review.  The script workaround will bypass GUI mechanisms and ensure the community strings are inputed in the desired order.

Resolution

Add community strings via asl.

/* updateCommunityList.asl
 * Copyright © 2005, EMC/SMARTS
 * All Rights Reserved
 *
 * RCS $Id: updateCommunityList.asl,v 1.0 2005/07/20 18:35:00 cranea Exp $
 *
 * Rule set for adding community strings to the DM in a specific order.
 *
 * NOTE: If the number of community strings in the seedfile exceed the
 *       maximum number of entries defined in the discovery.conf, the
 *       script will generate an error and NOT update the list.
 *
 * To execute the script,
 * 1.  copy it to BASEDIR/smarts/local/rules/utils
 * 2.  change to the BASEDIR/smarts/bin directory
 * 3.  execute the following
 *     sm_adapter -s <server_name> -f <path_and_file>
            utils/updateCommunityList.asl
 */

ASLNAME = " ".getRuleFileName().": ";

default debug = FALSE;
inputCount = 0;
commList = list();

if (debug) { print(time().ASLNAME."Started.."); }

START {
   READ_COMMUNITY_STRING
   .. eol
}

DEFAULT {
    line:{ .. eol }
} do {
    if (debug) {print(time().ASLNAME."Unprocessed: ".line);}
}

COMMENT { "#" .. eol }
BLANK { rep(" ") eol }
EMPTY { eol }

READ_COMMUNITY_STRING {
    community:word
    } do {
    inputCount = inputCount + 1;
    commList += community;
    if (debug){ print(time().ASLNAME."Input #: ".inputCount.", community string = ".community);}
}

UPDATE_COMMUNITY_LIST
do {
    if (sizeOf(commList) > 0) {
        print("Updating community list..");

        manager = object("ICF-TopologyManager");
        manager->setCommunities(commList);
    }
}

EOF {
    UPDATE_COMMUNITY_LIST
    do {
        print("# Community strings read: ".inputCount);
        if (debug) { print(time().ASLNAME."Completed.."); }
    }
}