aristanetworks / cvprac

Other
46 stars 47 forks source link

Add support for search device by hostname #152

Closed titom73 closed 3 years ago

titom73 commented 3 years ago

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:

Happy to discuss about the best approach before sending PR.

titom73 commented 3 years ago

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

emilotep commented 3 years ago

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

mharista commented 3 years ago

Hi @emilotep

I'll look into getting this merged today

mharista commented 3 years ago

Fixed #153