Class: Dcmgr::NodeModules::OpenFlowNetwork
- Inherits:
-
Object
- Object
- Dcmgr::NodeModules::OpenFlowNetwork
- Defined in:
- lib/dcmgr/node_modules/openflow_controller.rb
Instance Attribute Summary collapse
-
#dhcp_hw ⇒ Object
Returns the value of attribute dhcp_hw.
-
#dhcp_ip ⇒ Object
Returns the value of attribute dhcp_ip.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#ipv4_network ⇒ Object
Returns the value of attribute ipv4_network.
-
#local_ports ⇒ Object
readonly
Returns the value of attribute local_ports.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#virtual ⇒ Object
Returns the value of attribute virtual.
Instance Method Summary collapse
- #add_port(port, is_local) ⇒ Object
- #flood_flows ⇒ Object
- #flood_local_flows ⇒ Object
- #generate_flood_actions(template, use_ports) ⇒ Object
- #generate_flood_flows ⇒ Object
-
#initialize(id) ⇒ OpenFlowNetwork
constructor
A new instance of OpenFlowNetwork.
- #remove_port(port) ⇒ Object
Constructor Details
#initialize(id) ⇒ OpenFlowNetwork
Returns a new instance of OpenFlowNetwork.
736 737 738 739 740 741 742 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 736 def initialize id @id = id @ports = [] @local_ports = [] @virtual = false @prefix = 0 end |
Instance Attribute Details
#dhcp_hw ⇒ Object
Returns the value of attribute dhcp_hw.
731 732 733 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 731 def dhcp_hw @dhcp_hw end |
#dhcp_ip ⇒ Object
Returns the value of attribute dhcp_ip.
732 733 734 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 732 def dhcp_ip @dhcp_ip end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
727 728 729 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 727 def id @id end |
#ipv4_network ⇒ Object
Returns the value of attribute ipv4_network.
733 734 735 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 733 def ipv4_network @ipv4_network end |
#local_ports ⇒ Object (readonly)
Returns the value of attribute local_ports.
729 730 731 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 729 def local_ports @local_ports end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports.
728 729 730 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 728 def ports @ports end |
#prefix ⇒ Object
Returns the value of attribute prefix.
734 735 736 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 734 def prefix @prefix end |
#virtual ⇒ Object
Returns the value of attribute virtual.
730 731 732 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 730 def virtual @virtual end |
Instance Method Details
#add_port(port, is_local) ⇒ Object
744 745 746 747 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 744 def add_port port, is_local ports << port local_ports << port if is_local end |
#flood_flows ⇒ Object
773 774 775 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 773 def flood_flows @flood_flows ||= Array.new end |
#flood_local_flows ⇒ Object
777 778 779 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 777 def flood_local_flows @flood_local_flows ||= Array.new end |
#generate_flood_actions(template, use_ports) ⇒ Object
765 766 767 768 769 770 771 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 765 def generate_flood_actions template, use_ports actions = "" use_ports.each { |port| actions << ",#{template.gsub('<>', port.to_s)}" } actions end |
#generate_flood_flows ⇒ Object
754 755 756 757 758 759 760 761 762 763 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 754 def generate_flood_flows flows = [] flood_flows.each { |flow| flows << [flow[0], "#{flow[1]}#{generate_flood_actions(flow[2], ports)}#{flow[3]}"] } flood_local_flows.each { |flow| flows << [flow[0], "#{flow[1]}#{generate_flood_actions(flow[2], local_ports)}#{flow[3]}"] } flows end |
#remove_port(port) ⇒ Object
749 750 751 752 |
# File 'lib/dcmgr/node_modules/openflow_controller.rb', line 749 def remove_port port ports.delete port local_ports.delete port end |