Project

General

Profile

FaceMgmt » History » Version 63

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