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

Classes: Down, Ipnetworkinterface, Up

Instance Attribute Summary

Attributes inherited from Core::Link

#rel, #source, #target

Attributes inherited from Core::Entity

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

Class Method Summary collapse

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, #inspect, #location, new, #title, #title=, #to_header, #to_s, #to_text, type_identifier

Constructor Details

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

Class Method Details

.actionsObject



27
28
29
# File 'lib/occi/infrastructure/networkinterface.rb', line 27

def self.actions
  Occi::Core::Actions.new << Up.new << Down.new
end

.mixinsObject



7
8
9
# File 'lib/occi/infrastructure/networkinterface.rb', line 7

def self.mixins
  Occi::Core::Mixins.new << Occi::Infrastructure::Networkinterface::Ipnetworkinterface.new
end

Instance Method Details

#addressObject



86
87
88
# File 'lib/occi/infrastructure/networkinterface.rb', line 86

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

#address=(address) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/occi/infrastructure/networkinterface.rb', line 90

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



110
111
112
# File 'lib/occi/infrastructure/networkinterface.rb', line 110

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

#allocation=(allocation) ⇒ Object



114
115
116
117
118
119
120
# File 'lib/occi/infrastructure/networkinterface.rb', line 114

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



98
99
100
# File 'lib/occi/infrastructure/networkinterface.rb', line 98

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

#gateway=(gateway) ⇒ Object



102
103
104
105
106
107
108
# File 'lib/occi/infrastructure/networkinterface.rb', line 102

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



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

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

#interface=(interface) ⇒ Object



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

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

#ipnetworkinterface(boolean = true) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/occi/infrastructure/networkinterface.rb', line 54

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



70
71
72
# File 'lib/occi/infrastructure/networkinterface.rb', line 70

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

#mac=(mac) ⇒ Object



74
75
76
# File 'lib/occi/infrastructure/networkinterface.rb', line 74

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

#stateObject



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

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

#state=(state) ⇒ Object



82
83
84
# File 'lib/occi/infrastructure/networkinterface.rb', line 82

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