class Topologygenerator

Constants

LIST_PROVIDERS_IMPLEMENTED
VERSION

Attributes

output_builder[R]
topology_provider[R]

Public Class Methods

new(arguments) click to toggle source
# File lib/topologygenerator.rb, line 15
def initialize(arguments)
  validate arguments
  @arguments = arguments

  case @arguments['source']
      when 'ONOS'
          @topology_provider = OnosTopologyProvider.new @arguments['uri_resource']
      when 'OPENDAYLIGHT'
          @topology_provider = OpendaylightTopologyProvider.new @arguments['uri_resource']
      when 'CUSTOM'
          @topology_provider = CustomTopologyProvider.new @arguments['uri_resource']
      when 'OBJECT'
          @topology_provider = ObjectTopologyProvider.new @arguments['uri_resource']
  end
end

Public Instance Methods

generate() click to toggle source
# File lib/topologygenerator.rb, line 31
def generate
  output_builder = OutputBuilder.new @topology_provider, @arguments['directory_concrete_builders'], @arguments['output_directory']
  output_builder.build_output    
end
validate(arguments) click to toggle source
# File lib/topologygenerator.rb, line 36
def validate(arguments)
  raise ArgumentError, 'No arguments received' unless arguments
  ["source","directory_concrete_builders","output_directory", "uri_resource"].each do |argument_name|
    raise ArgumentError, "It is mandatory that arguments has a #{argument_name}" unless arguments.key? argument_name
  end

  raise ArgumentError, "The source: #{arguments['source']} is not one of the expected" unless LIST_PROVIDERS_IMPLEMENTED.include? arguments['source']
end