Documentation
¶
Index ¶
- func BackingSubnetToParamsSubnet(subnet network.SubnetInfo) params.Subnet
- func BackingSubnetToParamsSubnetV2(subnet network.SubnetInfo) params.SubnetV2
- func NetworkInterfacesToStateArgs(devs network.InterfaceInfos) ([]state.LinkLayerDeviceArgs, []state.LinkLayerDeviceAddress)
- func SubnetInfoToParamsSubnet(subnet network.SubnetInfo) params.Subnet
- 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
- type NetworkService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackingSubnetToParamsSubnet ¶
func BackingSubnetToParamsSubnet(subnet network.SubnetInfo) params.Subnet
func BackingSubnetToParamsSubnetV2 ¶
func BackingSubnetToParamsSubnetV2(subnet network.SubnetInfo) params.SubnetV2
BackingSubnetToParamsSubnetV2 converts a network backing subnet to the new version of the subnet API parameter.
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 SubnetInfoToParamsSubnet ¶
func SubnetInfoToParamsSubnet(subnet network.SubnetInfo) params.Subnet
Types ¶
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 }
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) // 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 // 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(ctx context.Context, st *state.State, cloudService common.CloudService, networkService NetworkService, getCanModify common.GetAuthFunc) (*NetworkConfigAPI, error)
NewNetworkConfigAPI constructs a new common network configuration API and returns its reference.
func (*NetworkConfigAPI) SetObservedNetworkConfig ¶
func (api *NetworkConfigAPI) SetObservedNetworkConfig(ctx context.Context, 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.
type NetworkService ¶
type NetworkService interface { // GetAllSubnets returns all the subnets for the model. GetAllSubnets(ctx context.Context) (network.SubnetInfos, error) // AddSubnet creates and returns a new subnet. AddSubnet(ctx context.Context, args network.SubnetInfo) (network.Id, error) }
NetworkService is the interface that is used to interact with the network spaces/subnets.