Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper identification of 'viptela-router' and 'cisco-router' causes commands to fail. #172

Open
jdcarp opened this issue Oct 7, 2022 · 1 comment

Comments

@jdcarp
Copy link

jdcarp commented Oct 7, 2022

Issue:

Attempting to use 'get_ip_route_table' for a Cisco ISR1100-6G with Viptela OS device fails with:

Error 400 (bad_request) - Device data error: IPRoutes is not supported by ISR 1100 6G (Viptela OS)'

There appears to be a logic error in the def _get_device_type(self, system_ip) function. This function queries the '/devices/models' to return the following results for an ISR 1100 6g:

ISR1100-6G-XE running Cisco IOS.

{
   "name":"vedge-ISR1100-6G-XE",
   "templateClass":"cedge",
   "displayName":"ISR 1100 6G (Cisco OS)",
   "deviceType":"vedge",
   "isCliSupported":true,
   "templateSupported":true,
   "deviceClass":"cisco-router",
   "cpuCountAttribute":{
      "enable":true,
      "attributeField":"total_cpu_count"
   },
   ...
},

ISR1100-6G-XE running Viptela OS.

{
   "name":"vedge-ISR1100-6G",
   "templateClass":"vedge",
   "displayName":"ISR 1100 6G (Viptela OS)",
   "deviceType":"vedge",
   "isCliSupported":true,
   "templateSupported":true,
   "deviceClass":"viptela-router",
   "cpuCountAttribute":{
      "enable":true,
      "attributeField":"linux_cpu_count"
   },
  ...
}

def _get_device_type then uses the following logic to check for a match:

device_type = [device['deviceClass'] for device in result if device_model in device['name']][0]

The use of 'in' is improperly matching the "vedge-ISR1100-6G-XE" with deviceClass of 'cisco-router'. It should be matching the "vedge-ISR1100-6G" with device type of deviceClass of 'viptela-router'.

jdcarp added a commit to jdcarp/python-viptela that referenced this issue Oct 7, 2022
@jdcarp
Copy link
Author

jdcarp commented Oct 7, 2022

After a quick check, this issue appears to impact more than just 'get_ip_route_table'. From my looking this can impact the functionality of the following functions:

get_dhcp_interfaces
get_eigrp_interfaces
get_eigrp_routes
get_eigrp_topology
get_multicast_replicator
get_multicast_rpf
get_multicast_tunnel
get_ospf_routes
get_ospf_database
get_ospf_database_summary
get_ospf_process
get_ospf_database_external

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant