Project

General

Profile

FaceMgmt » History » Version 68

Junxiao Shi, 04/19/2017 05:08 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 67 Junxiao Shi
Underlying protocol     | Remote FaceUri scheme            | Local FaceUri scheme
96
----------------------- | -------------------------------- | --------------------------
97
IPv4 UDP unicast        | udp4                             | udp4
98
IPv6 UDP unicast        | udp6                             | udp6
99
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 unicast        | ether                            | dev
106
Ethernet multicast      | ether                            | dev
107
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 65 Davide Pesavento
* **Uri** (required): canonical remote FaceUri of the face to create (e.g., UDP unicast, Ethernet unicast, or TCP)
154
* **LocalUri** (optional): canonical local FaceUri of the face to create (e.g., FaceUri of the local interface for an Ethernet unicast face)
155
* **FacePersistency** (optional): either *persistent* or *permanent*; creating on-demand faces is not permitted.  
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 65 Davide Pesavento
This command allows the creation of UDP unicast, Ethernet unicast, and TCP faces only.  
162 66 Davide Pesavento
If the command succeeds, the \<body> of the ControlResponse block contains the ControlParameters describing the current properties of the created face:
163 50 Junxiao Shi
164 64 Alex Afanasyev
* **FaceId**
165 66 Davide Pesavento
* **Uri**
166 68 Junxiao Shi
* **LocalUri**
167 64 Alex Afanasyev
* **FacePersistency**
168
* **Flags**: contains effective value for *LocalFieldsEnabled* bit
169 68 Junxiao Shi
170
If this creation would conflict with an existing face (e.g., same underlying protocol and remote endpoint, or a NIC-associated permanent face), the command fails with StatusCode 409, and the \<body> of the ControlResponse block contains the ControlParameters describing the existing face, with the same fields as above.
171 52 Junxiao Shi
172 66 Davide Pesavento
If the request attempts to create a face other than UDP unicast, Ethernet unicast, or TCP, or if a static property specified in the request is not acceptable, the command fails with StatusCode 406.
173 52 Junxiao Shi
174
If face creation fails due to a socket error (e.g. TCP connection timeout), the command fails with StatusCode 504.
175 1 Junxiao Shi
176
### Update static properties
177 20 Junxiao Shi
178 1 Junxiao Shi
**command-verb**: `update`
179
180 20 Junxiao Shi
ControlParameters fields:
181 52 Junxiao Shi
182 64 Alex Afanasyev
* **FaceId** (optional)
183
* **FacePersistency** (optional): *on-demand* or *persistent* or *permanent*  
184 52 Junxiao Shi
  See "static face attributes" for more information.
