Re: [vpp-dev] Loopback Interface Names

2017-02-23 Thread Burt Silverman
​No problem, Jon. Your original note suggests 2 problems, one in paragraphs
1-3, and the second problem being "not following PRCL". My understanding is
that John Lo's note eliminates the first problem as being interesting, so
that leaves the latter being in the "interesting" bucket. And like you say,
being similar to Linux does not help with that issue.

Burt
___
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Re: [vpp-dev] Loopback Interface Names

2017-02-23 Thread Burt Silverman
​I am arriving a bit late to the party; I just wanted to point out that the
current user interface is similar to that of the Linux losetup command for
Linux loop devices. Here is a silly example to demonstrate:

burts@burtvb:~$ sudo losetup -f junk3.c
[sudo] password for burts:
losetup: junk3.c: Warning: file does not fit into a 512-byte sector; the
end of the file will be ignored.
burts@burtvb:~$ losetup -l
NAME   SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO
/dev/loop0 00  0 0
/home/burts/junk3.c   0

Burt
___
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Re: [vpp-dev] Loopback Interface Names

2017-02-23 Thread Jon Loeliger
Dave,

Thanks for taking the time to help me here!

On Wed, Feb 22, 2017 at 4:47 PM, Dave Barach (dbarach) 
wrote:

> You would certainly have to rewrite vnet_create_loopback_interface(...) a
> little bit. That’s not necessarily a bad thing.
>

Yeah, I figured as much on that front... :-)  I'm not afraid of
giving it a swing.


> Please brain-police the instance number: flunk attempts to create specific
> loopback instances (e.g. loop0) more than once, and so forth. Bitmap, plus
> some upper limit (maybe 16k?) on the loopback instance number.
>

Can do.  Two questions.  If a loopback interface is deleted,
would that free-up the instance number for re-use?  Or is
there lingering reason to never reuse an instance number?
And second, is there a bit-vector implementation around?
I would assume so and I just need to go looking...?

I still need to resolve the name expectations; that is, expecting
"Loopback" to be the base, and not "loop".  Does one of these
options make more sense here?

1) Have the API create call supply the desired name directly,
defaulting to "loop"-names if none are specified.

2) Have a loopback-module-global-ish config variable stating
to be in "loop" or "Loopback" mode.  Mode can be set via
new loopback API config call, or via VPP startup config setting.

3) Tell our users to get used to the New "loop" World Order? :-)

HTH… Dave
>

Thanks,
jdl


> PS -- At the risk of foretelling the future, bridge names are going to
 have this same naming issue, right?  'Cuz those are next up!
___
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Re: [vpp-dev] Loopback Interface Names

2017-02-22 Thread John Lo (loj)
Hi Jon,

The CLI is intended for human user. One can thus create an interface, use “show 
int” to see the name of the created interface and use it for subsequent CLIs on 
that interface.

The API calls expect the caller to specify sw_if_index of an interface to be 
configured. The interface creation API such as create_loopback will return the 
sw_if_index of the created loopback interface. Thus, calls following creation 
of loopback will use the returned sw_if_index in subsequent API calls to 
configure its IP address or put it in a BD as BVI. There is no assumption 
needed as interface name is not involved .

As for getting the name of interfaces and their sw_if_index, there is the 
dump_interface_table API which will provide interface names and associated 
sw_if_index of all interfaces.

Regards,
John


From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On 
Behalf Of Jon Loeliger
Sent: Wednesday, February 22, 2017 4:56 PM
To: vpp-dev 
Subject: [vpp-dev] Loopback Interface Names

Folks,

So, I want to address this example from Dave's "home gateway" example:

loopback create
set int l2 bridge loop0 1 bvi
set int ip address loop0 192.168.1.1/24
set int state loop0 up

Here, lines 2, 3, and 4 all have unspoken knowledge of the effects of
line 1.  Specifically, it "knows" that "loop0", by name, just got
created.  One just knows.

In VPP land, one issues an API call to create a loopback interface.
VPP makes up the name for it ("loop0"), and tells you a new sw_if_index
for it.  Likely something like 5 or 6 or so, depending on how many
other IFs have been made already.

In a Popular Router Configuration Language (PRCL), one says
interface loopback 0
and it creates the named interface, "Loopback0".

But there is a subtle difference, in VPP the name is assumed
for subsequent commands, while in PRCL, later commands will
need to know the name of the loopback interface.  Not assume,
know.  But without specifying it at creation, one can not know its
name for use later.

So, I'm proposing a slight modification to the create_loopback
API message.  My proposal can maintain backward compatibility.

Currently:

/** \brief Create loopback interface request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param mac_address - mac addr to assign to the interface if none-zero
*/
define create_loopback
{
  u32 client_index;
  u32 context;
  u8 mac_address[6];
};

I'm proposing adding a field that specifies the actual
name of the loopback interface be added.

define create_loopback
{
  u32 client_index;
  u32 context;
  u8 mac_address[6];
  u8 name[32];
};

Pick your favorite upper-bound for name length or substitute
a zero-terminated C-string-like name.  Don't much care there.

But my point is that to achieve some compatibility with PRCL's
expected behavior, we'll need them to be named "Loopback",
and not "loop".  Naturally, if the name isn't supplied by
the API caller, the current default name can be allocated.

At the bare minimum, the instance number should be supplied
in the API call and the VAT command changed to allow the form:

loopback create []

For example:

> loopback create 2

That way there is an explicit, not assumed, correspondence for
the following commands like:

> set int l2 bridge loop2 1 bvi

Thoughts?

jdl

___
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev