neutron

package
v2.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const SelfIPDeviceOwner = "network:f5selfip"

SelfIPDeviceOwner is the device_owner used for default-mode per-F5-device SelfIP/SNAT ports.

View Source
const SnatPortDeviceOwner = "network:f5snat"

SnatPortDeviceOwner is the device_owner used for service-scoped SNAT pool ports. Distinct from SelfIPDeviceOwner so listing/cleanup never crosses the two.

Variables

This section is empty.

Functions

This section is empty.

Types

type NeutronClient

type NeutronClient struct {
	*gophercloud.ServiceClient
	// contains filtered or unexported fields
}

func ConnectToNeutron

func ConnectToNeutron(providerClient *gophercloud.ProviderClient) (*NeutronClient, error)

func (*NeutronClient) AllocateNeutronEndpointPort

func (n *NeutronClient) AllocateNeutronEndpointPort(ctx context.Context, target *models.EndpointTarget, endpoint *models.Endpoint,
	projectID string, host string, client *gophercloud.ServiceClient) (*ports.Port, error)

func (*NeutronClient) CleanupServiceSnatPorts

func (n *NeutronClient) CleanupServiceSnatPorts(ctx context.Context, serviceID strfmt.UUID) error

CleanupServiceSnatPorts deletes every SNAT port owned by the given service. Idempotent. Used by the agent's PENDING_DELETE cleanup branch.

func (*NeutronClient) DeletePort

func (n *NeutronClient) DeletePort(ctx context.Context, portId string) error

func (*NeutronClient) EnsureNeutronSelfIPs

func (n *NeutronClient) EnsureNeutronSelfIPs(ctx context.Context, deviceIDs []string, subnetID string, dryRun bool) (map[string]*ports.Port, error)

EnsureNeutronSelfIPs ensures one SelfIP port exists per deviceID on the given subnet. dryRun=true skips creation but still returns the matching subset. Existing extras are not deleted (legacy behavior — cleanup happens through CleanupSelfIPs).

func (*NeutronClient) EnsureServiceSnatPorts

func (n *NeutronClient) EnsureServiceSnatPorts(
	ctx context.Context,
	serviceID strfmt.UUID,
	subnetID string,
	count int,
	dryRun bool,
) (map[string]*ports.Port, error)

EnsureServiceSnatPorts ensures `count` service-scoped SNAT ports exist on subnetID for the given service. Existing ports are matched by name (scoped via device_id) regardless of their current binding:host_id, so a service migrated to this agent has its ports rebound rather than duplicated. Stale ports outside the desired set are deleted. Returns ports keyed by "snat-<index>". dryRun=true returns the matching subset without mutating Neutron.

func (*NeutronClient) FetchSelfIPPorts

func (n *NeutronClient) FetchSelfIPPorts(ctx context.Context) (map[string][]*ports.Port, error)

FetchSelfIPPorts lists every SelfIP port bound to this agent's host, grouped by network ID.

func (*NeutronClient) FetchSnatPorts

func (n *NeutronClient) FetchSnatPorts(ctx context.Context) ([]*ports.Port, error)

FetchSnatPorts lists every SNAT pool port bound to this agent's host. Returns a flat slice (not grouped) because the orphan signal for SNAT ports is per-service (device_id) rather than per-segment.

func (*NeutronClient) GetMask

func (n *NeutronClient) GetMask(ctx context.Context, subnetID string) (int, error)

func (*NeutronClient) GetNetwork

func (n *NeutronClient) GetNetwork(ctx context.Context, networkID string) (*NetworkMTU, error)

func (*NeutronClient) GetNetworkMTU

func (n *NeutronClient) GetNetworkMTU(ctx context.Context, networkID string) (int, error)

GetNetworkMTU returns the MTU of the network throws ErrNoPhysNetFound if the physical network is not found

func (*NeutronClient) GetNetworkSegment

func (n *NeutronClient) GetNetworkSegment(ctx context.Context, networkID, physnet string) (int, error)

GetNetworkSegment return the segmentation ID for the given network throws ErrNoPhysNetFound if the physical network is not found

func (*NeutronClient) GetPort

func (n *NeutronClient) GetPort(ctx context.Context, portId string) (*ports.Port, error)

func (*NeutronClient) GetSubnet

func (n *NeutronClient) GetSubnet(ctx context.Context, subnetID string) (*subnets.Subnet, error)

func (*NeutronClient) GetSubnetSegment

func (n *NeutronClient) GetSubnetSegment(ctx context.Context, subnetID, physnet string) (int, error)

func (*NeutronClient) InitCache

func (n *NeutronClient) InitCache()

func (*NeutronClient) ListPorts

func (n *NeutronClient) ListPorts(ctx context.Context, opts ports.ListOpts, hostID string) ([]PortWithBinding, error)

ListPorts returns ports matching opts (with hostID applied as binding:host_id when non-empty) along with their binding extension, served from a 10-minute LRU when possible. The cache key includes the full set of filters; mutations elsewhere call invalidatePortCache to drop stale entries. When InitCache hasn't been called the cache is bypassed.

func (*NeutronClient) RemoveFromCache

func (n *NeutronClient) RemoveFromCache(id string)

func (*NeutronClient) ResetCache

func (n *NeutronClient) ResetCache()

func (*NeutronClient) UpdatePortBinding

func (n *NeutronClient) UpdatePortBinding(ctx context.Context, portID, hostID string) error

UpdatePortBinding updates the binding:host_id of a Neutron port. Used after a service has been migrated to a different host so the port follows the workload.

type PortListOpts

type PortListOpts struct {
	IDs []string
}

PortListOpts builds a ports.ListOptsBuilder that filters by a set of port IDs (multiple id= query parameters), useful for fetching a known batch in one round trip.

func (PortListOpts) ToPortListQuery

func (opts PortListOpts) ToPortListQuery() (string, error)

type PortListOptsExt

type PortListOptsExt struct {
	ports.ListOptsBuilder

	// The ID of the host where the port is allocated
	HostID string
}

PortListOptsExt adds the PortBinding options to the base port ListOpts.

func (PortListOptsExt) ToPortListQuery

func (opts PortListOptsExt) ToPortListQuery() (string, error)

ToPortListQuery adds the PortBinding options to the base port list options.

type PortWithBinding

type PortWithBinding struct {
	ports.Port
	portsbinding.PortsBindingExt
}

PortWithBinding pairs a Neutron port with its binding extension. Use it (with ports.ExtractPortsInto) to read binding:host_id alongside the rest of the port — needed when callers want to skip a no-op rebind.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL