1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vcloud_director] Add tests and connect up get_network_complete

This commit is contained in:
Mike Pountney 2014-02-18 11:08:35 +00:00
parent 6b99c003a1
commit 3f317d478e
3 changed files with 42 additions and 1 deletions

View file

@ -126,6 +126,7 @@ module Fog
request :get_metadata
request :get_network
request :get_network_cards_items_list
request :get_network_complete
request :get_network_config_section_vapp
request :get_network_config_section_vapp_template
request :get_network_connection_system_section_vapp

View file

@ -33,10 +33,14 @@ Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) d
@service.delete_network('00000000-0000-0000-0000-000000000000')
end
tests('Retrieve non-existent OrgNetwork').raises(Fog::Compute::VcloudDirector::Forbidden) do
tests('Retrieve non-existent OrgNetwork (get_network)').raises(Fog::Compute::VcloudDirector::Forbidden) do
@service.get_network('00000000-0000-0000-0000-000000000000')
end
tests('Retrieve non-existent OrgNetwork (get_network_complete)').raises(Fog::Compute::VcloudDirector::Forbidden) do
@service.get_network_complete('00000000-0000-0000-0000-000000000000')
end
tests('#get_network').data_matches_schema(GET_NETWORK_FORMAT) do
link = @org[:Link].detect do |l|
l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.orgNetwork+xml'
@ -46,6 +50,16 @@ Shindo.tests('Compute::VcloudDirector | network requests', ['vclouddirector']) d
@service.get_network(@network_id).body
end
tests('#get_network_complete').data_matches_schema(VcloudDirector::Compute::Schema::NETWORK_TYPE) do
pending if Fog.mocking?
link = @org[:Link].detect do |l|
l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.orgNetwork+xml'
end
pending unless link # nothing to test here cannot continue
@network_id = link[:href].split('/').last
@service.get_network_complete(@network_id).body
end
tests('#get_network_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do
pending if Fog.mocking?
pending unless @network_id # nothing to test here cannot continue

View file

@ -613,6 +613,32 @@ class VcloudDirector
:Network => [REFERENCE_TYPE]
}
NETWORK_CONFIGURATION_TYPE = {
:IpScopes => {
:IpScope => {
:IsInherited => String,
:Gateway => String,
:Netmask => String,
:Dns1 => String,
:Dns2 => String,
:IsEnabled=> String,
}
},
:FenceMode => String,
:RetainNetInfoAcrossDeployments => String,
}
NETWORK_TYPE = {
:name => String,
:href => String,
:type => String,
:status => String,
:id => String,
:Description => String,
:Configuration => NETWORK_CONFIGURATION_TYPE,
:IsShared => String,
}
VCLOUD_TYPE = ENTITY_TYPE.merge({
:OrganizationReferences => ORGANIZATION_REFERENCES_TYPE,
:ProviderVdcReferences => PROVIDER_VDC_REFERENCES_TYPE,