Project

General

Profile

ControlCommand » History » Version 48

Ju Pan, 06/03/2019 01:53 PM

1 1 Junxiao Shi
# Control Command
2 39 Davide Pesavento
3
{{>toc}}
4 1 Junxiao Shi
5 29 Davide Pesavento
**Control Command** is a mechanism of [[Management|NFD Management protocol]]. This mechanism is useful for altering the state of the forwarder.
6 28 Davide Pesavento
This document defines the request and response format of such commands, and how they should be signed and authenticated.
7 1 Junxiao Shi
8
## Request format
9 9 Anonymous
10 26 Junxiao Shi
Control commands are [[ndn-cxx:CommandInterest|Command Interests]] under a NFD management prefix.
11 1 Junxiao Shi
12 22 Junxiao Shi
The Name for a request Interest has the following form:
13 1 Junxiao Shi
14 26 Junxiao Shi
    /<prefix>/<management-module>/<command-verb>/<control-parameters>/<command-interest-components>
15 1 Junxiao Shi
16 23 Junxiao Shi
* *prefix* is a NFD management prefix.
17
  Unless otherwise noted, all commands use `/localhost/nfd` prefix.
18
  Each individual command MAY specify additional prefixes under which that command could be accepted.
19 22 Junxiao Shi
* *management-module* is the name of management module to which the command needs to be dispatched.
20
* *command-verb* is the command to be executed.
21 37 Junxiao Shi
* *control-parameters* is a ControlParameters TLV element wrapped in a NameComponent.
22 26 Junxiao Shi
* *command-interest-components* are four additional components defined by [[ndn-cxx:CommandInterest|Command Interest]] spec.
23 1 Junxiao Shi
24 13 Junxiao Shi
### ControlParameters
25 1 Junxiao Shi
26 37 Junxiao Shi
ControlParameters element contains arguments to the command.
27 1 Junxiao Shi
28 40 Eric Newberry
    ControlParameters               ::= CONTROL-PARAMETERS-TYPE TLV-LENGTH
29
                                          Name?
30
                                          FaceId?
31
                                          Uri?
32
                                          LocalUri?
33
                                          Origin?
34
                                          Cost?
35
                                          Capacity?
36 45 Davide Pesavento
                                          Count?
37 40 Eric Newberry
                                          BaseCongestionMarkingInterval?
38
                                          DefaultCongestionThreshold?
39 46 Eric Newberry
                                          Mtu?
40 40 Eric Newberry
                                          Flags?
41
                                          Mask?
42
                                          Strategy?
43
                                          ExpirationPeriod?
44
                                          FacePersistency?
45 48 Ju Pan
                                          EndpointId?
46 1 Junxiao Shi
    
47
    ; Name is defined in NDN packet format specification
48
    
49 40 Eric Newberry
    FaceId                          ::= FACE-ID-TYPE TLV-LENGTH
50
                                          nonNegativeInteger
51 19 Junxiao Shi
    
52 40 Eric Newberry
    Uri                             ::= URI-TYPE TLV-LENGTH
53
                                          RFC3986 URI in UTF-8 encoding
54 1 Junxiao Shi
    
55 40 Eric Newberry
    LocalUri                        ::= LOCAL-URI-TYPE TLV-LENGTH
56
                                          RFC3986 URI in UTF-8 encoding
57 1 Junxiao Shi
    
58 40 Eric Newberry
    Origin                          ::= ORIGIN-TYPE TLV-LENGTH
59
                                          nonNegativeInteger
60 37 Junxiao Shi
    
61 40 Eric Newberry
    Cost                            ::= COST-TYPE TLV-LENGTH
62
                                          nonNegativeInteger
63 1 Junxiao Shi
64 40 Eric Newberry
    Capacity                        ::= CAPACITY-TYPE TLV-LENGTH 
65
                                          nonNegativeInteger
