nat: refactoring NAT44ED cfg functions
[vpp.git] / src / plugins / nat / nat44-ed / nat44_ed_cli.c
index 1d54f99..cb0fe9e 100644 (file)
@@ -665,8 +665,7 @@ snat_feature_command_fn (vlib_main_t * vm,
   u32 *inside_sw_if_indices = 0;
   u32 *outside_sw_if_indices = 0;
   u8 is_output_feature = 0;
-  int is_del = 0;
-  int i;
+  int i, rv, is_del = 0;
 
   sw_if_index = ~0;
 
@@ -701,8 +700,15 @@ snat_feature_command_fn (vlib_main_t * vm,
          sw_if_index = inside_sw_if_indices[i];
          if (is_output_feature)
            {
-             if (snat_interface_add_del_output_feature
-                 (sw_if_index, 1, is_del))
+             if (is_del)
+               {
+                 rv = nat44_ed_del_output_interface (sw_if_index);
+               }
+             else
+               {
+                 rv = nat44_ed_add_output_interface (sw_if_index);
+               }
+             if (rv)
                {
                  error = clib_error_return (0, "%s %U failed",
                                             is_del ? "del" : "add",
@@ -713,7 +719,15 @@ snat_feature_command_fn (vlib_main_t * vm,
            }
          else
            {
-             if (snat_interface_add_del (sw_if_index, 1, is_del))
+             if (is_del)
+               {
+                 rv = nat44_ed_del_interface (sw_if_index, 1);
+               }
+             else
+               {
+                 rv = nat44_ed_add_interface (sw_if_index, 1);
+               }
+             if (rv)
                {
                  error = clib_error_return (0, "%s %U failed",
                                             is_del ? "del" : "add",
@@ -732,8 +746,15 @@ snat_feature_command_fn (vlib_main_t * vm,
          sw_if_index = outside_sw_if_indices[i];
          if (is_output_feature)
            {
-             if (snat_interface_add_del_output_feature
-                 (sw_if_index, 0, is_del))
+             if (is_del)
+               {
+                 rv = nat44_ed_del_output_interface (sw_if_index);
+               }
+             else
+               {
+                 rv = nat44_ed_add_output_interface (sw_if_index);
+               }
+             if (rv)
                {
                  error = clib_error_return (0, "%s %U failed",
                                             is_del ? "del" : "add",
@@ -744,7 +765,15 @@ snat_feature_command_fn (vlib_main_t * vm,
            }
          else
            {
-             if (snat_interface_add_del (sw_if_index, 0, is_del))
+             if (is_del)
+               {
+                 rv = nat44_ed_del_interface (sw_if_index, 0);
+               }
+             else
+               {
+                 rv = nat44_ed_add_interface (sw_if_index, 0);
+               }
+             if (rv)
                {
                  error = clib_error_return (0, "%s %U failed",
                                             is_del ? "del" : "add",