OpenIxia / IxNetwork

A central location for IxNetwork sample scripts and utilities. Please also visit http://openixia.com
MIT License
50 stars 59 forks source link

Can not connect to Windows API browser #84

Closed sshuguan closed 4 years ago

sshuguan commented 4 years ago

(1) My Windows GUI is invoked by command "Ixia\IxNetwork\9.00.1915.16\IxNetwork.exe" -tclPort 8020 -restPort 11010 -restOnAllInterface" and configuration is loaded from a saved file. (2) My restpy code trying to connect the session created by (1). the code is running on another Linux box: _apiServerIp = '135.228.2.128' # Windows server ip restPort = 11010 # rest port opened by (1) testplatform = TestPlatform(apiServerIp, rest_port=restPort, log_filename='restpy.log')

but above code throw error as below: Traceback (most recent call last): File "./loadConfigFile.py", line 72, in testPlatform = TestPlatform(apiServerIp, rest_port=restPort, log_file_name='restpy.log') File "/usr/local/lib/python3.7/site-packages/ixnetwork_restpy/testplatform/testplatform.py", line 44, in init self._connection = Connection(ip_address, rest_port, platform, log_file_name, ignore_env_proxy, verify_cert, trace) File "/usr/local/lib/python3.7/site-packages/ixnetwork_restpy/connection.py", line 101, in init self._scheme = self._determine_test_tool_platform(platform) File "/usr/local/lib/python3.7/site-packages/ixnetwork_restpy/connection.py", line 136, in _determine_test_tool_platform raise ConnectionError('Unable to connect to %s. Check the ip address and consider using the rest_port parameter.' % self._hostname) ixnetwork_restpy.errors.ConnectionError: Unable to connect to 135.228.2.128. Check the ip address and consider using the rest_port parameter.

any clues ? looks like port 11010 is not opened on 135.228.2.128

whandjr commented 4 years ago

You might try the following, to see if it matters.

testplatform = TestPlatform(apiServerIp, rest_port=restPort, platform=’Windows’,log_file_name='restpy.log')

Regards, Wes

Wesley Hand m: 818-312-6752

