-
Notifications
You must be signed in to change notification settings - Fork 68
Device Communication
Quokka communicates with devices using various mechanisms, depending on the setting of the 'transport' value in the 'devices.yaml' configuration file. There currently are three possible values:
- napalm: This indicates to quokka to use NAPALM to communicate with the device. NAPALM may use either SSH or NETCONF for the actual communication.
- ncclient: This indicates to quokka that it should use ncclient to communicate with the device.
- HTTP-REST: The intention of this setting is to indicate that the device will be sending heartbeat messages to quokka at regular intervals, which will be used to gather status information (currently), such as availability, response time, CPU and memorization utilization.
These communication mechanisms are described in more detail below.
NAPALM is a handy python package that abstracts device communication, such that an application can do things like request device facts, environment, interfaces, arp table, etc., and NAPALM will actually perform the device communication. So, the application does not need to know about, or deal with, the nitty-gritty details of the communication process - NAPALM takes care of that.
Depending on the device type, NAPALM will get a "network driver", which is then used to communicate with the device. Examples of these driver types are "ios" and "nxos-ssh", which will use SSH for communication, and "nxos", which uses NETCONF. Juniper devices (which quokka does not address) use NETCONF.
NAPALM itself uses abstractions for it communication. E.g. it uses NetMiko for SSH communication in the examples I've seen. Of course, that is all hidden from us, we only need to access the NAPALM interface - that's the idea of having an abstraction layer.
ncclient is a package that allows quokka to communicate to devices via NETCONF. You first connect to the device, and then you are able to query the device for the entire configuration, or for a specific portion of the configuration. And of course, to edit the configuration, if so desired.
A limitation of ncclient is that it does not provide the abstraction that NAPALM does; in other words, you need to know exactly how to query the device, using NETCONF XML, in order to get what you want. ncclient - as far as I know, and at this time anyway - does not provide a layer that allows you to say "get device facts", and have ncclient translate that request into the correct XML, depending on the device (e.g. Cisco CSR vs Junos).
So within quokka, we attempt to get the firmware version for one of the devices, and also to get the entire configuration - that's about it.
However you should be aware, as mentioned above, that NAPALM is capable of doing NETCONF, and so it can be used rather than the more 'raw' ncclient.