juju: github.com/juju/juju/apiserver/common/networkingcommon Index | Files

package networkingcommon

import "github.com/juju/juju/apiserver/common/networkingcommon"

Index

Package Files

networkconfigapi.go shims.go types.go

func BackingSubnetToParamsSubnet Uses

func BackingSubnetToParamsSubnet(subnet BackingSubnet) params.Subnet

func FanConfigResultToFanConfig Uses

func FanConfigResultToFanConfig(config params.FanConfigResult) (network.FanConfig, error)

func FanConfigToFanConfigResult Uses

func FanConfigToFanConfigResult(config network.FanConfig) params.FanConfigResult

func MachineNetworkInfoResultToNetworkInfoResult Uses

func MachineNetworkInfoResultToNetworkInfoResult(inResult state.MachineNetworkInfoResult) params.NetworkInfoResult

func MergeProviderAndObservedNetworkConfigs Uses

func MergeProviderAndObservedNetworkConfigs(
    providerConfigs, observedConfigs []params.NetworkConfig,
) []params.NetworkConfig

MergeProviderAndObservedNetworkConfigs returns the effective network configs, using observedConfigs as a base and selectively updating it using the matching providerConfigs for each interface.

func NetworkConfigFromInterfaceInfo Uses

func NetworkConfigFromInterfaceInfo(interfaceInfos []network.InterfaceInfo) []params.NetworkConfig

NetworkConfigFromInterfaceInfo converts a slice of network.InterfaceInfo into the equivalent params.NetworkConfig slice.

func NetworkConfigsToStateArgs Uses

func NetworkConfigsToStateArgs(networkConfig []params.NetworkConfig) (
    []state.LinkLayerDeviceArgs,
    []state.LinkLayerDeviceAddress,
)

NetworkConfigsToStateArgs splits the given networkConfig into a slice of state.LinkLayerDeviceArgs and a slice of state.LinkLayerDeviceAddress. The input is expected to come from MergeProviderAndObservedNetworkConfigs and to be sorted.

func NetworkingEnvironFromModelConfig Uses

func NetworkingEnvironFromModelConfig(configGetter environs.EnvironConfigGetter) (environs.NetworkingEnviron, error)

NetworkingEnvironFromModelConfig constructs and returns environs.NetworkingEnviron using the given configGetter. Returns an error satisfying errors.IsNotSupported() if the model config does not support networking features.

func NewSpaceShim Uses

func NewSpaceShim(sp *state.Space) *spaceShim

NewSpaceShim creates new subnet shim to be used by subnets and spaces Facades.

func NewSubnetShim Uses

func NewSubnetShim(sub *state.Subnet) *subnetShim

NewSubnetShim creates new subnet shim to be used by subnets and spaces Facades.

type BackingSpace Uses

type BackingSpace interface {
    // ID returns the ID of the space.
    Id() string

    // Name returns the space name.
    Name() string

    // Subnets returns the subnets in the space
    Subnets() ([]BackingSubnet, error)

    // ProviderId returns the network ID of the provider
    ProviderId() corenetwork.Id
}

BackingSpace defines the methods supported by a Space entity stored persistently.

type BackingSubnet Uses

type BackingSubnet interface {
    CIDR() string
    ID() string
    VLANTag() int
    ProviderId() corenetwork.Id
    ProviderNetworkId() corenetwork.Id
    AvailabilityZones() []string
    Status() string
    SpaceName() string
    SpaceID() string
    Life() life.Value
}

BackingSubnet defines the methods supported by a Subnet entity stored persistently.

TODO(dimitern): Once the state backing is implemented, remove this and just use *state.Subnet.

type BackingSubnetInfo Uses

