class DpdkWrapper(ClientServerWrapper):

    def get_server_prog_path(self):
        return "../dpdk_performance.py --server --mip 10.224.14.113 --ip 22.4.3.5 --cip 22.4.3.6"

    def get_client_prog_path(self):
        return "../dpdk_performance.py --ip 22.4.3.5  --mip 10.224.14.113 --cip 22.4.3.6"

    def configure_parser(self):
        super(DpdkWrapper, self).configure_parser()
 
        # Arguments
	#self.add_dynamic_client_argument('--mip', self.??, value_only=False, priority=1)
        #self.add_dynamic_client_argument('--ip', self.get_server_manage_ip, value_only=False, priority=2)
        #self.add_dynamic_client_argument('--cip', self.??, value_only=False, priority=3)
        
        self.add_cmd_argument('--invalidMac', help='Pass Invalid Mac', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--setPromisc', help='Set Promiscous Mode', type=str, value_only=False, priority=2)
        self.add_cmd_argument('--add_mac', help='Add Mac Address', type=str, value_only=False, priority=3)
        self.add_cmd_argument('--dest_ip', help='Destination IP', type=str, value_only=False, priority=4)
        self.add_cmd_argument('--txq', help='Transmission Queue', type=str, value_only=False, priority=5)
        self.add_cmd_argument('--rxq', help='Receive Queue', type=str, value_only=False, priority=6)
        self.add_cmd_argument('--portUpInInit', help='The port link is brought up during init', type=str, value_only=False, priority=7)
        self.add_cmd_argument('--mtuSet', help='Set the mtu for the giving amount for mellanox interface', type=str, value_only=False, priority=8)
        self.add_cmd_argument('--vlanFiltering', help='Set vlan filter on or off', type=str, value_only=False, priority=9)
        self.add_cmd_argument('--mtuSetMultipleTimes', help='Set MTU multiple times at run time', type=str, value_only=False, priority=10)
        self.add_cmd_argument('--autonegotiateEthtool', help='Set autonegotiate value through Ethtool', type=str, value_only=False, priority=11)
        self.add_cmd_argument('--rxEthtool', help='Set RX value through Ethtool', type=str, value_only=False, priority=12)
        self.add_cmd_argument('--txEthtool', help='Set TX value through Ethtool', type=str, value_only=False, priority=13)
        self.add_cmd_argument('--disable_rss', help='disable_rss', type=str, value_only=False, priority=14)
        self.add_cmd_argument('--rssQueuesFlage', help='rssQueuesFlage', type=str, value_only=False, priority=15)
        self.add_cmd_argument('--device', help='device to run on', type=str, value_only=False, priority=16)
        self.add_cmd_argument('--dnfs', help='Enable DNFS', type=str, value_only=False, priority=17)
        self.add_cmd_argument('--RSS', help='Enable RSS', type=str, value_only=False, priority=18)
        self.add_cmd_argument('--Bidirectional', help='Enable Bidirectional', type=str, value_only=False, priority=19)
        self.add_cmd_argument('--recv-inline', help='Enable Receive Inline', type=str, value_only=False, priority=20)
        self.add_cmd_argument('--msg-size', help='message Size', type=str, value_only=False, priority=21)
        self.add_cmd_argument('--checksum', help='Check bad checksum IP, UDP or TCP', type=str, value_only=False, priority=22)
        self.add_cmd_argument('--first_case', help='First Performance case', type=str, value_only=False, priority=23)
        self.add_cmd_argument('--last_case', help='Last Performance case', type=str, value_only=False, priority=24)
        self.add_cmd_argument('--master_rc', help='Create New Vlan and Virtual Interface to Test PMD', type=str, value_only=False, priority=25)

    def get_server_manage_ip(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        server_ip = self.ServerPlayer.Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == server_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[0])

        return ip
Exemple #2
0
def parse_topology(topo_file):
	print " *** Parse topology file"
	t_api = TopologyAPI(topo_file)
	test_runner = t_api.get_topology_obj_by_id("test_runner")
	setup_num = str(test_runner.GetAttribute("setup_num"))
	print "Setup num " + setup_num
	return setup_num
Exemple #3
0
def parse_topology(topo_file):
	print " *** Parse topology file"
	t_api = TopologyAPI(topo_file)
	hosts = t_api.get_all_hosts()
	ezbox = t_api.get_topology_obj_by_id("main_ezbox")
	test_runner = t_api.get_topology_obj_by_id("test_runner")
#	print vars(test_runner) 
	setup_num = str(test_runner.GetAttribute("setup_num"))
	print "setup num " + setup_num 
#	print vars(ezbox) 
	host_name = ezbox.GetAttribute("host_name")
	return setup_num
Exemple #4
0
class DpdkWrapper(ClientServerWrapper):

    def get_server_prog_path(self):
        return "echo Server"

    def get_client_prog_path(self):
        return "../ping.py"

    def configure_parser(self):
        super(DpdkWrapper, self).configure_parser()
 
        # Arguments
	self.add_dynamic_client_argument('--ip', self.get_server_manage_ip, value_only=False, priority=1)
        self.add_client_cmd_argument('--msg_size', help='The msg size', type=str, value_only=False, priority=2)
        self.add_client_cmd_argument('--iter_num', help='The iter num', type=str, value_only=False, priority=3)
        self.add_client_cmd_argument('--timeout', help='The timeout', type=str, value_only=False, priority=4)

	#self.add_dynamic_server_argument('--ip_address_server', self.get_server_manage_ip, value_only=True, priority=1)
        #self.add_server_cmd_argument('--port_server', help='The server port', type=str, value_only=True, priority=2)

    def get_server_manage_ip(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        server_ip = self.ServerPlayer.Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == server_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[0])

        return ip
    def get_client_port2(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        client_ip = self.ClientPlayers[0].Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == client_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[1])
        return ip
class DpdkWrapper(ClientServerWrapper):

    def post_server_init(self):
        time.sleep(3)

    def get_server_prog_path(self):
        #return "../dpdk_server --device /dev/mst/mt4115_pciconf0 --serverIPPort1 21.4.3.6 --serverIPPort2 22.4.3.6 --NIC CX4  --mip 10.224.14.113 "#--seed " +  str(self.seed)
        return "../dpdk_server "

    def get_client_prog_path(self):
        #return "../dpdk_client --device /dev/mst/mt4115_pciconf0 --serverIPPort1 21.4.3.6 --serverIPPort2 22.4.3.6 --NIC CX4 --mip 10.224.14.113  "#--seed  " + str(self.seed)
        return "../dpdk_client  "

    def configure_parser(self):
        super(DpdkWrapper, self).configure_parser()
 
        # Arguments
	#self.add_dynamic_client_argument('--mip', self.??, value_only=False, priority=1)
        #self.add_dynamic_client_argument('--ip', self.get_server_manage_ip, value_only=False, priority=2)
        #self.add_dynamic_client_argument('--cip', self.??, value_only=False, priority=3)
        self.add_dynamic_server_argument('--mip', self.get_server_manage_ip, value_only=False, priority=1)
        self.add_dynamic_client_argument('--mip', self.get_server_manage_ip, value_only=False, priority=1)
        self.add_dynamic_server_argument('--cip', self.get_client_manage_ip, value_only=False, priority=1)
        self.add_dynamic_client_argument('--cip', self.get_client_manage_ip, value_only=False, priority=1)

        self.add_dynamic_server_argument('--serverIPPort1', self.get_client_port1, value_only=False, priority=1)
        self.add_dynamic_client_argument('--serverIPPort1', self.get_client_port1, value_only=False, priority=1)
        self.add_dynamic_server_argument('--serverIPPort2', self.get_client_port2, value_only=False, priority=1)
        self.add_dynamic_client_argument('--serverIPPort2', self.get_client_port2, value_only=False, priority=1)
        
        #self.add_dynamic_server_argument('--NIC', self.get_hca_type, value_only=False, priority=1)
        #self.add_dynamic_client_argument('--NIC', self.get_hca_type, value_only=False, priority=1)
        self.add_cmd_argument('--mbuf_size', help='mbuf Size to run testpmd with', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--test', help='test file', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--retaHash', help='reta hash cases', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--serverIPPort1', help='server firest IP ', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--flowDirectorRunLevel', help='Single, multi, random run', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--flowDirector', help='Flow director mode of operation', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--asyncApp', help='Async application test', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--rxVlanStripping', help='rxVlanStripping', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--caseRunLevel', help='case Run Level', type=str, value_only=False, priority=1)
        self.add_test_attribute_argument('--seed', 'seed', priority=3)
        #self.add_cmd_argument('--seed', help='seed Given by MARS ', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--invalidMac', help='Pass Invalid Mac', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--setPromisc', help='Set Promiscous Mode', type=str, value_only=False, priority=2)


        #self.add_cmd_argument('--add_mac', help='Add Mac Address', type=str, value_only=False, priority=3)
        self.add_cmd_argument('--add_mac', help='Add Mac Address', action='store_true', value_only=True, priority=3)

        self.add_cmd_argument('--dest_ip', help='Destination IP', type=str, value_only=False, priority=4)
        self.add_cmd_argument('--txq', help='Transmission Queue', type=str, value_only=False, priority=5)
        self.add_cmd_argument('--rxq', help='Receive Queue', type=str, value_only=False, priority=6)
        self.add_cmd_argument('--portUpInInit', help='The port link is brought up during init', type=str, value_only=False, priority=7)
        self.add_cmd_argument('--mtuSet', help='Set the mtu for the giving amount for mellanox interface', type=str, value_only=False, priority=8)
        self.add_cmd_argument('--vlanFiltering', help='Set vlan filter on or off', type=str, value_only=False, priority=9)
        self.add_cmd_argument('--mtuSetMultipleTimes', help='Set MTU multiple times at run time', type=str, value_only=False, priority=10)
        self.add_cmd_argument('--autonegotiateEthtool', help='Set autonegotiate value through Ethtool', type=str, value_only=False, priority=11)
        self.add_cmd_argument('--rxEthtool', help='Set RX value through Ethtool', type=str, value_only=False, priority=12)
        self.add_cmd_argument('--txEthtool', help='Set TX value through Ethtool', type=str, value_only=False, priority=13)
        self.add_cmd_argument('--disable_rss', help='disable_rss', type=str, value_only=False, priority=14)
        self.add_cmd_argument('--rssQueuesFlage', help='rssQueuesFlage', type=str, value_only=False, priority=15)
        self.add_cmd_argument('--traffic', help='rss traffic type ', type=str, value_only=False, priority=15)
        self.add_cmd_argument('--device', help='device to run on', type=str, value_only=False, priority=16)
        self.add_cmd_argument('--dnfs', help='Enable DNFS', type=str, value_only=False, priority=17)
        self.add_cmd_argument('--vxlan', help='Send VXLAN', type=str, value_only=False, priority=18)
        self.add_cmd_argument('--recv-inline', help='Enable recieve inline', type=str, value_only=False, priority=19)
        self.add_cmd_argument('--m', help='PMD compiled with -m', type=str, value_only=False, priority=20)
        self.add_cmd_argument('--set_flow_control_at_once', help='Set flow control parameters at once', type=str, value_only=False, priority=21)
        self.add_cmd_argument('--checksum', help='Check bad checksum IP, UDP or TCP', type=str, value_only=False, priority=22)
        self.add_cmd_argument('--d', help='PMD compiled with -d', type=str, value_only=False, priority=23)
        self.add_cmd_argument('--vlan', help='Create New Vlan and Virtual Interface to Test PMD', type=str, value_only=False, priority=22)
        self.add_cmd_argument('--master_rc', help='Create New Vlan and Virtual Interface to Test PMD', type=str, value_only=False, priority=23)
        self.add_cmd_argument('--c', help='Run on compiled PMD with -c ', type=str, value_only=False, priority=24)
        self.add_cmd_argument('--ipv6', help='Send IPv6 packets ', type=str, value_only=False, priority=25)
        self.add_cmd_argument('--static', help='DPDK compiled with libs statically ', type=str, value_only=False, priority=26)
        self.add_cmd_argument('--sg1', help='DPDK compiled with SGE_WR_N=1 ', type=str, value_only=False, priority=27)
        self.add_cmd_argument('--dmfs', help='Choose  DMFS mode A0 or B0', type=str, value_only=False, priority=28)
	self.add_cmd_argument('--multicast', help='Multicast test', type=str, value_only=False, priority=29)
        self.add_cmd_argument('--offloaded', help='Offloaded checksum', type=str, value_only=False, priority=30)
        self.add_cmd_argument('--bidirectional', help='bidirectiona traffic ', type=str, value_only=False, priority=31)
        self.add_cmd_argument('--broadcast', help='broadcast traffic ', type=str, value_only=False, priority=32)
        self.add_cmd_argument('--checkSumOptions', help='Check sum options (good/bad) ', type=str, value_only=False, priority=33)
        self.add_cmd_argument('--offloadCheckSum', help='Offload Checksum ', type=str, value_only=False, priority=34)

    def get_server_manage_ip(self):
        return self.ServerPlayer.Ip

    def get_client_manage_ip(self):
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        client_ip = self.ClientPlayers[0].Ip
        return client_ip

    def get_hca_type(self):
        '''
        p = re.compile('^HCA')
        lines = [line.rstrip('\n') for line in open('/root/dataForCollector.txt')]
        for line in lines:
            if p.match(line):
                
                print "real is",line.split(':')[1]
            else:
                print "yes"
        '''
        
        #self.ServerPlayer.run_process('cat /root/dataForCollector.txt')
        
        #print "output", self.ServerPlayer.output_list
        return "CX4"

    def get_client_port1(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        client_ip = self.ClientPlayers[0].Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == client_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[0])
        return ip

    def get_client_port2(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        client_ip = self.ClientPlayers[0].Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == client_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[1])
        return ip
class SockperfWrapper(ClientServerWrapper):

    def get_server_prog_path(self):
        return "../sockperfWrapper.py --daemon " #--daemon --ip 11.4.3.7 --mip 10.224.14.162 --cip 11.4.3.8 "

    def get_client_prog_path(self):
        return "../sockperfWrapper.py " #--ip 11.4.3.7 --mip 10.224.14.162 --cip 11.4.3.8 "

    def configure_parser(self):
        super(SockperfWrapper, self).configure_parser()

        # Arguments
        #self.add_dynamic_client_argument('--mip', self.??, value_only=False, priority=1)
        
        #self.add_dynamic_client_argument('--cip', self.??, value_only=False, priority=3)
        self.add_server_cmd_argument('--daemon',help='Run sockperf wrapper as a daemon', type=str, value_only=False, priority=1)
        self.add_dynamic_server_argument('--ip', self.get_server_tested_ip, value_only=False, priority=2)
        self.add_dynamic_client_argument('--ip', self.get_server_tested_ip, value_only=False, priority=2)
        self.add_dynamic_server_argument('--mip', self.get_server_manage_ip, value_only=False, priority=3)
        self.add_dynamic_client_argument('--mip', self.get_server_manage_ip, value_only=False, priority=3)
        self.add_dynamic_server_argument('--cip', self.get_client_tested_ip, value_only=False, priority=4)
        self.add_dynamic_client_argument('--cip', self.get_client_tested_ip, value_only=False, priority=4)
        #self.add_server_cmd_argument('--daemon',help='Run sockperf wrapper as a daemon', type=str, value_only=False, priority=1)
        #self.add_dynamic_cmd_argument('--ip', self.get_server_tested_ip, value_only=False, priority=2)
        #self.add_dynamic_cmd_argument('--mip', self.get_server_manage_ip, value_only=False, priority=3)
        #self.add_dynamic_cmd_argument('--cip', self.get_client_tested_ip, value_only=False, priority=4)

        self.add_cmd_argument('--activity', help='Measure activity by printing a \'.\' for the last <N> messages processed.', type=int, value_only=False, priority=12)
        self.add_cmd_argument('--Activity', help='Measure activity by printing the duration for last <N> messages processed.', type=int, value_only=False, priority=14)
        self.add_cmd_argument('--mc-loopback-enable', help='Enables mc loopback (default: Disabled)', type=str, value_only=False, priority=21)
        self.add_cmd_argument('--vmazcopyread', help='If possible use VMA\'s zero copy reads API (See VMA\'s readme)', type=str, value_only=False, priority=24)
        self.add_cmd_argument('--nonblocked', help='Open non-blocked sockets.', type=str, value_only=False, priority=33)
        self.add_cmd_argument('--dontwarmup', help='Don\'t send warm up messages on start', type=str, value_only=False, priority=40)
        self.add_cmd_argument('--buffer-size', help='Set total socket receive/send buffer <size> in bytes (system defined by default)', type=long, value_only=False, priority=35)
        self.add_cmd_argument('--msg-size', help='Use messages of size <size> bytes (Minimum Default:12)', type=str, value_only=False, priority=34)
        self.add_cmd_argument('--mps', help='Set number of messages-per-second (Default = 10000 - for under-load mode, or max - for ping-pong and throughput modes', type=str, value_only=False, priority=39)
        self.add_cmd_argument('--burst', help='Control the client\'s number of a messages sent in every burst', type=long, value_only=False, priority=41)
        self.add_cmd_argument('--time', help='Run for <sec> seconds (Default 1, max = 36000000)', type=long, value_only=False, priority=11)
        self.add_cmd_argument('--tcp', help='Use TCP protocol (Default: UDP)', type=str, value_only=False, priority=37)
        self.add_cmd_argument('--iomux-type', help='Type of multiple file descriptors handle [s|select|p|poll|e|epoll|r|recvfrom](default select)', type=str, value_only=False, priority=13)
        self.add_cmd_argument('--file', help='Read multiple ip+port combinations from file <file> (server uses select)', type=str, value_only=False, priority=36)
        self.add_cmd_argument('--timeout', help='Set select/poll/epoll timeout to <msec>, -1 for infinite (Default is 10 msec)', type=int, value_only=False, priority=15)
        self.add_cmd_argument('--mc-rx-if', help='Address of interface on which to receive mulitcast messages (can be other than route table)', type=str, value_only=False, priority=16)
        self.add_cmd_argument('--mc-tx-if', help='Address of interface on which to transmit mulitcast messages (can be other than route table)', type=str, value_only=False, priority=17)
        self.add_cmd_argument('--mc-ttl', help='Limit the lifetime of the message (Default: 2)', type=int, value_only=False, priority=18)
        self.add_cmd_argument('--pre-warmup-wait', help='Time to wait before sending warm up messages (seconds)', type=int, value_only=False, priority=19)
        self.add_cmd_argument('--no-rdtsc', help='Don\'t use register when taking time; instead use monotonic clock.', type=str, value_only=False, priority=20)
        self.add_cmd_argument('--ping-pong', help='Run sockperf client for latency test in ping pong mode.', type=str, value_only=False, priority=5)
        self.add_cmd_argument('--playback', help='Run sockperf client for latency test using playback of predefined traffic, based on timeline and message size.', type=str, value_only=False, priority=6)
        self.add_cmd_argument('--under-load', help='Run sockperf client for latency under load test.', type=str, value_only=False, priority=7)
        self.add_cmd_argument('--throughput', help='Run sockperf client for one way throughput test.', type=str, value_only=False, priority=8)
        self.add_cmd_argument('--server', help='Run sockperf as a server.', type=str, value_only=False, priority=9)
        self.add_cmd_argument('--servers', help='The number of servers to be started', type=int, value_only=False, priority=22)
        self.add_cmd_argument('--mode', help='The mode to run sockperf with', type=int, value_only=False, priority=23)
        self.add_cmd_argument('--multicast', help='Generate multicast traffic', type=str, value_only=False, priority=38)
        self.add_cmd_argument('--sockets', help='The number of sockets in the sockperf feed file', type=str, value_only=False, priority=10)
        self.add_cmd_argument('--multi-port', help='Generate traffic across multiple ports', type=str, value_only=False, priority=25)
        self.add_cmd_argument('--mixed-file', help='Generate a mixed feed file', type=str, value_only=False, priority=26)
        self.add_cmd_argument('--VMA_APPLICATION_ID', help='VMA application ID', type=str, value_only=False, priority=27)
        self.add_cmd_argument('--VMA_CONFIG_FILE', help='VMA configuration file', type=str, value_only=False, priority=28)
        self.add_cmd_argument('--VMA_STATS_FILE', help='The output file for the VMA state', type=str, value_only=False, priority=29)
        self.add_cmd_argument('--clients', help='The number of clients', type=int, value_only=False, priority=30)
        self.add_cmd_argument('--management', help='Use management interface', type=str, value_only=False, priority=31)
        self.add_cmd_argument('--max-memory', help='Use maximum memory availble on the machine', type=str, value_only=False, priority=32)


    def get_server_manage_ip(self):
        return self.ServerPlayer.Ip

    def get_server_tested_ip(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        server_ip = self.ServerPlayer.Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == server_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[0])

        return ip

 
    def get_client_tested_ip(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        client_ip = self.ClientPlayers[0].Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == client_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[0])

        return ip
Exemple #8
0
class DpdkWrapper(ClientServerWrapper):

    def get_server_prog_path(self):
        return "../dpdk.py --server --mip 10.224.14.113 --ip 21.4.3.5 --cip_port1 21.4.3.6 --cip_port2 22.4.3.6 --NIC cx4 " 

    def get_client_prog_path(self):
        return "../dpdk.py --ip 21.4.3.5  --mip 10.224.14.113 --cip_port1 21.4.3.6 --cip_port2 22.4.3.6 --NIC cx4 "

    def configure_parser(self):
        super(DpdkWrapper, self).configure_parser()
 
        # Arguments
	#self.add_dynamic_client_argument('--mip', self.??, value_only=False, priority=1)
        #self.add_dynamic_client_argument('--ip', self.get_server_manage_ip, value_only=False, priority=2)
        #self.add_dynamic_client_argument('--cip', self.??, value_only=False, priority=3)
        
        self.add_cmd_argument('--invalidMac', help='Pass Invalid Mac', type=str, value_only=False, priority=1)
        self.add_cmd_argument('--setPromisc', help='Set Promiscous Mode', type=str, value_only=False, priority=2)
        self.add_cmd_argument('--add_mac', help='Add Mac Address', type=str, value_only=False, priority=3)
        self.add_cmd_argument('--dest_ip', help='Destination IP', type=str, value_only=False, priority=4)
        self.add_cmd_argument('--txq', help='Transmission Queue', type=str, value_only=False, priority=5)
        self.add_cmd_argument('--rxq', help='Receive Queue', type=str, value_only=False, priority=6)
        self.add_cmd_argument('--portUpInInit', help='The port link is brought up during init', type=str, value_only=False, priority=7)
        self.add_cmd_argument('--mtuSet', help='Set the mtu for the giving amount for mellanox interface', type=str, value_only=False, priority=8)
        self.add_cmd_argument('--vlanFiltering', help='Set vlan filter on or off', type=str, value_only=False, priority=9)
        self.add_cmd_argument('--mtuSetMultipleTimes', help='Set MTU multiple times at run time', type=str, value_only=False, priority=10)
        self.add_cmd_argument('--autonegotiateEthtool', help='Set autonegotiate value through Ethtool', type=str, value_only=False, priority=11)
        self.add_cmd_argument('--rxEthtool', help='Set RX value through Ethtool', type=str, value_only=False, priority=12)
        self.add_cmd_argument('--txEthtool', help='Set TX value through Ethtool', type=str, value_only=False, priority=13)
        self.add_cmd_argument('--disable_rss', help='disable_rss', type=str, value_only=False, priority=14)
        self.add_cmd_argument('--rssQueuesFlage', help='rssQueuesFlage', type=str, value_only=False, priority=15)
        self.add_cmd_argument('--traffic', help='rss traffic type ', type=str, value_only=False, priority=15)
        self.add_cmd_argument('--device', help='device to run on', type=str, value_only=False, priority=16)
        self.add_cmd_argument('--dnfs', help='Enable DNFS', type=str, value_only=False, priority=17)
        self.add_cmd_argument('--vxlan', help='Send VXLAN', type=str, value_only=False, priority=18)
        self.add_cmd_argument('--recv-inline', help='Enable recieve inline', type=str, value_only=False, priority=19)
        self.add_cmd_argument('--m', help='PMD compiled with -m', type=str, value_only=False, priority=20)
        self.add_cmd_argument('--set_flow_control_at_once', help='Set flow control parameters at once', type=str, value_only=False, priority=21)
        self.add_cmd_argument('--checksum', help='Check bad checksum IP, UDP or TCP', type=str, value_only=False, priority=22)
        self.add_cmd_argument('--d', help='PMD compiled with -d', type=str, value_only=False, priority=23)
        self.add_cmd_argument('--vlan', help='Create New Vlan and Virtual Interface to Test PMD', type=str, value_only=False, priority=22)
        self.add_cmd_argument('--master_rc', help='Create New Vlan and Virtual Interface to Test PMD', type=str, value_only=False, priority=23)
        self.add_cmd_argument('--c', help='Run on compiled PMD with -c ', type=str, value_only=False, priority=24)
        self.add_cmd_argument('--ipv6', help='Send IPv6 packets ', type=str, value_only=False, priority=25)
        self.add_cmd_argument('--static', help='DPDK compiled with libs statically ', type=str, value_only=False, priority=26)
        self.add_cmd_argument('--sg1', help='DPDK compiled with SGE_WR_N=1 ', type=str, value_only=False, priority=27)
        self.add_cmd_argument('--dmfs', help='Choose  DMFS mode A0 or B0', type=str, value_only=False, priority=28)
	self.add_cmd_argument('--multicast', help='Multicast test', type=str, value_only=False, priority=29)
        self.add_cmd_argument('--offloaded', help='Offloaded checksum', type=str, value_only=False, priority=30)
        self.add_cmd_argument('--bidirectional', help='bidirectiona traffic ', type=str, value_only=False, priority=31)
        
    def get_server_manage_ip(self):
        # Define needed parameters
        here = os.path.dirname(os.path.abspath(__file__))
        print("Running directory is " + here + "!")
        print("Running user is " + getpass.getuser() + "!")

        server_ip = self.ServerPlayer.Ip
        ip = ""

        self.topology_api = TopologyAPI(self.topo_file)
        hosts = self.topology_api.get_all_hosts()
        for host in hosts:
            base_ip = self.topology_api.get_object_attribute(host, "BASE_IP")
            if base_ip == server_ip:
                ports = self.topology_api.get_device_active_ports(host)
                ip = self.topology_api.get_port_ip(ports[0])

        return ip