Exemplo n.º 1
0
            "params": {
                "from_port": int(src),
                "to_port": int(dst)
            }
        }
        send_command(s, [data])
    elif input == "linkdown":
        src = raw_input("Enter source id:")
        dst = raw_input("Enter target id:")
        data = {
            "method": "remove_link",
            "id": 1,
            "jsonrpc": "2.0",
            "params": {
                "from_port": int(src),
                "to_port": int(dst)
            }
        }
        send_command(s, [data])
    elif input == "print":
        sw = raw_input("Enter table name:")
        data = r.print_table(sw)
        send_command(s, data)
    elif input == "remove":
        sw = raw_input("Enter switch name:")
        rule_id = raw_input("Enter a rule id:")
        data = r.delete_rule(sw, rule_id)
        send_command(s, data)
    elif input == "end" or input == "q":
        break
Exemplo n.º 2
0
        src = raw_input("Enter source id:")
        dst = raw_input("Enter target id:")
        data = {"method":"add_link",
                "id":1,
                "jsonrpc":"2.0",
                "params":{"from_port":int(src),
                          "to_port":int(dst)}
                  }
        send_command(s,[data])
    elif input == "linkdown":
        src = raw_input("Enter source id:")
        dst = raw_input("Enter target id:")
        data = {"method":"remove_link",
                "id":1,
                "jsonrpc":"2.0",
                "params":{"from_port":int(src),
                          "to_port":int(dst)}
                  }
        send_command(s,[data])
    elif input == "print":
        sw = raw_input("Enter table name:")
        data = r.print_table(sw)
        send_command(s,data)
    elif input == "remove":
        sw = raw_input("Enter switch name:")
        rule_id = raw_input("Enter a rule id:")
        data = r.delete_rule(sw, rule_id)
        send_command(s,data)
    elif input == "end" or input == "q":
        break