Documentation
¶
Index ¶
- func BackingSubnetToParamsSubnet(subnet BackingSubnet) params.Subnet
- func BackingSubnetToParamsSubnetV2(subnet BackingSubnet) params.SubnetV2
- func FanConfigResultToFanConfig(config params.FanConfigResult) (network.FanConfig, error)
- func FanConfigToFanConfigResult(config network.FanConfig) params.FanConfigResult
- func NetworkInterfacesToStateArgs(devs network.InterfaceInfos) ([]state.LinkLayerDeviceArgs, []state.LinkLayerDeviceAddress)
- func NewSpaceShim(sp *state.Space) *spaceShim
- func NewSubnetShim(sub *state.Subnet) *subnetShim
- type AddSubnetsState
- type BackingSpace
- type BackingSubnet
- type BackingSubnetInfo
- type LinkLayerAccessor
- type LinkLayerAddress
- type LinkLayerAndSubnetsState
- type LinkLayerDevice
- type LinkLayerMachine
- type LinkLayerState
- type LinkLayerWriter
- type MachineLinkLayerOp
- func (o *MachineLinkLayerOp) AssertAliveOp() txn.Op
- func (o *MachineLinkLayerOp) ClearProcessed()
- func (o *MachineLinkLayerOp) DeviceAddresses(dev LinkLayerDevice) []LinkLayerAddress
- func (o *MachineLinkLayerOp) Done(err error) error
- func (o *MachineLinkLayerOp) ExistingAddresses() []LinkLayerAddress
- func (o *MachineLinkLayerOp) ExistingDevices() []LinkLayerDevice
- func (o *MachineLinkLayerOp) Incoming() network.InterfaceInfos
- func (o *MachineLinkLayerOp) IsAddrProcessed(name, ipAddr string) bool
- func (o *MachineLinkLayerOp) IsDevProcessed(dev network.InterfaceInfo) bool
- func (o *MachineLinkLayerOp) MarkAddrProcessed(name, ipAddr string)
- func (o *MachineLinkLayerOp) MarkDevProcessed(name string)
- func (o *MachineLinkLayerOp) MatchingIncoming(dev LinkLayerDevice) *network.InterfaceInfo
- func (o *MachineLinkLayerOp) MatchingIncomingAddrs(name string) []state.LinkLayerDeviceAddress
- func (o *MachineLinkLayerOp) PopulateExistingAddresses() error
- func (o *MachineLinkLayerOp) PopulateExistingDevices() error
- type NetworkBacking
- type NetworkConfigAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackingSubnetToParamsSubnet ¶
func BackingSubnetToParamsSubnet(subnet BackingSubnet) params.Subnet
func BackingSubnetToParamsSubnetV2 ¶
func BackingSubnetToParamsSubnetV2(subnet BackingSubnet) params.SubnetV2
BackingSubnetToParamsSubnetV2 converts a network backing subnet to the new version of the subnet API parameter.
func FanConfigResultToFanConfig ¶
func FanConfigResultToFanConfig(config params.FanConfigResult) (network.FanConfig, error)
func FanConfigToFanConfigResult ¶
func FanConfigToFanConfigResult(config network.FanConfig) params.FanConfigResult
func NetworkInterfacesToStateArgs ¶
func NetworkInterfacesToStateArgs(devs network.InterfaceInfos) ( []state.LinkLayerDeviceArgs, []state.LinkLayerDeviceAddress, )
NetworkInterfacesToStateArgs splits the given interface list into a slice of state.LinkLayerDeviceArgs and a slice of state.LinkLayerDeviceAddress.
func NewSpaceShim ¶
NewSpaceShim creates new subnet shim to be used by subnets and spaces Facades.
func NewSubnetShim ¶
NewSubnetShim creates new subnet shim to be used by subnets and spaces Facades.
Types ¶
type AddSubnetsState ¶
type AddSubnetsState interface { // AddSubnetOps returns transaction operations required to ensure that the // input subnet is added to state. AddSubnetOps(network.SubnetInfo) ([]txn.Op, error) }
AddSubnetsState describes methods required to add new subnets.
type BackingSpace ¶
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() network.Id }
BackingSpace defines the methods supported by a Space entity stored persistently.
type BackingSubnet ¶
type BackingSubnet interface { ID() string CIDR() string VLANTag() int ProviderId() network.Id ProviderNetworkId() network.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 ¶
type BackingSubnetInfo struct { // ProviderId is a provider-specific network id. This may be empty. ProviderId network.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 network.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 life.Value }
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 LinkLayerAccessor ¶
type LinkLayerAccessor interface { // AllLinkLayerDevices returns all currently known // layer-2 devices for the machine. AllLinkLayerDevices() ([]LinkLayerDevice, error) // AllDeviceAddresses returns all IP addresses assigned to // the machine's link-layer devices AllDeviceAddresses() ([]LinkLayerAddress, error) }
LinkLayerAccessor describes an entity that can return link-layer data related to it.
type LinkLayerAddress ¶
type LinkLayerAddress interface { // DeviceName is the name of the device to which this address is assigned. DeviceName() string // Value returns the actual IP address. Value() string // Origin indicates the authority that is maintaining this address. Origin() network.Origin // SetProviderIDOps returns the operations required to set the input // provider ID for the address. SetProviderIDOps(id network.Id) ([]txn.Op, error) // SetOriginOps returns the transaction operations required to change // the origin for this address. SetOriginOps(origin network.Origin) []txn.Op // SetProviderNetIDsOps returns the transaction operations required to ensure // that the input provider IDs are set against the address. SetProviderNetIDsOps(networkID, subnetID network.Id) []txn.Op // RemoveOps returns the transaction operations required to remove this // address and if required, its provider ID. RemoveOps() []txn.Op // UpdateOps returns the transaction operations required to update the device // so that it reflects the incoming arguments. UpdateOps(state.LinkLayerDeviceAddress) ([]txn.Op, error) }
LinkLayerAddress describes a single layer-3 network address assigned to a layer-2 device.
type LinkLayerAndSubnetsState ¶
type LinkLayerAndSubnetsState interface { LinkLayerState AddSubnetsState }
LinkLayerAndSubnetsState describes a persistence indirection that includes the ability to update link-layer data and add discovered subnets.
type LinkLayerDevice ¶
type LinkLayerDevice interface { // MACAddress is the hardware address of the device. MACAddress() string // Name is the name of the device. Name() string // ProviderID returns the provider-specific identifier for this device. ProviderID() network.Id // Type returns the device's type. Type() network.LinkLayerDeviceType // SetProviderIDOps returns the operations required to set the input // provider ID for the link-layer device. SetProviderIDOps(id network.Id) ([]txn.Op, error) // RemoveOps returns the transaction operations required to remove this // device and if required, its provider ID. RemoveOps() []txn.Op // UpdateOps returns the transaction operations required to update the // device so that it reflects the incoming arguments. UpdateOps(state.LinkLayerDeviceArgs) []txn.Op // AddAddressOps returns transaction operations required // to add the input address to the device. AddAddressOps(state.LinkLayerDeviceAddress) ([]txn.Op, error) }
LinkLayerDevice describes a single layer-2 network device.
type LinkLayerMachine ¶
type LinkLayerMachine interface { LinkLayerAccessor LinkLayerWriter // Id returns the ID for the machine. Id() string // AssertAliveOp returns a transaction operation for asserting // that the machine is currently alive. AssertAliveOp() txn.Op // ModelUUID returns the unique identifier // for the model that this machine is in. ModelUUID() string }
LinkLayerMachine describes a machine that can return its link-layer data and assert that it is alive in preparation for updating such data.
type LinkLayerState ¶
type LinkLayerState interface { // Machine returns the machine for which link-layer data is being set. Machine(string) (LinkLayerMachine, error) // AllSubnetInfos returns all known model subnets. // It is used for correctly setting the subnet // of addresses in Fan networks. AllSubnetInfos() (network.SubnetInfos, error) // ApplyOperation applied the model operation that sets link-layer data. ApplyOperation(state.ModelOperation) error }
LinkLayerState describes methods required for sanitising and persisting link-layer data sourced from a single machine.
type LinkLayerWriter ¶
type LinkLayerWriter interface { // AddLinkLayerDeviceOps returns transaction operations for adding the // input link-layer device and the supplied addresses to the machine. AddLinkLayerDeviceOps(state.LinkLayerDeviceArgs, ...state.LinkLayerDeviceAddress) ([]txn.Op, error) }
LinkLayerWriter describes an entity that can have link-layer devices added to it.
type MachineLinkLayerOp ¶
type MachineLinkLayerOp struct {
// contains filtered or unexported fields
}
MachineLinkLayerOp is a base type for model operations that update link-layer data for a single machine/host/container.
func NewMachineLinkLayerOp ¶
func NewMachineLinkLayerOp(source string, machine LinkLayerMachine, in network.InterfaceInfos) *MachineLinkLayerOp
NewMachineLinkLayerOp returns a reference that can be embedded in a model operation for updating the input machine's link layer data.
func (*MachineLinkLayerOp) AssertAliveOp ¶
func (o *MachineLinkLayerOp) AssertAliveOp() txn.Op
AssertAliveOp returns a transaction operation for asserting that the machine for which we are updating link-layer data is alive.
func (*MachineLinkLayerOp) ClearProcessed ¶
func (o *MachineLinkLayerOp) ClearProcessed()
ClearProcessed ensures that any record of processed devices and addresses is effectively zeroed. This should be called before each transaction attempt.
func (*MachineLinkLayerOp) DeviceAddresses ¶
func (o *MachineLinkLayerOp) DeviceAddresses(dev LinkLayerDevice) []LinkLayerAddress
DeviceAddresses returns all currently known IP addresses assigned to the input device.
func (*MachineLinkLayerOp) Done ¶
func (o *MachineLinkLayerOp) Done(err error) error
Done (state.ModelOperation) returns the result of running the operation.
func (*MachineLinkLayerOp) ExistingAddresses ¶
func (o *MachineLinkLayerOp) ExistingAddresses() []LinkLayerAddress
ExistingAddresses is a property accessor for the currently known addresses assigned to machine link-layer devices.
func (*MachineLinkLayerOp) ExistingDevices ¶
func (o *MachineLinkLayerOp) ExistingDevices() []LinkLayerDevice
ExistingDevices is a property accessor for the currently known machine link-layer devices.
func (*MachineLinkLayerOp) Incoming ¶
func (o *MachineLinkLayerOp) Incoming() network.InterfaceInfos
Incoming is a property accessor for the link-layer data we are processing.
func (*MachineLinkLayerOp) IsAddrProcessed ¶
func (o *MachineLinkLayerOp) IsAddrProcessed(name, ipAddr string) bool
IsAddrProcessed returns a boolean indicating whether the input incoming device/address pair matches an entry that was marked as processed by the method above.
func (*MachineLinkLayerOp) IsDevProcessed ¶
func (o *MachineLinkLayerOp) IsDevProcessed(dev network.InterfaceInfo) bool
IsDevProcessed returns a boolean indicating whether the input incoming device matches a known device that was marked as processed by the method above.
func (*MachineLinkLayerOp) MarkAddrProcessed ¶
func (o *MachineLinkLayerOp) MarkAddrProcessed(name, ipAddr string)
MarkAddrProcessed indicates that the input (known) IP address was present in the incoming data for the device with input hardware address.
func (*MachineLinkLayerOp) MarkDevProcessed ¶
func (o *MachineLinkLayerOp) MarkDevProcessed(name string)
MarkDevProcessed indicates that the input device name was present in the incoming data and its updates have been handled by the build step.
func (*MachineLinkLayerOp) MatchingIncoming ¶
func (o *MachineLinkLayerOp) MatchingIncoming(dev LinkLayerDevice) *network.InterfaceInfo
MatchingIncoming returns the first incoming interface that matches the input known device based on name. Nil is returned if there is no match.
func (*MachineLinkLayerOp) MatchingIncomingAddrs ¶
func (o *MachineLinkLayerOp) MatchingIncomingAddrs(name string) []state.LinkLayerDeviceAddress
MatchingIncomingAddrs finds all the primary addresses on devices matching the input name, and returns them as state args. TODO (manadart 2020-07-15): We should investigate making an enhanced core/network address type instead of this state type. It would embed ProviderAddress and could be obtained directly via a method or property of InterfaceInfos.
func (*MachineLinkLayerOp) PopulateExistingAddresses ¶
func (o *MachineLinkLayerOp) PopulateExistingAddresses() error
PopulateExistingAddresses retrieves all current link-layer device addresses for the machine.
func (*MachineLinkLayerOp) PopulateExistingDevices ¶
func (o *MachineLinkLayerOp) PopulateExistingDevices() error
PopulateExistingDevices retrieves all current link-layer devices for the machine.
type NetworkBacking ¶
type NetworkBacking interface { environs.EnvironConfigGetter // AvailabilityZones returns all cached availability zones (i.e. // not from the provider, but in state). AvailabilityZones() (network.AvailabilityZones, error) // SetAvailabilityZones replaces the cached list of availability // zones with the given zones. SetAvailabilityZones(network.AvailabilityZones) error // AddSpace creates a space AddSpace(string, network.Id, []string, bool) (BackingSpace, 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) SubnetByCIDR(cidr string) (BackingSubnet, error) // ModelTag returns the tag of the model this state is associated to. ModelTag() names.ModelTag }
NetworkBacking defines the methods needed by the API facade to store and retrieve information from the underlying persistence layer (state DB).
type NetworkConfigAPI ¶
type NetworkConfigAPI struct {
// contains filtered or unexported fields
}
func NewNetworkConfigAPI ¶
func NewNetworkConfigAPI(st *state.State, getCanModify common.GetAuthFunc) (*NetworkConfigAPI, error)
NewNetworkConfigAPI constructs a new common network configuration API and returns its reference.
func (*NetworkConfigAPI) SetObservedNetworkConfig ¶
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.