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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
.TH liblldp_clif 3 "February 2014" "open-lldp" "Linux"
.SH NAME
clif_vsi,clif_vsievt,clif_vsiwait \- Manipulate VDP IEEE 802.1 Ratified Standard Associations
.SH SYNOPSIS
#include "include/clif.h"
.sp 1
.B "int clif_vsi(struct clif *connp, char *ifname, unsigned int tlvid, char *cmd, char *reply, size_t *reply_len);"
.sp 1
.B "int clif_vsievt(struct clif *connp, char *reply, size_t *reply_len, int wait);"
.sp 1
.B "int clif_vsiwait(struct clif *connp, char *ifname, unsigned int tlvid, char *cmd, char *reply, size_t *reply_len, int wait);"
.sp 1
.SH DESCRIPTION
The Virtual station interface Discovery Protocol
is a protocol to manage the association and deassociation of virtual
machine network interfaces (VSIs) between the station and an adjacent switch.
VDP is typically used with the local switch in VEPA mode and the adjacent
switch port in reflective relay (also called haripin) mode.
This allows all traffic to be sent to the switch for processing.
Reflective relay mode is negotiated via EVB TLVs (see lldptool-evb).
.P
This man pages describes the IEEE 802.1 Qbg ratified standard
dated from July 5th, 2012. This differs from the draft 0.2 which is
implemented as well, see
.BR lldptool-vdp (8).
For clarification in this man page
the version complying to the ratified standard is
called VDP22 and the version complying to the draft 0.2 is called VDP.
.SS VSI Parameter
Each VDP22 TLVs contains a command mode, manager identifier,
type identifier, type identifier version, VSI instance identifier,
migiration hints and filter information.
The fields are explained next:
.TP
.B "Command Mode:"
The command mode determines the type
of the VSI association to be established.
It is an ascii string can be one of:
.RS
.IP assoc:
Create an VSI association.
.IP preassoc:
Create an VSI preassociation. The association
is only announced to the switch.
.IP preassoc-rr:
Create an VSI preassociation. The association
is only announced to the switch and the
switch should reserve the resources.
.IP deassoc:
Delete an VSI association.
.RE
Other strings are not recognized and return an error.
.TP
.B "Manager identifier:"
The manager identifier is a string of up to 16
alphanumeric characters.
It can also be an UUID according to RFC 4122
with optional dashes in between.
.TP
.B "Type Identifier:"
The type identifier is a number in the range
of 0 to 2^24 - 1.
.TP
.B "Type Identifier Version:"
The type identifier version is a number
in the range of 0 to 255.
.TP
.B "VSI Instance Identifier:"
The VSI instance identifier is
an UUID according to RFC 4122
with optional dashes in between.
.TP
.B "Migration Hints:"
The migiration hints is a string aiding in
migration of virtual machines:
.RS
.IP none:
No hints available.
.IP from:
The virtual machine is migriting away.
.IP to:
The virtual machine is migriting to.
.RE
.TP
.B "Filter Information Data:"
The filter information data can be supplied in four
different formats:
.RS
.IP "vlan (1)"
A vlan number only, also known as filter information format 1.
The vlan identifier is a number in the range of 1 to 2^16 - 1.
The high order 4 bits are used as quality of service bits.
The vlan identifier can be zero, a vlan identifier is then
selected by the switch. Refer to IEEE 802.1 Qbg ratified
standard for details.
.IP "vlan-mac (2)"
A vlan number and MAC address delimited by a slash ('-'),
also known as filter information format 2.
The MAC address is specified in the format xx:xx:xx:xx:xx:xx.
The colons are mandatory.
For vlan details see (1).
.IP "vlan-mac-group (4)"
A vlan number, MAC address and group identifier,
each delimited by a slash ('-'),
also known as filter information format 4.
The group identifier is a 32 bit number.
For vlan and MAC address details see (1) and (2).
.IP "vlan--group (3)"
A vlan number and group identifier,
delimited by two slashes ('--'),
also known as filter information format 3.
For vlan and group details see (1) and (4).
.RE
Several filter information fields can be supplied.
The have to be separated by comma (',') and must be
of the same format.
.SS clif_vsi
This function sends a VSI command to
.BR lldpad (8).
Parameter
.I connp
is a pointer to the connection information.
This information is obtained by calling
.I clif_open
and
.IR clif_attach .
Parameter
.I ifname
is the interface name
.B lldpad
(8) uses to send the VSI data.
Paramenter
.I tlvid
is the number of the VSI request.
Valid numbers are
1 (for Preassociation),
2 (for Preassociation with resource reservation) and
3 (for association),
4 (for Deassociation).
Parameter
.I cmd
points to a character string containing the VSI command.
The layout of the VSI command has been explained above.
All VSI fields are concatenated together and separated to
by commas (',') to form one large string.
Parameter
.I reply
is a pointer to a character array to receive the reply from
.BR lldpad (8).
Parameter
.I reply_len
holds the maximum number of characters available in the array
pointed to by
.IR reply .
On successful return of the call,
.I reply_len
contains the number of characters stored by
.BR lldpad (8)
as the response of the command.
.P
The functions returns zero on success and the
.I reply
and
.I reply_len
parameters are set.
.I Reply_len
contains the number of bytes in the
memory area pointed to by
.IR reply .
.I Reply
contains the same information and format as the
.I cmd
parameter with several exceptions:
.RS
.IP "Command Mode:"
This field should be the same as in
.I cmd
parameter. If it contains
.I deassoc
then the command failed and the field
.I ",igration hints"
contains an error number.
.IP "Migration Hints:"
This field contains the error number on why the command
was not accepted by
.BR lldpad (8).
This command failed to pass the
.BR lldpad (8)
sanity checks.
Note that the command was not even sent to the switch
for processing.
If no error occurred, this field contains a dash ('-').
.IP "Filter Information Data:"
If parameter
.I cmd
contained the a
.I "vlan identifier"
of value zero or a
.I "group identifier"
the switch is allowed to assign a
different
.IR "vlan identifier" ,
which is saved and returned in the reply buffer.
.RE
All the other fields should be returned unchanged.
.P
The function returns zero when the command was accepted by
.BR lldpad (8).
Otherwise it returns a positive number on why the command was not
accepted.
.SS clif_vsievt
After a successful return of
.IR clif_vsi ,
.BR lldpad (8)
has sent the command to the switch and waits for a response from the switch.
The switch can still deny the request.
Function
.I clif_vsievt
waits for
parameter
.I wait
seconds for a reply from
.BR lldpad (8).
Parameter
.I reply_len
specifies the maximum buffer size pointed to by parameter
.IR reply.
If a response was received in
.I wait
seconds, the function
returns zero and sets
.I reply_len
to the number of bytes received and
.I reply
contains the response.
The format is the same as in
.IR clif_vsi .
.P
Since the switch can disassociate an established
VSI association any time, it is recommended
to call
.I clif_vsievt
periodically to check for disassociate event
messages from
.IR lldpad (8).
.P
If the functions fails it returns
.IP -EINVAL
No attachment to
.BR lldpad (8)
or
.I wait
is negative.
.IP -EAGAIN
No message was received during the wait.
.IP -EIO
Message was received but could not be read.
.IP -EBADF
Message was received but was not an event message.
.SS clif_vsiwait
This function combines
.I clif_vsi
and
.I clif_vsievt
into one function call.
.SH EXAMPLE & USAGE
Code sample to create an VSI association on
.IR eth0 :
.P
.nf
.DS
char ok[MAX_CLIF_MSGBUF];
int rc;
size_t ok_len = sizeof(ok);
char *cmd ="assoc,blabla,12345,1,00000000-1111-2222-3333-aabbccddeeff"
",none,10-aa:bb:00:00:00:10,11-aa:bb:00:00:00:11";
struct clif *tool_conn = clif_open();
if (!tool_conn) {
fprintf(stderr, "%s can not open connection to LLDPAD\n",
progname);
exit(5);
}
/* Attach to the vdp22 module */
if (clif_attach(tool_conn, "80c4")) {
fprintf(stderr, "%s can not attach to LLDPAD\n", progname);
clif_close(tool_conn);
tool_conn = NULL;
exit(5);
}
rc = clif_vsiwait(tool_conn, "eth0", 1, cmd, ok, &ok_len, 5);
if (!rc) {
/* Parse the response in ok */
....
}
clif_detach(tool_conn));
clif_close(tool_conn);
.DE
.fi
.SH SEE ALSO
.BR lldptool-vdp (8),
.BR lldptool-evb (8),
.BR lldptool-evb22 (8),
.BR lldptool (8),
.BR lldpad (8)
.br
IEEE 802.1Qbg (http://www.ieee802.org/1/pages/802.1bg.html)
.SH AUTHOR
Thomas Richter
|