Project

General

Profile

FaceMgmt » History » Version 55

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