Closed JulioPDX closed 1 year ago
Using cloudvision-python 1.4.1
Hi Julio
The import error you're encountering is due to some protobuf wrappers not being installed
Could you get the list of installed modules from via the pip associated with your python3 installation (pip/pip3) using pip list
?
Afterwards, can you make sure the following modules are installed via pip install
?
protobuf
types-protobuf
fmp
That should ensure all the dependencies/wrappers are installed for any lookup to succeed for protobuf files
It most likely is due to fmp not being correctly installed from what I can tell, as it's not listed in the requirements file, so if that's the culprit I'll make a change to add it there.
The installed fmp pip package you have in your site-packages
is unfamiliar to me as well looking at the stack trace, as the one installed via pip only has the version number in the init.py
file while yours has actual imports.
It could be that the repo version of fmp was somehow installed, though I'm not sure as to how, or why, that would happen.
Hi @cianmcgrath, it looks like I was missing the fmp package. I got that installed. Making progress but I'm curious if you've seen this error before. I verified credentials and reachability to the CVP instance.
> pip list
Package Version
------------------ -----------
autoflake 1.4
beautifulsoup4 4.11.1
black 22.3.0
certifi 2021.10.8
charset-normalizer 2.0.12
click 8.1.2
cloudvision 1.4.1
colorama 0.4.5
commonmark 0.9.1
cvprac 1.0.7
fmp 0.3.0
grpcio 1.46.3
idna 3.3
msgpack 1.0.4
mypy-extensions 0.4.3
pathspec 0.9.0
pip 22.0.4
platformdirs 2.5.2
protobuf 3.20.1
pyflakes 2.4.0
Pygments 2.11.2
requests 2.27.1
rich 10.16.2
setuptools 60.10.0
six 1.16.0
soupsieve 2.3.2.post1
tomli 2.0.1
types-protobuf 3.19.22
types-PyYAML 6.0.8
types-requests 2.27.30
types-urllib3 1.26.15
typing_extensions 4.2.0
urllib3 1.26.9
yapf 0.32.0
> python conn.py
Traceback (most recent call last):
File "/Users/julioperez/Documents/cvp-test/conn.py", line 27, in <module>
for resp in event_stub.Subscribe(event_watch_request):
File "/Users/julioperez/Documents/cvp-test/venv/lib/python3.9/site-packages/grpc/_channel.py", line 426, in __next__
return self._next()
File "/Users/julioperez/Documents/cvp-test/venv/lib/python3.9/site-packages/grpc/_channel.py", line 826, in _next
raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"@1655840566.905531000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3218,"referenced_errors":[{"created":"@1655840566.905530000","description":"failed to connect to all addresses","file":"src/core/lib/transport/error_utils.cc","file_line":165,"grpc_status":14}]}"
I have seen issues like that before, though they were due to dialling the wrong address on the cvp instance, e.g. not hitting the apiserver port on the cluster for the connector, which I believe is 9900, so the connection address would be <cvp-ip>:9900
I'll try track down a more definitive answer for you though, and I'll add fmp to the requirements file for now
If you are running CVP version 2021.3.0 and above you should run the example scripts with port 443 not 8443.
If you are running CVP version 2021.3.0 and above you should run the example scripts with port 443 not 8443.
Hi @onderergun, I am setting the port to 443. Thank you!
It looks like you may be attempting to connect to the cluster using the wrong CA certificate(s) to validate the connection. You can confirm this by setting the following envvars and running your script:
export GRPC_TRACE=transport_security,tsi export GRPC_VERBOSITY=DEBUG
You'll need to specify the 'ca' argument to GRPClient to point to a file containing the certificate which the server is presenting, if you're using a self-signed certificate (or a cert that has no route back to a known authority) on your server. There's an example on how to do this programmatically here: https://aristanetworks.github.io/cloudvision-apis/connecting/ , but you should be able to do this from your browser of choice too.
Apologies, the above example refers to the cloudvision Connector, not the resource api examples - but the debug envvars still apply and are worth checking...
@gingerbus Thank you for the tip, is this required when using the Arista ATD? In my example I am not using a self signed cert, when enabling the debugs it seems that this is the root of my issue. I need to research a fix. If anyone is aware of a fix or seen this before, any help is appreciated!
D0623 09:03:53.492561000 6141816832 security_handshaker.cc:181] Security handshake failed: {"created":"@1656000233.492555000","description":"Cannot check peer: missing selected ALPN property.","file":"src/core/lib/security/security_connector/ssl_utils.cc","file_line":138}
Sorry, I'm not familiar with Arista ATD - if its this: https://solutions.arista.com/atd-training then maybe there's an account manager you can talk to, to see if the endpoint you're testing against differs in any way to a typical on-prem install of CVP? It might also be that you're connecting via a proxy which is MITMing your requests, in which case you may need to use the proxy's ca cert chain here. This particular issue looks related: https://github.com/grpc/grpc/issues/29331 I'm pretty sure that the grpcio lib you're using has BoringSSL statically linked, so any version of OpenSSL you might have installed locally shouldn't have any impact. The issue looks like it's server side, with the server not supporting ALPN. Can you provide some more details about the CVP endpoint you're connecting to, and any intermediate hops that may be involved? It might also be worth running wireshark here to capture the connection setup...
I'm also receiving this same error in another project. However, I don't believe that this is due to missing protobuff libraries. This is because y'all don't have this project setup as a proper python package and y'all's imports are fubar. You have a folder in the root of your project that's called fmp that you're attempting to import from. It's extremely obvious when you see the full stacktrace:
File "/usr/local/lib/python3.9/site-packages/arista/inventory/v1/inventory_pb2.py", line 17, in <module>
from fmp import extensions_pb2 as fmp_dot_extensions__pb2
File "/usr/local/lib/python3.9/site-packages/fmp/__init__.py", line 3, in <module>
import wrappers_pb2 as wrappers
ModuleNotFoundError: No module named 'wrappers_pb2'
Y'all need to fix your imports to be correctly pathed and not conflicting with the actual fmp project.
Yes, there was a small issue with the imports. The fmp __init__.py
file was autogenerated and was missing the fmp.
from its own imports. It now works as expected, and the internal generation code has been fixed for future updates as part of this change, which is in v1.4.3+.
As for "not conflicting with the actual fmp project.", that dependency was removed, as it's not an officially supported project. The fmp that is installed alongside this package should be used.
@cianmcgrath I hate to do this, but you're wrong. The problem is not the fmp folder. The problem is here: https://github.com/aristanetworks/cloudvision-python/blob/ce9d8e866b083322dcdd443f314bcd5ef2f3640b/arista/inventory/v1/inventory_pb2.py#L17. You're specifically trying to import the fmp project. That line should actually have your project name. Because it's a blank fmp it's trying to use the actual fmp project that was started in Apr 2022. That's why this is only becoming a problem now. You still have not fixed your imports and this problem is NOT resolved.
I will raise this issue with the relevant team so that they can respond to this so, as I am not involved in resource API development
I am going to close this issue as the problem described in the issue itself is resolved (if using v1.4.3/1.4.4 and not the yanked v1.5.0 or v1.4.2 or before) and open a new one for the potential package overlap issue for tracking as this will start to get muddied otherwise
Please use the above new issue for further discussion on the imports. Thanks
Hello All,
When running through the example events script, I get the following error on imports. Any help is appreciated.