Example #1
0
def _print(filename, **_kwargs):
    """Prints the JSON flow table from a file in a human readable format"""
    with open(filename, 'r', encoding='utf-8') as file_handle:
        msg = json.load(file_handle)
    datapath = FakeRyuDp()
    ofmsg = ofp_parser.ofp_msg_from_jsondict(datapath, msg)
    table = FakeOFTable(1)
    table.apply_ofmsgs([ofmsg])
    print(table)
Example #2
0
def probe(filename, packet):
    """Prints the actions applied to packet by the table from the file"""
    with open(filename, 'r', encoding='utf-8') as file_handle:
        msg = json.load(file_handle)
    datapath = FakeRyuDp()
    ofmsg = ofp_parser.ofp_msg_from_jsondict(datapath, msg)
    table = FakeOFTable(1)
    table.apply_ofmsgs([ofmsg])
    instructions, out_packet = table.lookup(packet)
    print(packet)
    for instruction in instructions:
        print(instruction)
    print(out_packet)
Example #3
0
 def _jsondict_to_msg(dp, jsondict):
     return ofproto_parser.ofp_msg_from_jsondict(dp, jsondict)