session: implement app_ns deletion
[vpp.git] / src / plugins / unittest / session_test.c
index ad9c976..292f725 100644 (file)
@@ -420,6 +420,10 @@ session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input)
   detach_args.app_index = client_index;
   vnet_application_detach (&detach_args);
 
+  ns_args.is_add = 0;
+  error = vnet_app_namespace_add_del (&ns_args);
+  SESSION_TEST ((error == 0), "app ns delete should succeed: %d", error);
+
   /* Allow the disconnects to finish before removing the routes. */
   vlib_process_suspend (vm, 10e-3);
 
@@ -625,15 +629,12 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input)
   SESSION_TEST ((error == 0), "client connect should not return error code");
 
   /* wait for accept */
-  if (vlib_num_workers ())
+  tries = 0;
+  while (!placeholder_accept && ++tries < 100)
     {
-      tries = 0;
-      while (!placeholder_accept && ++tries < 100)
-       {
-         vlib_worker_thread_barrier_release (vm);
-         vlib_process_suspend (vm, 100e-3);
-         vlib_worker_thread_barrier_sync (vm);
-       }
+      vlib_worker_thread_barrier_release (vm);
+      vlib_process_suspend (vm, 100e-3);
+      vlib_worker_thread_barrier_sync (vm);
     }
 
   SESSION_TEST ((placeholder_segment_count == 1),
@@ -769,6 +770,10 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input)
   detach_args.app_index = server_index;
   vnet_application_detach (&detach_args);
 
+  ns_args.is_add = 0;
+  error = vnet_app_namespace_add_del (&ns_args);
+  SESSION_TEST ((error == 0), "app ns delete should succeed: %d", error);
+
   /*
    * Cleanup
    */
@@ -1604,6 +1609,10 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input)
   detach_args.app_index = server_index2;
   vnet_application_detach (&detach_args);
 
+  ns_args.is_add = 0;
+  error = vnet_app_namespace_add_del (&ns_args);
+  SESSION_TEST ((error == 0), "app ns delete should succeed: %d", error);
+
   vec_free (ns_id);
   vec_free (attach_args.name);
   return 0;