Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doTCPConnectionTest does not cater for a remote host and port. #117

Open
jjjw420 opened this issue Feb 15, 2021 · 0 comments
Open

doTCPConnectionTest does not cater for a remote host and port. #117

jjjw420 opened this issue Feb 15, 2021 · 0 comments

Comments

@jjjw420
Copy link
Contributor

jjjw420 commented Feb 15, 2021

The IBM Datapower XML management interface provides troubleshooting functionality to test TCP connections to a remote host and port(the "TCPConnectionTest" action). This allows you to confirm that the Datapower device is able to open a TCP connection to a remote system.

The current doTCPConnectionTest method in Soma.java maps the "host" and "port" parameters to "RemoteHost" and "RemotePort" elements. As the "host" and "port" parameters are set to the host and port for the XML management interface you are never able to test connections to other hosts defying the purpose of the TCPConnectionTest operation.

I have changed the doTCPConnectionTest method Soma.java to cater for the remote host and port and tested the fix on firmware 2018.4.1.5.

As I already have a pull request outstanding(PR 104) so I pushed the fix to https://github.com/jjjw420/datapower-configuration-manager-test-tcp-connection-fix. I'll be happy to do a PR if I understand what will happen to (PR 104). Please advise on this.

The following illustrates what was changed in Soma.java (two lines):

The doTCPConnectionTest method

public NamedParams doTCPConnectionTest (NamedParams params) throws Exception {
    params.insistOn (new String[] {"host", "port"});

    // Make the request of the XML Management Interface.
    StringBuffer body = new StringBuffer ("<TCPConnectionTest>");
    body.append("<RemoteHost>" + params.get("host") + "</RemoteHost>");
    body.append("<RemotePort>" + params.get("port") + "</RemotePort>");
    ...

becomes

public NamedParams doTCPConnectionTest (NamedParams params) throws Exception {
    params.insistOn (new String[] {"host", "port"});

    // Make the request of the XML Management Interface.
    StringBuffer body = new StringBuffer ("<TCPConnectionTest>");
    body.append("<RemoteHost>" + params.get("remotehost") + "</RemoteHost>");
    body.append("<RemotePort>" + params.get("remoteport") + "</RemotePort>");
    ...

When calling the wdp function - remote host and port can then be specified:

<wdp operation="TCPConnectionTest" dumpinput="${dumpinput}" dumpoutput="${dumpoutput}" capturesoma="${capturesoma}" 
	responseprop="response" xpath="normalize-space(/env:Envelope/env:Body/soma:response/soma:result)" xpathprop="okay">
	<hostname>${host}</hostname>
	<host>${host}</host>
	<port>${port}</port>
	<uid>${uid}</uid>
	<pwd>${pwd}</pwd>
	<domain>${domain}</domain>
	<remotehost>${remotehost}</remotehost>
	<remoteport>${remoteport}</remoteport>
</wdp>

Please advise.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant