Class: Vnic

Inherits:
Object
  • Object
show all
Defined in:
lib/rbvppc/vnic.rb

Overview

Authors: Christopher M Wood (<[email protected]>) John F Hutchinson (<[email protected]) © Copyright IBM Corporation 2015.

LICENSE: MIT (opensource.org/licenses/MIT)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(virtual_slot_num, is_ieee, vlan_id, additional_vlan_ids, is_trunk, is_required) ⇒ Vnic

Returns a new instance of Vnic.

Raises:

  • (StandardError)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rbvppc/vnic.rb', line 13

def initialize(virtual_slot_num, is_ieee, vlan_id,
                 additional_vlan_ids, is_trunk, is_required)
    #Test for the explicitly required parameters
    raise StandardError.new("A vNIC cannot be defined without a virtual_slot_num") if virtual_slot_num.nil?
    raise StandardError.new("A vNIC cannot be defined without a vlan_id") if vlan_id.nil?        
    raise StandardError.new("A vNIC cannot be defined without specifying is_trunk") if is_trunk.nil?
    raise StandardError.new("A vNIC cannot be defined without specifying is_required") if is_required.nil?

    is_ieee     ||= 1
    is_trunk    ||= 0
    is_required ||= 1


    @virtual_slot_num    = virtual_slot_num.to_i
    @is_ieee             = is_ieee.to_i
    @vlan_id             = vlan_id.to_i
    @additional_vlan_ids = additional_vlan_ids
    @is_trunk            = is_trunk.to_i
    @is_required         = is_required.to_i      
end

Instance Attribute Details

#additional_vlan_idsObject

Returns the value of attribute additional_vlan_ids.



10
11
12
# File 'lib/rbvppc/vnic.rb', line 10

def additional_vlan_ids
  @additional_vlan_ids
end

#is_ieeeObject

Returns the value of attribute is_ieee.



10
11
12
# File 'lib/rbvppc/vnic.rb', line 10

def is_ieee
  @is_ieee
end

#is_requiredObject

Returns the value of attribute is_required.



10
11
12
# File 'lib/rbvppc/vnic.rb', line 10

def is_required
  @is_required
end

#is_trunkObject

Returns the value of attribute is_trunk.



10
11
12
# File 'lib/rbvppc/vnic.rb', line 10

def is_trunk
  @is_trunk
end

#virtual_slot_numObject

Returns the value of attribute virtual_slot_num.



10
11
12
# File 'lib/rbvppc/vnic.rb', line 10

def virtual_slot_num
  @virtual_slot_num
end

#vlan_idObject

Returns the value of attribute vlan_id.



10
11
12
# File 'lib/rbvppc/vnic.rb', line 10

def vlan_id
  @vlan_id
end