pocketscion 0.5.2

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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
# 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.5.2
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
  /routers:
    get:
      tags:
      - management
      summary: List all available routers in pocket SCION.
      operationId: get_routers
      responses:
        '200':
          description: List all available routers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutersResponse'
  /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'
  /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.
    CertifiedKeyPair:
      type: object
      description: |-
        Struct containing a certificate and private key for an AS, used for both AS certificates and
        CA certificates
      required:
      - key
      - cert
      properties:
        cert:
          $ref: '#/components/schemas/StoreCertificateDer'
          description: Certificate
        key:
          $ref: '#/components/schemas/StoreKeyDer'
          description: Private Key
    ControlServiceState:
      type: object
      description: Serializable PocketScion State for the control service
      required:
      - beaconing_interfaces
      properties:
        beaconing_interfaces:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/InterfaceBeaconState'
          propertyNames:
            type: object
            description: Globally unique identifier for a SCION interface.
            required:
            - isd_as
            - if_id
            properties:
              if_id:
                type: integer
                format: int32
                description: Interface ID within the AS.
                minimum: 0
              isd_as:
                $ref: '#/components/schemas/IsdAsn'
                description: ISD-AS number of the AS the interface belongs to.
            example: 1-1#0
    EndhostApiDiscoveryStateDto:
      description: Serialized state for EndhostApiDiscoveryState
      default: null
    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
    ExternalAsInterfaceDto:
      type: object
      description: Serialized state for ExternalAsInterfaceState
      required:
      - interface_id
      - target_addr
      properties:
        interface_id:
          type: integer
          format: int32
          description: ID of the interface described
          minimum: 0
        target_addr:
          type: string
          description: |-
            Address to where this interface connects, used for sending packets to the External AS and
            validating received packets
    ExternalAsStateDto:
      type: object
      description: Serialized state for ExternalAsState
      required:
      - interfaces
      properties:
        interfaces:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ExternalAsInterfaceDto'
          propertyNames:
            type: integer
            format: int32
            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.
    InterfaceBeaconState:
      type: object
      description: The beaconing state for a specific interface
      required:
      - interface
      - is_core
      - hop_expiry_units
      - generate_forward_beacons
      - beacon_interval
      - beacon_retry_interval
      - next_send_time
      properties:
        beacon_interval:
          type: string
          description: The interval at which beacons should be sent on this interface
        beacon_retry_interval:
          type: string
          description: The interval to wait before retrying beacon sending after a failure
        generate_forward_beacons:
          type: boolean
          description: |-
            If beacons which would pass through this interface's AS should be generated and sent on
            this interface
        hop_expiry_units:
          type: integer
          format: int32
          description: |-
            The number of hop expiry units to set for generated beacons, which determines the
            validity
          minimum: 0
        interface:
          $ref: '#/components/schemas/ScionGlobalInterfaceId'
          description: Beacon egress interface
        is_core:
          type: boolean
          description: Whether the AS is a core AS, which determines the beacon generation logic
        next_send_time:
          type: string
          format: date-time
          description: The next scheduled time to send beacons on this interface
        originator_ases:
          type:
          - array
          - 'null'
          items:
            $ref: '#/components/schemas/IsdAsn'
          description: |-
            The set of ISD-ASes that originate beacons which should be forwarded through this
            interface. Only segments starting from these ASes will be forwarded.
            If `None`, beacons from all originating ASes will be forwarded.
          uniqueItems: true
    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
      - endhost_discovery_apis
      - external_ases
      - network_forwarders
      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
        endhost_discovery_apis:
          type: object
          description: Listening Sockets for Endhost API discovery APIs
          additionalProperties:
            type: string
          propertyNames:
            type: integer
            description: Endhost Discovery API instance identifier.
            minimum: 0
        external_ases:
          type: object
          description: Listening Sockets for External ASes, keyed by (ISD-AS, interface ID)
          additionalProperties:
            type: string
          propertyNames:
            type: array
            items: false
            prefixItems:
            - 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+$
            - type: integer
              format: int32
              minimum: 0
        network_forwarders:
          type: object
          description: Listening Sockets for Network Forwarders
          additionalProperties:
            type: string
          propertyNames:
            type: string
        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.
    Isd:
      type: integer
      format: int32
      description: |-
        A 16-bit identifier of a SCION Isolation Domain.

        See [this table][anapaya-assignments] for current ISD network assignments.

        [anapaya-assignments]: https://docs.anapaya.net/en/latest/resources/isd-as-assignments/
      minimum: 0
    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+$
    IsdCa:
      type: object
      description: |-
        CA certificate for an ISD-AS, containing the certificate and private key for the CA, as well as
        the root certificate for the ISD
      required:
      - isd_as
      - root
      - intermediary
      properties:
        intermediary:
          $ref: '#/components/schemas/CertifiedKeyPair'
          description: The intermediary identity for this CA
        isd_as:
          $ref: '#/components/schemas/IsdAsn'
          description: The ISD-AS for this CA
        root:
          $ref: '#/components/schemas/CertifiedKeyPair'
          description: The root identity for this CA
    IsdTrustStore:
      type: object
      description: Isd specific trust store, containing the TRC and CA certificates for the ISD
      required:
      - isd
      - trc
      - ca_certs
      - as_certs
      properties:
        as_certs:
          type: object
          description: The AS certificates for this ISD, keyed by ISD-AS
          additionalProperties:
            $ref: '#/components/schemas/CertifiedKeyPair'
          propertyNames:
            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+$
        ca_certs:
          type: object
          description: The CA certificates for this ISD, keyed by ISD-AS
          additionalProperties:
            $ref: '#/components/schemas/IsdCa'
          propertyNames:
            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+$
        isd:
          $ref: '#/components/schemas/Isd'
          description: The ISD for this trust store
        trc:
          $ref: '#/components/schemas/StoreTrc'
          description: The TRC of this ISD
    NetworkForwarderState:
      type: object
      description: |-
        Serializable state of a network forwarder stored in the system state. This is used to create a
        [NetworkForwarder] when the app starts up.
      required:
      - local_as
      - sim_addr
      - queue_size
      - forward_addr
      properties:
        forward_addr:
          type: string
          description: |-
            The peer to send/receive packets to/from on the real network. The forwarder will only
            accept packets from this address on the real network, and will forward packets to this
            address on the real network.
        local_as:
          $ref: '#/components/schemas/IsdAsn'
          description: |-
            The AS number to listen for packets from the network simulation. The forwarder will only
            accept packets from this AS on the network simulation, and will forward packets to this AS
            on the network simulation.
        queue_size:
          type: integer
          description: The maximum number of packets that can be queued for the sim socket.
          minimum: 0
        sim_addr:
          type: string
          description: |-
            The IP address to listen for packets from the network simulation. The forwarder will only
            accept packets to this address from the network simulation, and will forward packets as
            this address on the network simulation.
    ReadyState:
      type: string
      description: PocketSCION ready state.
      enum:
      - Ready
      - NotReady
    Router:
      type: object
      description: Router in pocketSCION.
      required:
      - isd_as
      - addr
      properties:
        addr:
          type: string
          description: Router socket address.
        isd_as:
          $ref: '#/components/schemas/IsdAsn'
          description: The ISD-AS of the AS the router belongs to.
    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
    RoutersResponse:
      type: object
      description: Router response.
      required:
      - routers
      properties:
        routers:
          type: object
          description: Map of routers.
          additionalProperties:
            $ref: '#/components/schemas/Router'
          propertyNames:
            type: integer
            description: The router identifier.
            minimum: 0
    ScionAsDto:
      oneOf:
      - type: object
        description: |-
          AS that is simulated by PocketSCION. Packets to and from this AS will be handled by the
          simulator.
        required:
        - isd_asn
        - is_core_as
        - forwarding_key
        - type
        properties:
          forwarding_key:
            type: array
            items:
              type: integer
              format: int32
              minimum: 0
            description: Forwarding key of the AS, encoded as base64
          is_core_as:
            type: boolean
            description: Whether this AS is a core AS
          isd_asn:
            $ref: '#/components/schemas/IsdAsn'
            description: ISD-AS number of the AS
          type:
            type: string
            enum:
            - simulated
      - type: object
        description: |-
          AS that is not simulated by PocketSCION, but is still part of the topology. Packets to and
          from this AS will be handled by an external implementation.
        required:
        - isd_asn
        - is_core_as
        - type
        properties:
          is_core_as:
            type: boolean
            description: Whether this AS is a core AS
          isd_asn:
            $ref: '#/components/schemas/IsdAsn'
            description: ISD-AS number of the AS
          type:
            type: string
            enum:
            - external
      description: Human readable Pocket SCION AS
    ScionGlobalInterfaceId:
      type: object
      description: Globally unique identifier for a SCION interface.
      required:
      - isd_as
      - if_id
      properties:
        if_id:
          type: integer
          format: int32
          description: Interface ID within the AS.
          minimum: 0
        isd_as:
          $ref: '#/components/schemas/IsdAsn'
          description: ISD-AS number of the AS the interface belongs to.
      example: 1-1#0
    ScionRouter:
      type: object
      description: Representation of a SCION Router, which can be associated with an AS in the topology.
      required:
      - interfaces
      - ip
      properties:
        interfaces:
          $ref: '#/components/schemas/ScionRouterInterface'
          description: The interface IDs of the router within the AS.
        ip:
          type: string
          description: The IP address of the router.
          example: 192.168.1.1
    ScionRouterInterface:
      oneOf:
      - type: string
        description: |-
          The router is not explicitly associated with any interface, and should be used as a fallback
          for the AS unless another router is explicitly assigned.
        enum:
        - Fallback
      - type: object
        description: The router is associated with the given interface IDs.
        required:
        - Ids
        properties:
          Ids:
            type: array
            items:
              type: integer
              format: int32
              minimum: 0
            description: The router is associated with the given interface IDs.
      description: Defines the interfaces associated with a SCION router.
    ScionTopologyDto:
      type: object
      description: Human readable ScionTopology
      required:
      - trust_store
      - as_list
      - links
      - routers
      properties:
        as_list:
          type: array
          items:
            $ref: '#/components/schemas/ScionAsDto'
        links:
          type: array
          items:
            $ref: '#/components/schemas/pocketscion::network::scion::topology::dto::ScionLinkDto'
        routers:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/ScionRouter'
          propertyNames:
            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+$
        trust_store:
          $ref: '#/components/schemas/TrustStore'
    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.
    StoreCertificateDer:
      type: string
      description: Wrapper around CertificateDer
    StoreKeyDer:
      type: string
      description: Wrapper around PrivateKeyDer
    StoreTrc:
      type: string
    SystemStateDto:
      type: object
      description: The pocket SCION system state.
      required:
      - snap_token_public_key
      - snaps
      - routers
      - endhost_apis
      - endhost_api_discovery_api
      - external_ases
      - control_service_states
      - network_forwarders
      properties:
        auth_server_state:
          $ref: '#/components/schemas/AuthServerStateDto'
          description: Test authentication server.
        control_service_states:
          type: object
          description: The state of the control service for each ISD-AS
          additionalProperties:
            $ref: '#/components/schemas/ControlServiceState'
          propertyNames:
            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+$
        endhost_api_discovery_api:
          type: object
          description: Endhost API discovery state
          additionalProperties:
            $ref: '#/components/schemas/EndhostApiDiscoveryStateDto'
          propertyNames:
            type: integer
            description: Endhost Discovery API instance identifier.
            minimum: 0
        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
        external_ases:
          type: object
          description: The list of external ASes, keyed by ISD-AS.
          additionalProperties:
            $ref: '#/components/schemas/ExternalAsStateDto'
          propertyNames:
            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+$
        network_forwarders:
          type: object
          description: |-
            The list of network forwarders, keyed by the SCION address of the forwarder on the network
            simulation.
          additionalProperties:
            $ref: '#/components/schemas/NetworkForwarderState'
          propertyNames:
            type: string
        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
    TrustStore:
      type: object
      description: Pocket SCION trust store
      required:
      - isds
      properties:
        isds:
          type: object
          description: The ISD trust stores, keyed by ISD
          additionalProperties:
            $ref: '#/components/schemas/IsdTrustStore'
          propertyNames:
            type: integer
            format: int32
            description: |-
              A 16-bit identifier of a SCION Isolation Domain.

              See [this table][anapaya-assignments] for current ISD network assignments.

              [anapaya-assignments]: https://docs.anapaya.net/en/latest/resources/isd-as-assignments/
            minimum: 0
    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