YaST2 Developers Documentation: Network configuration



functions
files
intro

Network configuration

modules/NetworkDevices.ycp
Interface manipulation (/etc/sysconfig/network/ifcfg-*)
The new sysconfig naming is interface (eg. eth0) vs. device (eg. NE2000 card), but historically yast has called them device vs. module.

Imports

  • Arch
  • Map

Includes

  • network/complex.ycp
  • network/routines.ycp

Global Variables

Global Functions

Local Variables

Local Functions

global Name -> string

Current device identifier

Example:
  eth0, eth1:blah, lo, ...
 Add, Edit and Delete copy the requested device info (via Select)
 to Name and Current,
 Commit puts it back

global Current -> map<string,any>

Current device information

Example:
  $["BOOTPROTO":"dhcp", "STARTMODE":"onboot"]

local Devices -> map<string,map>

Interface information: Devices[string type, string id] is a map with the contents of ifcfg-type-id. Separating type from id is useful because the type determines the fields of the interface file. Multiple addresses for an interface are nested maps [type, id, "_aliases", aid] (Aliases currently do not work because ":" has changed its meaning in ifcfg file names and it clashes with yast's internal use of it)

See:
Read

local OriginalDevices -> map<string,map>

Devices information

See:
Read

local Deleted -> list<string>

Deleted devices

local initialized -> boolean

True if devices are already read

Info:

Which operation is pending?

global CardRegex -> map<string,string>

Predefined network card regular expressions

local HotplugTypes -> list<string>

Supported hotplug types

local HotplugRegex (list<string> devs) -> string

Create a list of hot-pluggable device names for the given devices

Parameters:
devs

global DeviceRegex -> map<string,string>

Predefined network device regular expressions

local FastestTypes -> map<integer,string>

Types in order from fastest to slowest.

See:
FastestRegexps

local stack -> map

See:
Push

global Read () -> boolean

Read devices from files

Return value:
true if sucess

local Filter (map<string,map> devices, string devregex) -> map<string,map>

Parameters:
devices
devregex

local FilterNOT (map<string,map> devices, string devregex) -> map

Parameters:
devices
devregex

global Write (string devregex) -> boolean

Write devices to files

Parameters:
devregex regular expression for the device type
Return value:
true if success
Example:
  NetworkDevice::Write("eth|tr");

global Import (string devregex, map<string,map> devices) -> boolean

Import data

Parameters:
devregex
devices
Return value:
true on success

global Export (string devregex) -> map<string,map>

Export data

Parameters:
devregex
Return value:
dumped settings (later acceptable by Import())

global Modified (string devregex) -> boolean

Were the devices changed?

Parameters:
devregex
Return value:
true if modified

global GetFreeDevicesOld (string type, integer num) -> list

Compute free devices

Parameters:
type device type
num how many free devices return
Return value:
num of free devices
Example:
  GetFreeDevices("eth", 2) -> [ 1, 2 ]

global GetFreeDevice (string type) -> string

Return free device

Parameters:
type device type
Return value:
free device
Example:
  GetFreeDevice("eth") -> "1"

global Check (string dev) -> boolean

Check presence of the device (alias)

Parameters:
dev device identifier
Return value:
true if device is present

global Select (string name) -> boolean

Select the given device

Parameters:
name
Return value:
true if success

global Add () -> boolean

Add a new device

Return value:
true if success

global Edit (string name) -> boolean

Edit the given device

Parameters:
name
Return value:
true if success

global Delete (string name) -> boolean

Delete the given device

Parameters:
name
Return value:
true if success

local Change2 (string name, map newdev, boolean check) -> boolean

Update Devices map

Parameters:
name
newdev new device map
check if check if device already exists
Return value:
true if success

Info:

Add the alias to the list of deleted items. Called when exiting from the aliases-of-device dialog. #63191

global Locate (string key, string val) -> list<string>

Locate devices of the given type and value

Parameters:
key device key
val device value
Return value:
of devices with key=val

global LocateNOT (string key, string val) -> list<string>

Locate devices of the given type and value

Parameters:
key device key
val device value
Return value:
of devices with key!=val

global LocateProvider (string provider) -> boolean

Check if any device is using the specified provider

Parameters:
provider provider identification
Return value:
true if there is any

global UpdateModemSymlink () -> boolean

Update /dev/modem symlink

Return value:
true if success

global CleanHotplugSymlink () -> boolean

Clean the hotplug devices compatibility symlink, usually ifcfg-eth-pcmcia -> ifcfg-eth-pcmcia-0.

Return value:
true if success

global List (string devregex) -> list<string>

Get devices of the given type

Parameters:
devregex
Return value:
of found devices

global Fastest () -> string

Find the fastest available device

global HasAliases (string name) -> boolean

Check if the given device has any virtual alias.

Parameters:
name
Return value:
true if there are some aliases

global Push () -> void

DSL needs to save its config while the underlying network card is being configured.


YaST2 Developers Documentation