summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/cambium.rb
blob: 230282c0e26be06a8ea77c9fab066582b46c6b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Cambium < Oxidized::Model

  cfg_cb = lambda do
    c_page = @m.click @m_page.link_with(text: "Configuration")
    u_page = @m.click c_page.link_with(text: "Unit Settings")
    cfg    = @m.click u_page.link_with(text: /\.cfg$/)
    cfg.body
  end

  cmd cfg_cb do |cfg|
    cfg
  end

  cfg :http do
    @main_page = "/main.cgi"
    define_singleton_method :login do
      @m_page = @m_page.form_with(action: "login.cgi") do |form|
        form.CanopyUsername = @node.auth[:username]
        form.CanopyPassword = @node.auth[:password]
      end.submit
    end
  end
end