-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from agrare/add_host_switch_parser
Parse Switches for Streaming Refresh
- Loading branch information
Showing
6 changed files
with
258 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ls/manageiq/providers/vmware/infra_manager/inventory/parser/distributed_virtual_switch.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class ManageIQ::Providers::Vmware::InfraManager::Inventory::Parser | ||
module DistributedVirtualSwitch | ||
def parse_dvs_config(dvs_hash, config) | ||
return if config.nil? | ||
|
||
dvs_hash[:name] ||= CGI.unparse(config[:name]) if config[:name].present? | ||
dvs_hash[:ports] = config[:numPorts] || 0 | ||
dvs_hash[:switch_uuid] ||= config[:uuid] | ||
|
||
parse_dvs_security_policy(dvs_hash, config[:defaultPortConfig].securityPolicy) | ||
end | ||
|
||
def parse_dvs_summary(dvs_hash, summary) | ||
return if summary.nil? | ||
|
||
dvs_hash[:name] ||= CGI.unescape(summary[:name]) if summary[:name].present? | ||
dvs_hash[:switch_uuid] ||= summary[:uuid] | ||
end | ||
|
||
def parse_dvs_security_policy(dvs_hash, security_policy) | ||
return if security_policy.nil? | ||
|
||
dvs_hash[:allow_promiscuous] = security_policy.allowPromiscuous&.value | ||
dvs_hash[:forged_transmits] = security_policy.forgedTransmits&.value | ||
dvs_hash[:mac_changes] = security_policy.macChanges&.value | ||
end | ||
|
||
def parser_dvs_hosts(switch, props) | ||
hosts = props.fetch_path(:summary, :hostMember) | ||
return if hosts.nil? | ||
|
||
hosts.each do |host| | ||
persister.host_switches.build( | ||
:host => persister.hosts.lazy_find(host._ref), | ||
:switch => switch | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.