Project

General

Profile

ControlCommand » History » Version 50

Davide Pesavento, 06/03/2020 05:45 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 50 Davide Pesavento
    ControlParameters               = CONTROL-PARAMETERS-TYPE TLV-LENGTH
29
                                        [Name]
30
                                        [FaceId]
31
                                        [Uri]
32
                                        [LocalUri]
33
                                        [Origin]
34
                                        [Cost]
35
                                        [Capacity]
36
                                        [Count]
37
                                        [BaseCongestionMarkingInterval]
38
                                        [DefaultCongestionThreshold]
39
                                        [Mtu]
40
                                        [Flags]
41
                                        [Mask]
42
                                        [Strategy]
43
                                        [ExpirationPeriod]
44
                                        [FacePersistency]
45
46 40 Eric Newberry
    ; Name is defined in NDN packet format specification
47 50 Davide Pesavento
48
    FaceId                          = FACE-ID-TYPE TLV-LENGTH
49
                                        nonNegativeInteger
50 1 Junxiao Shi
    
51 50 Davide Pesavento
    Uri                             = URI-TYPE TLV-LENGTH
52
                                        RFC3986 URI in UTF-8 encoding
53 1 Junxiao Shi
    
54 50 Davide Pesavento
    LocalUri                        = LOCAL-URI-TYPE TLV-LENGTH
55
                                        RFC3986 URI in UTF-8 encoding
56 37 Junxiao Shi
    
57 50 Davide Pesavento
    Origin                          = ORIGIN-TYPE TLV-LENGTH
58
                                        nonNegativeInteger
59 1 Junxiao Shi
    
60 50 Davide Pesavento
    Cost                            = COST-TYPE TLV-LENGTH
61
                                        nonNegativeInteger
62 26 Junxiao Shi
63 50 Davide Pesavento
    Capacity                        = CAPACITY-TYPE TLV-LENGTH 
64
                                        nonNegativeInteger
65 17 Junxiao Shi
66 50 Davide Pesavento
    Count                           = COUNT-TYPE TLV-LENGTH 
67
                                        nonNegativeInteger
68 41 Eric Newberry
69 50 Davide Pesavento
    BaseCongestionMarkingInterval   = BASE-CONGESTION-MARKING-INTERVAL-TYPE TLV-LENGTH
70
                                        nonNegativeInteger
71 17 Junxiao Shi
72 50 Davide Pesavento
    DefaultCongestionThreshold      = DEFAULT-CONGESTION-THRESHOLD-TYPE TLV-LENGTH
73
                                        nonNegativeInteger
74 46 Eric Newberry
75 50 Davide Pesavento
    Mtu                             = MTU-TYPE TLV-LENGTH
76
                                        nonNegativeInteger
77 40 Eric Newberry
78 50 Davide Pesavento
    Flags                           = FLAGS-TYPE TLV-LENGTH 
79
                                        nonNegativeInteger
80 40 Eric Newberry
81 50 Davide Pesavento
    Mask                            = MASK-TYPE TLV-LENGTH 
82
                                        nonNegativeInteger
83 40 Eric Newberry
84 50 Davide Pesavento
    Strategy                        = STRATEGY-TYPE TLV-LENGTH
85
                                        Name
86 48 Ju Pan
87 50 Davide Pesavento
    ExpirationPeriod                = EXPIRATION-PERIOD-TYPE TLV-LENGTH
88
                                        nonNegativeInteger
89 35 Junxiao Shi
90
    ; FacePersistency is defined in FaceMgmt section
91 36 Davide Pesavento
92
This definition exhausts all possible fields used in existing commands.
93 35 Junxiao Shi
94
Each individual command MUST specify:
95 36 Davide Pesavento
96
* a list of required fields: those fields MUST be present
97 1 Junxiao Shi
* a list of optional fields: those fields MAY be present
98 35 Junxiao Shi
* the semantics of each required and optional field
99 36 Davide Pesavento
100 35 Junxiao Shi
A field that is neither required nor optional for a command MUST NOT be present in a ControlParameter given to that command.
101 1 Junxiao Shi
102
Each individual command MAY impose additional constraints on certain fields.
103
104 37 Junxiao Shi
### Flags and Mask
105 1 Junxiao Shi
106
Various commands collect multiple boolean attributes into the **Flags** field as an inclusive OR.
107
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.
108 26 Junxiao Shi
109 1 Junxiao Shi
The **Mask** field, if accepted by a command, indicates which attributes are being updated.
110
In such cases, Flags field and Mask field must be both present or both omitted in the request.
111
Bits in the Mask field are arranged in the same order as the Flags field.
112
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".
113
114 13 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.
115 2 Junxiao Shi
116 1 Junxiao Shi
## Response format
117 37 Junxiao Shi
118 1 Junxiao Shi
A response from the command interface is a Data that matches the request Interest.
119 13 Junxiao Shi
The payload of this Data is a ControlResponse element.
120 2 Junxiao Shi
121 50 Davide Pesavento
    ControlResponse = CONTROL-RESPONSE-TYPE TLV-LENGTH
