Networking API concepts

OpenLMI-Networking provides CIM API. Some CIM knowledge is required and this guide assumes that reader can routinely read and modify remote CIM objects and call their intrinsic and extrinsic methods.

Hardware representation

There is instance of subclass of CIM_NetworkPort for each physical network device present in the system, e.g. LMI_EthernetPort for ethernet ports.

Instances of class LMI_LANEndpoint represent communication endpoints, identified by MAC address to which the network port will respond. It’s associated to the corresponding instance of CIM_NetworkPort subclass via instance of LMI_NetworkDeviceSAPImplementation.

Current network configuration

LMI_IPNetworkConnection instances represents the network connection in the system, e.g. “eth0”, “p1p1”. Instances of this class are associated to the LMI_LANEndpoint via LMI_EndpointForIPNetworkConnection.

Note

There are usually 1:1:1 relation between instances of CIM_NetworkPort subclasses, LMI_LANEndpoint instances and LMI_IPNetworkConnection instance in this provider. The classes are implemented for sake of compatibility with DMTF profiles.

LMI_IPProtocolEndpoint - there is instance of this class for each IP address on any network device and the instance is associated with LMI_IPNetworkConnection via LMI_NetworkSAPSAPDependency and with LMI_LANEndpoint via LMI_BindsToLANEndpoint.

Default gateway is represented by instance of LMI_NetworkRemoteServiceAccessPoint with attribute AccessContext equal to 2 (Default Gateway).

Instances of class LMI_IPVersionSettingData represent IPv4 or IPv6 support. If there is instance of this class associated with CIM_ComputerSystem it means that the system supports IPv4 and/or IPv6 (depending on value of the ProtocolIFType property). Instances of this class can be associated also to LMI_IPNetworkConnection. It means that the network connection supports IPv4 and/or IPv6.

Settings

The OpenLMI networking provider is based on concept of setting. Setting is a set of configuration options that can be applied to an interface. Each setting is represented by instance of LMI_IPAssignmentSettingData and it is aggregator for detailed configuration represented by instances of following classes: LMI_DHCPSettingData, LMI_DNSSettingData, LMI_ExtendedStaticIPAssignmentSettingData. These detailed settings are associated with the master setting via LMI_OrderedIPAssignmentComponent where the master has role GroupComponent.

Settings available for given port are associated by LMI_IPElementSettingData. Its property IsCurrent is 1 when the setting is currently active. Property IsDefault is 1 when the setting is automatically activated.

Altering and applying settings

Method LMI_CreateIPSetting of the LMI_IPNetworkConnectionCapabilites class can be used to create new setting. The setting will be tied to LMI_IPNetworkConnection that is associated with given LMI_IPNetworkConnectionCapabilites.

Singleton class LMI_IPConfigurationService provides method ApplySettingToIPNetworkConnection that applies LMI_IPAssignmentSettingData to LMI_IPNetworkConnection.

Bridging and bonding

Current state

Instance of the LMI_LinkAggregator8023ad class represents currently active bond. It’s associated to the LMI_LAGPort8023ad representing bonded interface via LMI_LinkAggregationBindsTo.

Instance of the LMI_SwitchService class represents currently active bridge. It’s associated to the LMI_SwitchPort representing bridged interface via LMI_SwitchesAmong”.

Creating bridge/bond

Creating bridge/bond setting is the same as creating any other setting, just the Type parameter of the LMI_CreateIPSetting is different (Bonding or Bridging).

Bonding/bridging setting details can be altered by changing the properties of LMI_BondingMasterSettingData (or LMI_BridgingMasterSettingData) instance that is returned from the LMI_CreateIPSetting method.

For activating bridge/bond setting, use ApplySettingToIPNetworkConnection of the LMI_IPConfigurationService class.

For deletion of the bridge/bond setting just delete the “master” setting (the one created by LMI_CreateIPSetting). Deleting other settings will just remove the slave from the settings.

Enslaving

First network interface is enslaved to the given bond/bridge setting automatically (depending on what LMI_IPNetworkConnectionCapabilities is the LMI_CreateIPSetting method called). Other interface can be enslaved by using LMI_CreateSlaveSetting method of the LMI_IPNetworkConnectionCapabilities.

Alter the LMI_BondingSlaveSettingData (or LMI_BridgingSlaveSettingData) instance to change the properties of bond/bridge slave.