topologygenerator 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +75 -2
- data/images/topologygenerator.png +0 -0
- data/lib/createTopology.rb +20 -4
- data/lib/topologygenerator.rb +8 -7
- data/lib/topologygenerator/version.rb +1 -1
- data/topologygenerator.gemspec +4 -4
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d250f12524f93774240d4b5fca2ad128efd821d
|
4
|
+
data.tar.gz: 58b14cb23e6186552fbb5c28e2eeda1f3529e015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77be69a01a75a271b1051364542efcac286864348aebfc0a901d7a4628336c25b55b899beea34d2d79db7eb2bc3161da7094943ed47a0f5ed39b834df7a40c9e
|
7
|
+
data.tar.gz: 8f8d5217a2a02f28220046ae952f3b8471cf592ed6851332e256836a15d0e81ae0014b37f34e14d1cfb74331874a35abde2eecdf0d7acb08f49e4038f623a911
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## What is this gem for?
|
2
|
+
|
3
|
+
This gem was designed for the SDN enviorment. The idea of this gem is to obtain from a specified provider a network topology representation, and eventually some additional properties of the network which will be used to build a custom output.
|
4
|
+
Right now the gem supports two providers:
|
5
|
+
|
6
|
+
1. ONOS SDN Controller( http://onosproject.org/ ): This will obtain the network using the Rest API.
|
7
|
+
2. Custom Topology: This provider allows to define a custom network using ruby, and check properties on the specified network.
|
8
|
+
|
9
|
+
This is an image that explains the above explanation.
|
10
|
+
|
11
|
+

|
12
|
+
|
13
|
+
As you can see, the idea is to get the network topology from a provider, and build an output using the builders implemented. The builders and providers are supposed to be implemented by users, however some examples are provided to help the development.
|
14
|
+
|
15
|
+
TODO: Add OpenDayLight Controller as provider.
|
16
|
+
|
17
|
+
## Example of use
|
18
|
+
|
19
|
+
### Case 1
|
20
|
+
Suppose that you have a network that uses SDN. You can use this gem to obtain the network topology representation from the controller, and generate a graph model from this network to check some logic properties. See Providers Examples - Controller and Builders Examples - Ruby Builder for more information.
|
21
|
+
|
22
|
+
### Case 2
|
23
|
+
Suppose that you are designing your network, and you want to check if the designed network fulfills some properties, for example that the delay from one host is less that 0.02s . You can use this gem to describe your desired network in ruby, and generate an output for a network simulator to check the desired properties. See Providers Examples - Custom and Builders Examples - PowerDevs Builder for more information.
|
24
|
+
|
25
|
+
## Who uses this gem?
|
26
|
+
|
27
|
+
This gem is used by the Haikunet programming language for getting the initial topology and perform the semantic checker analysis. For more information of Haikunet, you can check the following link:
|
28
|
+
|
29
|
+
https://github.com/andyLaurito92/tesis/tree/master/haikunet
|
30
|
+
|
1
31
|
## Installation
|
2
32
|
|
3
33
|
Add this line to your application's Gemfile:
|
@@ -16,7 +46,50 @@ Or install it yourself as:
|
|
16
46
|
|
17
47
|
## Usage
|
18
48
|
|
19
|
-
For using the topologygenerator gem, you will need to write your builder, and specify the uri from where the initial topology information will be get.
|
49
|
+
For using the topologygenerator gem, you will need to write your output builder, and specify the uri from where the initial topology information will be get.
|
50
|
+
The use of the topology generator is as follow:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
my_topology_generator = TopologyGenerator.new({
|
54
|
+
"source" => "name_of_my_provider", #Actually ONOS and CUSTOM are the options supported
|
55
|
+
"directory_concrete_builders" => "my_directory", #The directory where to locate the output builders
|
56
|
+
"output_directory" => "my_output_directory", #The directory where the output will be saved
|
57
|
+
"uri_resource" => "path_to_source" #Must be the rest api uri if ONOS is choosed or the path of a file if CUSTOM is choosed.
|
58
|
+
})
|
59
|
+
my_custom_topology = topology_generator.generate
|
60
|
+
```
|
61
|
+
|
62
|
+
Suppose that you want to use the tree topology network example located at network_topologies_examples, and you want to use the PowerDevs builder located at builders_examples of this repository. This is how you would do this:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
my_topology_generator = Topologygenerator.new({
|
66
|
+
"source" => "CUSTOM",
|
67
|
+
"directory_concrete_builders" => "builders_examples/pdm_builders",
|
68
|
+
"output_directory" => "output",
|
69
|
+
"uri_resource" => "network_topologies_examples/tree_topology.rb"
|
70
|
+
})
|
71
|
+
my_custom_topology = topology_generator.generate
|
72
|
+
```
|
73
|
+
|
74
|
+
Now, if you want to use a ONOS controller running in your local host, and use the Ruby builder, this is what you have to do:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
my_topology_generator = Topologygenerator.new({
|
78
|
+
"source" => "ONOS",
|
79
|
+
"directory_concrete_builders" => "builders_examples/ruby_builders",
|
80
|
+
"output_directory" => "output",
|
81
|
+
"uri_resource" => "http://127.0.0.1:8181/onos/v1/docs/"
|
82
|
+
})
|
83
|
+
my_custom_topology = topology_generator.generate
|
84
|
+
```
|
85
|
+
|
86
|
+
If you need help to program either your provider or your builder, check the Providers Examples or Builders Examples for more information.
|
87
|
+
|
88
|
+
You can also use the topologygenerator as an executable throw the createTopology.rb script. For using the topologygenerator as an executable, you have to use it like this:
|
89
|
+
|
90
|
+
createTopology.rb source -n NAME_OF_SOURCE -o OUTPUT_DIRECTORY -u URI_RESOURCE -d CONCRETE_BUILDERS_DIRECTORY
|
91
|
+
|
92
|
+
Where each of the options is the same as detailed above.
|
20
93
|
|
21
94
|
## Development
|
22
95
|
|
@@ -26,7 +99,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
26
99
|
|
27
100
|
## Contributing
|
28
101
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
102
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andyLaurito92/topologygenerator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
30
103
|
|
31
104
|
|
32
105
|
## License
|
Binary file
|
data/lib/createTopology.rb
CHANGED
@@ -2,9 +2,25 @@
|
|
2
2
|
|
3
3
|
require_relative 'command_line/command_line_arguments.rb'
|
4
4
|
require_relative "./topology_generator.rb"
|
5
|
+
require 'colorize'
|
5
6
|
|
6
|
-
|
7
|
-
my_command_line_arguments.
|
7
|
+
begin
|
8
|
+
my_command_line_arguments = CommandLineArguments.new
|
9
|
+
my_command_line_arguments.run
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
+
raise ArgumentError, 'No arguments received' unless arguments
|
12
|
+
[:source,:directory_concrete_builders,:output_directory, :uri_resource].each do |argument_name|
|
13
|
+
raise ArgumentError, "It is mandatory that arguments has a #{argument_name}" unless arguments.key? argument_name
|
14
|
+
end
|
15
|
+
|
16
|
+
topo_gen = topologygenerator.new({
|
17
|
+
"source" => my_command_line_arguments.source
|
18
|
+
"directory_concrete_builders" => my_command_line_arguments.directory_concrete_builders,
|
19
|
+
"output_directory" => my_command_line_arguments.output_directory,
|
20
|
+
"uri_resource" => my_command_line_arguments.uri_resource
|
21
|
+
})
|
22
|
+
topo_gen.generate
|
23
|
+
rescue Exception => ex
|
24
|
+
puts "#{ex.class}".red
|
25
|
+
puts "#{ex.message}".blue
|
26
|
+
end
|
data/lib/topologygenerator.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative "topologygenerator/version"
|
|
2
2
|
require_relative 'providers/apis/onos_topology_provider.rb'
|
3
3
|
require_relative 'providers/customs/custom_topology_provider.rb'
|
4
4
|
require_relative 'output_builder.rb'
|
5
|
+
require 'byebug'
|
5
6
|
|
6
7
|
"Main class that reads a topology from a source provider and writes it using a builder"
|
7
8
|
class Topologygenerator
|
@@ -10,25 +11,25 @@ class Topologygenerator
|
|
10
11
|
validate arguments
|
11
12
|
@arguments = arguments
|
12
13
|
|
13
|
-
case @arguments
|
14
|
+
case @arguments['source']
|
14
15
|
when 'ONOS'
|
15
|
-
@topology_provider = OnosTopologyProvider.new @arguments
|
16
|
+
@topology_provider = OnosTopologyProvider.new @arguments['uri_resource']
|
16
17
|
when 'CUSTOM'
|
17
|
-
@topology_provider = CustomTopologyProvider.new @arguments
|
18
|
+
@topology_provider = CustomTopologyProvider.new @arguments['uri_resource']
|
18
19
|
else
|
19
|
-
raise ArgumentError, "The source: #{@arguments
|
20
|
+
raise ArgumentError, "The source: #{@arguments['source']} is not one of the expected"
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
24
|
def generate
|
24
|
-
output_builder = OutputBuilder.new @topology_provider, @arguments
|
25
|
+
output_builder = OutputBuilder.new @topology_provider, @arguments['directory_concrete_builders'], @arguments['output_directory']
|
25
26
|
output_builder.build_output
|
26
27
|
end
|
27
28
|
|
28
29
|
def validate(arguments)
|
29
30
|
raise ArgumentError, 'No arguments received' unless arguments
|
30
|
-
[
|
31
|
-
raise ArgumentError, "It is mandatory that arguments has a #{argument_name}" unless arguments.
|
31
|
+
["source","directory_concrete_builders","output_directory", "uri_resource"].each do |argument_name|
|
32
|
+
raise ArgumentError, "It is mandatory that arguments has a #{argument_name}" unless arguments.key? argument_name
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
data/topologygenerator.gemspec
CHANGED
@@ -11,17 +11,17 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ["Andrés Laurito"]
|
12
12
|
spec.email = ["andy.laurito@gmail.com"]
|
13
13
|
|
14
|
-
spec.summary = %q{Build a topology from a source provider and
|
14
|
+
spec.summary = %q{Build a topology from a source provider and generates an output using a custom builder.}
|
15
15
|
spec.description = %q{The topologygenerator gem is a tool for building from a network topology a custom output.
|
16
16
|
This network topology can be obtained from a custom file written in ruby by the user, or
|
17
17
|
by a SDN controller specifying the API uri (actually ONOS is support, and we are working
|
18
18
|
for OpenDayLight support).
|
19
|
-
|
19
|
+
When building your builder output, you have to write for each class defined in the network topology
|
20
20
|
a module that describes how to build this class. The topologygenerator gem will then use this
|
21
21
|
module's defined to generate the output desired.
|
22
|
-
You can see examples of use in
|
22
|
+
You can see examples of how to use this gem in the public github webpage.
|
23
23
|
}
|
24
|
-
spec.homepage = "https://github.com/andyLaurito92"
|
24
|
+
spec.homepage = "https://github.com/andyLaurito92/topologygenerator"
|
25
25
|
spec.license = "MIT"
|
26
26
|
|
27
27
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: topologygenerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrés Laurito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,12 +84,12 @@ description: "The topologygenerator gem is a tool for building from a network to
|
|
84
84
|
a custom output. \n This network topology can be obtained
|
85
85
|
from a custom file written in ruby by the user, or \n by
|
86
86
|
a SDN controller specifying the API uri (actually ONOS is support, and we are working
|
87
|
-
\n for OpenDayLight support).\n
|
88
|
-
|
89
|
-
topology
|
90
|
-
|
87
|
+
\n for OpenDayLight support).\n When
|
88
|
+
building your builder output, you have to write for each class defined in the network
|
89
|
+
topology \n a module that describes how to build this class.
|
90
|
+
The topologygenerator gem will then use this \n module's
|
91
91
|
defined to generate the output desired.\n You can see examples
|
92
|
-
of use in
|
92
|
+
of how to use this gem in the public github webpage.\n "
|
93
93
|
email:
|
94
94
|
- andy.laurito@gmail.com
|
95
95
|
executables: []
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- Rakefile
|
107
107
|
- bin/console
|
108
108
|
- bin/setup
|
109
|
+
- images/topologygenerator.png
|
109
110
|
- lib/behaviors/serialize_behavior.rb
|
110
111
|
- lib/builders_examples/pdm_builders/PhaseI/Flow_concrete_builder.rb
|
111
112
|
- lib/builders_examples/pdm_builders/PhaseI/Host_concrete_builder.rb
|
@@ -161,7 +162,7 @@ files:
|
|
161
162
|
- lib/topologygenerator/version.rb
|
162
163
|
- lib/utils/custom_files_utils.rb
|
163
164
|
- topologygenerator.gemspec
|
164
|
-
homepage: https://github.com/andyLaurito92
|
165
|
+
homepage: https://github.com/andyLaurito92/topologygenerator
|
165
166
|
licenses:
|
166
167
|
- MIT
|
167
168
|
metadata: {}
|
@@ -184,5 +185,6 @@ rubyforge_project:
|
|
184
185
|
rubygems_version: 2.5.1
|
185
186
|
signing_key:
|
186
187
|
specification_version: 4
|
187
|
-
summary: Build a topology from a source provider and
|
188
|
+
summary: Build a topology from a source provider and generates an output using a custom
|
189
|
+
builder.
|
188
190
|
test_files: []
|