From: sshanggu notifications@github.com Sent: Tuesday, December 3, 2019 11:23 AM To: OpenIxia/IxNetwork IxNetwork@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [OpenIxia/IxNetwork] Can not connect to Windows API browser (#84)

[EXTERNAL]

(1) My Windows GUI is invoked by command "Ixia\IxNetwork\9.00.1915.16\IxNetwork.exe" -tclPort 8020 -restPort 11010 -restOnAllInterface" and configuration is loaded from a saved file. (2) My restpy code trying to connect the session created by (1): apiServerIp = '135.228.2.128' # Windows server ip restPort = 11010 # rest port opened by (1) testplatform = TestPlatform(apiServerIp, rest_port=restPort, log_file_name='restpy.log')

but above code throw error as below: Traceback (most recent call last): File "./loadConfigFile.py", line 72, in testPlatform = TestPlatform(apiServerIp, rest_port=restPort, log_file_name='restpy.log') File "/usr/local/lib/python3.7/site-packages/ixnetwork_restpy/testplatform/testplatform.py", line 44, in init self._connection = Connection(ip_address, rest_port, platform, log_file_name, ignore_env_proxy, verify_cert, trace) File "/usr/local/lib/python3.7/site-packages/ixnetwork_restpy/connection.py", line 101, in init self._scheme = self._determine_test_tool_platform(platform) File "/usr/local/lib/python3.7/site-packages/ixnetwork_restpy/connection.py", line 136, in _determine_test_tool_platform raise ConnectionError('Unable to connect to %s. Check the ip address and consider using the rest_port parameter.' % self._hostname) ixnetwork_restpy.errors.ConnectionError: Unable to connect to 135.228.2.128. Check the ip address and consider using the rest_port parameter.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/OpenIxia/IxNetwork/issues/84?email_source=notifications&email_token=AGJXMDFIB5W7HTY363DGSSLQW2WYPA5CNFSM4JU5HVOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5Y3PVQ, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGJXMDDTV67QSLGJIC4UP7DQW2WYPANCNFSM4JU5HVOA.

ajbalogh commented 4 years ago

You are not listening on external interfaces as your command line parameter is incorrect. It should be: -restonallinterfaces You can always confirm after ixnetwork has started by using the cmd line: netstat -an | findstr 11010 You should see it listening on 0.0.0.0:11010

sshuguan commented 4 years ago

Tried "IxNetwork.exe" -tclPort 8020 -restPort 11010 -restonallinterfaces and netstat -an | findstr 11010: TCP 0.0.0.0:11010 0.0.0.0:0 LISTENING TCP [::]:11010 [::]:0 LISTENING

also added 'platform=’Windows’ in command. but the same error is thrown. Can you reproduce it on your setup ?

ajbalogh commented 4 years ago

I'm unable to reproduce it on my setup.

from ixnetwork_restpy.testplatform.testplatform import TestPlatform

apiServerIp = '127.0.0.1' # Windows server ip
restPort = 11010 # rest port opened by (1)
testplatform = TestPlatform(apiServerIp, rest_port=restPort, log_file_name='restpy.log', trace=TestPlatform.TRACE_INFO)

log

2019-12-03 21:46:47 [ixnetwork_restpy.connection] [INFO] using python version 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
2019-12-03 21:46:47 [ixnetwork_restpy.connection] [INFO] using ixnetwork-restpy version 1.0.47
2019-12-03 21:46:47 [ixnetwork_restpy.connection] [WARNING] Verification of certificates is disabled
2019-12-03 21:46:47 [ixnetwork_restpy.connection] [INFO] The package will automatically determine the test tool platform and rest_port using the 127.0.0.1 address.
2019-12-03 21:46:47 [ixnetwork_restpy.connection] [INFO] Connection established to `http://127.0.0.1:11010 on windows`
sshuguan commented 4 years ago

Your code runs at the same machine as Windows GUI. Can you try to run your code on a different machine from Windows GUI ? (code runs on machine-A to connect Windows GUI session on machine-B)

ajbalogh commented 4 years ago

still unable to reproduce from a remote machine - perhaps you have a firewall issue?

C:\Users\anbalogh>python Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from ixnetwork_restpy.testplatform.testplatform import TestPlatform

apiServerIp = '10.36.66.49' # Windows server ip restPort = 11010 # rest port opened by (1) testplatform = TestPlatform(apiServerIp, rest_port=restPort, log_file_name='restpy.log', trace=TestPlatform.TRACE_INFO) 2019-12-03 22:10:49 [ixnetwork_restpy.connection] [INFO] using python version 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] 2019-12-03 22:10:49 [ixnetwork_restpy.connection] [INFO] using ixnetwork-restpy version 1.0.47 2019-12-03 22:10:49 [ixnetwork_restpy.connection] [WARNING] Verification of certificates is disabled 2019-12-03 22:10:49 [ixnetwork_restpy.connection] [INFO] The package will automatically determine the test tool platform and rest_port using the 10.36.66.49 address. 2019-12-03 22:10:50 [ixnetwork_restpy.connection] [INFO] Connection established to http://10.36.66.49:11010 on windows

sshuguan commented 4 years ago

Thanks. will dig deep.

sshuguan commented 4 years ago

Changed firewall setting on Windows server and connection works. Thanks.

uditpatel014 commented 4 years ago

uditp@tb152:~$ sudo python3 IxNetwork.py 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [INFO] using python version 3.4.3 (default, Nov 12 2018, 22:25:49) [GCC 4.8.4] 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [INFO] using ixnetwork-restpy version 1.0.51 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [WARNING] Verification of certificates is disabled 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [INFO] The package will automatically determine the test tool platform and rest_port using the 10.33.13.15 address. 2020-03-12 00:25:58 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at http://10.33.13.15:11009. 2020-03-12 00:26:00 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at https://10.33.13.15:11009. 2020-03-12 00:26:02 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at http://10.33.13.15:443. 2020-03-12 00:26:04 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at https://10.33.13.15:443. 2020-03-12 00:26:06 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at http://10.33.13.15:11009. 2020-03-12 00:26:08 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at https://10.33.13.15:11009.

Traceback (most recent call last): File "IxNetwork.py", line 58, in ClearConfig=True, LogLevel='all', LogFilename='restpy.log') File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/assistants/sessions/sessionassistant.py", line 97, in init trace=LogLevel) File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/testplatform/testplatform.py", line 66, in init self._connection = Connection(ip_address, rest_port, platform, log_file_name, ignore_env_proxy, verify_cert, trace, script_watch) File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/connection.py", line 108, in init self._scheme = self._determine_test_tool_platform(platform) File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/connection.py", line 139, in _determine_test_tool_platform raise ConnectionError('Unable to connect to %s. Check the ip address and consider using the rest_port parameter.' % self._hostname) ixnetwork_restpy.errors.ConnectionError: Unable to connect to 10.33.13.15. Check the ip address and consider using the rest_port parameter.

I am unable to connect any clues?

therkong commented 4 years ago

What is 10.33.13.15 address? Is this a Linux chassis? a Windows machine running ixNet API Server? or a Linux machine running ixNet API Server? You must have one of the above running. Next, is there a firewall that may block the connection to 10.33.13.15?

Regards,

Theresa Kong Senior Tech Support Engineer Keysight Technologies

