Smarts ASL and DMCTL vs Perl API – a comparison

This note lists the language constructs of the SMARTS InCharge ASL language and DMCTL utility, and indicates the PERL API equivalents. This is intended for DMCTL and ASL script writers who are familiar with the DMCTL, ASL and the PERL languages, but are new to the InCharge Perl API.

ASL features

ASL

Perl API

Notes

== , !=

== or eq, != or ne - depending on data type (standard PERL)

1

+, -, *, /, %

+, -, *, /, %

1

&&, ||

&& or "and", || or "or"

1

. (concatination)

. (the same)

1

. (immediate match)

Use perl "RE" features

1

.. (skip to next match)

Use perl "RE" features

1

+=

For repository relations:
$object->insertElement( $relation, $object )

For arrays: use perl functions such as "push", "unshift", etc

2

-=

For repository relations:
$object->removeElement( $relation, $object )

For arrays: use perl functions such as "pop", "shift", etc

2

? (match one or zero items)

Use perl RE features

1

? (exception handling)

Use perl "eval" function logic (see InCharge::primitives manpage, "Error handling" section

2

, >=

, >= or lt, gt, le, ge

1

obj->property

$obj->{property}
or: $obj->get("property") 

2

obj->*variable

$obj->{$variable}
or: $obj->get($variable) 

2

obj->operation(arg[s])

$obj->operation( $arg[s] )
or: $obj->invoke("operation", $args[s] ) 

2

any (match any)

Use perl RE features

1

boolean

No equivalent required in perl

1

break

last

1

case = (case matching)

Use perl RE features

1

char (match a character)

Use perl RE features

1

consistencyUpdate()

$session->consistencyUpdate()

2

continue

next

1

correlate()

$session->correlate()

2

obj = Create(class, objname)

$obj = $session->create( $class, $objname )

2

default

No equivalent required in perl

1

delim

Use perl RE features

1

do

Use standard perl language features

1

eol

Use perl RE features

1

FAIL

See InCharge::primitives man page - "Error handling" section.

2

FALSE

The value 0 (zero)

1

feError

No equivalent

0

feErrorMsg

No equivalent

0

feErrorReset

No equivalent

0

filter

Use perl language features

1

float

Use perl language features

1

foreach

foreach

1

fs

Use perl RE features

1

getCauses( .. )

$session->getCauses( .. )

2

getClosure( .. )

$session->getClosure( .. )

2

getEventClassName( .. )

$session->getEventClassName( .. )

2

getEventDescription( .. )

$session->getEventDescription( .. )

2

getEventType( .. )

$session->getEventType( .. )

2

getExplainedBy( .. )

$session->getExplainedBy( .. )

2

getExplains( .. )

$session->getExplains( .. )

2

getInstances( class )

$session->getInstances( $class )

2

getRuleFileName( )

"$0" or "$PROGRAM_NAME"

1

getServerName( )

$session->getServerName( )

2

glob

The InCharge "glob" syntax is not supported directly by the perl client API. It can be used in domain manager calls that support it, but pattern matching within the script itself should make use of perl REs.

1

global

Use perl language scoping features: my/local/our etc

1

hex

hex

1

hexToString

No equivalent required - use perl language features

1

if / else

if / elsif / else

1

ignore

Use perl RE features

1

IGNORE

See InCharge::primitives manpage, "Error handling" section

2

input=string

Use perl language features

1

integer

Use perl language features

1

is(obj1->relate, obj2)

$session->isMember( $obj1, $relate, $obj2 )

2

isNull

Test against "undef"

1

len

Use perl RE features

1

list( ... )

Use perl language features (arrays)

1

local

Use perl language scoping features

1

LOG

See InCharge::primitives manpgage, "Error handling" section

2

LOG(loglevel)

Use perl "syslog" module features

1

NEXT

See InCharge::primitives manpage, "Error handling" section

2

not

Use perl RE features

1

notany

Use perl RE features

1

numeric

Use perl language features

1

object(class, objname)

$session->object($class, $objname) [see InCharge::session manpage]

2

peek

Use perl RE features

1

print

print

1

quit

$session->quit()

2

rep

Use perl RE features

1

return

return

1

self

No equivalent - Perl ASL can establish multiple DM sessions anyway - so not needed.

0

sizeOf( string )

length( $string )

1

sizeOf( list )

$#list + 1

1

sleep

sleep

1

STOP

See InCharge::primitives manpage, "Error handling" section

2

stop

exit

1

string

Use perl language features

1

substring

substr

1

tab

Use perl RE features

1

table

Use perl language features (hashes)

1

this

No equivalent

0

thread

$$

1

time

time

1

toLower

lc

1

toUpper

uc

1

transaction/abort/ commit

$session->transaction, $session->abortTxn, $session->commitTxn

2

TRUE

Non-zero value

1

undef

undef

1

while

while

1

word

Use perl RE features

1

DMCTL features

InCharge DMCTL

Perl API

Notes

attach domain

InCharge::session->new() or InCharge::session->init()

2

create class::inst

$session->create( $class, $inst )

2,5

consistencyUpdate

$session->consistencyUpdate( )

2

correlate

$session->correlate( )

2

delete class::inst

$object->delete( )

2,5

detach

$session->detach( )

2

execute prog args

$session->execute( $prog, \@args )

2

findInstances class_regex::inst_regex

@list = $session->findInstances( $class_regex, $inst_regex, 0x10000)

2

get class::inst

There is no single call that extracts and/or displays the entire set of properties for an object. But see the example in note #3.

 

 

3

get class::inst::prop

$value = $object->{$prop}
or: $value = $object->get( $prop );

2,5

getClasses

@classes = $session->getClasses( )

2

getEvents class

@events = $session->getEvents( $class )

2

getEventDescription class::event

$descr = $session->getEventDescription( $class, $event )

2

getInstances class

@instances = $session->getInstances( $class )

2

getModels

@models = $session->getModels( )

2

getOperations class

@operations = $session->getOperations( $class )

2

getPrograms

@programs = $session->getPrograms( )

2

getProperties class

@properties = $session->getProperties( $class )

2

getThreads

@threads = $session->getThreads( )

2

insert class::inst::prop value

$object->insertElement( $prop, $value )

2 4,5

invoke class::inst op args

$object->op( @args )
or: $object->invoke( $op, @args )

2,5

loadModel model

$session->loadModel( $model )

2

loadProgram program

$session->loadProgram( $program )

2

ping

$session->ping( )

2

put class::inst::prop value

$object->{$prop} = $value
or: $object->put( $prop, $value )

2,5

quit

exit( 0 )

1

remove class::inst::prop value

$object->removeElement( $prop, $value )

NB: Dont confuse the "removeElement" function with the "remove" operation that many classes provide.

2,4,5

restore filename

$session->restore( $filename )

2

shutdown

$session->shutdown( )

2

status

No direct equivalent

0

save filename

$session->save( $filename )

2

save filename class

$session->save( $filename, $class )

2

Note 0:

This facility is not provided by the Perl API, because it is not needed.

Note 1 :

This facility is provide by the standard capabilities of the perl language, and so the Perl API module adds nothing further to the feature.

Note 2:

This facility is provided by the features of the Perl API module. Refer to the manpages InCharge::session, InCharge::object and InCharge::primitives.

Note 3:

There is no one-line function to collect or display all the properties of an object, but the facility is easily reproduced using one the approaches shown below, or variants of them..

Example 1 - using the Data::Dumper module..

use Data::Dumper;
$obj = $session->object( "Router::gw1" );
print Dumper( $obj );

Example 2 - DIY approach - hash walking, for scalar properties only.

foreach $prop ( sort keys %{$obj} ) {
$val = $obj->{$prop};
print "$prop = $val\n" unless( ref( $val ) );
}

Note 4:

For most DMCTL commands, EMC have tried to provide primitives, aliases or object methods that match the DMCTL command name. The "remove" and "insert" commands are exceptions to this rule. This is because many ICIM classes provide a "remove" operation that deletes the object and cleans up associated relationships. Because of the existence of this common operation, providing a primitive with the same name would cause confusion - and for this reason they have chosen to call the primitives "insertElement" and "removeElement" in order to differentiate the two variants of "remove". The ASL language gets round this issue by using the "+=" and "-=" operators for the insert and remove primitives - this is not a syntax that can easily be matched in perl without creating some very "a - typical" constructs.

Note 5:

Many DMCTL command take an argument that includes "Class::Instance". The majority of these commands resolve to methods that can be called with reference to a perl object from the InCharge::object module. For example, the command to set an object property looks like this in DMCTL:

put Router::gw1::Vendor Cisco

And looks like this in Perl:

$obj = $session->object( "Router::gw1" );
$obj->{Vendor} = "Cisco";

Or, a valid one-line shorthand as..

$session->object( "Router::gw1" )->{Vendor} = "Cisco";
Scroll to Top