Sha256: f9cc0cca1a47f5fa823414db4fe54d19a7387c1b5c10106705373b8b9d8fe622

Contents?: true

Size: 1.37 KB

Versions: 21

Compression:

Stored size: 1.37 KB

Contents

module Fog
  module Network
    class OpenStack
      class Real
        def get_port(port_id)
          request(
            :expects => [200],
            :method  => 'GET',
            :path    => "ports/#{port_id}"
          )
        end
      end

      class Mock
        def get_port(port_id)
          response = Excon::Response.new
          if data = self.data[:ports][port_id]
            response.status = 200
            response.body = {
              'port' => {
                'id' => '5c81d975-5fea-4674-9c1f-b8aa10bf9a79',
                'name' => 'port_1',
                'network_id' => 'e624a36d-762b-481f-9b50-4154ceb78bbb',
                'fixed_ips' => [
                  {
                    'ip_address' => '10.2.2.2',
                    'subnet_id' => '2e4ec6a4-0150-47f5-8523-e899ac03026e',
                  }
                ],
                'mac_address' => 'fa:16:3e:62:91:7f',
                'status' => 'ACTIVE',
                'admin_state_up' => true,
                'device_id' => 'dhcp724fc160-2b2e-597e-b9ed-7f65313cd73f-e624a36d-762b-481f-9b50-4154ceb78bbb',
                'device_owner' => 'network:dhcp',
                'tenant_id' => 'f8b26a6032bc47718a7702233ac708b9',
              }
            }
            response
          else
            raise Fog::Network::OpenStack::NotFound
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
fog-1.31.0 lib/fog/openstack/requests/network/get_port.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/openstack/requests/network/get_port.rb
fog-1.30.0 lib/fog/openstack/requests/network/get_port.rb
fog-1.29.0 lib/fog/openstack/requests/network/get_port.rb
fog-1.28.0 lib/fog/openstack/requests/network/get_port.rb
fog-1.27.0 lib/fog/openstack/requests/network/get_port.rb
fog-1.26.0 lib/fog/openstack/requests/network/get_port.rb
fog-1.25.0 lib/fog/openstack/requests/network/get_port.rb
nsidc-fog-1.24.1 lib/fog/openstack/requests/network/get_port.rb
fog-1.24.0 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.11 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.10 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.9 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.8 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.7 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.6 lib/fog/openstack/requests/network/get_port.rb
fog-1.23.0 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.4 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.3 lib/fog/openstack/requests/network/get_port.rb
ns-fog-1.22.2 lib/fog/openstack/requests/network/get_port.rb