Class: SampleBase Abstract

Inherits:
Object
  • Object
show all
Defined in:
/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb

Overview

This class is abstract.

Sample base class.

Direct Known Subclasses

ConnectionWorkflow, SelfTestSample, TaggingWorkflow

Constant Summary

LOG_LEVELS =
[:INFO, :DEBUG, :WARN]

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (SampleBase) initialize(title, description, use_supporters = true, multiple_mgmt_node = false)

Constructs a new instance.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 45

def initialize(title, description,
               use_supporters=true, multiple_mgmt_node=false)
    raise 'Sample title is required' if title.nil?
    raise 'Sample description is required' if description.nil?
    @title = title
    @description = description
    @use_supporters = use_supporters
    @multiple_mgmt_node = multiple_mgmt_node

    init_logging()
    init_options()

    # The following two configurations are used when the sample uses a
    # single management node, which is the case for most of our samples.
    # When a sample uses multiple management nodes, the sample has to deal
    # with the management nodes service managers at the sample level.
    @mgmt_node_id = nil
    @mgmt_node_name = nil
    @mgmt_node_index = 0
end

Instance Attribute Details

- (Object) description (readonly)

ctor args



35
36
37
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 35

def description
  @description
end

- (Object) log (readonly)

common aspects



38
39
40
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 38

def log
  @log
end

- (Object) ls_ip

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def ls_ip
  @ls_ip
end

- (Object) ls_url

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def ls_url
  @ls_url
end

- (Object) mgmt_node_id

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def mgmt_node_id
  @mgmt_node_id
end

- (Object) mgmt_node_index

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def mgmt_node_index
  @mgmt_node_index
end

- (Object) mgmt_node_name

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def mgmt_node_name
  @mgmt_node_name
end

- (Object) multiple_mgmt_node (readonly)

ctor args



35
36
37
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 35

def multiple_mgmt_node
  @multiple_mgmt_node
end

- (Object) option_parser (readonly)

common aspects



38
39
40
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 38

def option_parser
  @option_parser
end

- (Object) options (readonly)

common aspects



38
39
40
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 38

def options
  @options
end

- (Object) sso_password

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def sso_password
  @sso_password
end

- (Object) sso_username

sample config properties



41
42
43
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 41

def sso_username
  @sso_username
end

- (Object) title (readonly)

ctor args



35
36
37
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 35

def title
  @title
end

- (Object) use_supporters (readonly)

ctor args



35
36
37
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 35

def use_supporters
  @use_supporters
end

Instance Method Details

- (Object) main

The main entry point for samples, which executes in a conventional pattern: Call parse_options(), call before(), call run(), then call after(). All of these methods are meant to be fixed implementations as well. However, the specific samples have opportunities to customize each step by implementing the following methods:


    inject_options()
    check_options()
    setup()
    execute()
    cleanup()


76
77
78
79
80
81
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/sample_base.rb', line 76

def main
    parse_options()
    before()
    run()
    after()
end