YaST2 Developers Documentation: Unknown YCP Module

Unknown YCP Module

This module has an unstable interface.

Imports

  • Arch
  • Map
  • Mode
  • Netmask
  • String

Global Variables

Global Functions

Local Variables

Local Functions

Info:

File: modules/NetworkInterfaces.ycp Package: Network configuration Summary: Interface manipulation (/etc/sysconfig/network/ifcfg-*) Authors: Michal Svec

$Id: NetworkInterfaces.ycp 43062 2007-12-13 16:12:26Z mzugec $

global report_every_check -> boolean

False suppresses tones of logs 'NetworkInterfaces.ycp:ABC Check(eth,id-00:aa:bb:cc:dd:ee,)'

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 -> ifcfg_t

Current device information

Example
 $["BOOTPROTO":"dhcp", "STARTMODE":"auto"]
local Devices -> devices_t

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]

See
Read
local OriginalDevices -> devices_t

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
local alias_separator -> string

A single character used to separate alias id

local ifcfg_name_regex -> string

ifcfg name = type + id + alias_id If id is numeric, it is not separated from type, otherwise separated by "-" Id may be empty Alias_id, if nonempty, is separated by alias_separator

global device_type (string dev) -> string

Return a device type

Parameters:
dev device
Return value:
device type
Example
 device_type("eth1") -> "eth"
 device_type("eth-pcmcia-0") -> "eth-pcmcia"
global GetTypeFromIfcfg (ifcfg_t ifcfg) -> string

Parameters:
ifcfg
global GetDeviceType (string dev) -> string

Return device type in human readable form :-)

Parameters:
dev device
Return value:
device type
Example
 GetDeviceType(eth-bus-pci-0000:01:07.0) -> "Network Card"
 GetDeviceType(modem0) -> "Modem"
global device_num (string dev) -> string

Return a device number

Parameters:
dev device
Return value:
device number
Example
 device_num("eth1") -> "1"
 device_num("lo") -> ""
global alias_num (string dev) -> string

Return a device alias number

Parameters:
dev device
Return value:
alias number
Example
 alias_num("eth1#2") -> "2"
 alias_num("eth1#blah") -> "blah"
global device_name (string typ, string num) -> string

Create a device name from its type and number

Parameters:
typ device type
num device number
Return value:
device name
Example
 device_name("eth", "1") -> "eth1"
 device_name("lo", "") -> "lo"
global alias_name (string typ, string num, string anum) -> string

Create a alias name from its type and numbers

Parameters:
typ device type
num device number
anum alias number
Return value:
alias name
Example
 alias_name("eth", "1", "2") -> "eth1#2"
global IsHotplug (string type) -> boolean

Test hotplugability of a device

Parameters:
type device type
Return value:
true if hotpluggable
Info:

Return matching inteface for this hardware ID (uses getcfg-interface)

Parameters:
dev unique device string return interface name
Example
 MatchInterface("eth-id-00:01:DE:AD:BE:EF") -> "eth0"
global IsConnected (string dev) -> boolean

Test whether device is connected (Link:up) The info is taken from sysfs

Parameters:
dev unique device string
Return value:
true if connected
global RealType (string type, string hotplug) -> string

Return real type of the device (incl. PCMCIA, USB, ...)

Parameters:
type basic device type
hotplug hot plug type
Return value:
real type
Example
 RealType("eth", "usb") -> "eth-usb"
global CanonicalizeStartmode (map<string, any> ifcfg) -> map<string, any>

STARTMODE: onboot, on and boot are aliases for auto

Parameters:
ifcfg
global CanonicalizeIP (map<string, any> ifcfg) -> map<string, any>

Canonicalize netmask data (#46885) Sysconfig allows: IPADDR=10.0.0.1/8 IPADDR=10.0.0.1 PREFIXLEN=8 IPADDR=10.0.0.1 NETMASK=255.0.0.0 (IPADDR overrides PREFIXLEN, NETMASK used only if prefix length unspecified) If prefix length and NETMASK are unspecified, 32 is implied. Canonicalize it to IPADDR=10.0.0.1 PREFIXLEN= NETMASK=255.0.0.0

Parameters:
ifcfg a map containing IPADDR and possibly NETMASK, PREFIXLEN and possibly other fields
Return value:
the map with IPADDR, NETMASK adjusted; PREFIXLEN "" others unchanged. If IPADDR is empty, return the original.
global ConcealSecrets1 (map<string, any> ifcfg) -> map

Conceal secret information, such as WEP keys, so that the output can be passed to y2log and bugzilla.

Parameters:
ifcfg one ifcfg
Return value:
ifcfg with secret fields masked out
global ConcealSecrets (map devs) -> map

Conceal secret information, such as WEP keys, so that the output can be passed to y2log and bugzilla. (#65741)

Parameters:
devs a two-level map of ifcfgs like Devices
Return value:
ifcfgs with secret fields masked out
global Read () -> boolean

Read devices from files

Return value:
true if sucess
global CleanCacheRead () -> boolean

re-read all settings again from system for creating new proposal from scratch (#170558)

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

Parameters:
devices
devregex
global FilterDevices (string devregex) -> map<string,map>

Used in BuildSummary, BuildOverview

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

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

Import data

Parameters:
devregex
devices
Return value:
true on success
global GetDeviceTypes () -> list<string>

Return supported network device types (for type netcard) for this hardware

global GetDevTypeDescription (string type, boolean longdescr) -> string

Return textual device type

Parameters:
type description type
longdescr
Return value:
textual form of device type
Example
 GetDevTypeDescription("eth", false) -> "Ethernet"
 GetDevTypeDescription("eth", true)  -> "Ethernet Network Card"
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, ifcfg_t 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
global DeleteAlias (string device, string aid) -> boolean

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

Parameters:
device
aid
global GetIP (string device) -> list<string>

get IP addres + additional IP addresses

Parameters:
device
Return value:
of IP addresses of selected interface
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.

global ValidCharsIfcfg () -> string

#46803: forbid "/" (filename), maybe also "-" (separator) "_" (escape)

global ListDevicesExcept (string dev) -> list<string>

list of all devices except given one by parameter dev also loopback is ommited

Parameters:
dev