def add_linux_interface_mac(device, interface_name, macaddress): eth_if = IpInterface(interface_name) device.os.interfaces._setObject(eth_if.id, eth_if) eth_if = device.os.interfaces._getOb(eth_if.id) eth_if.macaddress = macaddress eth_if.index_object() device.index_object()
def add_interface(dev, macaddress='', clientmacs=[]): ''' Add new interface to device ''' eth_id = random_id() eth = IpInterface(eth_id, eth_id) eth.macaddress = macaddress eth.clientmacs = clientmacs dev.os.interfaces._setObject('unused_id_param', eth)
def add_interface(dev, macaddress='', clientmacs=[], vlans=None): ''' Add new interface to device ''' eth_id = random_id() eth = IpInterface(eth_id, eth_id) eth.macaddress = macaddress eth.clientmacs = clientmacs if vlans: eth.vlans = vlans dev.os.interfaces._setObject('unused_id_param', eth)