Exemplo n.º 1
0
def set_hop_penalty(penalty="10"):
    for node in nodes:
        host = "{}:{}".format(node.forward_ip, node.port)
        s = cmd.connect(host)
        if node.endnode:
            cmd.write_cmd(s, cmd.hop_path, penalty)
        else:
            cmd.write_cmd(s, cmd.hop_path, "0")
Exemplo n.º 2
0
def set_hop_penalty(penalty="10"):
    for node in nodes:
        host = "{}:{}".format(node.forward_ip, node.port)
        s = cmd.connect(host)
        if node.endnode:
            cmd.write_cmd(s, cmd.hop_path, penalty)
        else:
            cmd.write_cmd(s, cmd.hop_path, "0")
Exemplo n.º 3
0
def set_coding_nodes(coding=True, toggle_tq=False):
    c = "1" if coding else "0"
    try:
        for node in nodes:
            host = "{}:{}".format(node.forward_ip, node.port)
            if toggle_tq:
                s = cmd.connect(host)
                cmd.write_cmd(s, cmd.tq_path, c)
                s = cmd.connect(host)
                cmd.write_cmd(s, cmd.catw_path, "1")
            else:
                s = cmd.connect(host)
                cmd.write_cmd(s, cmd.catw_path, c)
    except Exception:
        return False
    else:
        return True
Exemplo n.º 4
0
def set_coding_nodes(coding=True, toggle_tq=False):
    c = "1" if coding else "0"
    try:
        for node in nodes:
            host = "{}:{}".format(node.forward_ip, node.port)
            if toggle_tq:
                s = cmd.connect(host)
                cmd.write_cmd(s, cmd.tq_path, c)
                s = cmd.connect(host)
                cmd.write_cmd(s, cmd.catw_path, "1")
            else:
                s = cmd.connect(host)
                cmd.write_cmd(s, cmd.catw_path, c)
    except Exception:
        return False
    else:
        return True
Exemplo n.º 5
0
def set_tq(node, tq=True):
    print("Random tq: {}".format(tq))
    t = "1" if tq else "0"
    s = cmd.connect(node)
    cmd.write_cmd(s, cmd.tq_path, t)
Exemplo n.º 6
0
def set_coding(node, coding=True):
    print("Network Coding: {}".format(coding))
    c = "1" if coding else "0"
    s = cmd.connect(node)
    cmd.write_cmd(s, cmd.catw_path, c)
Exemplo n.º 7
0
def set_tq(node, tq=True):
    print("Random tq: {}".format(tq))
    t = "1" if tq else "0"
    s = cmd.connect(node)
    cmd.write_cmd(s, cmd.tq_path, t)
Exemplo n.º 8
0
def set_coding(node, coding=True):
    print("Network Coding: {}".format(coding))
    c = "1" if coding else "0"
    s = cmd.connect(node)
    cmd.write_cmd(s, cmd.catw_path, c)
Exemplo n.º 9
0
def set_hold_nodes(hold="30"):
    for node in nodes:
        host = "{}:{}".format(node.forward_ip, node.port)
        s = cmd.connect(host)
        cmd.write_cmd(s, cmd.hold_path, int(hold))
Exemplo n.º 10
0
def set_hold_nodes(hold="30"):
    for node in nodes:
        host = "{}:{}".format(node.forward_ip, node.port)
        s = cmd.connect(host)
        cmd.write_cmd(s, cmd.hold_path, int(hold))