Project

General

Profile

FaceMgmt » History » Version 64

Alex Afanasyev, 03/27/2017 04:46 PM

1 20 Junxiao Shi
# Face Management
2 1 Junxiao Shi
3 38 Alex Afanasyev
{{toc}}
4
5 20 Junxiao Shi
**Face Management** is a module of [[Management|NFD Management protocol]].
6
It provides:
7 1 Junxiao Shi
8 20 Junxiao Shi
* commands to create and destroy faces
9
* commands to enable and disable [[LocalControlHeader]] features on a face
10
* a dataset of description of all active faces and their counters
11 33 Junxiao Shi
* a dataset of description of all active channels
12 20 Junxiao Shi
* a notification stream for face creating and destroying events
13 1 Junxiao Shi
14 45 Junxiao Shi
Face Management commands, datasets, and notifications are available under namespace `ndn:/localhost/nfd/faces`.
15 12 Alex Afanasyev
16
17 20 Junxiao Shi
## FaceUri
18 1 Junxiao Shi
19 27 Junxiao Shi
A FaceUri represents the underlying protocol and address used by a Face.  
20
Every Face has two FaceUris: one for local endpoint, and the other for remote endpoint.
21 1 Junxiao Shi
22 27 Junxiao Shi
### UDP
23 9 Junxiao Shi
24 30 Junxiao Shi
`udp[4|6]://<IP-or-host>[:<port>]`  
25 2 Alex Afanasyev
26 9 Junxiao Shi
Examples:
27 1 Junxiao Shi
28 20 Junxiao Shi
* `udp4://192.0.2.1:6363` (canonical form)
29
* `udp6://[2001:db8::1]:6363` (canonical form)
30 1 Junxiao Shi
* `udp://192.0.2.1` (remote-port defaults to 6363)
31
* `udp://example.net:6363`
32
* `udp4://example.net:6363` (resolve hostname to IPv4 address only)
33 9 Junxiao Shi
* `udp6://example.net:6363` (resolve hostname to IPv6 address only)
34 27 Junxiao Shi
* `udp4://224.0.23.170:56363` (multicast, canonical form)
35 1 Junxiao Shi
36 61 Davide Pesavento
LocalUri of a NIC-associated UDP face has the form:
37
38
`udp[4|6]+dev://<NIC>:<port>`
39
40 1 Junxiao Shi
This is only used in face dataset.
41 61 Davide Pesavento
42 51 Junxiao Shi
Examples:
43
44 60 Junxiao Shi
* `udp4+dev://eth1:6363`
45
* `udp6+dev://en0:6363`
46 51 Junxiao Shi
47 1 Junxiao Shi
### TCP
48
49 30 Junxiao Shi
`tcp[4|6]://<IP-or-host>[:<port>]`
50 1 Junxiao Shi
51
Examples:
52
53 20 Junxiao Shi
* `tcp4://192.0.2.1:6363` (canonical form)
54
* `tcp6://[2001:db8::1]:6363` (canonical form)
55 1 Junxiao Shi
* `tcp://192.0.2.1` (remote-port defaults to 6363)
56
* `tcp://example.net:6363`
57 9 Junxiao Shi
* `tcp4://example.net:6363` (resolve hostname to IPv4 address only)
58 1 Junxiao Shi
* `tcp6://example.net:6363` (resolve hostname to IPv6 address only)
59
60
### UNIX stream
61
62 9 Junxiao Shi
`unix://<path>`
63 1 Junxiao Shi
64
Examples:
65
66 61 Davide Pesavento
* `unix:///var/run/nfd.sock` (note that there are three forward-slashes after 'unix:')
67 1 Junxiao Shi
68 30 Junxiao Shi
### File Descriptor
69
70
`fd://<file-descriptor>`
71
72
Examples:
73
74
* `fd://6`
75
76 1 Junxiao Shi
### Ethernet
77 27 Junxiao Shi
78 42 Junxiao Shi
`ether://[<MAC>]`
79 1 Junxiao Shi
80
Examples:
81 42 Junxiao Shi
82
* `ether://[08:00:27:01:01:01]`
83 1 Junxiao Shi
* `ether://[33:33:01:01:01:01]` (multicast)
84
85 30 Junxiao Shi
### Network Device
86 1 Junxiao Shi
87 61 Davide Pesavento
`dev://<interface-name>`
88 30 Junxiao Shi
89
Examples:
90
91 1 Junxiao Shi
* `dev://eth0`
92
93
### Underlying protocol and FaceUri scheme
94
95 61 Davide Pesavento
Underlying protocol | Remote FaceUri scheme            | Local FaceUri scheme
96 1 Junxiao Shi
------------------- | -------------------------------- | --------------------------
97
IPv4 UDP unicast    | udp4                             | udp4
98 30 Junxiao Shi
IPv6 UDP unicast    | udp6                             | udp6
99 61 Davide Pesavento
IPv4 UDP multicast  | udp4 (multicast IP)     | udp4 (local IP, same port)
100
IPv4 UDP NIC-associated  | udp4           | udp4+dev
101
IPv6 UDP NIC-associated  | udp6           | udp6+dev
102
IPv4 TCP                 | tcp4                        | tcp4
103
IPv6 TCP                 | tcp6                        | tcp6
104
UNIX stream           | fd (file descriptor on NFD side) | unix (socket path)
105
Ethernet multicast  | ether                       | dev
106 64 Alex Afanasyev
Ethernet unicast    | ether                       | dev
107 61 Davide Pesavento
WebSocket             | wsclient                  | ws
108 46 Junxiao Shi
109
## Static Face Attributes
110
111
**FaceScope** indicates whether the face is local for [[ScopeControl|scope control]] purposes.
112
113
* non-local(=0)
114
* local(=1)
115
116
**FacePersistency** indicates whether the face is persistent.
117
118
* on-demand(=1), face closes if it remains idle for some time
119
* persistent(=0), face remains open until it's explicitly destroyed or there's a transport failure
120
* permanent(=2), face remains open until it's explicitly destroyed; transport failures will be recovered internally
121
122
**LinkType** indicates the type of communication link.
123
124
* point-to-point(=0), communication with one peer
125
* multi-access(=1), communication with a multicast group
126 52 Junxiao Shi
127
**LocalFieldsEnabled** indicates whether the face allows [[NDNLPv2]] NextHopFaceId, CachePolicy, IncomingFaceId fields.
128
129
* yes(=1), allows these fields; this is valid only if FaceScope=local
130
* no(=0), disallows these fields
131
132
### Flags and Mask
133
134
Some attributes are collected as inclusive OR into a **Flags** field in commands and datasets.
135
These attributes are: (bit 0 is the least significant bit)
136
137
* bit 0: LocalFieldsEnabled
138 55 Junxiao Shi
139 52 Junxiao Shi
In `create` and `update` commands, the **Flags** field must be accompanied by a **Mask** field which indicates which static attributes should be set; in other words, Flags and Mask fields must be both specified or both omitted.
140
Bits in the Mask field is arranged in the same order as the Flags field.
141
If a bit in Mask is zero, `faces/create` command keeps the default setting of the attribute, `faces/update` command keeps the old value of the attribute.
142 20 Junxiao Shi
143 1 Junxiao Shi
## Control Commands
144
145 20 Junxiao Shi
[[ControlCommand]] **management-module**: `faces`
146 41 Junxiao Shi
147
### Create a face
148 1 Junxiao Shi
149
**command-verb**: `create`
150 46 Junxiao Shi
151
ControlParameters fields:
152 1 Junxiao Shi
153 64 Alex Afanasyev
* **Uri** (required): a canonical remote FaceUri of the face to create (e.g., UDP unicast, Ethernet unicast, or TCP)
154
* **LocalUri** (optional): a canonical local FaceUri of the face to create (e.g., FaceUri for the local interface for Ethernet unicast face)
155
* **FacePersistency** (optional): either *persistent* or *permanent*; creating on-demand faces is disallowed.  
156 20 Junxiao Shi
  The default is *persistent*.  
