reverted refactoring method name until xen/bsd nodes are cleared out

This commit is contained in:
Blake J. Harnden 2018-03-01 09:26:28 -08:00
parent 908fb777de
commit 0b8ee7760d
5 changed files with 14 additions and 14 deletions

View file

@ -398,20 +398,20 @@ class SimpleLxcNode(PyCoreNode):
except subprocess.CalledProcessError:
logger.exception("failure bringing interface up")
def newnetif(self, net=None, address_list=None, hwaddr=None, ifindex=None, ifname=None):
def newnetif(self, net=None, addrlist=None, hwaddr=None, ifindex=None, ifname=None):
"""
Create a new network interface.
:param net: network to associate with
:param list address_list: addresses to add on the interface
:param list addrlist: addresses to add on the interface
:param core.misc.ipaddress.MacAddress hwaddr: hardware address to set for interface
:param int ifindex: index of interface to create
:param str ifname: name for interface
:return: interface index
:rtype: int
"""
if not address_list:
address_list = []
if not addrlist:
addrlist = []
with self.lock:
# TODO: see if you can move this to emane specific code
@ -424,7 +424,7 @@ class SimpleLxcNode(PyCoreNode):
self.attachnet(ifindex, net)
netif = self.netif(ifindex)
netif.sethwaddr(hwaddr)
for address in utils.maketuple(address_list):
for address in utils.maketuple(addrlist):
netif.addaddr(address)
return ifindex
else:
@ -436,7 +436,7 @@ class SimpleLxcNode(PyCoreNode):
if hwaddr:
self.sethwaddr(ifindex, hwaddr)
for address in utils.maketuple(address_list):
for address in utils.maketuple(addrlist):
self.addaddr(ifindex, address)
self.ifup(ifindex)

View file

@ -1166,7 +1166,7 @@ class Session(object):
interface1 = node.newnetif(net=control_net,
ifindex=control_net.CTRLIF_IDX_BASE + net_index,
ifname="ctrl%d" % net_index, hwaddr=MacAddress.random(),
address_list=addrlist)
addrlist=addrlist)
node.netif(interface1).control = True
def update_control_interface_hosts(self, net_index=0, remove=False):

View file

@ -162,7 +162,7 @@ class CoreDocumentParser0(object):
hwaddr = addrstr
else:
addrlist.append(addrstr)
i = n.newnetif(net, address_list=addrlist, hwaddr=hwaddr, ifindex=None, ifname=name)
i = n.newnetif(net, addrlist=addrlist, hwaddr=hwaddr, ifindex=None, ifname=name)
for model in ifc.getElementsByTagName("model"):
self.parsemodel(model, n, n.objid)
key = (n.name, name)

View file

@ -389,7 +389,7 @@ class CoreDocumentParser1(object):
hwaddr = MacAddress.from_string(mac[0])
else:
hwaddr = None
ifindex = node.newnetif(network, address_list=ipv4 + ipv6, hwaddr=hwaddr, ifindex=None, ifname=if_name)
ifindex = node.newnetif(network, addrlist=ipv4 + ipv6, hwaddr=hwaddr, ifindex=None, ifname=if_name)
# TODO: 'hostname' addresses are unused
msg = 'node \'%s\' interface \'%s\' connected ' \
'to network \'%s\'' % (node.name, if_name, network.name)

View file

@ -51,21 +51,21 @@ class CoreNs3Node(CoreNode, ns.network.Node):
kwds['objid'] = objid
CoreNode.__init__(self, *args, **kwds)
def newnetif(self, net=None, address_list=None, hwaddr=None, ifindex=None, ifname=None):
def newnetif(self, net=None, addrlist=None, hwaddr=None, ifindex=None, ifname=None):
"""
Add a network interface. If we are attaching to a CoreNs3Net, this
will be a TunTap. Otherwise dispatch to CoreNode.newnetif().
"""
if not address_list:
address_list = []
if not addrlist:
addrlist = []
if not isinstance(net, CoreNs3Net):
return CoreNode.newnetif(self, net, address_list, hwaddr, ifindex, ifname)
return CoreNode.newnetif(self, net, addrlist, hwaddr, ifindex, ifname)
ifindex = self.newtuntap(ifindex=ifindex, ifname=ifname, net=net)
self.attachnet(ifindex, net)
netif = self.netif(ifindex)
netif.sethwaddr(hwaddr)
for addr in maketuple(address_list):
for addr in maketuple(addrlist):
netif.addaddr(addr)
addrstr = netif.addrlist[0]