Connection problems with Python Remote Server and Robot Framework - python

We are trying to use the Robot Framework together with a Python Remote Server, so that libraries can be used, that are lying on a different machine.
Lets call the machine on which runs the Python Remote Server A giving me library libA, and the machine which calls libA using the Python Remote Server B. I need this settings, as only machine A has internet connection. Both machines are Windows 10 machines.
I was already successully calling a method in libA from the machine B and everything works as expected if I was logging in to machine B manually and start the on A manually.
Now, I was trying to do the same thing using jenkins, which a special jenkins User and I have connectivity problems. (So it shouldn't be a firewall issue)
Getting keyword names from library 'Remote' failed:
Calling dynamic method 'get_keyword_names' failed:
Connecting remote server at http://192.168.0.1:8270 failed:
[WinError 10061] No connection could be established,
as target computer refuses connection
Does anyone knows, what might be the problem?

Related

how ansible connects to remote devices

I am learning how to create ansible modules in python, I want to connect to remote devices, I am looking at ansible source code to see how they connect, but I still cant understand how???
I took this simple module file from ansible to check how they connect to the remote device and do all the stuff that the module does
https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/ping.py
I don't see any socket or libraries for ssh in this file, so how does it happed?
does ansible first connect to the remote host and then activate the module on the remote host?
is that why it requires python on remote devices?
I cant really understand it
As far as i know, Ansible use ssh to connect.
You can perform a research whith 'repo:ansible/ansible filename:ssh' in
github research here
You can examin this code.
Ansible also use the lib paramiko to connect with ssh.
as we can see here

Can't connect to my google cloud VM instance through tcp using python

Situation
I wrote a simple program in python. It's a simple socket chatting program. In my program, the client just connect to an address (ip, port) and send a message, while at this time the server is ready and receives the message and prints it. I can assure the program is correct, since I tried on my computer.
I have a VM instance on Google Cloud Platform, which I can operate through ssh, a simple way provided by google cloud. I can make sure the server is working.
Problem
I start a simple tcp server, python program on my google cloud server. Then I start my client program on my computer. But I get this error:
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
or equivalently in Chinese:
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。
How do I solve this problem and connect to my google cloud server?
I guess maybe the firewall refused my computer's connection, but have no idea how to solve it.
This error means that your program is not listening on 0.0.0.0 port XYZ.
Check to see if your program is instead listening on localhost. If it is change to 0.0.0.0 which means all available networks. localhost means do not listen on any network interfaces and only accept connections from inside the computer.
Then double check the port number.
To see if you have something listening run this command (Linux): netstat -at
Look for a line with your port XYZ.
When you start your program, make sure that it does not error when creating the listener. If you are trying to use a port number below 1024, you will need to lauch the program with root privileges.
The TCP connection is being refused because the GCP Firewall is indeed blocking it. Therefore, you must create a firewall rule that opens the TCP port for Ingress connections.
By navigating to Firewall rules in the VPC network section of the GCP Console, you can create firewall rules or update existing ones.
One approach is to tag your GCE instance, and when creating the firewall rule, set the target to be this tag, and as for 'Source filters', the IP of the machine you're attempting to establish the connection from, or simply allow all IPs to connect with 0.0.0.0/0 as the source. Remember to specify the TCP port that needs to be opened.

Paramiko for remote ssh

I have a common VM and remote VM. we have network devices, only remote VM has access to network devices.
Python script will do configurations in network devices.
I must trigger a python script from common VM.
To implement this Currently I have two options in my mind.
Configure password less between common vm to remote vm. Trigger a script from common vm which copies script to remote vm then start execution.
directly ssh using paramiko to remote and again ssh using paramiko to network devices (This option is not tried, I am going to try now)
Which is the better method or any other suggestions will welcome.
Thanks

No connection could be made because the target machine actively refused it (RobotFramework)

My test case in Robot Framework works well on my local machine.
But when I run the same test case on Oracle VM VirtualBox machine at client side after connecting it remotely(where setup for Robot Framework has been done) I get below error message while executing any sample test case.
command: pybot.bat --argumentfile
c:\users\tolabr~1\appdata\local\temp\RIDEaoyfb9.d\argfile.txt
--listener C:\Python27\lib\site-packages\robotframework_ride-2.0a1-py2.7.egg\robotide\contrib\testrunner\TestRunnerAgent.py:49191:False
C:\Projects-GIT unable to open socket to "localhost:49191" error:
[Errno 10061] No connection could be made because the target machine
actively refused it
Even those test case which pass shows this error.
But most of test case which works well on my local machine is not working well on client machine & I get the mentioned error message. Though I found some similar question as mine on stackoverflow, but none of them were for Robot Framework and those solution does not seems to be feasible for my case. Have anyone faced this issue on Robot Framework? Any idea on how to resolve it? Many thanks, Shoaib

Issues using Spyder python to connect to remote machine

So I have a RedHat System in AWS running Spark on top of HDFS. Now I want to access PySpark from my local machine i.e. Interactive Python.
So, I installed Spyder-Py2 to connect to the remote AWS machine so I can access Spyder Python.
Route:
Using Cookbook: Connecting to a remote kernel via ssh, I started Kernel on AWS machine i.e. Server and copied the json file over to local machine.
Changed the ip in kernel1234.json to point to the public ip.
Went to Consoles in Spyder-Py2 and select "Connect to existing kernel".
Passed the kernel1234.json file, added username and host in the hostname section.
Passed my AWS pem key in SSH Key section and entered the password
But it fails with the below error:
Unable to connect to IPython kernel-1234.json
Can anybody please tell me what am I missing here ?
Note: The server on the AWS VM is still running.

Categories