157 1 Junxiao Shi
  See "static face attributes" for more information.
158 64 Alex Afanasyev
* **Flags** (optional): see "static face attributes".
159
* **Mask** (optional): see "static face attributes".
160 1 Junxiao Shi
161 64 Alex Afanasyev
This command allows creation of UDP unicast, Ethernet unicast, and TCP faces only.  
162 50 Junxiao Shi
If the command succeeds, \<body> in ControlResponse block contains ControlParameters describing the current properties of the face:
163
164 64 Alex Afanasyev
* **FaceId**
165
* **FacePersistency**
166
* **Flags**: contains effective value for *LocalFieldsEnabled* bit
167 52 Junxiao Shi
168 64 Alex Afanasyev
If this creation would conflict with another existing face (e.g., same underlying protocol and remote address, or a NIC-associated permanent face), the command fails with StatusCode 409, and \<body> in ControlResponse block contains ControlParameters describing the existing face including these fields:
169 50 Junxiao Shi
170 64 Alex Afanasyev
* **FaceId**
171
* **Uri**
172
* **FacePersistency**
173
* **Flags**: contains effective value for *LocalFieldsEnabled* bit
174 52 Junxiao Shi
175
If the request attempts to create a face other than UDP unicast and TCP faces, or a static property specified is not acceptable, the command fails with StatusCode 406.
176
177
If face creation fails due to a socket error (e.g. TCP connection timeout), the command fails with StatusCode 504.
178 1 Junxiao Shi
179
### Update static properties
180 20 Junxiao Shi
181 1 Junxiao Shi
**command-verb**: `update`
182
183 20 Junxiao Shi
ControlParameters fields:
184 52 Junxiao Shi
185 64 Alex Afanasyev
* **FaceId** (optional)
186
* **FacePersistency** (optional): *on-demand* or *persistent* or *permanent*  
187 52 Junxiao Shi
  See "static face attributes" for more information.
