Documentation ¶
Overview ¶
Package networkmanager provides set of API to configure network
Package networkmanager provides set of API to configure network ¶
Package networkmanager provides set of API to configure network ¶
Package networkmanager provides set of API to configure network
Index ¶
- Constants
- Variables
- type IPTablesInterface
- type NetworkManager
- func (manager *NetworkManager) AddInstanceToNetwork(instanceID, networkID string, params NetworkParams) (err error)
- func (manager *NetworkManager) Close() error
- func (manager *NetworkManager) GetInstanceIP(instanceID, networkID string) (ip string, err error)
- func (manager *NetworkManager) GetInstanceTraffic(instanceID string) (inputTraffic, outputTraffic uint64, err error)
- func (manager *NetworkManager) GetNetnsPath(instanceID string) (pathToNetNS string)
- func (manager *NetworkManager) GetSystemTraffic() (inputTraffic, outputTraffic uint64, err error)
- func (manager *NetworkManager) RemoveInstanceFromNetwork(instanceID, networkID string) error
- func (manager *NetworkManager) SetTrafficPeriod(period int) error
- func (manager *NetworkManager) UpdateNetworks(networkParameters []aostypes.NetworkParameters) error
- type NetworkParameters
- type NetworkParams
- type Storage
- type Vlan
Constants ¶
const ( MinutePeriod = iota HourPeriod DayPeriod MonthPeriod YearPeriod )
Describes reset traffic period.
Variables ¶
var ( ErrEntryNotExist = errors.New("entry does not exist") ErrRuleNotExist = errors.New("chain rule not exist") )
var CNIPlugins cni.CNI
CNIPlugins this global variable is used to be able to mocking the functionality of networking in tests.
var CreateVlan = createVlan
CreateVlan this global variable is used to be able to mocking the functionality of networking in tests.
var UpdateIptablesCachePeriod = 1 * time.Minute
UpdateIptablesCachePeriod is used to be able to mocking the functionality of networking in tests.
Functions ¶
This section is empty.
Types ¶
type IPTablesInterface ¶
type IPTablesInterface interface { Append(table, chain string, rulespec ...string) error Delete(table, chain string, rulespec ...string) error NewChain(table, chain string) error Insert(table, chain string, pos int, rulespec ...string) error ClearChain(table, chain string) error DeleteChain(table, chain string) error ListChains(table string) ([]string, error) ListAllRulesWithCounters(table string) ([]string, error) }
var ( IsSamePeriod = isSamePeriod IPTables IPTablesInterface )
These global variables are used to be able to mocking the functionality in tests.
type NetworkManager ¶
NetworkManager network manager instance.
func New ¶
func New(cfg *config.Config, storage Storage) (manager *NetworkManager, err error)
New creates network manager instance.
func (*NetworkManager) AddInstanceToNetwork ¶
func (manager *NetworkManager) AddInstanceToNetwork(instanceID, networkID string, params NetworkParams) (err error)
AddInstanceToNetwork adds instance to network.
func (*NetworkManager) Close ¶
func (manager *NetworkManager) Close() error
Close closes network manager instance.
func (*NetworkManager) GetInstanceIP ¶
func (manager *NetworkManager) GetInstanceIP(instanceID, networkID string) (ip string, err error)
GetInstanceIP return instance IP address.
func (*NetworkManager) GetInstanceTraffic ¶
func (manager *NetworkManager) GetInstanceTraffic(instanceID string) (inputTraffic, outputTraffic uint64, err error)
func (*NetworkManager) GetNetnsPath ¶
func (manager *NetworkManager) GetNetnsPath(instanceID string) (pathToNetNS string)
GetNetnsPath get path to instance network namespace.
func (*NetworkManager) GetSystemTraffic ¶
func (manager *NetworkManager) GetSystemTraffic() (inputTraffic, outputTraffic uint64, err error)
func (*NetworkManager) RemoveInstanceFromNetwork ¶
func (manager *NetworkManager) RemoveInstanceFromNetwork(instanceID, networkID string) error
RemoveInstanceFromNetwork removes instance from network.
func (*NetworkManager) SetTrafficPeriod ¶
func (manager *NetworkManager) SetTrafficPeriod(period int) error
func (*NetworkManager) UpdateNetworks ¶
func (manager *NetworkManager) UpdateNetworks(networkParameters []aostypes.NetworkParameters) error
UpdateNetworks updates networks.
type NetworkParameters ¶
type NetworkParameters struct { NetworkID string Subnet string IP string VlanID uint64 VlanIfName string }
NetworkParameters network parameters set for service provider.
type NetworkParams ¶
type NetworkParams struct { aostypes.InstanceIdent aostypes.NetworkParameters Hostname string Aliases []string IngressKbit uint64 EgressKbit uint64 ExposedPorts []string Hosts []cloudprotocol.HostInfo DNSSevers []string HostsFilePath string ResolvConfFilePath string UploadLimit uint64 DownloadLimit uint64 }
NetworkParams network parameters set for instance.
type Storage ¶
type Storage interface { // storage for network info RemoveNetworkInfo(networkID string) error AddNetworkInfo(info NetworkParameters) error GetNetworksInfo() ([]NetworkParameters, error) // storage for network traffic monitoring SetTrafficMonitorData(chain string, timestamp time.Time, value uint64) (err error) GetTrafficMonitorData(chain string) (timestamp time.Time, value uint64, err error) RemoveTrafficMonitorData(chain string) (err error) }
Storage interface for network manager.