All example scripts are for lmishell. See it’s documentation on OpenLMI page.
We also assume that lmishell is connected to the CIMOM and the connection is stored in connection variable:
connection = connect("server", "username", "password")
Obtaining a list of network devices can be done by executing following commands in lmishell:
for device in connection.root.cimv2.LMI_IPNetworkConnection.instances():
print device.ElementName
Obtaining parameters of network device might be a little bit tricky. DMTF standards split network device to three classes and one might need to traverse between them through associations, see Networking API concepts.
Following example gets device name, its status and MAC address for each device. MAC address is not in the LMI_IPNetworkConnection class and must be accessed through LMI_EndpointForIPNetworkConnection association to LMI_LANEndpoint class:
for device in connection.root.cimv2.LMI_IPNetworkConnection.instances():
print device.ElementName,
print connection.root.cimv2.LMI_IPNetworkConnection.OperatingStatusValues.value_name(device.OperatingStatus),
# MAC address in not part of LMI_IPNetworkConnection but LMI_LANEndpoint class,
# which is associated through LMI_EndpointForIPNetworkConnection
print device.first_associator(AssocClass="LMI_EndpointForIPNetworkConnection").MACAddress
(IPv4 and IPv6 addresses, default gateways, DNS)
Bring up / take down a network device Enumerate available settings (configurations for network device) Create new setting with independent IPv4 and IPv6 configuration (static addresses, DHCP(v6), Stateless, disabled), default gateway Set DNS servers for given setting Manage static routes for given setting Apply setting to network device: * Multiple modes: immediate activation and/or setting it as permanent * Immediate applying is done asynchronously (can take quite a long time)
Delete setting Bridging/bonding: * Create bridge/bond setting * Enslave network device * Delete bridge/bond Notification about changes in network devices and settings (created, modified, deleted)