#! /usr/bin/env python3

from vswitch.ovdk import OvsDpdk
import logging
import argparse

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG, format="----[%(asctime)s ]: %(message)s")
    parser = argparse.ArgumentParser(description='Add a port-to-port flow to an OVS-DPDK bridge')
    parser.add_argument('--bridge', required=True, dest='bridge', action='store', help='Bridge name')
    parser.add_argument('--in-port', required=True, dest='in_port', action='store', help='Input port (e.g. dpdk0)')
    parser.add_argument('--out-ports', required=True, dest='out_ports', action='store',
                        help='Comma separated list of output ports (e.g. vhost-user1,vhost-user2)')
    args = parser.parse_args()

    ovdk = OvsDpdk()
    ovdk.flow_add_port2port(args.bridge, args.in_port, args.out_ports.split(','))