185 64 Alex Afanasyev
* **Flags** (optional): allows *LocalFieldsEnabled* only, see "static face attributes".
186
* **Mask** (optional): see "static face attributes".
187 52 Junxiao Shi
188
FaceId is the FaceId returned in [[FaceMgmt|Face Management]].
189
If FaceId is omitted or is set to zero, it is implied as the requesting face (self updating).  
190 1 Junxiao Shi
If face does not exist, this command fails with StatusCode 404.
191
192
Static properties of the face is updated.
193
If an optional property field is omitted or a bitfield is zero in Mask, that static property remains unchanged.
194 55 Junxiao Shi
If no static property is changed, this command does nothing, but is still considered successful.
195
196
If the command succeeds, \<body> in ControlResponse block contains ControlParameters describing the current properties of the face:
197
198 64 Alex Afanasyev
* **FaceId**
199
* **FacePersistency**
200
* **Flags**: contains effective value for *LocalFieldsEnabled* bit
201 1 Junxiao Shi
202 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.
203
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.
204 62 Davide Pesavento
If the request had been sent without those fields (or bitfields in Mask), it would have been successful.
205 20 Junxiao Shi
206 1 Junxiao Shi
### Destroy a face
207 20 Junxiao Shi
208 26 Junxiao Shi
**command-verb:** `destroy`
209 20 Junxiao Shi
210 39 Junxiao Shi
ControlParameters fields:
211 1 Junxiao Shi
212 64 Alex Afanasyev
* **FaceId** (required)
213 39 Junxiao Shi
214 1 Junxiao Shi
If the specified face does not exist, this command does nothing, but is still considered successful.
215
216 40 Junxiao Shi
## Face Dataset
217 1 Junxiao Shi
218
Description and counters of all active faces are published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/faces/list`.
219 39 Junxiao Shi
220
Each face is represented by a **FaceStatus** block:
221 1 Junxiao Shi
222 39 Junxiao Shi
    FaceStatus      ::= FACE-STATUS-TYPE TLV-LENGTH
223
                          FaceId
224 37 Junxiao Shi
                          Uri (remote FaceUri)
225 39 Junxiao Shi
                          LocalUri
226 1 Junxiao Shi
                          ExpirationPeriod?
227
                          FaceScope
228
                          FacePersistency
229 52 Junxiao Shi
                          LinkType
230 1 Junxiao Shi
                          Flags
231
                          NInInterests
232 67 Junxiao Shi
                          NInData
233 1 Junxiao Shi
                          NInNacks
234 39 Junxiao Shi
                          NOutInterests
235 67 Junxiao Shi
                          NOutData
236 49 Junxiao Shi
                          NOutNacks
237
                          NInBytes
238 46 Junxiao Shi
                          NOutBytes
239
240
    Uri             ::= URI-TYPE TLV-LENGTH
241
                          FaceUri in UTF-8 encoding
242 39 Junxiao Shi
243 46 Junxiao Shi
    LocalUri        ::= LOCAL-URI-TYPE TLV-LENGTH
244 1 Junxiao Shi
                          FaceUri in UTF-8 encoding
245 46 Junxiao Shi
    
246 1 Junxiao Shi
    ; other TLVs have nonNegativeInteger as value
247
248
* **Uri** is a FaceUri representing remote endpoint.
249 40 Junxiao Shi
* **LocalUri** is a FaceUri representing local endpoint.
250 39 Junxiao Shi
* **ExpirationPeriod** is the remaining lifetime of this face.
251
  If this field is omitted, the face has infinite lifetime.
252 40 Junxiao Shi
  Currently, this is applicable to on-demand datagram faces only.
253 46 Junxiao Shi
* **FaceScope** indicates whether the face is local for [[ScopeControl|scope control]] purposes.
254 40 Junxiao Shi
  See "static face attributes" for more information.
255 46 Junxiao Shi
* **FacePersistency** indicates whether the face is persistent.
256 40 Junxiao Shi
  See "static face attributes" for more information.
257 52 Junxiao Shi
* **LinkType** indicates the type of communication link
258
  See "static face attributes" for more information.
259 46 Junxiao Shi
* **Flags** contains these bitfields: *LocalFieldsEnabled*.
260
  See "static face attributes" for more information.
261
* **NInInterests**: number of incoming Interest packets since the face is established.
262 67 Junxiao Shi
* **NInData** counts the number of incoming Data packets since the face is established.
263 46 Junxiao Shi
* **NInNacks** counts the number of incoming Nack packets since the face is established.
264 1 Junxiao Shi
* **NOutInterests** counts the number of outgoing Interest packets since the face is established.
265 67 Junxiao Shi
* **NOutData** counts the number of outgoing Data packets since the face is established.
266 37 Junxiao Shi
* **NOutNacks** counts the number of outgoing Nack packets since the face is established.
267
* **NInBytes** counts the number of bytes of link layer packets received via this face.
268
  This counter is initialized to zero when the face is established, and can wrap around after overflowing unsigned 64-bit integer range.
269
* **NOutBytes** counts the number of bytes of link layer packets sent via this face.
270
  This counter is initialized to zero when the face is established, and can wrap around after overflowing unsigned 64-bit integer range.
271
272
### Query Operation
273 1 Junxiao Shi
274 37 Junxiao Shi
The query operation allows one to retrieve a subset of face dataset that contains faces satisfying a filter.
275
276
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.
277
278
    FaceQueryFilter ::= FACE-QUERY-FILTER-TYPE TLV-LENGTH
279 40 Junxiao Shi
                          FaceId?
280
                          UriScheme?
281
                          Uri?
282 37 Junxiao Shi
                          LocalUri?
283
                          FaceScope?
284 1 Junxiao Shi
                          FacePersistency?
285 37 Junxiao Shi
                          LinkType?
286
    
287
    UriScheme       ::= URI-SCHEME-TYPE TLV-LENGTH
288
                          string in UTF-8
289
290 40 Junxiao Shi
* **FaceId** permits a face if its FaceId equals the value
291
* **UriScheme** permits a face if the scheme part of its local FaceUri or remote FaceUri equals the value
292
* **Uri** permits a face if its remote FaceUri equals the value
293 1 Junxiao Shi
* **LocalUri** permits a face if its local FaceUri equals the value
294
* **FaceScope** permits a face if its *FaceScope* attribute equals the value
295 39 Junxiao Shi
* **FacePersistency** permits a face if its *FacePersistency* attribute equals the value
296 37 Junxiao Shi
* **LinkType** permits a face if its *LinkType* attribute equals the value
297
298
A face must satisfy ALL conditions to satisfy the filter.
299 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>`).
300 37 Junxiao Shi
301 41 Junxiao Shi
Examples of filters:
302 37 Junxiao Shi
303 33 Junxiao Shi
* a specific face: FaceId=260
304 40 Junxiao Shi
* a specific TCP tunnel: Uri=tcp4://192.0.2.1:6363  
305 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
306
* all TCP tunnels: UriScheme=tcp  
307
  note: "tcp" permits both "tcp4" and "tcp6", "udp" permits both "udp4" and "udp6"
