Class: Opendaylight::API

Inherits:
Object
  • Object
show all
Defined in:
lib/opendaylight.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hostTracker(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object



60
61
62
63
# File 'lib/opendaylight.rb', line 60

def self.hostTracker(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
    auth = {username: username, password: password}
    HTTParty.get("#{url}controller/nb/v2/hosttracker/#{containerName}/hosts/active", :basic_auth => auth)
end

.makeflow(tpSrc: nil, protocol: "6", vlanId: nil, id: nil, type: "OF", vlanPriority: nil, idleTimeout: nil, priority: nil, ingressPort: nil, tosBits: nil, name: nil, hardTimeout: nil, dlDst: nil, installInHW: "true", etherType: "0x800", actions: nil, cookie: nil, dlSrc: nil, nwSrc: nil, nwDst: nil, tpDst: nil, username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/opendaylight.rb', line 23

def self.makeflow(tpSrc: nil, protocol: "6", vlanId: nil, id: nil, type: "OF", vlanPriority: nil, idleTimeout: nil, priority: nil, ingressPort: nil, tosBits: nil, name: nil, hardTimeout: nil, dlDst: nil, installInHW: "true", etherType: "0x800", actions: nil, cookie: nil, dlSrc: nil, nwSrc: nil, nwDst: nil, tpDst: nil, username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
  auth = {username: username, password: password}
  options = {
    headers: {"Content-Type" => "application/json"},
    body: {
      "tpSrc" => tpSrc,
      "protocol" => protocol,
      "vlanId" => vlanId,
      "node" => {
        "id" => id,
        "type" => type
      },
      "vlanPriority" => vlanPriority,
      "idleTimeout" => idleTimeout,
      "priority" => priority,
      "ingressPort" => ingressPort,
      "tosBits" => tosBits,
      "name" => name,
      "hardTimeout" => hardTimeout,
      "dlDst" => dlDst,
      "installInHW" => installInHW,
      "etherType" => etherType,
      "actions" => [actions],
      "cookie" => cookie,
      "dlSrc" => dlSrc,
      "nwSrc" => nwSrc,
      "nwDst" => nwDst,
      "tpDst" => tpDst
      }.to_json,
    basic_auth: auth
  }
  HTTParty.put("#{url}controller/nb/v2/flowprogrammer/#{containerName}/node/#{type}/#{id}/staticFlow/#{name}",options)
end

.topology(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object



56
57
58
59
# File 'lib/opendaylight.rb', line 56

def self.topology(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
    auth = {username: username, password: password}
    HTTParty.get("#{url}controller/nb/v2/topology/#{containerName}", :basic_auth => auth)
end

Instance Method Details

#passwordObject



68
69
70
# File 'lib/opendaylight.rb', line 68

def password
  Opendaylight.configuration.password
end

#urlObject



72
73
74
# File 'lib/opendaylight.rb', line 72

def url
  Opendaylight.configuration.url
end

#usernameObject



64
65
66
# File 'lib/opendaylight.rb', line 64

def username
  Opendaylight.configuration.username
end