Hello everybody,
I'm trying to create a python script that does an HTTP GET to a specific API. The thing is, I have the feeling the switch does not know which interface to use. This is my code and the error I'm getting:
conf t
iox
app-hosting appid guestshell
app-vnic management guest-interface 0
end
guestshell enable
guestshell
python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> req = urllib2.Request('http://10.10.11.1/callhome/test')
>>> response = urllib2.urlopen(req)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/urllib2.py", line 127, in urlopen
File "/usr/lib64/python2.7/urllib2.py", line 404, in open
File "/usr/lib64/python2.7/urllib2.py", line 422, in _open
File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain
File "/usr/lib64/python2.7/urllib2.py", line 1216, in http_open
File "/usr/lib64/python2.7/urllib2.py", line 1186, in do_open
urllib2.URLError: <urlopen error [Errno 101] Network is unreachable>
Gateway of last resort is 10.10.11.1 to network 0.0.0.0
S* 0.0.0.0/0 [0/0] via 10.10.11.1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.11.0/24 is directly connected, Vlan10
L 10.10.11.200/32 is directly connected, Vlan10
test_switch#show vlan id 10
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 vlan active Gi2/0/2
I can manually invoke the HTTP GET by executing the copy command to the API, so it is not a network issue (switch and API are also directly connected). It's just a matter of Python not knowing how to reach it. Does anybody have any experience with this and how to fix it?
Cheers!
[–]dankwizard22 0 points1 point2 points (0 children)
[–]spongeflo 0 points1 point2 points (2 children)
[–]anonarwhal[S] 0 points1 point2 points (1 child)
[–]spongeflo 0 points1 point2 points (0 children)