308
* all UDP multicast faces: UriScheme=udp & LinkType=multi-access
309
* all Ethernet faces: UriScheme=ether
310 1 Junxiao Shi
  note: UriScheme matches on both local and remote FaceUri, "dev" also works
311
* all faces: no condition  
312
  note: this is equivalent to face dataset, and face dataset should be preferred for this purpose
313 33 Junxiao Shi
314
## Channel Dataset
315
316 20 Junxiao Shi
Description of all active channels is published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/faces/channels`.
317 1 Junxiao Shi
318
Each channel is represented by a **ChannelStatus** block:
319 20 Junxiao Shi
320
    ChannelStatus    := CHANNEL-STATUS-TYPE TLV-LENGTH
321 21 Alex Afanasyev
                          LocalUri
322 20 Junxiao Shi
323 1 Junxiao Shi
* **LocalUri** is a FaceUri representing local endpoint.
324 21 Alex Afanasyev
325 37 Junxiao Shi
## Face Status Change Notification
326
327
Face status change events are published as a [[Notification|Notification Stream]] at `ndn:/localhost/nfd/faces/events`.
328 1 Junxiao Shi
Notifications of all faces are sent into the same notification stream.
329 37 Junxiao Shi
330
The Content of each notification Data packet is a `FaceEventNotification` block:
331 23 Alex Afanasyev
332 37 Junxiao Shi
    FaceEventNotification ::= FACE-EVENT-NOTIFICATION-TYPE TLV-LENGTH
333 40 Junxiao Shi
                                FaceEventKind
334
                                FaceId
335
                                Uri
336 25 Junxiao Shi
                                LocalUri
337 23 Alex Afanasyev
                                FaceScope
338
                                FacePersistency
339 58 Eric Newberry
                                LinkType
340 25 Junxiao Shi
                                Flags
341 23 Alex Afanasyev
    
342 9 Junxiao Shi
    FaceEventKind         ::= FACE-EVENT-KIND-TYPE TLV-LENGTH
343
                                nonNegativeInteger
344
345 1 Junxiao Shi
**FaceEventKind** indicates the kind of event. Its possible values are:
346 34 Junxiao Shi
347 33 Junxiao Shi
* **1**: face is created
348 57 Eric Newberry
* **2**: face is destroyed
349
* **3**: face goes UP (from DOWN state)
350 32 Junxiao Shi
* **4**: face goes DOWN (from UP state)
351 20 Junxiao Shi
352
## TLV-TYPE assignments
353
354 39 Junxiao Shi
Type                                        | Assigned value    | Assigned value (hex)
355 40 Junxiao Shi
------------------------------------------- | ----------------- | --------------------
356
FaceStatus                                  | 128               | 0x80
357
LocalUri                                    | 129               | 0x81
358 24 Alex Afanasyev
ChannelStatus                               | 130               | 0x82
359 1 Junxiao Shi
FaceScope                                   | 132               | 0x84
360
FacePersistency                             | 133               | 0x85
361 48 Junxiao Shi
LinkType                                    | 134               | 0x86
362 1 Junxiao Shi
NInInterests                                | 144               | 0x90
363 67 Junxiao Shi
NInData                                     | 145               | 0x91
364 48 Junxiao Shi
NInNacks                                    | 151               | 0x97
365 1 Junxiao Shi
NOutInterests                               | 146               | 0x92
366 67 Junxiao Shi
NOutData                                    | 147               | 0x93
367 1 Junxiao Shi
NOutNacks                                   | 152               | 0x98
368
NInBytes                                    | 148               | 0x94
369
NOutBytes                                   | 149               | 0x95
370 39 Junxiao Shi
FaceQueryFilter                             | 150               | 0x96
371 1 Junxiao Shi
UriScheme                                   | 131               | 0x83
372
FaceEventNotification                       | 192               | 0xc0
373
FaceEventKind                               | 193               | 0xc1
374
(reserved, formerly FaceFlags)              | 194               | 0xc2