akarneliuk / pygnmi

The pure Python implementation of the gNMI client.
https://training.karneliuk.com
BSD 3-Clause "New" or "Revised" License
129 stars 44 forks source link

Unable to connect to Unix domain socket #19

Closed jbemmel closed 3 years ago

jbemmel commented 3 years ago

At https://github.com/akarneliuk/pygnmi/blob/master/pygnmi/client.py#L61 the code assumes the target consists of a host:port string.

I have an application that needs to connect locally, as in grpc.insecure_channel('unix:///some/socket/path') I don't control the server path, so I cannot make it look like '/x/y/z:port'

akarneliuk commented 3 years ago

Hello @jbemmel ,

I believe you already have written the the path for that. I will try to test tomorrow and will let you know.

Out of curiosity, what is the application having such connectivity? OK if that is something private and you can't share.

Best, Anton

jbemmel commented 3 years ago

On our Nokia SR Linux platform we use gNMI and Yang models as a system interface. An agent process running on the same platform can connect locally to the server, using a Unix socket avoids complications with network namespaces

akarneliuk commented 3 years ago

Hello @jbemmel ,

gotcha, thanks. Actually, waiting SRLinux 21.6 to have hands on public release finally :-)

BTW, in the release published yesterday your commit is added as well as connect() method. Could you please check if that works for you now?

Best, Anton

jbemmel commented 3 years ago

Hi Anton, I noticed the new connect() method - perhaps it would be better to have enter(self) simply 'return self.connect()' ?

Regards, Jeroen

On Thu, Jun 24, 2021 at 4:37 PM Anton Karneliuk @.***> wrote:

Hello @jbemmel https://github.com/jbemmel ,

gotcha, thanks. Actually, waiting SRLinux 21.6 to have hands on public release finally :-)

BTW, in the release published yesterday your commit is added as well as connect() method. Could you please check if that works for you now?

Best, Anton

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/akarneliuk/pygnmi/issues/19#issuecomment-867967817, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPQAC5XEEEUITCDNEMQKE3TUOQQHANCNFSM47B7XVIQ .

akarneliuk commented 3 years ago

Hey @jbemmel ,

indeed, it looks simpler. Thanks for suggestion. I've just added this in the latest release 0.5.3. Could you please test and let me know if that works for you.

Best, Anton