make test: add quic multistream test case

- Also refactor test_quic.py to prepare for
  external echo tests & ipv6 tests

Change-Id: I7dff60b375ed67d920e73294e0bf491cd3206d56
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index bcb2edf..edc6a2a 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -365,29 +365,38 @@
 					       session_t * s, u8 is_fail)
 {
   echo_client_main_t *ecm = &echo_client_main;
-  vnet_connect_args_t a;
+  vnet_connect_args_t *a = 0;
   int rv;
   u8 thread_index = vlib_get_thread_index ();
   session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL;
+  u32 stream_n;
 
   DBG ("QUIC Connection handle %d", session_handle (s));
 
-  a.uri = (char *) ecm->connect_uri;
-  parse_uri (a.uri, &sep);
+  vec_validate (a, 1);
+  a->uri = (char *) ecm->connect_uri;
+  parse_uri (a->uri, &sep);
   sep.transport_opts = session_handle (s);
-  sep.port = 0;
-  clib_memset (&a, 0, sizeof (a));
-  a.app_index = ecm->app_index;
-  a.api_context = -1 - api_context;
-  clib_memcpy (&a.sep_ext, &sep, sizeof (sep));
+  sep.port = 0;			/* QUIC: create a stream flag */
 
-  if ((rv = vnet_connect (&a)))
+  for (stream_n = 0; stream_n < ecm->quic_streams; stream_n++)
     {
-      clib_error ("Session opening failed: %d", rv);
-      return -1;
+      clib_memset (a, 0, sizeof (a));
+      a->app_index = ecm->app_index;
+      a->api_context = -1 - api_context;
+      clib_memcpy (&a->sep_ext, &sep, sizeof (sep));
+
+      DBG ("QUIC opening stream %d", stream_n);
+      if ((rv = vnet_connect (a)))
+	{
+	  clib_error ("Stream session %d opening failed: %d", stream_n, rv);
+	  return -1;
+	}
+      DBG ("QUIC stream %d connected", stream_n);
     }
   vec_add1 (ecm->quic_session_index_by_thread[thread_index],
 	    session_handle (s));
+  vec_free (a);
   return 0;
 }
 
@@ -751,6 +760,7 @@
   session_endpoint_cfg_t sep = SESSION_ENDPOINT_CFG_NULL;
   int rv;
 
+  ecm->quic_streams = 1;
   ecm->bytes_to_send = 8192;
   ecm->no_return = 0;
   ecm->fifo_size = 64 << 10;
@@ -775,6 +785,8 @@
 	;
       else if (unformat (input, "nclients %d", &n_clients))
 	;
+      else if (unformat (input, "quic-streams %d", &ecm->quic_streams))
+	;
       else if (unformat (input, "mbytes %lld", &tmp))
 	ecm->bytes_to_send = tmp << 20;
       else if (unformat (input, "gbytes %lld", &tmp))
@@ -841,7 +853,7 @@
 
 
   ecm->ready_connections = 0;
-  ecm->expected_connections = n_clients;
+  ecm->expected_connections = n_clients * ecm->quic_streams;
   ecm->rx_total = 0;
   ecm->tx_total = 0;
 
diff --git a/src/vnet/session-apps/echo_client.h b/src/vnet/session-apps/echo_client.h
index 68a5921..34cf0bd 100644
--- a/src/vnet/session-apps/echo_client.h
+++ b/src/vnet/session-apps/echo_client.h
@@ -65,6 +65,7 @@
   u32 tls_engine;			/**< TLS engine mbedtls/openssl */
   u8 is_dgram;
   u32 no_copy;				/**< Don't memcpy data to tx fifo */
+  u32 quic_streams;			/**< QUIC streams per connection */
 
   /*
    * Test state variables