188 64 Alex Afanasyev
* **Flags** (optional): allows *LocalFieldsEnabled* only, see "static face attributes".
189
* **Mask** (optional): see "static face attributes".
190 52 Junxiao Shi
191
FaceId is the FaceId returned in [[FaceMgmt|Face Management]].
192
If FaceId is omitted or is set to zero, it is implied as the requesting face (self updating).  
193 1 Junxiao Shi
If face does not exist, this command fails with StatusCode 404.
194
195
Static properties of the face is updated.
196
If an optional property field is omitted or a bitfield is zero in Mask, that static property remains unchanged.
197 55 Junxiao Shi
If no static property is changed, this command does nothing, but is still considered successful.
198
199
If the command succeeds, \<body> in ControlResponse block contains ControlParameters describing the current properties of the face:
200
201 64 Alex Afanasyev
* **FaceId**
202
* **FacePersistency**
203
* **Flags**: contains effective value for *LocalFieldsEnabled* bit
204 1 Junxiao Shi
205 52 Junxiao Shi
If any of the requested changes is invalid, none of the changes should be performed, and this command fails with StatusCode 409.
206
The \<body> in ControlResponse block contains ControlParameters that includes only invalid fields; if some of the bit fields chosen in Flags+Mask is invalid, the \<body> block should also contain a Mask field indicating which bits are invalid, and echo back the original Flags field.
207 62 Davide Pesavento
If the request had been sent without those fields (or bitfields in Mask), it would have been successful.
208 20 Junxiao Shi
209 1 Junxiao Shi
### Destroy a face
210 20 Junxiao Shi
211 26 Junxiao Shi
**command-verb:** `destroy`
212 20 Junxiao Shi
213 39 Junxiao Shi
ControlParameters fields:
214 1 Junxiao Shi
215 64 Alex Afanasyev
* **FaceId** (required)
216 39 Junxiao Shi
217 1 Junxiao Shi
If the specified face does not exist, this command does nothing, but is still considered successful.
218
219 40 Junxiao Shi
## Face Dataset
220 1 Junxiao Shi
221
Description and counters of all active faces are published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/faces/list`.
222 39 Junxiao Shi
223
Each face is represented by a **FaceStatus** block:
224 1 Junxiao Shi
225 39 Junxiao Shi
    FaceStatus      ::= FACE-STATUS-TYPE TLV-LENGTH
226
                          FaceId
227 37 Junxiao Shi
                          Uri (remote FaceUri)
228 39 Junxiao Shi
                          LocalUri
229 1 Junxiao Shi
                          ExpirationPeriod?
230
                          FaceScope
231
                          FacePersistency
232 52 Junxiao Shi
                          LinkType
233 1 Junxiao Shi
                          Flags
234
                          NInInterests
235 46 Junxiao Shi
                          NInDatas
236 1 Junxiao Shi
                          NInNacks
237 39 Junxiao Shi
                          NOutInterests
238 46 Junxiao Shi
                          NOutDatas
239 49 Junxiao Shi
                          NOutNacks
240
                          NInBytes
241 46 Junxiao Shi
                          NOutBytes
242
243
    Uri             ::= URI-TYPE TLV-LENGTH
244
                          FaceUri in UTF-8 encoding
245 39 Junxiao Shi
246 46 Junxiao Shi
    LocalUri        ::= LOCAL-URI-TYPE TLV-LENGTH
247 1 Junxiao Shi
                          FaceUri in UTF-8 encoding
248 46 Junxiao Shi
    
249 1 Junxiao Shi
    ; other TLVs have nonNegativeInteger as value
250
251
* **Uri** is a FaceUri representing remote endpoint.
252 40 Junxiao Shi
* **LocalUri** is a FaceUri representing local endpoint.
253 39 Junxiao Shi
* **ExpirationPeriod** is the remaining lifetime of this face.
254
  If this field is omitted, the face has infinite lifetime.
255 40 Junxiao Shi
  Currently, this is applicable to on-demand datagram faces only.
256 46 Junxiao Shi
* **FaceScope** indicates whether the face is local for [[ScopeControl|scope control]] purposes.
257 40 Junxiao Shi
  See "static face attributes" for more information.
258 46 Junxiao Shi
* **FacePersistency** indicates whether the face is persistent.
259 40 Junxiao Shi
  See "static face attributes" for more information.
260 52 Junxiao Shi
* **LinkType** indicates the type of communication link
261
  See "static face attributes" for more information.
262 46 Junxiao Shi
* **Flags** contains these bitfields: *LocalFieldsEnabled*.
263
  See "static face attributes" for more information.
264
* **NInInterests**: number of incoming Interest packets since the face is established.
265
* **NInDatas** counts the number of incoming Data packets since the face is established.
266
* **NInNacks** counts the number of incoming Nack packets since the face is established.
267 1 Junxiao Shi
* **NOutInterests** counts the number of outgoing Interest packets since the face is established.
268
* **NOutDatas** counts the number of outgoing Data packets since the face is established.
269 37 Junxiao Shi
* **NOutNacks** counts the number of outgoing Nack packets since the face is established.
270
* **NInBytes** counts the number of bytes of link layer packets received via this face.
271
  This counter is initialized to zero when the face is established, and can wrap around after overflowing unsigned 64-bit integer range.
272
* **NOutBytes** counts the number of bytes of link layer packets sent via this face.
273
  This counter is initialized to zero when the face is established, and can wrap around after overflowing unsigned 64-bit integer range.
274
275
### Query Operation
276 1 Junxiao Shi
277 37 Junxiao Shi
The query operation allows one to retrieve a subset of face dataset that contains faces satisfying a filter.
278
279
To run a query, the consumer should express an Interest with Name: `ndn:/localhost/nfd/faces/query/<filter>`, where `<filter>` is a **FaceQueryFilter** block that specifies zero or more conditions.
280
281
    FaceQueryFilter ::= FACE-QUERY-FILTER-TYPE TLV-LENGTH
282 40 Junxiao Shi
                          FaceId?
283
                          UriScheme?
284
                          Uri?
285 37 Junxiao Shi
                          LocalUri?
286
                          FaceScope?
287 1 Junxiao Shi
                          FacePersistency?
288 37 Junxiao Shi
                          LinkType?
289
    
290
    UriScheme       ::= URI-SCHEME-TYPE TLV-LENGTH
291
                          string in UTF-8
292
293 40 Junxiao Shi
* **FaceId** permits a face if its FaceId equals the value
294
* **UriScheme** permits a face if the scheme part of its local FaceUri or remote FaceUri equals the value
295
* **Uri** permits a face if its remote FaceUri equals the value
296 1 Junxiao Shi
* **LocalUri** permits a face if its local FaceUri equals the value
297
* **FaceScope** permits a face if its *FaceScope* attribute equals the value
298 39 Junxiao Shi
* **FacePersistency** permits a face if its *FacePersistency* attribute equals the value
299 37 Junxiao Shi
* **LinkType** permits a face if its *LinkType* attribute equals the value
300
301
A face must satisfy ALL conditions to satisfy the filter.
302 1 Junxiao Shi
Faces that satisfy the filter are represented by **FaceStatus** blocks, and published as a [[StatusDataset]] under the Interest Name (a Data packet's Name would be `ndn:/localhost/nfd/faces/query/<filter>/<version>/<segment>`).
303 37 Junxiao Shi
304 41 Junxiao Shi
Examples of filters:
305 37 Junxiao Shi
306 33 Junxiao Shi
* a specific face: FaceId=260
307 40 Junxiao Shi
* a specific TCP tunnel: Uri=tcp4://192.0.2.1:6363  
308 33 Junxiao Shi
  note: FaceUri must precisely match the canonical form: use either "tcp4" or "tcp6" instead of "tcp", use IP address instead of DNS name, include port number
309
* all TCP tunnels: UriScheme=tcp  
310
  note: "tcp" permits both "tcp4" and "tcp6", "udp" permits both "udp4" and "udp6"
311
* all UDP multicast faces: UriScheme=udp & LinkType=multi-access
312
* all Ethernet faces: UriScheme=ether
313 1 Junxiao Shi
  note: UriScheme matches on both local and remote FaceUri, "dev" also works
314
* all faces: no condition  
315
  note: this is equivalent to face dataset, and face dataset should be preferred for this purpose
316 33 Junxiao Shi
317
## Channel Dataset
318
319 20 Junxiao Shi
Description of all active channels is published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/faces/channels`.
320 1 Junxiao Shi
321
Each channel is represented by a **ChannelStatus** block:
322 20 Junxiao Shi
323
    ChannelStatus    := CHANNEL-STATUS-TYPE TLV-LENGTH
