2018-07-18 08:48:24 +00:00
|
|
|
def add_ip_address(client, ifc_index, ip_addr):
|
|
|
|
"""Add IP address.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
ifc_index: ifc index of the nic device (int)
|
|
|
|
ip_addr: ip address will be added
|
|
|
|
"""
|
|
|
|
params = {'ifc_index': ifc_index, 'ip_address': ip_addr}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('add_ip_address', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-07-18 08:48:24 +00:00
|
|
|
def delete_ip_address(client, ifc_index, ip_addr):
|
|
|
|
"""Delete IP address.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
ifc_index: ifc index of the nic device (int)
|
|
|
|
ip_addr: ip address will be deleted
|
|
|
|
"""
|
|
|
|
params = {'ifc_index': ifc_index, 'ip_address': ip_addr}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('delete_ip_address', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-07-18 08:48:24 +00:00
|
|
|
def get_interfaces(client):
|
|
|
|
"""Display current interface list
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
List of current interface
|
|
|
|
"""
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('get_interfaces')
|