type BackingSubnetInfo struct {
    // ProviderId is a provider-specific network id. This may be empty.
    ProviderId corenetwork.Id

    // ProviderNetworkId is the id of the network containing this
    // subnet from the provider's perspective. It can be empty if the
    // provider doesn't support distinct networks.
    ProviderNetworkId corenetwork.Id

    // CIDR of the network, in 123.45.67.89/24 format.
    CIDR string

    // VLANTag needs to be between 1 and 4094 for VLANs and 0 for normal
    // networks. It's defined by IEEE 802.1Q standard.
    VLANTag int

    // AvailabilityZones describes which availability zone(s) this
    // subnet is in. It can be empty if the provider does not support
    // availability zones.
    AvailabilityZones []string

    // SpaceName holds the juju network space this subnet is
    // associated with. Can be empty if not supported.
    SpaceName string
    SpaceID   string

    // Status holds the status of the subnet. Normally this will be
    // calculated from the reference count and Life of a subnet.
    Status string

    // Live holds the life of the subnet
    Life params.Life
}

BackingSubnetInfo describes a single subnet to be added in the backing store.

TODO(dimitern): Replace state.SubnetInfo with this and remove BackingSubnetInfo, once the rest of state backing methods and the following pre-reqs are done: * Subnets need a reference count to calculate Status. * ensure EC2 and MAAS providers accept empty IDs as Subnets() args

and return all subnets, including the AvailabilityZones (for EC2;
empty for MAAS as zones are orthogonal to networks).

type NetworkBacking Uses

type NetworkBacking interface {
    environs.EnvironConfigGetter

    // AvailabilityZones returns all cached availability zones (i.e.
    // not from the provider, but in state).
    AvailabilityZones() ([]providercommon.AvailabilityZone, error)

    // SetAvailabilityZones replaces the cached list of availability
    // zones with the given zones.
    SetAvailabilityZones([]providercommon.AvailabilityZone) error

    // AddSpace creates a space
    AddSpace(Name string, ProviderId corenetwork.Id, Subnets []string, Public bool) error

    // AllSpaces returns all known Juju network spaces.
    AllSpaces() ([]BackingSpace, error)

    // AddSubnet creates a backing subnet for an existing subnet.
    AddSubnet(BackingSubnetInfo) (BackingSubnet, error)

    // AllSubnets returns all backing subnets.
    AllSubnets() ([]BackingSubnet, error)

    Subnet(cidr string) (BackingSubnet, error)

    // ModelTag returns the tag of the model this state is associated to.
    ModelTag() names.ModelTag

    // ReloadSpaces loads spaces from backing environ
    ReloadSpaces(environ environs.BootstrapEnviron) error
}

NetworkBacking defines the methods needed by the API facade to store and retrieve information from the underlying persistency layer (state DB).

type NetworkConfigAPI Uses

type NetworkConfigAPI struct {
    // contains filtered or unexported fields
}

func NewNetworkConfigAPI Uses

func NewNetworkConfigAPI(st *state.State, callCtx context.ProviderCallContext, getCanModify common.GetAuthFunc) *NetworkConfigAPI

func (*NetworkConfigAPI) SetObservedNetworkConfig Uses

func (api *NetworkConfigAPI) SetObservedNetworkConfig(args params.SetMachineNetworkConfig) error

SetObservedNetworkConfig reads the network config for the machine identified by the input args. This config is merged with the new network config supplied in the same args and updated if it has changed.

func (*NetworkConfigAPI) SetProviderNetworkConfig Uses

func (api *NetworkConfigAPI) SetProviderNetworkConfig(args params.Entities) (params.ErrorResults, error)

SetProviderNetworkConfig sets the provider supplied network configuration contained in the input args against each machine supplied with said args.

type NetworkConfigSource Uses

type NetworkConfigSource interface {
    // SysClassNetPath returns the Linux kernel userspace SYSFS path used by
    // this source. DefaultNetworkConfigSource() uses network.SysClassNetPath.
    SysClassNetPath() string

    // Interfaces returns information about all network interfaces on the
    // machine as []net.Interface.
    Interfaces() ([]net.Interface, error)

    // InterfaceAddresses returns information about all addresses assigned to
    // the network interface with the given name.
    InterfaceAddresses(name string) ([]net.Addr, error)
}

NetworkConfigSource defines the necessary calls to obtain the network configuration of a machine.

Package networkingcommon imports 16 packages (graph) and is imported by 163 packages. Updated 2019-09-26. Refresh now. Tools for package owners.