To configure an adapter request to communicate with a host that is not defined in the adapter configuration, you can designate a dynamic target by assigning values for the required configuration elements. These elements work as a set. You cannot retrieve partial information from the configuration node.
You can omit the <targets> block from the adapter request. In the absence of a <targets> block, the adapter uses the default target from the adapter configuration. BMC recommends that you do not include unused elements in the adapter configuration because they might cause errors.
When you use a context item as an input for an adapter request, you must enclose the adapter request in the <request-data> elements. However, when you create a static request, <request-data> is not required and the adapter request starts with the <adapterName-adapter-request> element.
The following table describes the elements of a Telnet adapter request.
Elements of a Telnet adapter request
The [expand] macro is a standalone macro and it cannot be used inline.
The following figure shows an XML sample of the Telnet adapter request. Use the adapter request XML when you create a custom process by using the Call Adapter activity in BMC Atrium Orchestrator Development Studio. In this case, the first target references the adapter configuration and the second target is a dynamic target.
XML sample of the Telnet adapter request
<telnet-request>
<prompts>
<prompt name="P1">/usr/bin></prompt>
</prompts>
<targets>
<target name="host1"/>
<target>
<host>server3</host>
<port>2300</port>
<user-name>user</user-name>
<password encryption-type-"Plain">test</password>
<prompt>user1$</prompt>
<verify-os>true</verify-os>
<timeout-secs>120</timeout-secs>
<login-prompt>user-name:</login-prompt>
<password-prompt>password for user1:</password-prompt>
<verify-os>true</verify-os>
<read-buffer-size>1024</read-buffer-size>
<connection>
<name>target1_connection</name>
<terminate-on-exit>false</terminate-on-exit>
<connection-initialize-commands>
<command prompt="%" ignore-response = "true">prompt %</command>
<command prompt="%" ignore-response = "true">cd Cookies</command>
</connection-initialize-commands>
</connection>
</target>
</targets>
<commands>
<command prompt="P1">ls -l</command>
</commands>
</telnet-request>
WarningNote
The command must be entered as if it were being keyed at the system prompt. The adapter appends cmd \c or /bin/sh -c at the beginning of the command as needed.
The [expand] macro is a standalone macro and it cannot be used inline.
The [expand] macro is a standalone macro and it cannot be used inline.
XML sample of the Telnet adapter request with multiple commands
<telnet-request>
<prompts>
<prompt name="prompt">${Prompt}</prompt>
</prompts>
<targets>
<target name="">
<host>${target1_host}</host>
<userName>${target1_username}</userName>
<password>${target1_password}</password>
<prompt>${Prompt}</prompt>
<login-prompt>${loginprompt}</login-prompt>
<password-prompt>${passwordprompt}</password-prompt>
</target>
</targets>
<commands>
<command>${Command}</command>
<command>${Command1}</command>
</commands>
</telnet-request>
The [expand] macro is a standalone macro and it cannot be used inline.
The [expand] macro is a standalone macro and it cannot be used inline.
The [expand] macro is a standalone macro and it cannot be used inline.
The Telnet adapter returns an adapter response containing the details for the command executed by the adapter request. The following table describes the elements of a Telnet adapter response.
Elements of a Telnet adapter response
The [expand] macro is a standalone macro and it cannot be used inline.
The [expand] macro is a standalone macro and it cannot be used inline.
The [expand] macro is a standalone macro and it cannot be used inline.
XML sample of the Telnet adapter response with IPv6 support in a Windows to Linux environment
<telnet-command-output>
<metadata>
<status>success</status>
</metadata>
<targets-output>
<target-output host="fe80::219:d1ff:fe2f:82e6%4">
<metadata>
<os-id>Linux</os-id>
<os-version>2.6.9-22.ELsmp</os-version>
<status>success</status>
</metadata>
<commands-output>
<command-output>
<metadata>
<command>hostname</command>
<line-count>2</line-count>
<execution-milliseconds>438</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
</metadata>
<output>
<line index="1">induslog118.synapse.com</line>
<line index="2">-bash-3.00$</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</telnet-command-output>