Class: Trema::DSL::Configuration

Inherits:
Object
  • Object
show all
Defined in:
ruby/trema/dsl/configuration.rb

Overview

The current configuration of Trema.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Creates a new Trema configuration

Examples:

config = Trema::DSL::Configuration.new


99
100
101
102
103
104
105
106
107
108
# File 'ruby/trema/dsl/configuration.rb', line 99

def initialize
  @port = 6633
  @apps = Trema::App.clear
  @hosts = Trema::Host.clear
  @links = Trema::Link.clear
  @packetin_filter = Trema::PacketinFilter.clear
  @switch_manager = Trema::SwitchManager.clear
  @switches = Trema::OpenflowSwitch.clear
  @netnss = Trema::Netns.clear
end

Instance Attribute Details

#appsHash (readonly)

the hash of App

Examples:

p config.apps
#=> {"trema tetris"=>#<Trema::App:0xb73c9328>, ...}

Returns:

  • (Hash)


52
53
54
# File 'ruby/trema/dsl/configuration.rb', line 52

def apps
  @apps
end

#hostsHash (readonly)

the hash of Host

Examples:

p config.hosts
#=> {"host #0"=>#<Trema::Host:0xb73c9328>, ...}

Returns:

  • (Hash)


63
64
65
# File 'ruby/trema/dsl/configuration.rb', line 63

def hosts
  @hosts
end

the hash of Link

Examples:

p config.links
#=> {"link #0"=>#<Trema::Link:0xb73c9328>, ...}

Returns:

  • (Hash)


74
75
76
# File 'ruby/trema/dsl/configuration.rb', line 74

def links
  @links
end

#netnssObject (readonly)

Returns the value of attribute netnss.



88
89
90
# File 'ruby/trema/dsl/configuration.rb', line 88

def netnss
  @netnss
end

#portNumber

set/get the port number for switch manager to listen to

Examples:

config.port = 5432

Returns:

  • (Number)


41
42
43
# File 'ruby/trema/dsl/configuration.rb', line 41

def port
  @port
end

#switchesHash (readonly)

the hash of Switch

Examples:

p config.switches
#=> {"switch #0"=>#<Trema::OpenflowSwitch:0xb73c9328>, ...}

Returns:

  • (Hash)


85
86
87
# File 'ruby/trema/dsl/configuration.rb', line 85

def switches
  @switches
end

Instance Method Details

#packetin_filterPacketinFilter

Returns PacketinFilter configuration

Examples:

config.packetin_filter => #<Trema::PacketinFilter:0xb73c9328>

Returns:



119
120
121
# File 'ruby/trema/dsl/configuration.rb', line 119

def packetin_filter
  @packetin_filter.values.last
end

#switch_managerSwitchManager

Returns SwitchManager configuration

Examples:

config.switch_manager => #<Trema::SwitchManager:0xb73c9328>

Returns:



132
133
134
# File 'ruby/trema/dsl/configuration.rb', line 132

def switch_manager
  @switch_manager.values.last
end