Class: Occi::Infrastructure::Network

Inherits:
Core::Resource show all
Defined in:
lib/occi/infrastructure/network.rb,
lib/occi/infrastructure/network/ipnetwork.rb

Defined Under Namespace

Modules: Ipnetwork

Instance Attribute Summary

Attributes inherited from Core::Resource

#links

Attributes inherited from Core::Entity

#actions, #attributes, #id, #kind, #location, #mixins, #model

Instance Method Summary collapse

Methods inherited from Core::Resource

#as_json, #initialize, #link, #model=, #summary, #summary=, #to_header, #to_text

Methods inherited from Core::Entity

#as_json, check, #check, #initialize, new, #title, #title=, #to_header, #to_s, #to_text, type_identifier

Methods included from Helpers::Inspect

#inspect

Constructor Details

This class inherits a constructor from Occi::Core::Resource

Instance Method Details

#addressObject

IPNetwork Mixin attributes


69
70
71
# File 'lib/occi/infrastructure/network.rb', line 69

def address
  @attributes.occi.network.address if @attributes.occi.network if @attributes.occi
end

#address=(address) ⇒ Object


73
74
75
76
77
78
79
# File 'lib/occi/infrastructure/network.rb', line 73

def address=(address)
  if @mixins.select { |mixin| mixin.kind_of? Occi::Infrastructure::Network::Ipnetwork }.empty?
    Occi::Log.info 'Adding mixin IPNetwork mixin'
    @mixins << Occi::Infrastructure::Network::Ipnetwork.new
  end
  @attributes.occi!.network!.address = address
end

#allocationObject


93
94
95
# File 'lib/occi/infrastructure/network.rb', line 93

def allocation
  @attributes.occi.network.allocation if @attributes.occi.network if @attributes.occi
end

#allocation=(allocation) ⇒ Object


97
98
99
100
101
102
103
# File 'lib/occi/infrastructure/network.rb', line 97

def allocation=(allocation)
  if @mixins.select { |mixin| mixin.kind_of? Occi::Infrastructure::Network::Ipnetwork }.empty?
    Occi::Log.info 'Adding mixin IPNetwork mixin'
    @mixins << Occi::Infrastructure::Network::Ipnetwork.new
  end
  @attributes.occi!.network!.allocation = allocation
end

#gatewayObject


81
82
83
# File 'lib/occi/infrastructure/network.rb', line 81

def gateway
  @attributes.occi.network.gateway if @attributes.occi.network if @attributes.occi
end

#gateway=(gateway) ⇒ Object


85
86
87
88
89
90
91
# File 'lib/occi/infrastructure/network.rb', line 85

def gateway=(gateway)
  if @mixins.select { |mixin| mixin.kind_of? Occi::Infrastructure::Network::Ipnetwork }.empty?
    Occi::Log.info 'Adding mixin IP network'
    @mixins << Occi::Infrastructure::Network::Ipnetwork.new
  end
  @attributes.occi!.network!.gateway = gateway
end

#ipnetwork(boolean = true) ⇒ Object


35
36
37
38
39
40
41
# File 'lib/occi/infrastructure/network.rb', line 35

def ipnetwork(boolean=true)
  if boolean
    mixins << Occi::Infrastructure::Network::Ipnetwork.mixin.type_identifier
  else
    mixins.delete Occi::Infrastructure::Network::Ipnetwork.mixin.type_identifier
  end
end

#labelObject


51
52
53
# File 'lib/occi/infrastructure/network.rb', line 51

def label
  @attributes.occi.nework.label if @attributes.occi.network if @attributes.occi
end

#label=(label) ⇒ Object


55
56
57
# File 'lib/occi/infrastructure/network.rb', line 55

def label=(label)
  @attributes.occi!.network!.label = label
end

#stateObject


59
60
61
# File 'lib/occi/infrastructure/network.rb', line 59

def state
  @attributes.occi.nework.state if @attributes.occi.network if @attributes.occi
end

#state=(state) ⇒ Object


63
64
65
# File 'lib/occi/infrastructure/network.rb', line 63

def state=(state)
  @attributes.occi!.network!.state = state
end

#vlanObject


43
44
45
# File 'lib/occi/infrastructure/network.rb', line 43

def vlan
  @attributes.occi.nework.vlan if @attributes.occi.network if @attributes.occi
end

#vlan=(vlan) ⇒ Object


47
48
49
# File 'lib/occi/infrastructure/network.rb', line 47

def vlan=(vlan)
  @attributes.occi!.network!.vlan = vlan
end