This feature is supported only by the "Advanced Script Execution" mode configlets. In order to provide this feature, we have introduced some additional attributes for the <command> tag defined in the Advanced Script Execution mode configlets. The additional attributes are described below.
Sequence: Sequence is used as an identifier for commands, which can be referred from any other command defined in the same configlet. Sequence id is used to direct the command execution flow based on the response received for a particular command. We have a set of constraints for this attribute: Sequence id should be unique within the configlet. the command which has the sequence id 1 will be taken as a starting point of configlet execution work flow. If no command has the sequence id 1, then the first command would be taken as the starting point of the configlet execution work flow.
Note: Every command should have sequence attribute, as it is the identifier for the command. The sequence numbers need not to be in the sorted order, it can be defined in any order.
Condition: This attribute specifies the condition which should be satisfied in response for that particular command. It can take the values contains, notcontains, equals and onlyonce which will be applied on the response with the value attribute defined in the same command. This attribute is an optional field and it must be implemented only with value attribute. If Condition attribute is specified without value attribute, it will be validated while saving the configlet.
Value: This attribute takes the value as regular expression / String which can be used as an operand while checking for the Condition. This should not exist without a Condition attribute. If it exists without Condition attribute, it would be validated while saving the configlet. Based on these attributes, the flow will be directed to any one of the paths which are defined as Success or Failure attributes.
Success: This attribute takes Sequence number defined in any one of the commands in the configlet. It must be specified along with Condition and Value attributes. If not, it would be validated while saving the configlet. If the specified Condition is matched with Value in the current command response, then the next command to be executed should be executed with the sequence id defined in Success. If this attribute is not provided and the condition is success, then the next command in the order will be executed.
Failure: This attribute takes Sequence number defined in any one of the commands in the configlet. This has the similar characteristics as the Success attribute. The difference is, this attribute is an optional one. If the user specified Condition does not match with Value, then the next command to be executed with the sequence id defined in Failure. If it is not specified, then it would be considered as end and the execution would be halted in the failure case.
ErrorString: Error string is a different attribute which can be used to determine the configlet execution failure state based on the string provided. This failure is different from the one which is defined as failure. If the command response contains the errorString, then the over all execution state for that particular device would be marked as FAILURE.
Command execution starts with the command with the Sequence number 1 and proceeds with the flow. If no condition values are specified, then it works as the same way as it does in the existing implementation. If the condition attributes are specified in the command, then the command response is taken from result and based on the condition and value attributes the success or failure is decided. If it is success then, the next command to be executed is taken from Success attribute. If the condition fails, then the next command is taken from Failure attribute. If failure is not specified, the execution will be halted. The flow can be diverted in any direction, both forward and backward directions.
At any case, if the condition is not specified for the last command, then it is treated as final command and execution comes to an end.
For those commands which do not have condition values, the flow will be taken as they defined in the order, not based on the sequence number. Sequence number is used only as the identifier and not for flow sequence.
Also user can halt the execution for any success and failure conditions by specifying the value as "end" / "END".
Advanced Script Execution Mode configlet creation shall be provided as an automated work flow generation in our upcoming release, which would be more useful.
Auto Loop Detection: if the command flow is subjected to an infinite loop, it would not be detected automatically by NCM. User should take care of avoiding such infinite loop cases. In case, if user is facing the looping issue in some specific scenario and he / she wants NCM to take care of Auto Loop Detection, there is an option to enable this feature. In Client / Server settings page, enable Enable auto loop detection in Advanced Script Execution mode configlets checkbox to handle Auto Loop Detection. If this is enabled, configlet execution work flow will be terminated, when the same command line is executed more than thrice.
© 2015, ZOHO Corp. All Rights Reserved.