-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QSFP uplink & Integer ports support #230
Changes from 4 commits
e63097c
a6af8fb
b534038
9bf3ee3
5b02141
abe35b2
b71cbfe
075635c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,15 +40,24 @@ def add_network(network) | |
|
||
# Specify one uplink passing the virtual connect bay and the port to be attached. | ||
# @param [Fixnum] bay number to identify the VC | ||
# @param [String] port to attach the uplink. Allowed D1..D16 and X1..X10 | ||
def add_uplink(bay, port) | ||
# @param [String, Fixnum] port to attach the uplink. Examples: X1, D1, Q1, Q1.1, Q1:1, 67 ... | ||
# @param [String] interconnect model name | ||
# @param [Fixnum] enclosure number for multi-frame configurations | ||
def add_uplink(bay, port, type = nil, enclosure_index = 1) | ||
enclosure_index = !type.nil? && type.include?('Virtual Connect SE 16Gb FC Module') ? -1 : enclosure_index | ||
port = | ||
if type | ||
fetch_relative_value_of(port, type) | ||
else | ||
port.to_s == port.to_i.to_s ? port : relative_value_of(port) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the point of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tmiotto I've put it there to handle for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, it's fine as is! 😄 I would just add a comment explaining it, since it's not quite clear at first sight. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tmiotto cool. I've put there a comment. Also, such ports ( |
||
end | ||
entry = { | ||
'desiredSpeed' => 'Auto', | ||
'logicalLocation' => { | ||
'locationEntries' => [ | ||
{ 'relativeValue' => bay, 'type' => 'Bay' }, | ||
{ 'relativeValue' => 1, 'type' => 'Enclosure' }, | ||
{ 'relativeValue' => relative_value_of(port), 'type' => 'Port' } | ||
{ 'relativeValue' => enclosure_index, 'type' => 'Enclosure' }, | ||
{ 'relativeValue' => port, 'type' => 'Port' } | ||
] | ||
} | ||
} | ||
|
@@ -79,6 +88,18 @@ def relative_value_of(port) | |
end | ||
port.to_i + offset | ||
end | ||
|
||
def fetch_relative_value_of(port, type) | ||
port_formats = [port.sub('.', ':'), port.sub(':', '.')].uniq | ||
interconnect_type = OneviewSDK::Interconnect.get_type(@client, type) | ||
unless interconnect_type | ||
list = OneviewSDK::Interconnect.get_types(@client).map { |t| t['name'] } | ||
raise OneviewSDK::NotFound, "Interconnect type #{type} not found! Supported types: #{list}" | ||
end | ||
type_port = interconnect_type['portInfos'].find { |p| port_formats.include? p['portName'] } | ||
raise OneviewSDK::NotFound, "Port #{port} not found!" unless type_port | ||
type_port['portNumber'] | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!type.nil?
can be replaced in this clause bytype