What's new in TPL

Changes to TPL in BMC Helix Discovery 24.1.02 

BMC Helix Discovery 24.1.02 introduces improvements to the way that reasoning works. Part of the reasoning changes make improvements to TPL compilation and execution, resulting in:

  • Reduced compile times.
  • Improved compile-time errors and warnings.
  • Runtime ECA Errors now include a traceback of the TPL calls.

No changes have been made to the TPL language itself, so its version remains 1.22, though as a result of the improvements, there are some fixes to the way that TPL behaves. Behavior changes are described here. 

Triggers with mixed regex flags

If a pattern trigger has an OR combination of regex matches, the old compiler would combine them into a single regex, even if they had different flags. For example triggers like this:

triggers
  on DiscoveredProcess where cmd matches regex "one" or cmd matches regex "(?i)two";
end triggers;

would be compiled as if it was:

triggers
  on DiscoveredProcess where cmd matches regex "(?i)one|two";
end triggers;

In other words, it would incorrectly match command "ONE", when actually it should only match "one" in lower case. The windows_cmd string qualifier is equivalent to a regex involving "(?i)" flags, and so this issue would occur with triggers mixing unix_cmd and windows_cmd, for example:

triggers
  on DiscoveredProcess where cmd matches unix_cmd "one" or cmd matches windows_cmd "two";
end triggers;

The new compiler no longer has this problem, meaning that patterns that previously triggered because of this will no longer trigger. In some cases, the TPL should have specified "(?i)" for a case insensitive match, but was working by mistake. Patterns may need to be updated to add the correct flags to all parts of an OR condition.

Validation of all constant regular expressions

The compiler always validated regular expressions with the regex qualifier, so it was previously a compile-time error if code was for example:

if regex.extract(value, regex "one(abc", raw "\1") matches regex "invalid[" then...

Both of those regular expressions are invalid, and the compiler would reports errors. However, if a regular expression in a matches expression or call to regex.extract was not qualified with regex, it was only a runtime error if the regular expression was invalid. Now, if a regular expression string is constant, it is checked at compile time. The above incorrect code will now cause a compile-time error even if the regex qualifiers are removed.

A likely problem is forgetting the regex qualifier, meaning that the regular expression is invalid, for example:

if path matches "abc\\def\\ghi then ...   // forgot the regex qualifier

That now reports a compile-time error: "bad escape \g at position 7".

"stop" in a function really stops the pattern

The "stop" statement is defined to stop execution of the pattern. Previously, if "stop" was used in a function, it did not stop the pattern, but instead caused the function to return none. If the function was declared to return a single value, that would mean the caller received none; if the function was declared to return multiple values, it would cause an immediate ECAError. "stop" now always stops execution of the pattern. If functions were previously using "stop", relying on that returning none, they may need to be changed to "return none".

"break" in nested for loops now behaves correctly

Previously, if a pattern had a nested set of for loops that performed some discovery requests, the "break" statement would sometimes break out from too many levels of the loop, or terminate processing of the pattern altogether. Now, "break" always correctly breaks out of just the innermost loop. Patterns may have accidentally been relying on the incorrect "break" behavior, and will now encounter errors during execution when "break" behaves correctly.

Uninitialized variables

If a variable is used without being initialized, it now always causes an ECAError at runtime. Previously, some uses of uninitialized variables caused ECAErrors, but others saw the variable's value as none. Patterns may previously have been working despite invalid use of uninitialized variables, in which case they will now fail. Any such patterns should be fixed to ensure all variables are initialized before use.

The compiler now issues warnings for more uses of uninitialized variables than in previous versions.

Invalid use of key expressions with list values

