Assign IP addresses to all interfaces on hosts and routers in the
        network.  
        
        NB: this method assumes that all interfaces are assigned
        addresses on the same subnet.  If you don't want that behavior,
        the setInterfaceAddresses method must be used.

def assignIPAddresses(self, prefix=None):
        '''
        Assign IP addresses to all interfaces on hosts and routers in the
        network.  
        
        NB: this method assumes that all interfaces are assigned
        addresses on the same subnet.  If you don't want that behavior,
        the setInterfaceAddresses method must be used.
        '''
        if not prefix:
            subnet = ipaddress.IPv4Network('10.0.0.0/8')
        else:
            subnet = ipaddress.IPv4Network(str(prefix),strict=False)

        ipgenerator = subnet.hosts()

        # collect all links; figure out which ones need to be numbered (i.e., 
        # only interfaces connected to hosts and routers)
        nodes_to_number = self.hosts + self.routers

        for u,v in sorted(self.links):
            linkdata = self.getLink(u,v)
            for node in [u,v]:
                if node in nodes_to_number:
                    ifname = linkdata[node]
                    intf = self.getNode(node)['nodeobj'].getInterface(ifname)
                    intf.ipaddr = next(ipgenerator)
                    intf.netmask = subnet.netmask