324 21 Alex Afanasyev
                          LocalUri
325 20 Junxiao Shi
326 1 Junxiao Shi
* **LocalUri** is a FaceUri representing local endpoint.
327 21 Alex Afanasyev
328 37 Junxiao Shi
## Face Status Change Notification
329
330
Face status change events are published as a [[Notification|Notification Stream]] at `ndn:/localhost/nfd/faces/events`.
331 1 Junxiao Shi
Notifications of all faces are sent into the same notification stream.
332 37 Junxiao Shi
333
The Content of each notification Data packet is a `FaceEventNotification` block:
334 23 Alex Afanasyev
335 37 Junxiao Shi
    FaceEventNotification ::= FACE-EVENT-NOTIFICATION-TYPE TLV-LENGTH
336 40 Junxiao Shi
                                FaceEventKind
337
                                FaceId
338
                                Uri
339 25 Junxiao Shi
                                LocalUri
340 23 Alex Afanasyev
                                FaceScope
341
                                FacePersistency
342 58 Eric Newberry
                                LinkType
343 25 Junxiao Shi
                                Flags
344 23 Alex Afanasyev
    
345 9 Junxiao Shi
    FaceEventKind         ::= FACE-EVENT-KIND-TYPE TLV-LENGTH
346
                                nonNegativeInteger