From: uditpatel014 notifications@github.com Sent: Wednesday, March 11, 2020 6:53 PM To: OpenIxia/IxNetwork IxNetwork@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [OpenIxia/IxNetwork] Can not connect to Windows API browser (#84)

[EXTERNAL]

uditp@tb152:~$ sudo python3 IxNetwork.py 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [INFO] using python version 3.4.3 (default, Nov 12 2018, 22:25:49) [GCC 4.8.4] 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [INFO] using ixnetwork-restpy version 1.0.51 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [WARNING] Verification of certificates is disabled 2020-03-12 00:25:56 [ixnetwork_restpy.connection] [INFO] The package will automatically determine the test tool platform and rest_port using the 10.33.13.15 address. 2020-03-12 00:25:58 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at http://10.33.13.15:11009https://urldefense.com/v3/__http:/10.33.13.15:11009__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qiidhAZw$. 2020-03-12 00:26:00 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at https://10.33.13.15:11009https://urldefense.com/v3/__https:/10.33.13.15:11009__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qscrcT0G$. 2020-03-12 00:26:02 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at http://10.33.13.15:443https://urldefense.com/v3/__http:/10.33.13.15:443__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8quFwh_8h$. 2020-03-12 00:26:04 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at https://10.33.13.15:443https://urldefense.com/v3/__https:/10.33.13.15:443__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qsKcvJvK$. 2020-03-12 00:26:06 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at http://10.33.13.15:11009https://urldefense.com/v3/__http:/10.33.13.15:11009__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qiidhAZw$. 2020-03-12 00:26:08 [ixnetwork_restpy.connection] [WARNING] Unable to connect to test tool at https://10.33.13.15:11009https://urldefense.com/v3/__https:/10.33.13.15:11009__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qscrcT0G$.

Traceback (most recent call last): File "IxNetwork.py", line 58, in ClearConfig=True, LogLevel='all', LogFilename='restpy.log') File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/assistants/sessions/sessionassistant.py", line 97, in init trace=LogLevel) File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/testplatform/testplatform.py", line 66, in init self._connection = Connection(ip_address, rest_port, platform, log_file_name, ignore_env_proxy, verify_cert, trace, script_watch) File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/connection.py", line 108, in init self._scheme = self._determine_test_tool_platform(platform) File "/usr/local/lib/python3.4/dist-packages/ixnetwork_restpy/connection.py", line 139, in _determine_test_tool_platform raise ConnectionError('Unable to connect to %s. Check the ip address and consider using the rest_port parameter.' % self._hostname) ixnetwork_restpy.errors.ConnectionError: Unable to connect to 10.33.13.15. Check the ip address and consider using the rest_port parameter.

I am unable to connect any clues?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/OpenIxia/IxNetwork/issues/84*issuecomment-597966791__;Iw!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qn6sgIBW$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AIRRUUOQJ3YTBPQODVF6CF3RHA6BHANCNFSM4JU5HVOA__;!!I5pVk4LIGAfnvw!2OgAjSdZExBMrGDDu2ZUSeAKh-SSVDyn43c4AidsuKaBfd33-P8aPJxBNRv8qtQKIpA-$.

uditpatel014 commented 4 years ago

This is my Windows PC address on which I am running IxNetwork Server API. I am not too sure about firewall

therkong commented 4 years ago

Try turning off firewall on your Windows.

On your browser, can you try http://10.33.13.15:11009/api/v1/sessions or https://10.33.13.15:443/api/v1/sessions

You should get response like below if there’s connection to 10.33.13.15:

[cid:image001.png@01D5F875.D444ABF0]I Regards,

Theresa Kong Senior Tech Support Engineer Keysight Technologies

From: uditpatel014 notifications@github.com Sent: Thursday, March 12, 2020 1:18 PM To: OpenIxia/IxNetwork IxNetwork@noreply.github.com Cc: Theresa Kong theresa.kong@keysight.com; Comment comment@noreply.github.com Subject: Re: [OpenIxia/IxNetwork] Can not connect to Windows API browser (#84)

[EXTERNAL]

This is my Windows PC address on which I am running IxNetwork Server API. I am not too sure about firewall

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/OpenIxia/IxNetwork/issues/84*issuecomment-598400037__;Iw!!I5pVk4LIGAfnvw!zMjTjHPnnRf36NXOnwpqtDhZPMsFR5T2IRQmsCHtIqOlX95S7rrd94BKYqP1iTfEQfmj$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AIRRUUJUV4QMWK6XUKSMMTDRHE7QFANCNFSM4JU5HVOA__;!!I5pVk4LIGAfnvw!zMjTjHPnnRf36NXOnwpqtDhZPMsFR5T2IRQmsCHtIqOlX95S7rrd94BKYqP1ifs01lz0$.