Here's yet another variation on the technique of creating an ATE configuration on the fly from the server and then forcing the client to open a second connection using the new configuration. It's similar to the above scheme, but doesn't actually require that the custom ashell-ate: URL scheme be predefined. But it does require TELNET.LIT 2.2(147) or higher (installed as part of ATE in %ATE%\dsk0\001004).
The technique consists of replacing the ATE configuration name with a URL-formatted string containing the name along with all the attributes, as illustrated in this example:
program LAUNCHATE,1.0(101) ! launch another ATE session
++include ashinc:ashell.def
map1 status,f
map1 profile$,s,0 ! name of ATE profile to launch
map1 wait,b,1,1 ! 0=don't wait, 1=wait
? "Launching another session..."
! to use an existing cfg profile resident in ATE client, just specify name
profile$ = "cfgname"
! Or...
! To build a profile on the fly, use this syntax (note set of single quotes)
! Replace cfgname with any name you want to assign (it will be created/stored)
! To get the attribute names, use ATE config dialog to export an existing
! profile to a text file.
profile$ = "'atex:cfgname/Address=1.2.3.4&Transport=TELNET&Port=9923'"
xcall MIAMEX, MX_SHELLEX, status, "$ATE", "", "-atecfg "+profile$, &
"", SW_SHOW, wait, "C"
? "status: ";status
Note that the critical difference between this version and the one shown at the top of this thread is that instead of using MX_SHELLEX to launch
URL object (
ashell-ate:dyncfg/attr=value&...), we are instead using it to explicitly launch an ATE
command line (made up of the
command object $ATE and the parameter list
-atecfg ....)
The trick here is that TELNET will accept the URL syntax in place of the normal configuration name (as the argument to the -atecfg switch). In this case, it ignores the
URL scheme: (
atex: in the above example). Note that the purpose of the custom scheme is to associate the URL (which might be resident on a web page out in the cloud somewhere) with the ATE app installed on the local computer, in a way that is browser compatible. (Web pages cannot contain explicit references to local executables, for obvious security reasons.) But if we are already within an ATE session, then we can launch it again explicitly via the special
$ATE command macro.
The other thing to note is the need for an extra pair of single quotes around the entire string, e.g.
"atex:dyncfg/attr=value&..." ! wrong
"'atex:dyncfg/attr=value&...'" ! correct
A couple of security-related notes:
1. If embedding the password info into the string, you should probably encrypt it so that it can't be captured by some kind of terminal logger (such as the one built into ATE!) Actually, ATE will make this easy for you since it automatically encrypts the passwords in the configuration and writes them that way when exporting, so you can just copy the encrypted string into the URL as is.
2. Both variations of the build-a-configuration-on-the-fly technique result in the specified configuration being created and stored on the local ATE workstation using the name specified (
cfgname or
dyncfg in the examples above). If, for whatever reason, you don't want to leave the working profile resident on the workstation after the session ends, you can modify it or remove it using a remote SBX call containing
MX_REGISTRY calls. The
SOSLIB contains a handy ATEREG.SBX routine in the [907033] directory that you may find useful for that kind of thing. Also see the ATEREGTST and SETATEREG programs in the same directory for examples of usage.