Forum Discussion

ecce's avatar
ecce
Icon for Cirrostratus rankCirrostratus
May 14, 2020

iRulesLX: Invalid command name

I want to write an ILX solution that generates OTPs. This ILX is then called within a APM session profile and the OTP value is used throughout the authentication process.

I have an irule agent in the access policy that calls an irule, who then calls ILX. ILX generates the OTP and, for now, replies back to TCL who simply outputs it in the LTM log file. Later, this will change and the script will set a session variable.

However, the ILX::call throws an error:

Rule /Common/otpgen_pl/otpgen <ACCESS_POLICY_AGENT_EVENT>: ILX failure: invalid command name "abc123"

This is the TCL:

when ACCESS_POLICY_AGENT_EVENT {
 set handle [ILX::init "otpgen_pl" "otpgen_ext"]
 if {[catch [ILX::call $handle "otpgen"] result]} {
  log local0.error "ILX failure: $result"
  return
 }
  
 log local0.error "OTP generated successfully: $result"
}

This is the node.js:

var f5 = require('f5-nodejs');
var ilx = new f5.ILXServer();
 
ilx.addMethod('otpgen', function (req, res) {
  res.reply('abc123');
});
 
ilx.listen();

I don't get the error message, how is the return string an "invalid command"?