def ip_gen(self, client_base, server_base, client_ips, server_ips):
     assert client_ips>0
     assert server_ips>0
     ip_gen_c = ASTFIPGenDist(ip_range = [client_base, int2ip(ip2int(client_base) + client_ips - 1)])
     ip_gen_s = ASTFIPGenDist(ip_range = [server_base, int2ip(ip2int(server_base) + server_ips - 1)])
     return ASTFIPGen(dist_client = ip_gen_c,
                      dist_server = ip_gen_s)
    def test_gtpu_mode(self):
        c = self.astf_trex
        if not c.is_tunnel_supported(tunnel_type=1)['is_tunnel_supported']:
            self.skip("tunnel is no supported")

        duration = self.duration
        self.duration = 1
        fname = 'http_simple.py'
        version = 4
        sport = 5000
        add_client_cnt = 255
        client_db = dict()
        ip_prefix = "16.0.0."
        sip = "11.11.0.1"
        dip = "1.1.1.11"
        teid = 0
        while teid <= add_client_cnt:
            c_ip = ip_prefix + str(teid)
            c_ip = ip2int(c_ip)
            client_db[c_ip] = Tunnel(sip, dip, sport, teid, version)
            teid += 1

        tunnel_info = {"clients_list": client_db, "tunnel_type": 1}

        try:
            c.reset()
            c.activate_tunnel(tunnel_type=1, activate=True, loopback=True)
            print(" running {}".format(fname))
            self.run_astf_profile(fname,
                                  m=1,
                                  is_udp=False,
                                  is_tcp=True,
                                  ipv6=False,
                                  check_counters=True,
                                  nc=True,
                                  tunnel_info=tunnel_info)
        finally:
            self.duration = duration
            c.reset()
            c.activate_tunnel(tunnel_type=1, activate=False, loopback=False)