ytti / oxidized

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

Cambium Model Issues #2000

Closed tmcdon89 closed 2 years ago

tmcdon89 commented 4 years ago

I'm getting generic fails when trying to connect to cambium PMP models using the built in cambium.rb model.

Its trying three times then moving on. Using oxidized -d doesn't reveal much.

I'm happy to share what Info I can, but I'm not sure where to start on posting. I'm seeing the same results as millenium7 in issue: https://github.com/ytti/oxidized/issues/1287

adamkuj commented 4 years ago

Seeing the same. I'm running 0.27.0 My debug logs look like this:

D, [2020-03-18T10:26:44.435439 #2876] DEBUG -- : resolving DNS for cambium-test-ap... D, [2020-03-18T10:32:19.450685 #2876] DEBUG -- : lib/oxidized/worker.rb: Added /cambium-test-ap to the job queue D, [2020-03-18T10:32:19.450758 #2876] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for cambium-test-ap at 2020-03-18 14:32:19 UTC D, [2020-03-18T10:32:19.451216 #2876] DEBUG -- : lib/oxidized/job.rb: Config fetched for cambium-test-ap at 2020-03-18 14:32:19 UTC W, [2020-03-18T10:32:20.452987 #2876] WARN -- : /cambium-test-ap status fail, retry attempt 1 D, [2020-03-18T10:32:20.453509 #2876] DEBUG -- : lib/oxidized/worker.rb: Added /cambium-test-ap to the job queue D, [2020-03-18T10:32:20.453618 #2876] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for cambium-test-ap at 2020-03-18 14:32:20 UTC D, [2020-03-18T10:32:20.454554 #2876] DEBUG -- : lib/oxidized/job.rb: Config fetched for cambium-test-ap at 2020-03-18 14:32:20 UTC W, [2020-03-18T10:32:21.455441 #2876] WARN -- : /cambium-test-ap status fail, retry attempt 2 D, [2020-03-18T10:32:21.457136 #2876] DEBUG -- : lib/oxidized/worker.rb: Added /cambium-test-ap to the job queue D, [2020-03-18T10:32:21.457215 #2876] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for cambium-test-ap at 2020-03-18 14:32:21 UTC D, [2020-03-18T10:32:21.457609 #2876] DEBUG -- : lib/oxidized/job.rb: Config fetched for cambium-test-ap at 2020-03-18 14:32:21 UTC W, [2020-03-18T10:32:22.459898 #2876] WARN -- : /cambium-test-ap status fail, retry attempt 3 D, [2020-03-18T10:32:22.460443 #2876] DEBUG -- : lib/oxidized/worker.rb: Added /cambium-test-ap to the job queue D, [2020-03-18T10:32:22.460543 #2876] DEBUG -- : lib/oxidized/job.rb: Starting fetching process for cambium-test-ap at 2020-03-18 14:32:22 UTC D, [2020-03-18T10:32:22.462056 #2876] DEBUG -- : lib/oxidized/job.rb: Config fetched for cambium-test-ap at 2020-03-18 14:32:22 UTC W, [2020-03-18T10:32:23.462171 #2876] WARN -- : /cambium-test-ap status fail, retries exhausted, giving up

A tcpdump confirms that NO outbound packets are being sent to the target (HTTP, SSH, Telnet, or otherwise). DNS resolution confirmed working.

Debug log does not make any reference to lib/oxidized/input/http.rb (whereas for i.e. juniper devices, there are lines like "... lib/oxidized/input/ssh.rb: Connecting to ...")

My input stanza looks like this:

input: debug: true http: debug: true

my models stanza looks like this:

models: junos: username: password: cambium: username: password:

I also noticed that https://www.rubydoc.info/gems/oxidized/Oxidized/Input does not list HTTP as an input method (though i.e. TFTP and FTP are listed, along side the standard SSH and Telnet)

I have all of the dependencies described in https://rubygems.org/gems/oxidized . I see that it lists net-ssh and net-telnet as required gems. Why no net-http gem?

martydingo commented 4 years ago

Bumping this as Cambium is within our ecosystem, this only supports 450i's and there's other devices too.

On this issue though, I'm not seeing any configurations being pulled on 450i's. Can we please clarify the naming convention too, since Cambium has ePMP3000's which aren't supported by this model, and it's misleading until you find the small note in the docs section.

ytti commented 4 years ago

In reality we support specific NOS, not vendor or model. So the models should be named based on NOS. So perhaps open support case to vendor and ask what do they call the different NOS they have.

martydingo commented 4 years ago

@ytti Well, this model should be named along the lines of CambiumCanopy, as Canopy is the 'NOS' in use on that, but just Canopy isn't very clear. As the other models are currently not supported it's not so much a bother, but then the ePMP series of NOS would then be 'Cambium-ePMP' and so forth.

ytti commented 4 years ago

If model does not work, it usually implies it's different NOS. You're proposing to call them VendorModel, which is not what we want to do, several models can use same NOS.

martydingo commented 4 years ago

@ytti That makes sense. They name the software 'Canopy', which runs on PMP Series, which includes the 450 series, you can see this here. The others do not seem to be clearly named, so I'll shoot them an e-mail later on.

In any case I'm derailing this issue, so I'll create a new issue for the naming convention when I have all the information. Configuration retrieval should be pretty easy on their other radios comparatively to Canopy, so once the naming standards are sorted I can look at seeing how difficult it would be to implement.

typecookie commented 4 years ago

along these lines i have a bash script that pulls configs from pmp1000 via SNMP is there a possibility it might be convertible to ruby and integrated???

I'm a script monkey and all my code is haky

martydingo commented 4 years ago

I've written the code already.

Save the following as /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/model/cambiumepmp.rb (Please double check the oxidized-0.28.0 folder is named correctly as the versioning may be different on your end)

 class CambiumePMP < Oxidized::Model
  # Cambium ePMP Radios

  # prompt /\(.*\)>/
  prompt /.*>/

  cmd :all do |cfg|
    cfg.cut_both
  end

  pre do
    cmd 'config show json'
  end

  cfg :ssh do
    pre_logout 'exit'
  end
end

Use the CambiumePMP as the model / device type / NOS in your configuration/inventory file.

typecookie commented 4 years ago

you are a champion dingo thanks for this

NoifP commented 4 years ago

Thanks Marty! That's awesome!

NoifP commented 4 years ago

Thanks @martydingo; it's working great!

CharlyBote commented 3 years ago

Hi @martydingo I flow your instruction to add a new feature to scan the Cambium epmp 3000 AP series, but, dosen't works for me.

E, [2021-05-08T19:17:57.191886 #19411] ERROR -- : node {:name=>"10.2.136.4", :model=>"epmp", :group=>"default"} raised Oxidized::ModelNotFound with message 'epmp not found for node 10.2.136.4' E, [2021-05-08T19:17:57.192119 #19411] ERROR -- : node {:name=>"10.2.181.4", :model=>"epmp", :group=>"default"} raised Oxidized::ModelNotFound with message 'epmp not found for node 10.2.181.4' E, [2021-05-08T19:17:57.192186 #19411] ERROR -- : node {:name=>"10.2.144.12", :model=>"epmp", :group=>"default"} raised Oxidized::ModelNotFound with message 'epmp not found for node 10.2.144.12' E, [2021-05-08T19:17:57.192249 #19411] ERROR -- : node {:name=>"10.2.144.13", :model=>"epmp", :group=>"default"} raised Oxidized::ModelNotFound with message 'epmp not found for node 10.2.144.13'

According to the log, the model name is "epmp", so I renamed the file cambiumepmp.rb to epmp.rb, but when I run oxidized, I get the following error: 1: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:60:in 'loader' /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:17:in 'load': undefined method 'new' for nil:NilClass (NoMethodError) My config file:


resolve_dns: false interval: 3600 use_syslog: false debug: false threads: 30 timeout: 20 retries: 3 prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/ rest: 192.168.9.7:8888 next_adds_job: false vars: {} groups: {} models: routeros: username: admin password: somepassword epmp: username: admin password: somepassword pid: "/root/.config/oxidized/pid" crash: directory: "/root/.config/oxidized/crashes" hostnames: false stats: history_size: 10 input: default: ssh debug: false ssh: secure: false ftp: passive: true utf8_encoded: true output: default: file file: directory: "/root/.config/oxidized/configs" source: default: http debug: false http: url: http://netmon.interno/api/v0/oxidized map: name: hostname model: os group: group headers: X-Auth-Token: sometoken model_map: juniper: junos cisco: ios

Any idea? Thanks in advance.

martydingo commented 3 years ago

I'm pretty sure you have to use cambiumepmp as the model. Be aware this issue is about 450i support. From #2081

CambiumCanopy (i.e. for 450-series PTP and PMP devices - aka "Canopy" NOS) CambiumEPMP (for EPMP3000-series devices, including low-end PTP devices - aka "Cambium Networks" NOS) CambiumCeraOS (for Ceragon-derived products - aka CeraOS NOS)

CharlyBote commented 3 years ago

Thanks for your answer @martydingo I attach the debbug for oxideized for epmp model name

D, [2021-05-18T13:37:44.115886 #14741] DEBUG -- : resolving DNS for 10.2.136.6... D, [2021-05-18T13:37:44.115900 #14741] DEBUG -- : IPADDR D, [2021-05-18T13:37:44.115919 #14741] DEBUG -- : node.rb: resolving node key 'model', with passed global value of '' and node value 'epmp' D, [2021-05-18T13:37:44.115934 #14741] DEBUG -- : node.rb: setting node key 'model' to value 'junos' from global D, [2021-05-18T13:37:44.115949 #14741] DEBUG -- : node.rb: returning node key 'model' with value 'epmp' D, [2021-05-18T13:37:44.115963 #14741] DEBUG -- : lib/oxidized/node.rb: Loading model "epmp" D, [2021-05-18T13:37:44.116525 #14741] DEBUG -- : lib/oxidized/model/model.rb Added all to the commands list F, [2021-05-18T13:37:44.116713 #14741] FATAL -- : Oxidized crashed, crashfile written in /root/.config/oxidized/crash undefined method new' for nil:NilClass Traceback (most recent call last): 20: from /usr/local/bin/oxidized:23:in

' 19: from /usr/local/bin/oxidized:23:in load' 18: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/bin/oxidized:8:in<top (required)>' 17: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/cli.rb:13:in run' 16: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:innew' 15: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in new' 14: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:ininitialize' 13: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in new' 12: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:125:ininitialize' 11: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:10:in load' 10: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:inwith_lock' 9: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in synchronize' 8: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:inblock in load' 7: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in each' 6: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:inblock (2 levels) in load' 5: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in new' 4: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:22:ininitialize' 3: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:170:in resolve_model' 2: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:47:inadd_model' 1: from /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:60:in loader' /var/lib/gems/2.5.0/gems/oxidized-0.28.0/lib/oxidized/manager.rb:17:inload': undefined method `new' for nil:NilClass (NoMethodError)

and without epmp model

resolving DNS for 10.2.136.6... D, [2021-05-18T13:48:03.055920 #27493] DEBUG -- : IPADDR D, [2021-05-18T13:48:03.055939 #27493] DEBUG -- : node.rb: resolving node key 'model', with passed global value of '' and node value 'epmp' D, [2021-05-18T13:48:03.055956 #27493] DEBUG -- : node.rb: setting node key 'model' to value 'junos' from global D, [2021-05-18T13:48:03.055972 #27493] DEBUG -- : node.rb: returning node key 'model' with value 'epmp' D, [2021-05-18T13:48:03.055982 #27493] DEBUG -- : lib/oxidized/node.rb: Loading model "epmp" E, [2021-05-18T13:48:03.056538 #27493] ERROR -- : node {:name=>"10.2.136.6", :model=>"epmp", :group=>"default"} raised Oxidized::ModelNotFound with message 'epmp not found for node 10.2.136.6'

martydingo commented 3 years ago

D, [2021-05-18T13:37:44.115963 #14741] DEBUG -- : lib/oxidized/node.rb: Loading model "epmp"

It needs to be configured as cambiumepmp, not epmp. You need to follow the instructions closely, and don't deviate with file names. Potentially an issue within Oxidized, but I'm unsure as I don't work at the place I required this and Oxidized for. It's also potentially a point that inside the ruby script, it's referenced as cambiumepmp, and Oxidizied is now looking for 'epmp'.

I'd remove all the things you've done to add epmp support, and start by placing the cambiumepmp.rb file in the correct location. configuring it without making any modifications to any files except for configurations, and see what output you arrive at.

I was using this on the same version are you are on currently, so I don't foresee any issues on that front.

mortzu commented 2 years ago

There is a PR #2195 waiting to be merged