Closed vranystepan closed 7 years ago
Or something like single method for all three resources?
def load_connection_template
if @context.associated_ethernet_network
resource_class_name = :EthernetNetwork
resource_name = @context.associated_ethernet_network
elsif @context.associated_fc_network
resource_class_name = :FcNetwork
resource_name = @context.associated_fc_network
elsif @context.associated_network_set
resource_class_name = :NetworkSet
resource_name = @context.associated_network_set
else
return
end
@item.data.delete('name')
res = resource_named(resource_class_name).find_by(@item.client, name: resource_name).first
@item['uri'] = res['connectionTemplateUri']
end
def create_or_update
load_connection_template
super
end
def reset
load_connection_template
@item['bandwidth'] = resource_named(:ConnectionTemplate).get_default(@item.client)['bandwidth']
create_or_update
end
It does seem like a reasonable enhancement @vranystepan .
I'm guessing FCoE networks will also require that, and to avoid adding lots of similar methods, I do like your load_connection_template
method.
Maybe I could suggest using the method load_resource
instead of resource_named
with find_by
?
If you'd like, please feel free to submit your code. :octocat:
@fgbulsoni Ok, will implement your suggestion & submit. I'll also add FCoE option. Thank you!
Related to #94
Description
I'm trying to configure Bandwidth parameter within the NetworkSet and FcNetwork. connection_template resource obviously supports EthernetNetwork only but connection_template can be configured at the three locations:
Ethernet Networks
,FC Networks
andNetwork Sets
Environment Details
Intent / Proposal
I suppose that additional methods would do the job. Something like:
and
and
and something similar for FC Networks.
Do you think it's reasonable enhancement?