ytti / oxidized

Oxidized is a network device configuration backup tool. It's a RANCID replacement!
Apache License 2.0
2.76k stars 917 forks source link

Add extra command to execute while doing the backup #3017

Closed lodpp closed 3 months ago

lodpp commented 9 months ago

Hi !

Thanks a lot for the oxidized tool, it's saving us lots of time !

With Cisco IOSXR, oxidized is doing:

This is okay but not enough for my case as it lacks the admin configuration. (given by admin show running-config)

Eventually, even the show inventory and show platform lacks some data when compared to their admin counter-part.

ie with the platform:

RP/0/RSP0/CPU0:ro-1.csd4#admin show platform
Tue Dec 26 14:38:21.191 UTC
Node            Type                      State            Config State
-----------------------------------------------------------------------------
0/RSP0/CPU0     ASR9001-RP(Active)        IOS XR RUN       PWR,NSHUT,MON
0/FT0/SP        ASR-9001-FAN              READY
0/0/CPU0        ASR9001-LC                IOS XR RUN       PWR,NSHUT,MON
0/0/1           A9K-MPA-20X1GE            OK               PWR,NSHUT,MON
0/PS0/M0/SP     A9K-750W-AC               READY            PWR,NSHUT,MON
0/PS0/M1/SP     A9K-750W-AC               READY            PWR,NSHUT,MON

VS

RP/0/RSP0/CPU0:ro-1.csd4#show platform
Tue Dec 26 14:38:24.146 UTC
Node            Type                      State            Config State
-----------------------------------------------------------------------------
0/RSP0/CPU0     ASR9001-RP(Active)        IOS XR RUN       PWR,NSHUT,MON
0/0/CPU0        ASR9001-LC                IOS XR RUN       PWR,NSHUT,MON
0/0/1           A9K-MPA-20X1GE            OK               PWR,NSHUT,MON

So here is my question: Is it possible to easily ask the backup tool to execute extra commands for all the ioxr family ? or eventually redefine the set of commands to exec on a devive for backup ?

I could duplicate/modify the lib/oxidized/model/iosxr.rb but I don't feel that it's the best way to do this...

Thanks a lot !

systeembeheerder commented 7 months ago

So here is my question: Is it possible to easily ask the backup tool to execute extra commands for all the ioxr family ? or eventually redefine the set of commands to exec on a devive for backup ?

See https://github.com/ytti/oxidized/blob/master/docs/Creating-Models.md#extending-an-existing-model-with-a-new-command

Something like ~/.config/oxidized/model/iosxr.rb


require 'oxidized/model/iosxr.rb'

class IOSXR
  using Refinements

  cmd 'admin show running-config' do |cfg|
    comment cfg
  end
  cmd 'admin show platform' do |cfg|
    comment cfg
  end

end
lodpp commented 7 months ago

Hi @systeembeheerder

That should do it in fact, I missed that point in the documentation, I will test it this week. thanks !