122
                        StatusCode
123
                        StatusText
124
                        <body>
125 28 Davide Pesavento
    
126 50 Davide Pesavento
    StatusCode      = STATUS-CODE-TYPE TLV-LENGTH nonNegativeInteger
127 13 Junxiao Shi
    
128 50 Davide Pesavento
    StatusText      = STATUS-TEXT-TYPE TLV-LENGTH UTF-8-STRING
129 1 Junxiao Shi
    
130 50 Davide Pesavento
    <body>          = *NDN-TLV
131 2 Junxiao Shi
132 16 Junxiao Shi
### StatusCode
133 28 Davide Pesavento
134 1 Junxiao Shi
StatusCode loosely follows the HTTP semantics described in [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6).
135
136
* Codes between 100 and 399 represent a success.
137 19 Junxiao Shi
* Codes between 400 and 499 represent a client error.
138
* Codes between 500 and 599 represent a server error.
139 1 Junxiao Shi
140
Common codes include:
141 13 Junxiao Shi
142 1 Junxiao Shi
StatusCode | Description
143 13 Junxiao Shi
-----------|------------------------
144 2 Junxiao Shi
200        | OK
145 13 Junxiao Shi
400        | ControlParameters is incorrect
146 1 Junxiao Shi
403        | Command Interest is not authorized
147 14 Junxiao Shi
404        | Resource (e.g., face, prefix, ...) not found
148 1 Junxiao Shi
501        | Module or verb is not supported
149 14 Junxiao Shi
503        | Service not available
150
151 1 Junxiao Shi
Each individual command MAY define additional codes.
152
153 13 Junxiao Shi
### \<body>
154 1 Junxiao Shi
155
Additional elements are allowed at the end of ControlResponse.
156 13 Junxiao Shi
157 1 Junxiao Shi
Each individual command MAY define the type and meaning of \<body>.
158 13 Junxiao Shi
159 1 Junxiao Shi
Unless otherwise defined by an individual command,
160 33 Alex Afanasyev
\<body> is the ControlParameters passed into this command for all successful responses,
161 13 Junxiao Shi
and \<body> is empty for all failure responses.
162 19 Junxiao Shi
163 37 Junxiao Shi
## TLV-TYPE assignments
164 1 Junxiao Shi
165 26 Junxiao Shi
Type                                        | Assigned value    | Assigned value (hex)
166 5 Alex Afanasyev
------------------------------------------- | ----------------- | --------------------
167 1 Junxiao Shi
ControlParameters                           | 104               | 0x68
168 24 Junxiao Shi
FaceId                                      | 105               | 0x69
169 5 Alex Afanasyev
Uri                                         | 114               | 0x72
170 44 Davide Pesavento
LocalUri                                    | 129               | 0x81
171
Origin                                      | 111               | 0x6f
172 40 Eric Newberry
Cost                                        | 106               | 0x6a
173 44 Davide Pesavento
Capacity       	       	       	       	    | 131      	       	| 0x83
174 46 Eric Newberry
Count  	       	       	       	            | 132               | 0x84
175 1 Junxiao Shi
BaseCongestionMarkingInterval               | 135               | 0x87
176
DefaultCongestionThreshold     	            | 136               | 0x88
177
Mtu                                         | 137               | 0x89
178
Flags                                       | 108               | 0x6c
179
Mask                                        | 112               | 0x70
180
Strategy                                    | 107               | 0x6b
181
ExpirationPeriod                            | 109               | 0x6d
182
ControlResponse                             | 101               | 0x65
183
StatusCode                                  | 102               | 0x66
184
StatusText                                  | 103               | 0x67
185
(reserved, formerly LocalControlFeature)    | 110               | 0x6e