Class: Occi::Infrastructure::Networkinterface

Inherits:
Core::Link show all
Defined in:
lib/occi/infrastructure/networkinterface.rb,
lib/occi/infrastructure/networkinterface/ipnetworkinterface.rb

Defined Under Namespace

Modules: Ipnetworkinterface

Instance Attribute Summary

Attributes inherited from Core::Link

#rel, #source, #target

Attributes inherited from Core::Entity

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

Instance Method Summary collapse

Methods inherited from Core::Link

#as_json, #check, #initialize, #to_string, #to_text_link

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::Link

Instance Method Details

#addressObject


65
66
67
# File 'lib/occi/infrastructure/networkinterface.rb', line 65

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

#address=(address) ⇒ Object


69
70
71
72
73
74
75
# File 'lib/occi/infrastructure/networkinterface.rb', line 69

def address=(address)
  if @mixins.select { |mixin| mixin.kind_of? Occi::Infrastructure::Networkinterface::Ipnetworkinterface }.empty?
    Occi::Log.info 'Adding mixin IP network interface'
    @mixins << Occi::Infrastructure::Networkinterface::Ipnetworkinterface.new
  end
  @attributes.occi!.networkinterface!.address = address
end

#allocationObject


89
90
91
# File 'lib/occi/infrastructure/networkinterface.rb', line 89

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

#allocation=(allocation) ⇒ Object


93
94
95
96
97
98
99
# File 'lib/occi/infrastructure/networkinterface.rb', line 93

def allocation=(allocation)
  if @mixins.select { |mixin| mixin.kind_of? Occi::Infrastructure::Networkinterface::Ipnetworkinterface }.empty?
    Occi::Log.info 'Adding mixin IP network interface'
    @mixins << Occi::Infrastructure::Networkinterface::Ipnetworkinterface.new
  end
  @attributes.occi!.networkinterface!.allocation = allocation
end

#gatewayObject


77
78
79
# File 'lib/occi/infrastructure/networkinterface.rb', line 77

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

#gateway=(gateway) ⇒ Object


81
82
83
84
85
86
87
# File 'lib/occi/infrastructure/networkinterface.rb', line 81

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

#interfaceObject


41
42
43
# File 'lib/occi/infrastructure/networkinterface.rb', line 41

def interface
  @attributes.occi.networkinterface.interface if @attributes.occi.networkinterface if @attributes.occi
end

#interface=(interface) ⇒ Object


45
46
47
# File 'lib/occi/infrastructure/networkinterface.rb', line 45

def interface=(interface)
  @attributes.occi!.networkinterface!.interface = interface
end

#ipnetworkinterface(boolean = true) ⇒ Object


33
34
35
36
37
38
39
# File 'lib/occi/infrastructure/networkinterface.rb', line 33

def ipnetworkinterface(boolean=true)
  if boolean
    @mixins << Occi::Infrastructure::Networkinterface::Ipnetworkinterface.type_identifier
  else
    mixins.delete Occi::Infrastructure::Networkinterface::Ipnetworkinterface.type_identifier
  end
end

#macObject


49
50
51
# File 'lib/occi/infrastructure/networkinterface.rb', line 49

def mac
  @attributes.occi.networkinterface.mac if @attributes.occi.networkinterface if @attributes.occi
end

#mac=(mac) ⇒ Object


53
54
55
# File 'lib/occi/infrastructure/networkinterface.rb', line 53

def mac=(mac)
  @attributes.occi!.networkinterface!.mac = mac
end

#stateObject


57
58
59
# File 'lib/occi/infrastructure/networkinterface.rb', line 57

def state
  @attributes.occi.networkinterface.state if @attributes.occi.networkinterface if @attributes.occi
end

#state=(state) ⇒ Object


61
62
63
# File 'lib/occi/infrastructure/networkinterface.rb', line 61

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