[vcloud|compute] improve network

* Add tests for multiple networks
* Add ProviderInfo field
* Add tests for configuration details
This commit is contained in:
Peter Meier 2011-10-17 17:46:06 +02:00
parent 9b7339156b
commit 734c94f9f9
4 changed files with 31 additions and 0 deletions

View File

@ -11,6 +11,7 @@ module Fog
attribute :description, :aliases => :Description attribute :description, :aliases => :Description
attribute :configuration, :aliases => :Configuration attribute :configuration, :aliases => :Configuration
attribute :provider_info, :aliases => :ProviderInfo
attribute :links, :aliases => :Link, :type => :array attribute :links, :aliases => :Link, :type => :array

View File

@ -127,6 +127,13 @@
<MACAddress>00:50:56:01:02:03</MACAddress> <MACAddress>00:50:56:01:02:03</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode> <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection> </NetworkConnection>
<NetworkConnection network="Network2">
<NetworkConnectionIndex>1</NetworkConnectionIndex>
<IpAddress>192.168.3.102</IpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:04</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/"/> <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/"/>
</NetworkConnectionSection> </NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/" ovf:required="false"> <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/" ovf:required="false">

View File

@ -18,7 +18,26 @@ Shindo.tests("Vcloud::Compute | network", ['vcloud']) do
tests("configuration") do tests("configuration") do
tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]} tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]}
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]} tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
tests("#fence_mode").returns("natRouted") { instance.configuration[:FenceMode] }
tests("features") do
tests("dhcp_service") do
tests("#is_enabled").returns("false") { instance.configuration[:Features][:DhcpService][:IsEnabled] }
tests("ip_range") do
tests("#start_address").returns("192.168.0.151") { instance.configuration[:Features][:DhcpService][:IpRange][:StartAddress] }
end
end
tests("firewall_server") do
tests("is_enabled").returns("true"){ instance.configuration[:Features][:FirewallService][:IsEnabled] }
end
tests("nat_service") do
tests("is_enabled").returns("false"){ instance.configuration[:Features][:NatService][:IsEnabled] }
end
end
end end
tests("features")
end end
tests("an external network") do tests("an external network") do
@ -31,6 +50,7 @@ Shindo.tests("Vcloud::Compute | network", ['vcloud']) do
tests("#href").returns("https://vcloud.example.com/api/v1.0/admin/network/2") { instance.href } tests("#href").returns("https://vcloud.example.com/api/v1.0/admin/network/2") { instance.href }
tests("#name").returns("ParentNetwork1") { instance.name } tests("#name").returns("ParentNetwork1") { instance.name }
tests("#description").returns("Internet Connection") { instance.description } tests("#description").returns("Internet Connection") { instance.description }
tests("#provider_info").returns("NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555") { instance.provider_info }
tests("configuration") do tests("configuration") do
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]} tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}

View File

@ -38,6 +38,9 @@ Shindo.tests("Vcloud::Compute | server", ['vcloud']) do
tests("#on?").returns(false) { instance.on? } tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? } tests("#off?").returns(true) { instance.off? }
tests("#network_connections") do
tests("#size").returns(2) { instance.network_connections.size }
end
#old tests #old tests
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do