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")
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
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)
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)
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))