Class: Net
- Inherits:
-
Object
- Object
- Net
- Defined in:
- lib/parse_dhcp/net.rb
Instance Attribute Summary collapse
-
#differ ⇒ Object
Returns the value of attribute differ.
-
#netmask ⇒ Object
Returns the value of attribute netmask.
-
#option ⇒ Object
Returns the value of attribute option.
-
#pool ⇒ Object
Returns the value of attribute pool.
-
#subnet ⇒ Object
Returns the value of attribute subnet.
Instance Method Summary collapse
-
#initialize ⇒ Net
constructor
A new instance of Net.
- #test ⇒ Object
Constructor Details
#initialize ⇒ Net
Returns a new instance of Net.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/parse_dhcp/net.rb', line 8 def initialize @subnet = "" @netmask = "" @option = {} @differ = {} @pool = { "range" => "", "allow" => "", "denny" => "", "hosts" => [] } end |
Instance Attribute Details
#differ ⇒ Object
Returns the value of attribute differ.
6 7 8 |
# File 'lib/parse_dhcp/net.rb', line 6 def differ @differ end |
#netmask ⇒ Object
Returns the value of attribute netmask.
6 7 8 |
# File 'lib/parse_dhcp/net.rb', line 6 def netmask @netmask end |
#option ⇒ Object
Returns the value of attribute option.
6 7 8 |
# File 'lib/parse_dhcp/net.rb', line 6 def option @option end |
#pool ⇒ Object
Returns the value of attribute pool.
6 7 8 |
# File 'lib/parse_dhcp/net.rb', line 6 def pool @pool end |
#subnet ⇒ Object
Returns the value of attribute subnet.
6 7 8 |
# File 'lib/parse_dhcp/net.rb', line 6 def subnet @subnet end |
Instance Method Details
#test ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/parse_dhcp/net.rb', line 20 def test net1 = Net.new net2 = Net.new # Set subnet net1.subnet = "192.168.1.0" net1.netmask = "255.255.255.0" # Set option net1.option["routers"] = "192.168.1.1" net1.option["subnet-mask"] = "255.255.255.0" net1.option["broadcast-address"] = "192.168.1.255" net1.option["domain-name-servers"] = "194.168.4.100" net1.differ["authoritative"] = "true" net1.differ["default-lease-time"] = "2" net1.differ['max-lease-time'] = "86400" # Set pool net1.pool["range"] = { "min" => "192.168.25.20", "max" => "192.168.25.200" } net1.pool["allow"] = "unknown-clients" net1.pool["hosts"] << Host.new("bla1", "DD:GH:DF:E5:F7:D7", "192.168.1.2") net1.pool["hosts"] << Host.new("bla2", "00:JJ:YU:38:AC:45", "192.168.1.20") # Set subnet net2.subnet = "192.168.1.0" net2.netmask = "255.255.255.0" # Set option net2.option["routers"] = "192.168.1.1" net2.option["subnet-mask"] = "255.255.255.0" net2.option["broadcast-address"] = "192.168.1.255" net2.option["domain-name-servers"] = "194.168.4.100" net2.differ["default-lease-time"] = "2" net2.differ['max-lease-time'] = "86400" # Set pool net2.pool["range"] = { "min" => "192.168.25.20", "max" => "192.168.25.200" } net2.pool["denny"] = "unknown-clients" net2.pool["hosts"] << Host.new("bla1", "DD:GH:DF:E5:F7:D7", "192.168.1.2") net2.pool["hosts"] << Host.new("bla2", "00:JJ:YU:38:AC:45", "192.168.1.20") return [net1,net2] end |