Key expressions (of the form node.#role:rel:role:node.attribute) are only valid when used on individual nodes. Previously, if a variable used in a key expression contained a list instead of a node, the key expression incorrectly evaluated to an empty list. Now such usage causes an ECAError. Patterns may have been appearing to work despite having incorrect logic; they will now receive errors.

Improved compiler errors and warnings

Certain incorrect code was previously permitted, but now generates compile-time errors or warnings:

  • Functions that are declared to return a result but do not contain a "return" statement now produce a compile error. Previously, the compiler did not report an error, and at runtime the function would return none.
  • Some cases of variables that may be used uninitialized now emit a warning, where previously they did not.
  • Mixing variable types in incompatible ways (for example trying to add text to a number) is now sometimes identified and warned about, where previously there was no compile warning.

New in TPL 1.22

TPL version 1.22 is a minor update to TPL version 1.21.

The following update is available:

A new parameter auto_rels has been added to model.publish.

New in TPL 1.21

TPL version 1.21 is a minor update to TPL version 1.20.

The following update is available:

You can now use the square bracket flags and limit syntax in search expressions.

New in TPL 1.20

TPL version 1.20 is a minor update to TPL version 1.19.

The following update is available:

A new function, discovery.getCertificate enables you to retrieve a TLS certificate from a discovery target.

New in TPL 1.19

TPL version 1.19 is a minor update to TPL version 1.18.

The following update is available:

  • Allow patterns to use non-taxonomy nodes, role and relationships with extra_node_kinds, extra_role_kinds, extra_rel_kinds in module metadata
  • Add dialect parameter to discovery.runCommand to select the shell used for running a command
  • Added with discovery.runPowerShell being a synonym for using powershell shell
  • Add replace parameter to inference.primary to use supplied evidence for primary inference in place of rather than addition to current inferences
  • The mail.send now supports cc_addrs and bcc_addrs parameters
  • Allow search to access members of dictionaries
  • The following convenience functions have been added:

New in TPL 1.18

TPL version 1.18 is a minor update to TPL version 1.17.

The following update is available:

  • The TPL discovery.scan function has been enhanced to include a new parameter scope. Scope is a string identifier used to distinguish between endpoints in different address spaces. If the scope is not specified, the default scope is used. For more information on scope, see Overlapping IP addresses.

New in TPL 1.17

TPL version 1.17 is a minor update to TPL version 1.16.

The following update is available:

  • The TPL discovery.scan function has been enhanced to specify the BMC Discovery Outpost or discovery service. The new parameter outpost_id enables you to specific the name or ID of the BMC Discovery Outpost that you want to perform the scan. 

New in TPL 1.16

TPL version 1.16 is a minor update to TPL version 1.15.

The following function has been added:

  • discovery.sqlQuery – performs an SQL query on a relational database, returning a list of SQLResultRow nodes.

New in TPL 1.15

TPL version 1.15 is a minor update to TPL version 1.14.

The following functions have been added:

  • discovery.restfulGet – performs a GET request on the target using the RESTful protocol specified and returns a node containing information on the discovered system. Adds "nimble_auth", a generic protocol for Nimble web API with token authentication. Intended for use discovering Nimble storage Open link  devices. An enhancement to the discovery.restfulGet function introduced in TPL 1.11.

New in TPL 1.14

TPL version 1.14 is a minor update to TPL version 1.13.

The following functions have been added:

  • discovery.restfulGet – performs a GET request on the target using the RESTful protocol specified and returns a node containing information on the discovered system. An enhancement to the discovery.restfulGet function introduced in TPL 1.11.
  • discovery.restfulPost – performs a POST request on the target using the RESTful system and returns a node containing information on the discovered system. An enhancement to the discovery.restfulPost function introduced in TPL 1.11.
  • discovery.restfulDelete– performs a delete request on the target using the RESTful protocol specified and returns a node containing information on the discovered system
  • discovery.restfulPatch – performs a patch request on the target using the RESTful protocol specified and returns a node containing information on the discovered system.
  • discovery.restfulPut – performs a put request on the target using the RESTful protocol specified and returns a node containing information on the discovered system.
  • discovery.lookupAddresses – performs a DNS lookup on the supplied DNS resolvable name and returns a list of IP addresses.
  • discovery.startTime – returns the start time of the scan which discovered a given DDD node.

  • Discovery cloud provider requests – a set of discovery functions which query the cloud provider API, for information on the target.

New in TPL 1.13

TPL version 1.13 is a minor update to TPL version 1.12.

The following functions have been added:

  • system.cmdbSync – adds a root node or nodes to the CMDB synchronization queue.
  • discovery.scan – adds a snapshot scan for the given target. Requires that you have a scheduled scan defined that includes the address or addresses of the scan targets.

New in TPL 1.12

TPL version 1.12 is a minor update to TPL version 1.10 which consists of some internal fixes.

New in TPL 1.11

TPL version 1.11 a minor update to TPL version 1.10.

  • json.encode – Converts a string, table, or a list (including nested structures) to a JSON encoded string.
  • json.decode – Decodes a JSON encoded string and returns a structure containing a string, table or list including nested structures.
  • model.kind – Returns the node kind of a given node.
  • related.hostingNode – Returns a node that is associated with the given triggers and is hosting the software instance.
  • discovery.wbemEnumInstances – a new parameter, filter_locally has been added. When set, the function does not request specific properties so all are returned. Only the specified properties are stored as DDD. This parameter can be used if a particular system does not support the retrieval of specific properties.
  • discovery.access – you no longer have to provide a DDD node. If no DDD node is specified, the function returns the DiscoveryAccess currently in use.
  • discovery.vSphereFindObjects  – search from the root folder the instances of an object type and returns the requested properties for each object found.
  • discovery.vSphereTraverseToObjects  – traverses from the initial object to instances of an object type and get properties on those objects.
  • discovery.vSphereGetProperties   – retrieve properties from a given MOR and returns the requested properties for each object found.
  • discovery.vSphereGetPropertyTable – retrieves a table of values from a given MOR and returns multiple NodeState objects, one for each DataObject in the list or array.

An obsoletes statement has been added which obsoletes (automatically deactivates) specified modules.

New in TPL 1.10

TPL version 1.10 is a minor update to TPL version 1.9.

New in TPL 1.9

TPL version 1.9 is a minor update to TPL version 1.8.

The following functions have been added:

New in TPL 1.8

TPL version 1.8 is a minor update to TPL version 1.7.

New in TPL 1.7

TPL version 1.7 is a minor update to TPL version 1.6.

TPL 1.7 adds the following new features:

New in TPL 1.6

TPL version 1.6 is a minor update to TPL version 1.5.

TPL 1.6 adds the following new features:

New in TPL 1.5

TPL version 1.5 is a minor update to TPL version 1.4.

TPL 1.5 adds the following new features:

  • User defined functions. See User defined functions.
  • You can now reference constants defined in a pattern from other patterns. See Constants.
  • Version restrictions are now enforced according to the version specified in the pattern. Prior to TPL 1.5 the TPL version specified at the top of a pattern file was only checked against the supported version in BMC Discovery. Now functionality defined in a specific TPL version is available if that (or a later) version is specified in the pattern file.

New in TPL 1.4

TPL version 1.4 is a minor update to TPL version 1.3.

TPL 1.4 adds the following new features:

New in TPL 1.3

TPL version 1.3 is a minor update to TPL version 1.2.

TPL 1.3 adds a number of new features:

New in TPL 1.2

TPL version 1.2 is a minor update to TPL version 1.1.

TPL 1.2 adds a number of new features:

  • Pattern configuration blocks allow end users to modify parameters without editing pattern text. See Pattern Configuration.
  • New definitions blocks support SQL Discovery (now Configuring database credentials) See Definitions.
  • Model maintenance is made easier with the addition of unique relationship functions. See Unique relationships.
  • Lookup tables can be created and manipulated inside patterns. See Table functions.
  • New functions to manipulate dates and times are available. See Time functions.

New in TPL 1.1

TPL version 1.1 is a minor update to TPL version 1.0.

It has the following new features:



Was this page helpful? Yes No Submitting... Thank you

Comments