akarneliuk/nornir_pygnmi

Port for gNMI connection should be plugin-specific parameter

jbemmel opened this issue · 2 comments

As suggested in https://karneliuk.com/wp-content/uploads/2022/08/Karneliuk_com_nornir_pygnmi.pdf slide 4

See e.g. https://salt-nornir.readthedocs.io/en/latest/Pillar%20and%20Inventory%20Examples.html#juniper-junos

proxy:
  proxytype: nornir

hosts:
  vmx1:
    hostname: 192.168.217.150
    platform: juniper_junos
    username: nornir
    password: nornir
    connection_options:
     ...
      scrapli_netconf:
        port: 830
        extras:
          transport: system # or paramiko, ssh2
          ssh_config_file: True
          auth_strict_key: False
      scrapli:
        platform: juniper_junos
        port: 22
        extras:
          transport: system # or asyncssh, ssh2, paramiko
          auth_strict_key: false
          ssh_config_file: false

Note how scrapli_netconf uses port 830, while scrapli uses port 22. The port is plugin specific, different plugins can use different ports to talk to a given device (in parallel)

Hey @jbemmel ,

That is already working, I've just tested. Example:

---
c-1-s1:
  hostname: 192.168.101.18
  groups:
    - spine
  connection_options:
    pygnmi:
      port: 12345
      extras:
        path_cert: "./certs/c-1-b1.pem"
        skip_verify: True
        debug: True
...

And in debug you would see:

GRPC Target
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
192.168.101.18:12345
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


GRPC Channel options
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[('grpc.ssl_target_name_override', 'c-1-b1.lab.karneliuk.com')]
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I will amend documentation, thanks.

Best,
Anton

Updated.

Please, let me know if anything else is needed.

Best,
Anton