summaryrefslogtreecommitdiffstats
path: root/vpp-api-test
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-02-19 13:52:44 +0000
committerGerrit Code Review <gerrit@fd.io>2016-02-19 15:58:07 +0000
commitef65cb0696b3ee42834a72a35c1eb08da75eed99 (patch)
treef949c0aea6b0d3ffd9059287c94bb9e20522338a /vpp-api-test
parentb44e9bc90b634b07d5f93a731a95028adc73bcbc (diff)
Add custom mac address option to vhost interfaces.
Generating a new MAC address everytime vpp reboots can quickly become cumbersome (e.g. in test scenarios). This commit allows vhost mac addresses to be configured manually. Change-Id: Ic6d16a2d14cdf8e49dc29041bbafde39d9fc8370 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'vpp-api-test')
-rw-r--r--vpp-api-test/vat/api_format.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 13b2c0d64b9..a1a023be28b 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -6893,6 +6893,8 @@ static int api_create_vhost_user_if (vat_main_t * vam)
u8 is_server = 0;
u8 file_name_set = 0;
u32 custom_dev_instance = ~0;
+ u8 hwaddr[6];
+ u8 use_custom_mac = 0;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
if (unformat (i, "socket %s", &file_name)) {
@@ -6900,6 +6902,8 @@ static int api_create_vhost_user_if (vat_main_t * vam)
}
else if (unformat (i, "renumber %"PRIu32, &custom_dev_instance))
;
+ else if (unformat (i, "mac %U", unformat_ethernet_address, hwaddr))
+ use_custom_mac = 1;
else if (unformat (i, "server"))
is_server = 1;
else
@@ -6926,6 +6930,8 @@ static int api_create_vhost_user_if (vat_main_t * vam)
mp->renumber = 1;
mp->custom_dev_instance = ntohl(custom_dev_instance);
}
+ mp->use_custom_mac = use_custom_mac;
+ memcpy(mp->mac_address, hwaddr, 6);
S; W;
/* NOTREACHED */
@@ -8993,7 +8999,8 @@ _(l2_interface_vlan_tag_rewrite, \
"[disable][push-[1|2]][pop-[1|2]][translate-1-[1|2]] \n" \
"[translate-2-[1|2]] [push_dot1q 0] tag1 <nn> tag2 <nn>") \
_(create_vhost_user_if, \
- "socket <filename> [server] [renumber <dev_instance>]") \
+ "socket <filename> [server] [renumber <dev_instance>] " \
+ "[mac <mac_address>]") \
_(modify_vhost_user_if, \
"<intfc> | sw_if_index <nn> socket <filename>\n" \
"[server] [renumber <dev_instance>]") \