Adapter request and response for the Telnet adapter
The Telnet adapter does not use an action. You must leave the Action field blank when configuring the activity properties for a Call Adapter activity in BMC Atrium Orchestrator Development Studio.
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.
When you use a context item as an input for an adapter request, you must enclose the adapter request in <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.
BMC recommends that you do not include empty elements in the adapter request because they might cause errors.
The following table describes the elements of a Telnet adapter request:
Elements of a Telnet adapter request
The following figure shows an XML template for the Telnet adapter request.
XML template of the Telnet adapter request
<telnet-request>
<prompts>
<prompt name=""></prompt>
</prompts>
<targets>
<target name=""/>
<target>
<host></host>
<port></port>
<user-name></user-name>
<password encryption-type-""></password>
<prompt></prompt>
<timeout-secs></timeout-secs>
<login-prompt></login-prompt>
<password-prompt></password-prompt>
<verify-os></verify-os>
<read-buffer-size></read-buffer-size>
</target>
</targets>
<commands>
<command prompt =""></command>
</commands>
</telnet-request>
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>
The following figure shows an XML sample of the Telnet adapter with the CharSet element.
XML sample of the Telnet adapter with CharSet
<telnet-request>
<targets>
<target>
<host>server1</host>
<user-name>user</user-name>
<password encryption-type-"Plain">test</password>
<prompt>></prompt>
<login-prompt>login:</login-prompt>
<password-prompt>password:</password-prompt>
<verify-os>true</verify-os>
<read-buffer-size>1024</read-buffer-size>
<character-set>Shift_JIS</character-set>
</target>
</targets>
<commands>
<command>type testFile.txt</command>
</commands>
</telnet-request>
The following figure shows an XML sample of the Telnet adapter request for multiple configurations.
XML sample of the Telnet adapter request for multiple configurations
<telnet-request>
<targets>
<target name="host2" />
</targets>
<commands>
<command working-dir="/" timeout-secs="2">ls -l</command>
<command timeout-secs="1">pwd</command>
</commands>
</telnet-request>
The following figure shows an XML sample of the Telnet adapter request with multiple commands.
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 following figure shows an XML sample of the Telnet adapter request with support for Internet Protocol version 6 (IPv6) in a Linux to Linux environment.
XML sample of the Telnet adapter request with IPv6 support in a Linux to Linux environment
<telnet-request>
<prompts>
<prompt name="prompt">$</prompt>
</prompts>
<targets>
<target name="">
<host>fe80::219:d1ff:fe2f:82e6%eth0</host>
<port>23</port>
<userName>name</userName>
<password encryption-type="plain">name</password>
<timeout-secs>60</timeout-secs>
<prompt>$</prompt>
</target>
</targets>
<commands>
<command encryption-type="plain" timeout-secs="60">ls -l</command>
</commands>
</telnet-request>
The following figure shows an XML sample of the Telnet adapter request with IPv6 support in a Windows to Linux environment.
XML sample of the Telnet adapter request with IPv6 support in a Windows to Linux environment
<telnet-request>
<targets>
<target>
<host>fe80::219:d1ff:fe2f:82e6%4</host>
<port>23</port>
<userName>name</userName>
<password>name</password>
<prompt>$</prompt>
<login-prompt>login:</login-prompt>
<password-prompt>Password:</password-prompt>
</target>
</targets>
<commands>
<command>hostname</command>
</commands>
</telnet-request>
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 following figure illustrates the adapter response for the Telnet adapter.
XML sample of the Telnet adapter response
<telnet-command-output>
<request-metadata>
<status>success</status>
<error>Present only with status of 'error'</error>
</request-metadata>
<targets-output>
<target-output host="server1">
<target-metadata>
<os-id>Linux</os-id>
<os-version>2.6.12-1.1381_FC3smp</os-version>
<status>success</status>
<error>Present only with status of 'error'</error>
</target-metadata>
<commands-output>
<command-output>
<metadata>
<command> command executed </command>
<line-count>1</line-count>
<execution-milliseconds>value</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
<error>Present only with status of 'error'</error>
</metadata>
<output>
<line index="1">line 1</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</telnet-command-output>
The following figure illustrates the adapter response for the Telnet adapter with multiple commands.
XML sample of the Telnet adapter response with multiple commands
<telnet-command-output>
<metadata>
<status>success</status>
</metadata>
<targets-output>
<target-output host="10.128.248.114">
<metadata>
<os-id>SunOS</os-id>
<os-version>5.10</os-version>
<status>success</status>
</metadata>
<commands-output>
<command-output>
<metadata>
<command>ls</command>
<line-count>6</line-count>
<execution-milliseconds>129</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
</metadata>
<output>
<command>pwd</command>
<line-count>2</line-count>
<execution-milliseconds>621</execution-milliseconds>
<exit-code>0</exit-code>
<status>success</status>
</metadata>
<output>
<line index="1">/export/home/user1</line>
<line index="2">$</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</telnet-command-output>
The following figure illustrates the adapter response for the Telnet adapter with IPv6 support in a Linux to Linux environment.
XML sample of the Telnet adapter response with IPv6 support in a Linux to Linux environment
<telnet-command-output>
<metadata>
<status>success</status>
</metadata>
<targets-output>
<target-output host="fe80::219:d1ff:fe2f:82e6%eth0">
<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>ls -l</command>
<line-count>19</line-count>
<execution-milliseconds>57</execution-milliseconds>
<exit-code>9999</exit-code>
<status>success</status>
</metadata>
<output>
<line index="1">total 84096</line>
<line index="2">drwxr-xr-x 2 root root 4096 Nov 16 09:43 760200</line>
<line index="3">drwxr-xr-x 7 root root 4096 Dec 9 12:28 Adobe CS5.1</line>
<line index="4">drwxrwxr-x 10 root root 4096 Dec 8 10:13 AMREPO_7602_9180</line>
<line index="5">drwxrwxr-x 17 name name 4096 Nov 15 12:49 Backup Data</line>
<line index="6">drwxr-xr-x 2 root root 4096 Jan 12 10:28 BEM</line>
<line index="7">drwxr-xr-x 3 root root 4096 Nov 22 15:01 blom</line>
<line index="8">drwxrwxr-x 3 name name 4096 Oct 21 2008 BPM_CLI</line>
<line index="9">drwxrwxr-x 2 name name 4096 Feb 3 2009 BPM_MIB</line>
<line index="10">drwxr-xr-x 2 root root 4096 Nov 28 15:19 BSA</line>
<line index="11">drwxrwxr-x 13 root root 4096 Dec 23 12:59 CDP_760200_9480</line>
<line index="12">rw-rr- 1 root root 17 Jun 30 2010 data.txt</line>
<line index="13">rw-rw-r- 1 name name 55 Aug 22 2008 deleteElements.csv</line>
<line index="14">drwxr-xr-x 2 name name 4096 Apr 15 2009 Desktop</line>
<line index="15">drwxr-xr-x 2 name name 4096 Mar 5 2009 DevLabDetails</line>
<line index="16">rw-rr- 1 name name 0 Apr 13 2011 echo</line>
<line index="17">rw-rw-r- 1 name name 5451 Dec 22 2008 InstallCert.class</line>
<line index="18">rw-rw-r- 1 name name 5036 Dec 22 2008 InstallCert.java</line>
<line index="19">rw-rw-r- 1 name name 1086 Dec 22 2008 InstallCert$</line>
</output>
</command-output>
</commands-output>
</target-output>
</targets-output>
</telnet-command-output>
The following figure illustrates the adapter response for the Telnet adapter with IPv6 support in a Windows to Linux environment.
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>