66 26 Junxiao Shi
67 45 Davide Pesavento
    Count                           ::= COUNT-TYPE TLV-LENGTH 
68 40 Eric Newberry
                                          nonNegativeInteger
69 17 Junxiao Shi
70 45 Davide Pesavento
    BaseCongestionMarkingInterval   ::= BASE-CONGESTION-MARKING-INTERVAL-TYPE TLV-LENGTH
71 41 Eric Newberry
                                          nonNegativeInteger
72
73 45 Davide Pesavento
    DefaultCongestionThreshold      ::= DEFAULT-CONGESTION-THRESHOLD-TYPE TLV-LENGTH
74 40 Eric Newberry
                                          nonNegativeInteger
75 17 Junxiao Shi
76 46 Eric Newberry
    Mtu                             ::= MTU-TYPE TLV-LENGTH
77
                                          nonNegativeInteger
78
79 40 Eric Newberry
    Flags                           ::= FLAGS-TYPE TLV-LENGTH 
80
                                          nonNegativeInteger
81 26 Junxiao Shi
82 40 Eric Newberry
    Mask                            ::= MASK-TYPE TLV-LENGTH 
83
                                          nonNegativeInteger
84 13 Junxiao Shi
85 40 Eric Newberry
    Strategy                        ::= STRATEGY-TYPE TLV-LENGTH
86
                                          Name
87 13 Junxiao Shi
88 40 Eric Newberry
    ExpirationPeriod                ::= EXPIRATION-PERIOD-TYPE TLV-LENGTH
89
                                          nonNegativeInteger  
90
91 1 Junxiao Shi
    ; FacePersistency is defined in FaceMgmt section
92 48 Ju Pan
93
    EndpointId                      ::= ENDPOINTID-TYPE TLV-LENGTH
94
                                          nonNegativeInteger
95 1 Junxiao Shi
96 17 Junxiao Shi
This definition exhausts all possible fields used in existing commands.
97 1 Junxiao Shi
98 35 Junxiao Shi
Each individual command MUST specify:
99
100 36 Davide Pesavento
* a list of required fields: those fields MUST be present
101
* a list of optional fields: those fields MAY be present
102 35 Junxiao Shi
* the semantics of each required and optional field
103
104 36 Davide Pesavento
A field that is neither required nor optional for a command MUST NOT be present in a ControlParameter given to that command.
105
106 1 Junxiao Shi
Each individual command MAY impose additional constraints on certain fields.
107 35 Junxiao Shi
108 36 Davide Pesavento
### Flags and Mask
109 35 Junxiao Shi
110 1 Junxiao Shi
Various commands collect multiple boolean attributes into the **Flags** field as an inclusive OR.
111
Each individual command that uses the Flags field MUST define the meaning of each bit. In the definition, "bit 0" refers to the least significant bit.
112
113 37 Junxiao Shi
The **Mask** field, if accepted by a command, indicates which attributes are being updated.
114 1 Junxiao Shi
In such cases, Flags field and Mask field must be both present or both omitted in the request.
115
Bits in the Mask field are arranged in the same order as the Flags field.
116
For example, if a command defines two flags at bit 0 and bit 1 and also accepts a Mask field, a request containing "Flags=0x02 Mask=0x02" specifies bit 1 as "true" and specifies bit 0 as "don't care, leave at default, or keep unchanged"; this request is equivalent to a request containing "Flags=0x03 Mask=0x02".
117 26 Junxiao Shi
118 1 Junxiao Shi
If a command does not accept the **Mask** field, it SHOULD interpret every bit in Flags, and there is no "don't care" bits.
119
120
## Response format
121
122
A response from the command interface is a Data that matches the request Interest.
123 13 Junxiao Shi
The payload of this Data is a ControlResponse element.
124 2 Junxiao Shi
125 1 Junxiao Shi
    ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH
126 37 Junxiao Shi
                          StatusCode
127 1 Junxiao Shi
                          StatusText
