Thanks, Dave. I will change the code at least for action-name, table-name.
If you see the help for my CLI, you will see a <key> and <value>. I would love to entry the key and value as a vector for CLI. Let me look into it. Hemant From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Dave Barach Sent: Friday, November 27, 2020 7:40 PM To: hem...@mnkcg.com; slu...@cisco.com; vpp-dev@lists.fd.io Subject: Re: [vpp-dev] unformat fails processing > 3 variables This will make you sad. Don’t write code line this: if (unformat (line_input, "%s %s %x %hhu %hhu %hu %hu %s %hhu %hu %hu %u %x %x %hu %hhu %hhu", ...)) <etc> If you want to parse a bunch of different fields, do it this way, aka the way it’s done elsewhere in the code base: if (unformat (line_input, “table-name %s”, &tbl_name)) ; else if (unformat (line_input, “action-name %s”, &action_name) ; ... etc ... } else { error = clib_error_return } That way you can provide default values – and an accurate help string! – which might help you type what you mean. Steven already found one typo. There are probably several more. From: vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> <vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> > On Behalf Of hemant via lists.fd.io Sent: Friday, November 27, 2020 7:24 PM To: slu...@cisco.com <mailto:slu...@cisco.com> ; vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> Subject: Re: [vpp-dev] unformat fails processing > 3 variables Sorry, I fat-fingered one format tag during moving the snippet of code to github. Even with 18 format tags and 18 args, I still fail. I used a delimiter of “=>” between table entry key and the entry value. vpp# upf add-entry pkt_filter4_0 permit4 0xac100102 0xac100202 17 0 61 2152 => 130 0 1 5241 0x03030302 0x03030301 2152 1 0 upf add-entry: unknown input '' vpp# Thanks, Hemant From: Steven Luong (sluong) <slu...@cisco.com <mailto:slu...@cisco.com> > Sent: Friday, November 27, 2020 7:14 PM To: hem...@mnkcg.com <mailto:hem...@mnkcg.com> ; vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> Subject: Re: [vpp-dev] unformat fails processing > 3 variables You have 17 format tags, but you pass 18 arguments to the unformat function. Is that intentional? Steven From: <vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> > on behalf of "hemant via lists.fd.io" <hemant=mnkcg....@lists.fd.io <mailto:hemant=mnkcg....@lists.fd.io> > Reply-To: "hem...@mnkcg.com <mailto:hem...@mnkcg.com> " <hem...@mnkcg.com <mailto:hem...@mnkcg.com> > Date: Friday, November 27, 2020 at 3:52 PM To: "vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> " <vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> > Subject: [vpp-dev] unformat fails processing > 3 variables I am writing VPP CLI for the first time. Please see this new CLI I developed for my VPP plugin at the link below. https://github.com/hesingh/misc/blob/master/vpp-issues/cli.c If I use more than three variables with unformat on line <https://github.com/hesingh/misc/blob/master/vpp-issues/cli.c#L26>, I run into the error on this line of code in the same file <https://github.com/hesingh/misc/blob/master/vpp-issues/cli.c#L47> Any idea how to get around this issue? Thanks, Hemant
smime.p7s
Description: S/MIME cryptographic signature
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#18182): https://lists.fd.io/g/vpp-dev/message/18182 Mute This Topic: https://lists.fd.io/mt/78558564/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-