Header Only - DO NOT REMOVE - Extreme Networks

python exception socket.error: [Errno 128] Network is unreachable


Colleagues, hello.
There was a need of sending mail on an event from the switch.
I was will find here such absolutely remarkable script of https://github.com/extremenetworks/ExtremeScripting/blob/master/EXOS/Python/Email_event/email.py

Everything is good only if to launch through cli: run script email.py I receive socket.error: [Errno 128] of Network is unreachable if through UPM Profile just silence, it is natural that the email server from the switch is available, as far as I understand problem in vr vr-default, but as to launch it having specified vr vr-default it isn't told anywhere. Prompt please how to resolve an issue with it python exception.

7 replies

Userlevel 7
Hi Vladimir,

Is you mail server reachable through VR-Default or VR-Mgmt?

After a quick glance that the script, I believe this script requires reachability to the mail server via VR-Mgmt.

-Brandon
Hi Brandon ,
The email server is available from VR-Default.Maybe you know how to change such behavior of a script?
Userlevel 6
I updated the code to be VR-Aware. Get the new python script from github, change myVirtualRouter to the VR you want (by default it is in vr-default now so no change needed for you).
Many thanks ! Now everything works perfectly.
Userlevel 2
When you say that you needed to change the VR are you referring to editing the /proc/self/ns_id file? I see (from the python doc) that it needs to be changed. Question is does it need to be changed every time the script is ran or is the initial change permanent?
Userlevel 7
bw447 wrote:

When you say that you needed to change the VR are you referring to editing the /proc/self/ns_id file? I see (from the python doc) that it needs to be changed. Question is does it need to be changed every time the script is ran or is the initial change permanent?

Yes, this needs to be modified every time you want to access something via VR-Mgmt.
Userlevel 7
bw447 wrote:

When you say that you needed to change the VR are you referring to editing the /proc/self/ns_id file? I see (from the python doc) that it needs to be changed. Question is does it need to be changed every time the script is ran or is the initial change permanent?

The self part of /proc/self/ns_id shows that this pseudo-file pertains to the currently running process itself.

The proc part hints that this is per-process, but Linux has not been consistent with this and lots of non-process-specific stuff landed in procfs (usually mounted under /proc), before adding sysfs (usually mounted under /sys) for new system wide information and settings. But /proc/self relates to the current process only.

So this file is new for every process and by default set to use VR-Mgmt and therefore needs to be changed every time the script is run.

Reply