opendaylight 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f44cd9094f7a592beaf63267991fff549ca6bb3a
4
- data.tar.gz: b2d79e707881276d4058441a69888d29160c86f1
3
+ metadata.gz: 14e0b3d76e3c585cf331d04943bbbb08f09bcdf8
4
+ data.tar.gz: 57c1cca1a743f733e7dc90b9809c80c0acc3a44b
5
5
  SHA512:
6
- metadata.gz: eabd13d50d3e6798b5eb569ecc134f3c2eb16d055d8f5a690a2a04b8c286d50d3c6e9c1591c9ab38317d3c8aa8e73220afebbf766120061745b7fa26626fd07b
7
- data.tar.gz: 52b661dab62f61abc1ee4515941feb2b1ccffb0083ced955b14a08a7a9aaeb0775559e17fa95b85811e609682edf0a7f7604d878cf134b1b1d9a45d20ca3145d
6
+ metadata.gz: 47ff984ccb589125e575a77b0bbc8bf6581fcef146a1cf0020251e6e899a975b2e8c677cd14b157478f74fd6be7648a9ab7ec4dc4b3181e78ac69d5ac29cbd1d
7
+ data.tar.gz: 25cc2ee49647f940c81fae52d651e2a356e1069d1dd2c9692981ed68864f87f42e58fb5be3c0cc746c30450030e0c5669801669500ae3332d55f6998452d800c
@@ -4,101 +4,101 @@ require "httparty"
4
4
  module Opendaylight
5
5
  class Configuration
6
6
  attr_accessor :username, :password, :url
7
- def initialize
8
- username = nil
9
- password = nil
10
- url = nil
11
- end
12
7
  end
13
8
 
14
9
  class << self
15
10
  attr_accessor :configuration
16
- end
17
11
 
18
- def self.configure
19
- self.configuration ||= Configuration.new
20
- yield(configuration) if block_given?
12
+ def configure
13
+ self.configuration ||= Configuration.new
14
+ yield(configuration) if block_given?
15
+ end
16
+
21
17
  end
22
18
 
23
19
  class API
24
20
 
25
- def self.makeflow **params
26
- options = build_options params
27
- HTTParty.put("#{options[:url]}controller/nb/v2/flowprogrammer/#{options[:containerName]}/node/#{options[:type]}/#{options[:id]}/staticFlow/#{options[:name]}",options[:request])
28
- end
21
+ class << self
29
22
 
30
- def self.deleteflow **params
31
- options = build_options params
32
- HTTParty.delete("#{options[:url]}controller/nb/v2/flowprogrammer/#{options[:containerName]}/node/#{options[:type]}/#{options[:id]}/staticFlow/#{options[:name]}",options[:request])
33
- end
23
+ def makeflow(**params)
24
+ options = build_options(params)
25
+ HTTParty.put("#{options[:url]}controller/nb/v2/flowprogrammer/#{options[:containerName]}/node/#{options[:type]}/#{options[:id]}/staticFlow/#{options[:name]}",options[:request])
26
+ end
27
+
28
+ def deleteflow(**params)
29
+ options = build_options(params)
30
+ HTTParty.delete("#{options[:url]}controller/nb/v2/flowprogrammer/#{options[:containerName]}/node/#{options[:type]}/#{options[:id]}/staticFlow/#{options[:name]}",options[:request])
31
+ end
34
32
 
