aristanetworks/cvprac

Add support for search device by hostname

titom73 opened this issue · 4 comments

For ansible-cvp collection, we are moving to a search by hotname instead of FQDN as it can create issue when we provision devices with no dns domain and then apply such configuration.

Currently, we don't have such function in cvprac and we can only rely on def get_device_by_name(self, fqdn) which requires an FQDN to get device.

Idea would be to do one of these options:

  • Create a new function to allow search by FQDN field
  • Implement an option in def get_device_by_name(self, fqdn) to select field to use for search: fqdn or hostname

Happy to discuss about the best approach before sending PR.

Actually, hostname is not part of the response when running search_topology

{
  "keywordList": [],
  "total": 1,
  "netElementList": [
    {
      "modelName": "",
      "internalVersion": "4.25.2F",
      "systemMacAddress": "50:8d:00:e3:78:aa",
      "serialNumber": "79AEA53101E7340AEC9AA4819D5E1F5B",
      "memTotal": 0,
      "bootupTimeStamp": 1622794376.503242,
      "memFree": 0,
      "version": "4.25.2F",
      "architecture": "",
      "internalBuildId": "6abe91ca-cb14-4038-96f6-f83dd0a346f5",
      "hardwareRevision": "",
      "fqdn": "CV-ANSIBLE-EOS01.emea.lab",
      "key": "50:8d:00:e3:78:aa"

So, having option to compare only hostname part of the FQDN would be nice

Have a customer that needs this in order to move to using v3 cvp modules with AVD.

Hi @emilotep

I'll look into getting this merged today

Fixed #153