Class: Opendaylight::API
- Inherits:
-
Object
- Object
- Opendaylight::API
- Defined in:
- lib/opendaylight.rb
Class Method Summary collapse
- .build_options(tpSrc: nil, protocol: nil, vlanId: nil, id: nil, type: "OF", vlanPriority: nil, idleTimeout: nil, priority: "500", 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
- .deleteflow(**params) ⇒ Object
- .hostTracker(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object
- .listFlows(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object
- .makeflow(**params) ⇒ Object
- .nodes(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", id: nil) ⇒ Object
- .statistics(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", stats: "flow") ⇒ Object
- .topology(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object
Class Method Details
.build_options(tpSrc: nil, protocol: nil, vlanId: nil, id: nil, type: "OF", vlanPriority: nil, idleTimeout: nil, priority: "500", 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
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/opendaylight.rb', line 63 def (tpSrc: nil, protocol: nil, vlanId: nil, id: nil, type: "OF", vlanPriority: nil, idleTimeout: nil, priority: "500", 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} = { url: url, containerName: containerName, type: type, id: id, name: name, request: { 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" => , "dlSrc" => dlSrc, "nwSrc" => nwSrc, "nwDst" => nwDst, "tpDst" => tpDst }.to_json, basic_auth: auth } } end |
.deleteflow(**params) ⇒ Object
29 30 31 32 |
# File 'lib/opendaylight.rb', line 29 def deleteflow(**params) = (params) HTTParty.delete("#{[:url]}controller/nb/v2/flowprogrammer/#{[:containerName]}/node/#{[:type]}/#{[:id]}/staticFlow/#{[:name]}",[:request]) end |
.hostTracker(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object
39 40 41 42 |
# File 'lib/opendaylight.rb', line 39 def 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 |
.listFlows(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object
44 45 46 47 |
# File 'lib/opendaylight.rb', line 44 def listFlows(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/flowprogrammer/#{containerName}", basic_auth: auth) end |
.makeflow(**params) ⇒ Object
24 25 26 27 |
# File 'lib/opendaylight.rb', line 24 def makeflow(**params) = (params) HTTParty.put("#{[:url]}controller/nb/v2/flowprogrammer/#{[:containerName]}/node/#{[:type]}/#{[:id]}/staticFlow/#{[:name]}",[:request]) end |
.nodes(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", id: nil) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/opendaylight.rb', line 54 def nodes(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", id: nil) auth = {username: username, password: password} if id.nil? HTTParty.get("#{url}controller/nb/v2/switchmanager/#{containerName}/nodes", basic_auth: auth) else HTTParty.get("#{url}controller/nb/v2/switchmanager/#{containerName}/node/OF/#{id}", basic_auth: auth) end end |
.statistics(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", stats: "flow") ⇒ Object
49 50 51 52 |
# File 'lib/opendaylight.rb', line 49 def statistics(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", stats: "flow") auth = {username: username, password: password} HTTParty.get("#{url}controller/nb/v2/statistics/#{containerName}/#{stats}", basic_auth: auth) end |
.topology(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default") ⇒ Object
34 35 36 37 |
# File 'lib/opendaylight.rb', line 34 def 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 |