UNSOLVED

sudhansu-P0PMo

updated

18 years ago

0

1437

September 9th, 2008 04:00

Call a ASL script from another ASL script

Hi,

Can anyone tell me, how I can call and execute a ASL script from another ASL script, passing a input file to the second ASL script... Please suggest some solution..

For eg, executing test2.asl called from test1.asl, passing an input file named list1.txt to be used in test2.asl.
  • Hemulll

    2 Intern

    •

    138 Posts

    399

    0

    Posted November 20th, 2008 00:00

    Hi.

    I think you need only one file, but 2 different rules for different tasks.

    Please explain what task do you want to solve .
  • Dinand1

    89 Posts

    399

    0

    Posted November 20th, 2008 01:00

    Hi,

    IN which context are u executing this?
    Wouldn't be easier using perl?
    I know a script might be called from another script, but never used parameters.

    cheers

    F,
  • Hemulll

    2 Intern

    •

    138 Posts

    399

    0

    Posted November 20th, 2008 04:00

    Hi

    You can use perl.

    Example for simple perl script

    use InCharge::session;


    # -- Global variables
    $domain = "INCHARGE-SA-TEST";
    $class = "Host";

    # -- Create session
    $session = InCharge::session->new(
    broker=>"127.0.0.1",
    domain=>$domain,
    username=>"admin",
    password=>"changeme",
    traceServer => 1
    );
    $observer = $session->observer();
    # -- Get instances from class Host
    foreach $inst (sort $session->getInstances($class)) {
    print $class . "::" . $inst . "\n";

    # -- Create the object for each instance
    $obj = $session->object($inst);

    # -- continue with next element if object is no defined
    next if ($obj->isNull());
    # -- put your code here



    2) you can use asl file with sm_adapter --file file.asl


    But needs to completely to understand your task, for create script.

    Let me know what do you want to do in your script and i will try to help you
  • TCorcoran

    53 Posts

    399

    0

    Posted December 26th, 2008 16:00

    To communicate between different ASL scripts you will either need to create a GA_Driver or ACT_Script type object.

    For ASL to ASL functionality the GA_Driver and similar classes are the preferred way, they also allow for 2-way communication between the scripts.

    Here is an example from the ic-topomanager.asl

    driver = create("GA_Driver", "Seed-Verify-Driver");
    fe = create("GA_FileFE", "Seed-Verify-FE");
    fe->fileName = SEED_FILE;
    driver->ReadsInputFrom = fe;
    rule = create("GA_RuleSet", "Seed-Verify-RS");
    rule->fileName = "discovery/ic-file-importer.asl";
    driver->ReadsRulesFrom = rule;
    localServer = create("GA_LocalServer", "Seed-Verify-BE");
    if (localServer->isNull()) {
    localServer = create("GA_NullServer", "Seed-Verify-BE");
    }
    driver->SendsActionsTo = localServer;

    paramObj = driver->getMyParameters();
    verify = "FALSE";
    if (SEED_VERIFY) {
    verify = "TRUE";
    }
    paramObj->insert("SEED_VERIFY", verify);
    driver->startWithParameters(paramObj);
  • ArunDeva

    37 Posts

    399

    0

    Posted January 27th, 2010 02:00

    ACT_Script is a class which can be used for this purpose.

    dmctl> getProperties ACT_Script

    Properties of class ACT_Script:
          CreationClassName =
                       Name =
                ServiceName =
        interpreterFilespec =
            interpreterPath =
            scriptDirectory =
                 scriptName =
                       test =
                      trace =

    dmctl> getO ACT_Script

    Operations for class ACT_Script:
        clone_name
        run parameters stdindata
        run_ex parameters stdindata

    dmctl>

    sample snippet

    ------------------------------

    sampleScript = create("ACT_Script", "SAMPLE-SCRIPT" );

    sampleScript->scriptName = "getDetails_From_AM.sh";
    systemUptime = sampleScript->run(firewallObj->Name);ACT_Script is a class which can be used for calling an external script

    the script that needs to be run should be /action/ folder.

    Hope this helps.

    Thanks

    Arun