pocketscion 0.3.0

A lightweight SCION network simulator
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# GENERATED FILE DO NOT EDIT
# This file was generated by the `generate_openapi` test in `src/api/admin/api.rs`
openapi: 3.1.0
info:
  title: Pocket SCION Management API
  description: Management API for Pocket SCION
  contact:
    name: Anapaya Operations
    email: ops@anapaya.net
  license:
    name: Apache-2.0
    identifier: Apache-2.0
  version: 0.3.0
servers:
- url: http://{host}:{port}/api/v1
paths:
  /auth_server:
    get:
      tags:
      - management
      summary: Fake authorization server details.
      operationId: get_auth_server
      responses:
        '200':
          description: Authorization Server details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthServerResponse'
        '404':
          description: No Authorization Server running
  /endhost_apis:
    get:
      tags:
      - management
      operationId: get_endhost_apis
      responses:
        '200':
          description: The pocket SCION endhost APIs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndhostApisResponse'
  /io_config:
    get:
      tags:
      - management
      summary: Get the current pocket SCION I/O config.
      operationId: get_io_config
      responses:
        '200':
          description: The pocket SCION I/O config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IoConfigDto'
  /link_state:
    post:
      tags:
      - management
      summary: Set the link state of a link in the topology.
      description: Returns 200 OK on success or 404 Not Found if the link does not exist.
      operationId: set_link_state
      responses:
        '200':
          description: Link state set successfully
        '404':
          description: Link not found
  /snaps:
    get:
      tags:
      - management
      summary: List all available SNAPs of the Pocket SCION.
      operationId: get_snaps
      responses:
        '200':
          description: List all available SNAPs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapsResponse'
  /snaps/{snap_id}/connections/{socket_addr}:
    delete:
      tags:
      - management
      summary: Delete (close) a snaptun connection from the server side.
      operationId: delete_snap_connection
      responses:
        '204':
          description: Connection closed successfully
        '404':
          description: Connection not found
  /status:
    get:
      tags:
      - management
      summary: Status of the Pocket SCION service.
      operationId: get_status
      responses:
        '200':
          description: Pocket SCION status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusResponse'
  /system_state:
    get:
      tags:
      - management
      summary: Get the current pocket SCION system state.
      operationId: get_system_state
      responses:
        '200':
          description: The pocket SCION system state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SystemStateDto'
