Class: Megam::Mixins::CommonDeployable

Inherits:
Object
  • Object
show all
Includes:
Nilavu::MegamAttributes
Defined in:
lib/megam/mixins/common_deployable.rb

Constant Summary collapse

DEFAULT_TOSCA_PREFIX =
'tosca'.freeze
DEFAULT_TOSCA_SUFFIX =

this is a mutable string, if nothing exists then we use ubuntu

'ubuntu'.freeze
ATTRIBUTES =
[
:assemblyname,
:componentname,
:tosca_type,
:status,
:inputs]

Constants included from Nilavu::MegamAttributes

Nilavu::MegamAttributes::KEY, Nilavu::MegamAttributes::VALUE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Nilavu::MegamAttributes

#set_attributes

Constructor Details

#initialize(params) ⇒ CommonDeployable

Returns a new instance of CommonDeployable.



23
24
25
26
27
28
29
30
# File 'lib/megam/mixins/common_deployable.rb', line 23

def initialize(params)
  @assemblyname = ""
  @tosca_type = ""
  @status = "launching"
	bld_toscatype(params)
  @inputs = InputGroupData.new(params)
  set_attributes(params)
end

Instance Attribute Details

#assemblynameObject (readonly)

Returns the value of attribute assemblyname.



7
8
9
# File 'lib/megam/mixins/common_deployable.rb', line 7

def assemblyname
  @assemblyname
end

#componentnameObject (readonly)

Returns the value of attribute componentname.



7
8
9
# File 'lib/megam/mixins/common_deployable.rb', line 7

def componentname
  @componentname
end

#inputsObject (readonly)

Returns the value of attribute inputs.



7
8
9
# File 'lib/megam/mixins/common_deployable.rb', line 7

def inputs
  @inputs
end

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/megam/mixins/common_deployable.rb', line 7

def status
  @status
end

#tosca_typeObject (readonly)

Returns the value of attribute tosca_type.



7
8
9
# File 'lib/megam/mixins/common_deployable.rb', line 7

def tosca_type
  @tosca_type
end

Instance Method Details

#attributesObject



20
21
22
# File 'lib/megam/mixins/common_deployable.rb', line 20

def attributes
	ATTRIBUTES
end

#bld_toscatype(mkp) ⇒ Object



42
43
44
45
46
# File 'lib/megam/mixins/common_deployable.rb', line 42

def bld_toscatype(mkp)
  tosca_suffix = DEFAULT_TOSCA_SUFFIX
  tosca_suffix = "#{mkp[:mkp_name]}" unless mkp[:cattype] != 'TORPEDO'.freeze
  @tosca_type = DEFAULT_TOSCA_PREFIX + ".#{mkp[:cattype].downcase}.#{mkp[:mkp_name].downcase}"
end

#to_hashObject



33
34
35
36
37
38
39
40
# File 'lib/megam/mixins/common_deployable.rb', line 33

def to_hash
  h = {
    :name => assemblyname,
    :status => status,
    :tosca_type => tosca_type,
    :inputs => inputs.to_hash  
  }
end