aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/arp/arp_test.c
blob: 9eaea91c70906c59c33f64ff37e7c1cf5537463d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 *------------------------------------------------------------------
 * arp_test.c
 *
 * Copyright (c) 2019 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *------------------------------------------------------------------
 */

#include <vat/vat.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
#include <vppinfra/error.h>

#include <vnet/ip/ip_format_fns.h>

#include <vpp/api/types.h>

typedef struct
{
  /* API message ID base */
  u16 msg_id_base;
  u32 ping_id;
  vat_main_t *vat_main;
} arp_test_main_t;

arp_test_main_t arp_test_main;

#define __plugin_msg_base arp_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);

/* Declare message IDs */
#include <vnet/arp/arp.api_enum.h>
#include <vnet/arp/arp.api_types.h>
#include <vlibmemory/vlib.api_types.h>

static int
api_proxy_arp_dump (vat_main_t * vam)
{
  return -1;
}

static int
api_proxy_arp_intfc_dump (vat_main_t * vam)
{
  return -1;
}

static void
vl_api_proxy_arp_details_t_handler (vl_api_proxy_arp_details_t * mp)
{
}

static void
vl_api_proxy_arp_intfc_details_t_handler (vl_api_proxy_arp_intfc_details_t *
					  mp)
{
}

static int
api_proxy_arp_add_del (vat_main_t * vam)
{
  unformat_input_t *i = vam->input;
  vl_api_proxy_arp_add_del_t *mp;
  u32 vrf_id = 0;
  u8 is_add = 1;
  vl_api_ip4_address_t lo, hi;
  u8 range_set = 0;
  int ret;

  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
    {
      if (unformat (i, "vrf %d", &vrf_id))
	;
      else if (unformat (i, "%U - %U", unformat_vl_api_ip4_address, &lo,
			 unformat_vl_api_ip4_address, &hi))
	range_set = 1;
      else if (unformat (i, "del"))
	is_add = 0;
      else
	{
	  clib_warning ("parse error '%U'", format_unformat_error, i);
	  return -99;
	}
    }

  if (range_set == 0)
    {
      errmsg ("address range not set");
      return -99;
    }

  M (PROXY_ARP_ADD_DEL, mp);

  mp->proxy.table_id = ntohl (vrf_id);
  mp->is_add = is_add;
  clib_memcpy (mp->proxy.low, &lo, sizeof (lo));
  clib_memcpy (mp->proxy.hi, &hi, sizeof (hi));

  S (mp);
  W (ret);
  return ret;
}

static int
api_proxy_arp_intfc_enable_disable (vat_main_t * vam)
{
  unformat_input_t *i = vam->input;
  vl_api_proxy_arp_intfc_enable_disable_t *mp;
  u32 sw_if_index;
  u8 enable = 1;
  u8 sw_if_index_set = 0;
  int ret;

  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
    {
      if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
	sw_if_index_set = 1;
      else if (unformat (i, "sw_if_index %d", &sw_if_index))
	sw_if_index_set = 1;
      else if (unformat (i, "enable"))
	enable = 1;
      else if (unformat (i, "disable"))
	enable = 0;
      else
	{
	  clib_warning ("parse error '%U'", format_unformat_error, i);
	  return -99;
	}
    }

  if (sw_if_index_set == 0)
    {
      errmsg ("missing interface name or sw_if_index");
      return -99;
    }

  M (PROXY_ARP_INTFC_ENABLE_DISABLE, mp);

  mp->sw_if_index = ntohl (sw_if_index);
  mp->enable = enable;

  S (mp);
  W (ret);
  return ret;
}

#include <vnet/arp/arp.api_test.c>

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
r | | ... | - rxq - Number of RX queues, default value: ${None}. Type: integer | | ... | | [Arguments] | ${frame_size} | ${phy_cores} | ${rxq}=${None} | | ... | | Set Test Variable | \${frame_size} | | ... | | Given Add worker threads and rxqueues to all DUTs | ${phy_cores} | ${rxq} | | And Add PCI devices to all DUTs | | And Set Max Rate And Jumbo And Handle Multi Seg | | And Apply startup configuration on all VPP DUTs | | When Initialize L2 bridge domain with IPv4 ACLs on DUT1 in 3-node circular topology | | Then Find NDR and PDR intervals using optimized search *** Test Cases *** | tc01-64B-1c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 64B | 1C | | frame_size=${64} | phy_cores=${1} | tc02-64B-2c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 64B | 2C | | frame_size=${64} | phy_cores=${2} | tc03-64B-4c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 64B | 4C | | frame_size=${64} | phy_cores=${4} | tc04-1518B-1c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 1518B | 1C | | frame_size=${1518} | phy_cores=${1} | tc05-1518B-2c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 1518B | 2C | | frame_size=${1518} | phy_cores=${2} | tc06-1518B-4c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 1518B | 4C | | frame_size=${1518} | phy_cores=${4} | tc07-9000B-1c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 9000B | 1C | | frame_size=${9000} | phy_cores=${1} | tc08-9000B-2c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 9000B | 2C | | frame_size=${9000} | phy_cores=${2} | tc09-9000B-4c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | 9000B | 4C | | frame_size=${9000} | phy_cores=${4} | tc10-IMIX-1c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | IMIX | 1C | | frame_size=IMIX_v4_1 | phy_cores=${1} | tc11-IMIX-2c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | IMIX | 2C | | frame_size=IMIX_v4_1 | phy_cores=${2} | tc12-IMIX-4c-eth-l2bdbasemaclrn-oacl50sf-100flows-ndrpdr | | [Tags] | IMIX | 4C | | frame_size=IMIX_v4_1 | phy_cores=${4}