This file is indexed.

/usr/lib/python3/dist-packages/gnocchi/tests/functional_live/gabbits/live.yaml is in python3-gnocchi 4.2.0-0ubuntu5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
#
# Confirmation tests to run against a live web server.
#
# These act as a very basic sanity check.

defaults:
    request_headers:
        x-auth-token: $ENVIRON['GNOCCHI_SERVICE_TOKEN']
        authorization: $ENVIRON['GNOCCHI_AUTHORIZATION']

tests:
    - name: check /
      GET: /

    # Fail to create archive policy
    - name: wrong archive policy content type
      desc: attempt to create archive policy with invalid content-type
      POST: /v1/archive_policy
      request_headers:
          content-type: text/plain
      status: 415
      response_strings:
          - Unsupported Media Type

    - name: wrong method
      desc: attempt to create archive policy with 'PUT' method
      PUT: /v1/archive_policy
      request_headers:
          content-type: application/json
      status: 405

    - name: invalid authZ
      desc: x-auth-token is invalid
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
          x-auth-token: 'hello'
          authorization: 'basic hello:'
      data:
          name: medium
          definition:
              - granularity: 1 second
      status: 401

    - name: bad archive policy body
      desc: archive policy contains invalid key 'cowsay'
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          cowsay: moo
      status: 400
      response_strings:
          - "Invalid input: extra keys not allowed"

    - name: missing definition
      desc: archive policy is missing 'definition' keyword
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: medium
      status: 400
      response_strings:
          - "Invalid input: required key not provided"

    - name: empty definition
      desc: empty definition for archive policy
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: medium
          definition: []
      status: 400
      response_strings:
          - "Invalid input: length of value must be at least 1"

    - name: wrong value definition
      desc: invalid type of 'definition' key
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: somename
          definition: foobar
      status: 400
      response_strings:
          - "Invalid input: expected a list"

    - name: useless definition
      desc: invalid archive policy definition
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: medium
          definition:
              - cowsay: moo
      status: 400
      response_strings:
          - "Invalid input: extra keys not allowed"

    #
    # Create archive policy
    #

    - name: create archive policy
      desc: create archve policy 'gabbilive' for live tests
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: gabbilive
          back_window: 0
          definition:
              - granularity: 1 second
                points: 60
              - granularity: 2 second
                timespan: 1 minute
              - points: 5
                timespan: 5 minute
          aggregation_methods:
              - mean
              - min
              - max
      response_headers:
          location: $SCHEME://$NETLOC/v1/archive_policy/gabbilive
      status: 201

    # Retrieve it correctly and then poorly

    - name: get archive policy
      desc: retrieve archive policy 'gabbilive' and asster its values
      GET: $LOCATION
      response_headers:
          content-type: /application/json/
      response_json_paths:
          $.name: gabbilive
          $.back_window: 0
          $.definition[0].granularity: "0:00:01"
          $.definition[0].points: 60
          $.definition[0].timespan: "0:01:00"
          $.definition[1].granularity: "0:00:02"
          $.definition[1].points: 30
          $.definition[1].timespan: "0:01:00"
          $.definition[2].granularity: "0:01:00"
          $.definition[2].points: 5
          $.definition[2].timespan: "0:05:00"
      response_json_paths:
          $.aggregation_methods.`sorted`: ["max", "mean", "min"]

    - name: get wrong accept
      desc: invalid 'accept' header
      GET: /v1/archive_policy/medium
      request_headers:
          accept: text/plain
      status: 406

    # Unexpected methods

    - name: post single archive
      desc: unexpected 'POST' request to archive policy
      POST: /v1/archive_policy/gabbilive
      status: 405

    - name: put single archive
      desc: unexpected 'PUT' request to archive policy
      PUT: /v1/archive_policy/gabbilive
      status: 405

    # Duplicated archive policy names ain't allowed

    - name: create duplicate archive policy
      desc: create archve policy 'gabbilive' for live tests
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: gabbilive
          definition:
              - granularity: 30 second
                points: 60
      status: 409
      response_strings:
          - Archive policy gabbilive already exists

    # Create a unicode named policy

    - name: post unicode policy name
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: ✔éñ☃
          definition:
              - granularity: 1 minute
                points: 20
      status: 201
      response_headers:
          location: $SCHEME://$NETLOC/v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
      response_json_paths:
          name: ✔éñ☃

    - name: retrieve unicode policy name
      GET: $LOCATION
      response_json_paths:
          name: ✔éñ☃

    - name: delete unicode archive policy
      DELETE: /v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
      status: 204

    # It really is gone

    - name: confirm delete
      desc: assert deleted unicode policy is not available
      GET: /v1/archive_policy/%E2%9C%94%C3%A9%C3%B1%E2%98%83
      status: 404

    # Fail to delete one that does not exist

    - name: delete missing archive
      desc: delete non-existent archive policy
      DELETE: /v1/archive_policy/grandiose
      status: 404
      response_strings:
          - Archive policy grandiose does not exist

    # Attempt to create illogical policies

    - name: create illogical policy
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: complex
          definition:
              - granularity: 1 second
                points: 60
                timespan: "0:01:01"
      status: 400
      response_strings:
          - timespan ≠ granularity × points

    - name: create identical granularities policy
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: complex
          definition:
              - granularity: 1 second
                points: 60
              - granularity: 1 second
                points: 120
      status: 400
      response_strings:
          - "More than one archive policy uses granularity `1.0'"

    - name: policy invalid unit
      desc: invalid unit for archive policy 'timespan' key
      POST: /v1/archive_policy
      request_headers:
          content-type: application/json
      data:
          name: 227d0e1f-4295-4e4b-8515-c296c47d71d3
          definition:
              - granularity: 1 second
                timespan: "1 shenanigan"
      status: 400

    #
    # Archive policy rules
    #

    - name: create archive policy rule1
      POST: /v1/archive_policy_rule
      request_headers:
          content-type: application/json
      data:
          name: gabbilive_rule
          metric_pattern: "live.*"
          archive_policy_name: gabbilive
      status: 201
      response_json_paths:
        $.metric_pattern: "live.*"
        $.archive_policy_name: gabbilive
        $.name: gabbilive_rule

    - name: create invalid archive policy rule
      POST: /v1/archive_policy_rule
      request_headers:
          content-type: application/json
      data:
        name: test_rule
        metric_pattern: "disk.foo.*"
      status: 400

    - name: missing auth archive policy rule
      POST: /v1/archive_policy_rule
      request_headers:
          content-type: application/json
          x-auth-token: 'hello'
          authorization: 'basic hello:'
      data:
        name: test_rule
        metric_pattern: "disk.foo.*"
        archive_policy_name: low
      status: 401

    - name: wrong archive policy rule content type
      POST: /v1/archive_policy_rule
      request_headers:
          content-type: text/plain
      status: 415
      response_strings:
          - Unsupported Media Type

    - name: bad archive policy rule body
      POST: /v1/archive_policy_rule
      request_headers:
          content-type: application/json
      data:
          whaa: foobar
      status: 400
      response_strings:
          - "Invalid input: extra keys not allowed"

    # get an archive policy rules

    - name: get all archive policy rules
      GET: /v1/archive_policy_rule
      status: 200
      response_json_paths:
          $[\name][0].name: "gabbilive_rule"
          $[\name][0].metric_pattern: "live.*"
          $[\name][0].archive_policy_name: "gabbilive"

    - name: get unknown archive policy rule
      GET: /v1/archive_policy_rule/foo
      status: 404


    - name: get archive policy rule
      GET: /v1/archive_policy_rule/gabbilive_rule
      status: 200
      response_json_paths:
          $.metric_pattern: "live.*"
          $.archive_policy_name: "gabbilive"
          $.name: "gabbilive_rule"

    - name: delete archive policy in use
      desc: fails due to https://bugs.launchpad.net/gnocchi/+bug/1569781
      DELETE: /v1/archive_policy/gabbilive
      status: 400

    #
    # Metrics
    #


    - name: get all metrics
      GET: /v1/metric
      status: 200

    - name: create metric with name and rule
      POST: /v1/metric
      request_headers:
          content-type: application/json
      data:
          name: "live.io.rate"
      status: 201
      response_json_paths:
          $.archive_policy_name: gabbilive
          $.name: live.io.rate

    - name: assert metric is present in listing
      GET: /v1/metric?id=$HISTORY['create metric with name and rule'].$RESPONSE['$.id']
      response_json_paths:
          $.`len`: 1

    - name: assert metric is the only one with this policy
      GET: /v1/metric?archive_policy_name=gabbilive
      response_json_paths:
          $.`len`: 1

    - name: delete metric
      DELETE: /v1/metric/$HISTORY['create metric with name and rule'].$RESPONSE['$.id']
      status: 204

    - name: assert metric is expunged
      GET: $HISTORY['assert metric is present in listing'].$URL&status=delete
      poll:
          count: 360
          delay: 1
      response_json_paths:
          $.`len`: 0

    - name: create metric with name and policy
      POST: /v1/metric
      request_headers:
          content-type: application/json
      data:
          name: "aagabbi.live.metric"
          archive_policy_name: "gabbilive"
      status: 201
      response_json_paths:
          $.archive_policy_name: gabbilive
          $.name: "aagabbi.live.metric"

    - name: get valid metric id
      GET: $LOCATION
      status: 200
      response_json_paths:
        $.archive_policy.name: gabbilive

    - name: delete the metric
      DELETE: /v1/metric/$RESPONSE['$.id']
      status: 204

    - name: ensure the metric is delete
      GET: /v1/metric/$HISTORY['get valid metric id'].$RESPONSE['$.id']
      status: 404

    - name: create metric bad archive policy
      POST: /v1/metric
      request_headers:
          content-type: application/json
      data:
          archive_policy_name: 2e2675aa-105e-4664-a30d-c407e6a0ea7f
      status: 400
      response_strings:
          - Archive policy 2e2675aa-105e-4664-a30d-c407e6a0ea7f does not exist

    - name: create metric bad content-type
      POST: /v1/metric
      request_headers:
          content-type: plain/text
      data: '{"archive_policy_name": "cookies"}'
      status: 415


    #
    # Cleanup
    #

    - name: delete archive policy rule
      DELETE: /v1/archive_policy_rule/gabbilive_rule
      status: 204

    - name: confirm delete archive policy rule
      DELETE: /v1/archive_policy_rule/gabbilive_rule
      status: 404


    #
    # Resources section
    #

    - name: root of resource
      GET: /v1/resource
      response_json_paths:
          $.generic: $SCHEME://$NETLOC/v1/resource/generic

    - name: typo of resource
      GET: /v1/resoue
      status: 404

    - name: typo of resource extra
      GET: /v1/resource/foobar
      status: 404

    - name: generic resource
      GET: /v1/resource/generic
      status: 200

    - name: post resource type
      POST: /v1/resource_type
      request_headers:
          content-type: application/json
      data:
          name: myresource
          attributes:
              display_name:
                  type: string
                  required: true
                  max_length: 5
                  min_length: 2
      status: 201
      response_headers:
          location: $SCHEME://$NETLOC/v1/resource_type/myresource

    - name: add an attribute
      PATCH: /v1/resource_type/myresource
      request_headers:
          content-type: application/json-patch+json
      data:
        - op: "add"
          path: "/attributes/awesome-stuff"
          value: {"type": "bool", "required": false}
      status: 200
      response_json_paths:
          $.name: myresource
          $.attributes."awesome-stuff".type: bool
          $.attributes.[*].`len`: 2

    - name: remove an attribute
      PATCH: /v1/resource_type/myresource
      request_headers:
          content-type: application/json-patch+json
      data:
        - op: "remove"
          path: "/attributes/awesome-stuff"
      status: 200
      response_json_paths:
          $.name: myresource
          $.attributes.display_name.type: string
          $.attributes.[*].`len`: 1

    - name: myresource resource bad accept
      desc: Expect 406 on bad accept type
      request_headers:
          accept: text/plain
      GET: /v1/resource/myresource
      status: 406
      response_strings:
          - 406 Not Acceptable

    - name: myresource resource complex accept
      desc: failover accept media type appropriately
      request_headers:
          accept: text/plain, application/json; q=0.8
      GET: /v1/resource/myresource
      status: 200

    - name: post myresource resource
      POST: /v1/resource/myresource
      request_headers:
          content-type: application/json
      data:
          id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
          user_id: 126204ef-989a-46fd-999b-ee45c8108f31
          project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
          display_name: myvm
          metrics:
              vcpus:
                  archive_policy_name: gabbilive
      status: 201
      response_json_paths:
          $.id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
          $.user_id: 126204ef-989a-46fd-999b-ee45c8108f31
          $.project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
          $.display_name: "myvm"

    - name: get myresource resource
      GET: $LOCATION
      status: 200
      response_json_paths:
          $.id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
          $.user_id: 126204ef-989a-46fd-999b-ee45c8108f31
          $.project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
          $.display_name: "myvm"

    - name: get vcpus metric
      GET: /v1/metric/$HISTORY['get myresource resource'].$RESPONSE['$.metrics.vcpus']
      status: 200
      response_json_paths:
          $.name: vcpus
          $.resource.id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e

    - name: search for myresource resource via user_id
      POST: /v1/search/resource/myresource
      request_headers:
        content-type: application/json
      data:
        =:
          user_id: "126204ef-989a-46fd-999b-ee45c8108f31"
      response_json_paths:
        $..id: 2ae35573-7f9f-4bb1-aae8-dad8dff5706e
        $..user_id: 126204ef-989a-46fd-999b-ee45c8108f31
        $..project_id: 98e785d7-9487-4159-8ab8-8230ec37537a
        $..display_name: myvm

    - name: search for myresource resource via user_id and 'generic' type
      POST: /v1/search/resource/generic
      request_headers:
        content-type: application/json
      data:
        =:
          id: "2ae35573-7f9f-4bb1-aae8-dad8dff5706e"
      response_strings:
          - '"user_id": "126204ef-989a-46fd-999b-ee45c8108f31"'

    - name: search for myresource resource via user_id and project_id
      POST: /v1/search/resource/generic
      request_headers:
        content-type: application/json
      data:
        and:
          - =:
              user_id: "126204ef-989a-46fd-999b-ee45c8108f31"
          - =:
              project_id: "98e785d7-9487-4159-8ab8-8230ec37537a"
      response_strings:
          - '"id": "2ae35573-7f9f-4bb1-aae8-dad8dff5706e"'

    - name: patch myresource resource
      PATCH: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e
      request_headers:
          content-type: application/json
      data:
          display_name: myvm2
      status: 200
      response_json_paths:
          display_name: myvm2

    - name: post some measures to the metric on myresource
      POST: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures
      request_headers:
          content-type: application/json
      data:
          - timestamp: "2015-03-06T14:33:57"
            value: 2
          - timestamp: "2015-03-06T14:34:12"
            value: 2
      status: 202

    - name: get myresource measures with poll
      GET: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures
      # wait up to 60 seconds before policy is deleted
      poll:
          count: 60
          delay: 1
      response_json_paths:
          $[0][2]: 2
          $[1][2]: 2

    - name: post some more measures to the metric on myresource
      POST: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures
      request_headers:
          content-type: application/json
      data:
          - timestamp: "2015-03-06T14:34:15"
            value: 5
          - timestamp: "2015-03-06T14:34:20"
            value: 5
      status: 202

    - name: get myresource measures with refresh
      GET: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e/metric/vcpus/measures?refresh=true
      response_json_paths:
          $[0][2]: 2
          $[1][2]: 4
          $[2][2]: 2
          $[3][2]: 2
          $[4][2]: 5
          $[5][2]: 5

    #
    # Search for resources
    #

    - name: typo of search
      POST: /v1/search/notexists
      status: 404

    - name: typo of search in resource
      POST: /v1/search/resource/foobar
      status: 404

    - name: search with invalid uuid
      POST: /v1/search/resource/generic
      request_headers:
        content-type: application/json
      data:
        =:
          id: "cd9eef"
      status: 200
      response_json_paths:
          $.`len`: 0

    - name: assert vcpus metric exists in listing
      GET: /v1/metric?id=$HISTORY['get myresource resource'].$RESPONSE['$.metrics.vcpus']
      poll:
          count: 360
          delay: 1
      response_json_paths:
          $.`len`: 1

    - name: delete myresource resource
      DELETE: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e
      status: 204

      # assert resource is really deleted
    - name: assert resource resource is deleted
      GET: /v1/resource/myresource/2ae35573-7f9f-4bb1-aae8-dad8dff5706e
      status: 404

    - name: assert vcpus metric is really expurged
      GET: $HISTORY['assert vcpus metric exists in listing'].$URL&status=delete
      poll:
          count: 360
          delay: 1
      response_json_paths:
          $.`len`: 0

    - name: post myresource resource no data
      POST: /v1/resource/myresource
      request_headers:
          content-type: application/json
      status: 400

    - name: assert no metrics have the gabbilive policy
      GET: $HISTORY['assert metric is the only one with this policy'].$URL
      response_json_paths:
          $.`len`: 0

    - name: assert no delete metrics have the gabbilive policy
      GET: $HISTORY['assert metric is the only one with this policy'].$URL&status=delete
      response_json_paths:
          $.`len`: 0

    - name: delete single archive policy cleanup
      DELETE: /v1/archive_policy/gabbilive
      poll:
          count: 360
          delay: 1
      status: 204

    # It really is gone

    - name: delete our resource type
      DELETE: /v1/resource_type/myresource
      status: 204

    - name: confirm delete of cleanup
      GET: /v1/archive_policy/gabbilive
      status: 404