35
- def self.topology(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
33
+ def topology(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
36
34
  auth = {username: username, password: password}
37
35
  HTTParty.get("#{url}controller/nb/v2/topology/#{containerName}", basic_auth: auth)
38
- end
36
+ end
39
37
 
40
- def self.hostTracker(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
38
+ def hostTracker(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
41
39
  auth = {username: username, password: password}
42
40
  HTTParty.get("#{url}controller/nb/v2/hosttracker/#{containerName}/hosts/active", basic_auth: auth)
43
- end
41
+ end
44
42
 
45
- def self.listFlows(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
43
+ def listFlows(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default")
46
44
  auth = {username: username, password: password}
47
45
  HTTParty.get("#{url}controller/nb/v2/flowprogrammer/#{containerName}", basic_auth: auth)
48
- end
46
+ end
49
47
 
50
- def self.statistics(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", stats: "flow")
51
- auth = {username: username, password: password}
52
- HTTParty.get("#{url}controller/nb/v2/statistics/#{containerName}/#{stats}", basic_auth: auth)
53
- end
48
+ def statistics(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", stats: "flow")
49
+ auth = {username: username, password: password}
50
+ HTTParty.get("#{url}controller/nb/v2/statistics/#{containerName}/#{stats}", basic_auth: auth)
51
+ end
54
52
 
55
- def self.nodes(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", id: nil)
56
- auth = {username: username, password: password}
57
- if id.nil?
58
- HTTParty.get("#{url}controller/nb/v2/switchmanager/#{containerName}/nodes", basic_auth: auth)
59
- else
60
- HTTParty.get("#{url}controller/nb/v2/switchmanager/#{containerName}/node/OF/#{id}", basic_auth: auth)
53
+ def nodes(username: Opendaylight.configuration.username, password: Opendaylight.configuration.password, url: Opendaylight.configuration.url, containerName: "default", id: nil)
54
+ auth = {username: username, password: password}
55
+ if id.nil?
56
+ HTTParty.get("#{url}controller/nb/v2/switchmanager/#{containerName}/nodes", basic_auth: auth)
57
+ else
58
+ HTTParty.get("#{url}controller/nb/v2/switchmanager/#{containerName}/node/OF/#{id}", basic_auth: auth)
59
+ end
60
+ end
61
+
62
+ def 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")
63
+ auth = {username: username, password: password}
64
+ options = { url: url,
65
+ containerName: containerName,
66
+ type: type,
67
+ id: id,
68
+ name: name,
69
+ request: { headers: {"Content-Type" => "application/json"},
70
+ body: {
71
+ "tpSrc" => tpSrc,
72
+ "protocol" => protocol,
73
+ "vlanId" => vlanId,
74
+ "node" => {
75
+ "id" => id,
76
+ "type" => type
77
+ },
78
+ "vlanPriority" => vlanPriority,
79
+ "idleTimeout" => idleTimeout,
80
+ "priority" => priority,
81
+ "ingressPort" => ingressPort,
82
+ "tosBits" => tosBits,
83
+ "name" => name,
84
+ "hardTimeout" => hardTimeout,
85
+ "dlDst" => dlDst,
86
+ "installInHW" => installInHW,
87
+ "etherType" => etherType,
88
+ "actions" => [actions],
89
+ "cookie" => cookie,
90
+ "dlSrc" => dlSrc,
91
+ "nwSrc" => nwSrc,
92
+ "nwDst" => nwDst,
93
+ "tpDst" => tpDst
94
+ }.to_json,
95
+ basic_auth: auth
96
+ } }
61
97
  end
62
- end
63
98
 
64
- def self.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")
65
- auth = {username: username, password: password}
66
- options = { url: url,
67
- containerName: containerName,
68
- type: type,
69
- id: id,
70
- name: name,
71
- request: { headers: {"Content-Type" => "application/json"},
72
- body: {
73
- "tpSrc" => tpSrc,
74
- "protocol" => protocol,
75
- "vlanId" => vlanId,
76
- "node" => {
77
- "id" => id,
78
- "type" => type
79
- },
80
- "vlanPriority" => vlanPriority,
81
- "idleTimeout" => idleTimeout,
82
- "priority" => priority,
83
- "ingressPort" => ingressPort,
84
- "tosBits" => tosBits,
85
- "name" => name,
86
- "hardTimeout" => hardTimeout,
87
- "dlDst" => dlDst,
88
- "installInHW" => installInHW,
89
- "etherType" => etherType,
90
- "actions" => [actions],
91
- "cookie" => cookie,
92
- "dlSrc" => dlSrc,
93
- "nwSrc" => nwSrc,
94
- "nwDst" => nwDst,
95
- "tpDst" => tpDst
96
- }.to_json,
97
- basic_auth: auth
98
- } }
99
99
  end
100
100
 
101
- Opendaylight.configure
101
+ Opendaylight.configure
102
102
 
103
103
  end
104
104
 
@@ -1,3 +1,3 @@
1
1
  module Opendaylight
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opendaylight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - rickpr