128 13 Junxiao Shi
                          <body>
129 2 Junxiao Shi
    
130 28 Davide Pesavento
    StatusCode      ::= STATUS-CODE-TYPE TLV-LENGTH
131 16 Junxiao Shi
                          nonNegativeInteger
132 28 Davide Pesavento
    
133
    StatusText      ::= STATUS-TEXT-TYPE TLV-LENGTH
134
                          string in UTF-8
135 16 Junxiao Shi
    
136 13 Junxiao Shi
    <body>          ::= zero or more arbitrary TLV elements
137 1 Junxiao Shi
138
### StatusCode
139 13 Junxiao Shi
140 2 Junxiao Shi
StatusCode loosely follows the HTTP semantics described in [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6).
141 16 Junxiao Shi
142 28 Davide Pesavento
* Codes between 100 and 399 represent a success.
143 1 Junxiao Shi
* Codes between 400 and 499 represent a client error.
144
* Codes between 500 and 599 represent a server error.
145
146 19 Junxiao Shi
Common codes include:
147
148 1 Junxiao Shi
StatusCode | Description
149
-----------|------------------------
150 13 Junxiao Shi
200        | OK
151 1 Junxiao Shi
400        | ControlParameters is incorrect
152 13 Junxiao Shi
403        | Command Interest is not authorized
153 2 Junxiao Shi
404        | Resource (e.g., face, prefix, ...) not found
154 13 Junxiao Shi
501        | Module or verb is not supported
155 1 Junxiao Shi
503        | Service not available
156 14 Junxiao Shi
157 1 Junxiao Shi
Each individual command MAY define additional codes.
158 14 Junxiao Shi
159
### \<body>
160 1 Junxiao Shi
161
Additional elements are allowed at the end of ControlResponse.
162 13 Junxiao Shi
163 1 Junxiao Shi
Each individual command MAY define the type and meaning of \<body>.
164
165 13 Junxiao Shi
Unless otherwise defined by an individual command,
166 1 Junxiao Shi
\<body> is the ControlParameters passed into this command for all successful responses,
167 13 Junxiao Shi
and \<body> is empty for all failure responses.
168 1 Junxiao Shi
169 33 Alex Afanasyev
## TLV-TYPE assignments
170 13 Junxiao Shi
171 19 Junxiao Shi
Type                                        | Assigned value    | Assigned value (hex)
172 37 Junxiao Shi
------------------------------------------- | ----------------- | --------------------
173 1 Junxiao Shi
ControlParameters                           | 104               | 0x68
174 26 Junxiao Shi
FaceId                                      | 105               | 0x69
175 5 Alex Afanasyev
Uri                                         | 114               | 0x72
176 1 Junxiao Shi
LocalUri                                    | 129               | 0x81
177 24 Junxiao Shi
Origin                                      | 111               | 0x6f
178 5 Alex Afanasyev
Cost                                        | 106               | 0x6a
179 44 Davide Pesavento
Capacity       	       	       	       	    | 131      	       	| 0x83
180
Count  	       	       	       	            | 132               | 0x84
181 40 Eric Newberry
BaseCongestionMarkingInterval               | 135               | 0x87
182 44 Davide Pesavento
DefaultCongestionThreshold     	            | 136               | 0x88
183 46 Eric Newberry
Mtu                                         | 137               | 0x89
184 1 Junxiao Shi
Flags                                       | 108               | 0x6c
185
Mask                                        | 112               | 0x70
186
Strategy                                    | 107               | 0x6b
187
ExpirationPeriod                            | 109               | 0x6d
188
ControlResponse                             | 101               | 0x65
189
StatusCode                                  | 102               | 0x66
190
StatusText                                  | 103               | 0x67
191 47 Ju Pan
EndpointId                           | 113               | 0x71
192 1 Junxiao Shi
(reserved, formerly LocalControlFeature)    | 110               | 0x6e