Class: CloudstackSpec::Resource::VpcTier
- Defined in:
- lib/cloudstack_spec/resource/vpc_tier.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #created? ⇒ Boolean
- #destroy? ⇒ Boolean
- #exist? ⇒ Boolean
-
#initialize(name = 'tier11', zonename = nil) ⇒ VpcTier
constructor
A new instance of VpcTier.
Methods inherited from Base
#get_zone, #inspect, #job_status?, #to_ary, #to_s
Constructor Details
#initialize(name = 'tier11', zonename = nil) ⇒ VpcTier
Returns a new instance of VpcTier.
5 6 7 8 9 10 |
# File 'lib/cloudstack_spec/resource/vpc_tier.rb', line 5 def initialize(name='tier11', zonename=nil) @name = name @connection = CloudstackSpec::Helper::Api.new.connection @zone = get_zone(zonename) @runner = Specinfra::Runner end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/cloudstack_spec/resource/vpc_tier.rb', line 3 def name @name end |
Instance Method Details
#created? ⇒ Boolean
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cloudstack_spec/resource/vpc_tier.rb', line 24 def created? unless self.exist? @connection.create_network( :name => @name, :displaytext => @name, :networkofferingid => get_offering_id, :zoneid => @zone['id'], :vpcid => $vpc['id'], :gateway => '10.10.0.1', :netmask => '255.255.255.0', :aclid => get_acl_id ) else print " already exist" return true #return false end end |
#destroy? ⇒ Boolean
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/cloudstack_spec/resource/vpc_tier.rb', line 43 def destroy? if self.exist? sleep(5) job = @connection.delete_network(id: get_tier['id']) job_status?(job['jobid']) else puts " Does not exist" return false end end |
#exist? ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cloudstack_spec/resource/vpc_tier.rb', line 12 def exist? begin if !get_tier.empty? return true else return false end rescue Exception => e return false end end |