provider

package
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package provider gives access to the provider Neutron plugin, allowing network extended attributes. The provider extended attributes for networks enable administrative users to specify how network objects map to the underlying networking infrastructure. These extended attributes also appear when administrative users query networks.

For more information about extended attributes, see the NetworkExtAttrs struct. The actual semantics of these attributes depend on the technology back end of the particular plug-in. See the plug-in documentation and the OpenStack Cloud Administrator Guide to understand which values should be specific for each of these attributes when OpenStack Networking is deployed with a particular plug-in. The examples shown in this chapter refer to the Open vSwitch plug-in.

The default policy settings enable only users with administrative rights to specify these parameters in requests and to see their values in responses. By default, the provider network extension attributes are completely hidden from regular tenants. As a rule of thumb, if these attributes are not visible in a GET /networks/<network-id> operation, this implies the user submitting the request is not authorized to view or manipulate provider network attributes.

Example to List Networks with Provider Information

type NetworkWithProvider {
	networks.Network
	provider.NetworkProviderExt
}

var allNetworks []NetworkWithProvider

allPages, err := networks.List(networkClient, nil).AllPages()
if err != nil {
	panic(err)
}

err = networks.ExtractNetworksInto(allPages, &allNetworks)
if err != nil {
	panic(err)
}

for _, network := range allNetworks {
	fmt.Printf("%+v\n", network)
}

Example to Create a Provider Network

segments := []provider.Segment{
	provider.Segment{
		NetworkType:     "vxlan",
		PhysicalNetwork: "br-ex",
		SegmentationID:  615,
	},
}

iTrue := true
networkCreateOpts := networks.CreateOpts{
	Name:         "provider-network",
	AdminStateUp: &iTrue,
	Shared:       &iTrue,
}

createOpts : provider.CreateOptsExt{
	CreateOptsBuilder: networkCreateOpts,
	Segments:          segments,
}

network, err := networks.Create(networkClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptsExt

type CreateOptsExt struct {
	networks.CreateOptsBuilder
	Segments []Segment `json:"segments,omitempty"`
}

CreateOptsExt adds a Segments option to the base Network CreateOpts.

func (CreateOptsExt) ToNetworkCreateMap

func (opts CreateOptsExt) ToNetworkCreateMap() (map[string]interface{}, error)

ToNetworkCreateMap adds segments to the base network creation options.

type NetworkProviderExt

type NetworkProviderExt struct {
	// Specifies the nature of the physical network mapped to this network
	// resource. Examples are flat, vlan, or gre.
	NetworkType string `json:"provider:network_type"`

	// Identifies the physical network on top of which this network object is
	// being implemented. The OpenStack Networking API does not expose any
	// facility for retrieving the list of available physical networks. As an
	// example, in the Open vSwitch plug-in this is a symbolic name which is
	// then mapped to specific bridges on each compute host through the Open
	// vSwitch plug-in configuration file.
	PhysicalNetwork string `json:"provider:physical_network"`

	// Identifies an isolated segment on the physical network; the nature of the
	// segment depends on the segmentation model defined by network_type. For
	// instance, if network_type is vlan, then this is a vlan identifier;
	// otherwise, if network_type is gre, then this will be a gre key.
	SegmentationID string `json:"-"`

	// Segments is an array of Segment which defines multiple physical bindings
	// to logical networks.
	Segments []Segment `json:"segments"`
}

NetworkProviderExt represents an extended form of a Network with additional fields.

func (*NetworkProviderExt) UnmarshalJSON

func (r *NetworkProviderExt) UnmarshalJSON(b []byte) error

type Segment

type Segment struct {
	PhysicalNetwork string `json:"provider:physical_network"`
	NetworkType     string `json:"provider:network_type"`
	SegmentationID  int    `json:"provider:segmentation_id"`
}

Segment defines a physical binding to a logical network.

Directories

Path Synopsis
provider unit tests
provider unit tests

Jump to

Keyboard shortcuts

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