2012-09-20 18:24:19 -04:00
|
|
|
Shindo.tests("Fog::Network[:openstack] | network", ['openstack']) do
|
|
|
|
|
|
|
|
tests('success') do
|
2013-02-21 06:32:43 -05:00
|
|
|
|
2012-09-20 18:24:19 -04:00
|
|
|
tests('#create').succeeds do
|
|
|
|
@instance = Fog::Network[:openstack].networks.create(:name => 'net_name',
|
|
|
|
:shared => false,
|
|
|
|
:admin_state_up => true,
|
|
|
|
:tenant_id => 'tenant_id')
|
|
|
|
!@instance.id.nil?
|
|
|
|
end
|
2013-02-21 06:32:43 -05:00
|
|
|
|
2013-02-26 08:51:28 -05:00
|
|
|
tests('#create+extensions').succeeds do
|
|
|
|
net = Fog::Network[:openstack].networks.create(
|
|
|
|
:name => 'net_name',
|
|
|
|
:shared => false,
|
|
|
|
:admin_state_up => true,
|
|
|
|
:tenant_id => 'tenant_id',
|
|
|
|
:router_external => true,
|
|
|
|
# local, gre, vlan. Depends on the provider.
|
|
|
|
# May rise an exception if the network_type isn't valid:
|
|
|
|
# QuantumError: "Invalid input for operation: provider:physical_network"
|
|
|
|
:provider_network_type => 'gre',
|
2013-03-11 16:49:33 -04:00
|
|
|
:provider_segmentation_id => 22
|
2013-02-26 08:51:28 -05:00
|
|
|
)
|
|
|
|
net.destroy
|
|
|
|
net.provider_network_type == 'gre'
|
|
|
|
end
|
|
|
|
|
2013-02-21 06:32:43 -05:00
|
|
|
tests('have attributes') do
|
|
|
|
attributes = [
|
|
|
|
:name,
|
|
|
|
:subnets,
|
|
|
|
:shared,
|
|
|
|
:status,
|
|
|
|
:admin_state_up,
|
|
|
|
:tenant_id,
|
|
|
|
:provider_network_type,
|
|
|
|
:provider_physical_network,
|
|
|
|
:provider_segmentation_id,
|
|
|
|
:router_external
|
|
|
|
]
|
|
|
|
tests("The network model should respond to") do
|
|
|
|
attributes.each do |attribute|
|
|
|
|
test("#{attribute}") { @instance.respond_to? attribute }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-09-20 18:24:19 -04:00
|
|
|
|
|
|
|
tests('#update').succeeds do
|
|
|
|
@instance.name = 'new_net_name'
|
|
|
|
@instance.update
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#destroy').succeeds do
|
|
|
|
@instance.destroy == true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|