def staticroutes(self, i, prefix, numnodes):
        ''' Add static routes on node number i to the other nodes in the chain.
        '''
        routecmd = ["/sbin/ip", "route", "add"]
        node = self.nodes[i-1]
        neigh_left = ""
        neigh_right = ""
        # add direct interface routes first
        if i > 1:
            neigh_left = "%s" % prefix.addr(i - 1)
            cmd = routecmd + [neigh_left, "dev", node.netif(0).name]
            (status, result) = node.cmdresult(cmd)
            if status != 0:
                self.warn("failed to add interface route: %s" % cmd)
        if i < numnodes:
            neigh_right = "%s" % prefix.addr(i + 1)
            cmd = routecmd + [neigh_right, "dev", node.netif(0).name]
            (status, result) = node.cmdresult(cmd)
            if status != 0:
                self.warn("failed to add interface route: %s" % cmd)

        # add static routes to all other nodes via left/right neighbors
        for j in xrange(1, numnodes + 1):
            if abs(j - i) < 2:
                continue
            addr = prefix.addr(j) % "%s"
            if j < i:
                gw = neigh_left
            else:
                gw = neigh_right
            cmd = routecmd + [addr, "via", gw]
            (status, result) = node.cmdresult(cmd)
            if status != 0:
                self.warn("failed to add route: %s" % cmd)
dataset/ETHPy150Open coreemu/core/daemon/examples/netns/wlanemanetests.py/Experiment.staticroutes/swapped operands of `%`