components:
  schemas:
    AuthServerResponse:
      type: object
      description: Authorization server response.
      required:
      - addr
      properties:
        addr:
          type: string
          description: Address of the authorization server.
    AuthServerStateDto:
      type: object
      description: The state of the authentication server.
      required:
      - token_exchanger
      properties:
        token_exchanger:
          $ref: '#/components/schemas/TokenExchangerStateDto'
          description: The token exchange state.
    EndhostApiId:
      type: integer
      description: Endhost API instance identifier.
      minimum: 0
    EndhostApiResponseEntry:
      type: object
      description: Endhost API information.
      required:
      - id
      - local_ases
      - url
      properties:
        id:
          $ref: '#/components/schemas/EndhostApiId'
          description: The ID of the Endhost API.
        local_ases:
          type: array
          items:
            $ref: '#/components/schemas/IsdAsn'
          description: The local ASes the Endhost API serves.
          uniqueItems: true
        url:
          type: string
          format: uri
          description: The URL of the Endhost API.
    EndhostApiState:
      type: object
      description: State per EndhostAPI instance
      required:
      - local_ases
      properties:
        local_ases:
          type: array
          items:
            $ref: '#/components/schemas/IsdAsn'
          uniqueItems: true
    EndhostApisResponse:
      type: object
      description: Response for the endhost APIs.
      required:
      - endhost_apis
      properties:
        endhost_apis:
          type: object
          description: Map of endhost APIs.
          additionalProperties:
            $ref: '#/components/schemas/EndhostApiResponseEntry'
          propertyNames:
            type: integer
            description: Endhost API instance identifier.
            minimum: 0
    FakeIdpDto:
      type: object
      description: The fake identity provider configuration for testing.
      required:
      - public_key
      properties:
        public_key:
          type: string
          description: The public key (PEM format) used to verify ID tokens.
    IoAuthServerConfigDto:
      type: object
      description: The I/O configuration of the Auth server.
      properties:
        addr:
          type: string
    IoConfigDto:
      type: object
      description: The pocket SCION I/O configuration.
      required:
      - auth_server
      - snaps
      - router_sockets
      - endhost_apis
      properties:
        auth_server:
          $ref: '#/components/schemas/IoAuthServerConfigDto'
          description: The I/O state of the optional Auth server.
        endhost_apis:
          type: object
          description: Listening Sockets for Endhost APIs
          additionalProperties:
            type: string
          propertyNames:
            type: integer
            description: Endhost API instance identifier.
            minimum: 0
        router_sockets:
          type: object
          description: The list of SCION router sockets.
          additionalProperties:
            type: string
          propertyNames:
            type: integer
            description: The router identifier.
            minimum: 0
        snaps:
          type: object
          description: The list of SNAP I/O configurations.
          additionalProperties:
            $ref: '#/components/schemas/IoSnapConfigDto'
          propertyNames:
            type: integer
            description: The SNAP identifier.
            minimum: 0
    IoControlPlaneConfigDto:
      type: object
      description: The I/O configuration of a SNAP control plane.
      properties:
        api_addr:
          type: string
          description: The Control plane API address.
    IoDataPlaneConfigDto:
      type: object
      description: The I/O configuration of a SNAP data plane.
      properties:
        addr:
          type: string
          description: The data plane address.
    IoSnapConfigDto:
      type: object
      description: The I/O configuration of a SNAP.
      required:
      - control_plane
      - data_plane
      properties:
        control_plane:
          $ref: '#/components/schemas/IoControlPlaneConfigDto'
          description: The control plane address of the SNAP.
        data_plane:
          $ref: '#/components/schemas/IoDataPlaneConfigDto'
          description: The list of data plane I/O configurations.
    IsdAsn:
      type: string
      description: |-
        The combined ISD and AS identifier of a SCION AS (sometimes abbreviated as IA).

        # Examples

        ```
        # use scion_proto::address::IsdAsn;
        #
        # fn main() -> Result<(), Box<dyn std::error::Error>> {
        assert_eq!(IsdAsn(0x1_ff00_0000_0110), "1-ff00:0:110".parse()?);
        # Ok(())
        # }
        ```
      examples:
      - 1-ff00:0:110
      pattern: ^\d+-([a-f0-9]{1,4}:){2}([a-f0-9]{1,4})|\d+$
    ReadyState:
      type: string
      description: PocketSCION ready state.
      enum:
      - Ready
      - NotReady
    RouterStateDto:
      type: object
      description: The state of a SCION router emulated by PocketScion.
      required:
      - isd_as
      - if_ids
      properties:
        if_ids:
          type: array
          items:
            type: integer
            format: int32
            minimum: 0
          description: The list of interface IDs of the router.
        isd_as:
          $ref: '#/components/schemas/IsdAsn'
          description: The ISD-AS of the router.
        snap_data_plane_excludes:
          type: array
          items:
            type: string
          description: |-
            The list of networks towards which SCION traffic will not be routed through
            the available SNAPs.
        snap_data_plane_interfaces:
          type: object
          description: The SNAP data planes that are connected to the router.
          additionalProperties:
            type: string
          propertyNames:
            type: string
    ScionAsDto:
      type: object
      description: Human readable Pocket SCION AS
      required:
      - isd_asn
      - is_core_as
      - forwarding_key
      properties:
        forwarding_key:
          type: array
          items:
            type: integer
            format: int32
            minimum: 0
        is_core_as:
          type: boolean
        isd_asn:
          $ref: '#/components/schemas/IsdAsn'
    ScionTopologyDto:
      type: object
      description: Human readable ScionTopology
      required:
      - as_list
      - links
      properties:
        as_list:
          type: array
          items:
            $ref: '#/components/schemas/ScionAsDto'
        links:
          type: array
          items:
            $ref: '#/components/schemas/pocketscion::network::scion::topology::dto::ScionLinkDto'
    Snap:
      type: object
      description: SNAP in pocketSCION.
      required:
      - control_plane_api
      properties:
        control_plane_api:
          type: string
          description: SNAP control plane API address.
    SnapStateDto:
      type: object
      description: The state of a SNAP.
      required:
      - isd_as
      properties:
        isd_as:
          $ref: '#/components/schemas/IsdAsn'
          description: The ISD-AS of the SNAP.
    SnapsResponse:
      type: object
      description: SNAP response.
      required:
      - snaps
      properties:
        snaps:
          type: object
          description: Map of SNAPs.
          additionalProperties:
            $ref: '#/components/schemas/Snap'
          propertyNames:
            type: integer
            description: The SNAP identifier.
            minimum: 0
    StatusResponse:
      type: object
      description: Status response.
      required:
      - state
      properties:
        state:
          $ref: '#/components/schemas/ReadyState'
          description: The current ready state of pocketSCION.
    SystemStateDto:
      type: object
      description: The pocket SCION system state.
      required:
      - snap_token_public_key
      - snaps
      - routers
      - endhost_apis
      properties:
        auth_server_state:
          $ref: '#/components/schemas/AuthServerStateDto'
          description: Test authentication server.
        endhost_apis:
          type: object
          description: The list of Endhost APIs
          additionalProperties:
            $ref: '#/components/schemas/EndhostApiState'
          propertyNames:
            type: integer
            description: Endhost API instance identifier.
            minimum: 0
        root_secret:
          type:
          - string
          - 'null'
          description: |-
            The root secret used to derive the secrets for the SNAPs.
            It must base 64 encoded and 32 bytes long.
        routers:
          type: object
          description: The list of SCION routers.
          additionalProperties:
            $ref: '#/components/schemas/RouterStateDto'
          propertyNames:
            type: integer
            description: The router identifier.
            minimum: 0
        snap_token_public_key:
          type: string
          description: The public key (PEM format) to verify SNAP tokens.
        snaps:
          type: object
          description: The list of SNAPs in the system.
          additionalProperties:
            $ref: '#/components/schemas/SnapStateDto'
          propertyNames:
            type: integer
            description: The SNAP identifier.
            minimum: 0
        snaptun_keepalive_interval:
          type: string
          description: The keepalive interval for the SNAPtun connection(s).
        topology:
          $ref: '#/components/schemas/ScionTopologyDto'
          description: Scion Topology used for routing
    TokenExchangerConfigDto:
      type: object
      description: Token exchanger configuration.
      required:
      - private_key
      - token_lifetime
      - fake_idp
      properties:
        fake_idp:
          $ref: '#/components/schemas/FakeIdpDto'
          description: The fake identity provider for testing.
        private_key:
          type: string
          description: The private key (PEM format) used to sign SNAP tokens.
        token_lifetime:
          type: string
          description: The lifetime of the SNAP tokens.
    TokenExchangerStateDto:
      type: object
      description: The state of the token exchanger.
      required:
      - config
      - id_mapping
      properties:
        config:
          $ref: '#/components/schemas/TokenExchangerConfigDto'
          description: The configuration of the token exchanger.
        id_mapping:
          type: object
          description: List of identity mappings (SSID -> PSSID).
          additionalProperties:
            type: string
          propertyNames:
            type: string
    pocketscion::network::scion::topology::dto::ScionLinkDto:
      type: string
      examples:
      - 1-ff00:0:110 parent_of ff00:0:111
tags:
- name: management
  description: Operations related to the management of Pocket SCION