mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
0c34ca84f5
Added support for OpenStack Network Connectivity (Quantum).
63 lines
No EOL
2.1 KiB
Ruby
63 lines
No EOL
2.1 KiB
Ruby
Shindo.tests('Fog::Network[:openstack] | port requests', ['openstack']) do
|
|
|
|
@port_format = {
|
|
'id' => String,
|
|
'name' => String,
|
|
'network_id' => String,
|
|
'fixed_ips' => Array,
|
|
'mac_address' => String,
|
|
'status' => String,
|
|
'admin_state_up' => Fog::Boolean,
|
|
'device_owner' => String,
|
|
'device_id' => String,
|
|
'tenant_id' => String,
|
|
}
|
|
|
|
tests('success') do
|
|
tests('#create_port').formats({'port' => @port_format}) do
|
|
network_id = 'net_id'
|
|
attributes = {:name => 'port_name', :fixed_ips => [],
|
|
:mac_address => 'fa:16:3e:62:91:7f', :admin_state_up => true,
|
|
:device_owner => 'device_owner', :device_id => 'device_id',
|
|
:tenant_id => 'tenant_id'}
|
|
Fog::Network[:openstack].create_port(network_id, attributes).body
|
|
end
|
|
|
|
tests('#list_port').formats({'ports' => [@port_format]}) do
|
|
Fog::Network[:openstack].list_ports.body
|
|
end
|
|
|
|
tests('#get_port').formats({'port' => @port_format}) do
|
|
port_id = Fog::Network[:openstack].ports.all.first.id
|
|
Fog::Network[:openstack].get_port(port_id).body
|
|
end
|
|
|
|
tests('#update_port').formats({'port' => @port_format}) do
|
|
port_id = Fog::Network[:openstack].ports.all.first.id
|
|
attributes = {:name => 'port_name', :fixed_ips => [],
|
|
:admin_state_up => true, :device_owner => 'device_owner',
|
|
:device_id => 'device_id'}
|
|
Fog::Network[:openstack].update_port(port_id, attributes).body
|
|
end
|
|
|
|
tests('#delete_port').succeeds do
|
|
port_id = Fog::Network[:openstack].ports.all.first.id
|
|
Fog::Network[:openstack].delete_port(port_id)
|
|
end
|
|
end
|
|
|
|
tests('failure') do
|
|
tests('#get_port').raises(Fog::Network::OpenStack::NotFound) do
|
|
Fog::Network[:openstack].get_port(0)
|
|
end
|
|
|
|
tests('#update_port').raises(Fog::Network::OpenStack::NotFound) do
|
|
Fog::Network[:openstack].update_port(0, {})
|
|
end
|
|
|
|
tests('#delete_port').raises(Fog::Network::OpenStack::NotFound) do
|
|
Fog::Network[:openstack].delete_port(0)
|
|
end
|
|
end
|
|
|
|
end |