347
348 1 Junxiao Shi
**FaceEventKind** indicates the kind of event. Its possible values are:
349 34 Junxiao Shi
350 33 Junxiao Shi
* **1**: face is created
351 57 Eric Newberry
* **2**: face is destroyed
352
* **3**: face goes UP (from DOWN state)
353 32 Junxiao Shi
* **4**: face goes DOWN (from UP state)
354 20 Junxiao Shi
355
## TLV-TYPE assignments
356
357 39 Junxiao Shi
Type                                        | Assigned value    | Assigned value (hex)
358 40 Junxiao Shi
------------------------------------------- | ----------------- | --------------------
359
FaceStatus                                  | 128               | 0x80
360
LocalUri                                    | 129               | 0x81
361 24 Alex Afanasyev
ChannelStatus                               | 130               | 0x82
362 1 Junxiao Shi
FaceScope                                   | 132               | 0x84
363
FacePersistency                             | 133               | 0x85
364 48 Junxiao Shi
LinkType                                    | 134               | 0x86
365 1 Junxiao Shi
NInInterests                                | 144               | 0x90
366
NInDatas                                    | 145               | 0x91
367 48 Junxiao Shi
NInNacks                                    | 151               | 0x97
368 1 Junxiao Shi
NOutInterests                               | 146               | 0x92
369 44 Junxiao Shi
NOutDatas                                   | 147               | 0x93
370 1 Junxiao Shi
NOutNacks                                   | 152               | 0x98
371
NInBytes                                    | 148               | 0x94
372
NOutBytes                                   | 149               | 0x95
373 39 Junxiao Shi
FaceQueryFilter                             | 150               | 0x96
374 1 Junxiao Shi
UriScheme                                   | 131               | 0x83
375
FaceEventNotification                       | 192               | 0xc0
376
FaceEventKind                               | 193               | 0xc1
377
(reserved, formerly FaceFlags)              | 194               | 0xc2