cactus-test-definitions 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cactus-test-definitions might be problematic. Click here for more details.

Files changed (142) hide show
  1. cactus_test_definitions-1.5.0/LICENSE.txt +22 -0
  2. cactus_test_definitions-1.5.0/MANIFEST.in +3 -0
  3. cactus_test_definitions-1.5.0/PKG-INFO +288 -0
  4. cactus_test_definitions-1.5.0/README.md +247 -0
  5. cactus_test_definitions-1.5.0/cactus_test_definitions/__init__.py +39 -0
  6. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/__init__.cpython-312.pyc +0 -0
  7. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/actions.cpython-312.pyc +0 -0
  8. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/checks.cpython-312.pyc +0 -0
  9. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/csipaus.cpython-312.pyc +0 -0
  10. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/errors.cpython-312.pyc +0 -0
  11. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/events.cpython-312.pyc +0 -0
  12. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/parameters.cpython-312.pyc +0 -0
  13. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/schema.cpython-312.pyc +0 -0
  14. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/test_procedures.cpython-312-pytest-8.3.5.pyc +0 -0
  15. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/test_procedures.cpython-312.pyc +0 -0
  16. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/variable_expressions.cpython-312.pyc +0 -0
  17. cactus_test_definitions-1.5.0/cactus_test_definitions/__pycache__/version.cpython-312.pyc +0 -0
  18. cactus_test_definitions-1.5.0/cactus_test_definitions/client/__init__.py +26 -0
  19. cactus_test_definitions-1.5.0/cactus_test_definitions/client/__pycache__/__init__.cpython-312.pyc +0 -0
  20. cactus_test_definitions-1.5.0/cactus_test_definitions/client/__pycache__/actions.cpython-312.pyc +0 -0
  21. cactus_test_definitions-1.5.0/cactus_test_definitions/client/__pycache__/checks.cpython-312.pyc +0 -0
  22. cactus_test_definitions-1.5.0/cactus_test_definitions/client/__pycache__/events.cpython-312.pyc +0 -0
  23. cactus_test_definitions-1.5.0/cactus_test_definitions/client/__pycache__/test_procedures.cpython-312-pytest-8.3.5.pyc +0 -0
  24. cactus_test_definitions-1.5.0/cactus_test_definitions/client/actions.py +98 -0
  25. cactus_test_definitions-1.5.0/cactus_test_definitions/client/checks.py +127 -0
  26. cactus_test_definitions-1.5.0/cactus_test_definitions/client/events.py +71 -0
  27. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-01.yaml +94 -0
  28. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-02.yaml +113 -0
  29. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-03-REJ.yaml +69 -0
  30. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-03.yaml +110 -0
  31. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-04.yaml +69 -0
  32. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-05.yaml +117 -0
  33. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-06.yaml +128 -0
  34. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-07.yaml +76 -0
  35. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-08.yaml +78 -0
  36. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-09.yaml +111 -0
  37. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-10.yaml +128 -0
  38. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-11.yaml +111 -0
  39. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-12.yaml +108 -0
  40. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-13.yaml +112 -0
  41. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-14.yaml +165 -0
  42. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-15.yaml +109 -0
  43. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-16.yaml +102 -0
  44. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-17.yaml +63 -0
  45. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-18.yaml +288 -0
  46. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-19.yaml +78 -0
  47. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-20.yaml +136 -0
  48. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-21.yaml +203 -0
  49. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-22.yaml +82 -0
  50. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-23.yaml +158 -0
  51. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-24.yaml +132 -0
  52. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-25-EXT.yaml +228 -0
  53. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-25.yaml +136 -0
  54. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-26.yaml +147 -0
  55. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-27.yaml +144 -0
  56. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-28.yaml +274 -0
  57. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-29.yaml +87 -0
  58. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/ALL-30.yaml +188 -0
  59. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/BES-01.yaml +136 -0
  60. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/BES-02.yaml +137 -0
  61. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/BES-03.yaml +135 -0
  62. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/BES-04.yaml +228 -0
  63. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/DRA-01.yaml +54 -0
  64. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/DRA-02.yaml +64 -0
  65. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/DRD-01.yaml +667 -0
  66. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/DRL-01.yaml +327 -0
  67. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-01.yaml +73 -0
  68. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-02.yaml +72 -0
  69. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-03.yaml +160 -0
  70. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-04.yaml +161 -0
  71. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-05.yaml +89 -0
  72. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-06.yaml +90 -0
  73. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-07.yaml +145 -0
  74. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-08.yaml +145 -0
  75. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-09.yaml +117 -0
  76. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-10.yaml +737 -0
  77. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-11.yaml +376 -0
  78. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-12.yaml +376 -0
  79. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/GEN-13.yaml +70 -0
  80. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-01.yaml +73 -0
  81. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-02.yaml +73 -0
  82. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-03.yaml +160 -0
  83. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-04.yaml +161 -0
  84. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-05.yaml +85 -0
  85. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-06.yaml +85 -0
  86. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-07.yaml +145 -0
  87. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-08.yaml +145 -0
  88. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-09.yaml +117 -0
  89. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-10.yaml +739 -0
  90. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-11.yaml +376 -0
  91. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-12.yaml +376 -0
  92. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/LOA-13.yaml +71 -0
  93. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/MUL-01.yaml +92 -0
  94. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/MUL-02.yaml +80 -0
  95. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/MUL-03.yaml +78 -0
  96. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/OPT-1-IN-BAND.yaml +115 -0
  97. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/OPT-1-OUT-OF-BAND.yaml +101 -0
  98. cactus_test_definitions-1.5.0/cactus_test_definitions/client/procedures/test-procedures.yaml +76 -0
  99. cactus_test_definitions-1.5.0/cactus_test_definitions/client/test_procedures.py +305 -0
  100. cactus_test_definitions-1.5.0/cactus_test_definitions/csipaus.py +81 -0
  101. cactus_test_definitions-1.5.0/cactus_test_definitions/errors.py +15 -0
  102. cactus_test_definitions-1.5.0/cactus_test_definitions/parameters.py +153 -0
  103. cactus_test_definitions-1.5.0/cactus_test_definitions/py.typed +0 -0
  104. cactus_test_definitions-1.5.0/cactus_test_definitions/schema.py +22 -0
  105. cactus_test_definitions-1.5.0/cactus_test_definitions/server/README.md +170 -0
  106. cactus_test_definitions-1.5.0/cactus_test_definitions/server/__pycache__/actions.cpython-312.pyc +0 -0
  107. cactus_test_definitions-1.5.0/cactus_test_definitions/server/__pycache__/checks.cpython-312.pyc +0 -0
  108. cactus_test_definitions-1.5.0/cactus_test_definitions/server/__pycache__/test_procedures.cpython-312-pytest-8.3.5.pyc +0 -0
  109. cactus_test_definitions-1.5.0/cactus_test_definitions/server/actions.py +139 -0
  110. cactus_test_definitions-1.5.0/cactus_test_definitions/server/checks.py +117 -0
  111. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-ALL-01.yaml +42 -0
  112. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-ALL-02.yaml +65 -0
  113. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-ALL-03.yaml +65 -0
  114. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-ALL-04.yaml +137 -0
  115. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-ALL-05.yaml +111 -0
  116. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-OPT-01.yaml +42 -0
  117. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-OPT-02.yaml +40 -0
  118. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-OPT-03.yaml +44 -0
  119. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/S-OPT-04.yaml +32 -0
  120. cactus_test_definitions-1.5.0/cactus_test_definitions/server/procedures/test-procedures.yaml +14 -0
  121. cactus_test_definitions-1.5.0/cactus_test_definitions/server/test_procedures.py +183 -0
  122. cactus_test_definitions-1.5.0/cactus_test_definitions/variable_expressions.py +419 -0
  123. cactus_test_definitions-1.5.0/cactus_test_definitions.egg-info/PKG-INFO +288 -0
  124. cactus_test_definitions-1.5.0/cactus_test_definitions.egg-info/SOURCES.txt +141 -0
  125. cactus_test_definitions-1.5.0/cactus_test_definitions.egg-info/dependency_links.txt +1 -0
  126. cactus_test_definitions-1.5.0/cactus_test_definitions.egg-info/requires.txt +20 -0
  127. cactus_test_definitions-1.5.0/cactus_test_definitions.egg-info/top_level.txt +2 -0
  128. cactus_test_definitions-1.5.0/pyproject.toml +81 -0
  129. cactus_test_definitions-1.5.0/setup.cfg +23 -0
  130. cactus_test_definitions-1.5.0/tests/__init__.py +0 -0
  131. cactus_test_definitions-1.5.0/tests/unit/__init__.py +0 -0
  132. cactus_test_definitions-1.5.0/tests/unit/client/__init__.py +0 -0
  133. cactus_test_definitions-1.5.0/tests/unit/client/test_actions.py +72 -0
  134. cactus_test_definitions-1.5.0/tests/unit/client/test_checks.py +71 -0
  135. cactus_test_definitions-1.5.0/tests/unit/client/test_config.py +61 -0
  136. cactus_test_definitions-1.5.0/tests/unit/client/test_events.py +36 -0
  137. cactus_test_definitions-1.5.0/tests/unit/client/test_test_procedures.py +163 -0
  138. cactus_test_definitions-1.5.0/tests/unit/server/__init__.py +0 -0
  139. cactus_test_definitions-1.5.0/tests/unit/server/test_test_procedures.py +86 -0
  140. cactus_test_definitions-1.5.0/tests/unit/test_csipaus.py +49 -0
  141. cactus_test_definitions-1.5.0/tests/unit/test_parameters.py +197 -0
  142. cactus_test_definitions-1.5.0/tests/unit/test_variable_expressions.py +402 -0
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2024
4
+
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the “Software”), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ # Include all the files (py, yaml and sql in the python package)
2
+ graft cactus_test_definitions
3
+
@@ -0,0 +1,288 @@
1
+ Metadata-Version: 2.4
2
+ Name: cactus-test-definitions
3
+ Version: 1.5.0
4
+ Summary: CSIP-AUS Client Test Harness Test Definitions
5
+ Author-email: Mike Turner <mike.turner@anu.edu.au>, Josh Vote <joshua.vote@anu.edu.au>
6
+ Maintainer-email: Mike Turner <mike.turner@anu.edu.au>, Josh Vote <joshua.vote@anu.edu.au>
7
+ Project-URL: Homepage, https://github.com/bsgip/cactus-test-definitions
8
+ Project-URL: Documentation, https://github.com/bsgip/cactus-test-definitions/blob/main/README.md
9
+ Project-URL: Repository, https://github.com/bsgip/cactus-test-definitions.git
10
+ Project-URL: Issues, https://github.com/bsgip/cactus-test-definitions/issues
11
+ Project-URL: Changelog, https://github.com/bsgip/cactus-test-definitions/blob/main/CHANGELOG.md
12
+ Keywords: CSIP-AUS,client,testing,definitions
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE.txt
23
+ Requires-Dist: pyyaml<7,>=6.0.2
24
+ Requires-Dist: pyyaml-include<3,>=2.2
25
+ Requires-Dist: dataclass-wizard<1,==0.35.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: bandit; extra == "dev"
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: flake8; extra == "dev"
30
+ Requires-Dist: isort; extra == "dev"
31
+ Requires-Dist: mccabe; extra == "dev"
32
+ Requires-Dist: mypy; extra == "dev"
33
+ Requires-Dist: tox; extra == "dev"
34
+ Requires-Dist: python-dotenv[cli]; extra == "dev"
35
+ Requires-Dist: types-PyYAML; extra == "dev"
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest; extra == "test"
38
+ Provides-Extra: docs
39
+ Requires-Dist: sphinx; extra == "docs"
40
+ Dynamic: license-file
41
+
42
+ # Cactus Test Definitions
43
+
44
+ This repository contains YAML test procedure definitions for use with the CSIP-AUS Client/Server Test Harnesses.
45
+
46
+ This repository also provides Python dataclasses to make it easier for Python code to work with these definitions. In addition, there are also helper functions for creating valid instances of these dataclasses directly from the YAML test procedure definition files.
47
+
48
+ **Client Test Procedures** can be found in the [cactus_test_definitions/client/procedures/](cactus_test_definitions/client/procedures/) directory
49
+
50
+ **Server Test Procedures** can be found in the [cactus_test_definitions/server/procedures/](cactus_test_definitions/server/procedures/) directory
51
+
52
+
53
+ ## Development / Testing
54
+
55
+ This repository also contains a small number of tests that verify that test definitions can be sucessfully converted to their equivalent python dataclasses.
56
+
57
+ First install the development and testing dependencies with,
58
+
59
+ ```sh
60
+ python -m pip install --editable .[dev,test]
61
+ ```
62
+
63
+ Once installed, run the tests with,
64
+
65
+ ```sh
66
+ pytest
67
+ ```
68
+
69
+ ## Server Test Procedure Schema
70
+
71
+ See [cactus_test_definitions/server/README.md](README)
72
+
73
+ ## Client Test Procedure Schema
74
+
75
+ A `TestProcedure` is a [YAML](https://yaml.org) configuration that describes how a CSIP-Aus Client test case should be implemented by a server / compliance body. It's designed to be human readable but interpretable by a test harness for administering a test. At its most basic level, a `TestProcedure` is a series of a "events" that a client must trigger in sequence in order to demonstrate compliance.
76
+
77
+ Here is a minimalist definition of a test case
78
+
79
+ ```
80
+ Description: Minimal Test Case Definition
81
+ Category: Explaining Schemas
82
+ Classes:
83
+ - Descriptive Test Tag 1
84
+ - Descriptive Test Tag 2
85
+ Preconditions:
86
+ # See definitions below for more info
87
+ actions:
88
+ checks:
89
+ Criteria:
90
+ # See definitions below for more info
91
+ checks:
92
+ Steps:
93
+ # See definitions below for more info
94
+ STEP_NAME:
95
+ ```
96
+
97
+ For how to actually interpret and "run" these test cases against a CSIP-Aus Server implementation, please see [cactus-runner](https://github.com/bsgip/cactus-runner) for a reference implementation.
98
+
99
+ ## Steps/Events Schema
100
+
101
+ The most basic building block of a `TestProcedure` is a `Step`. Each `Step` will always define an `Event` which dictates some form of trigger based on client behavior (eg sending a particular request). When an `Event` is triggered, each of it's `Action` elements will fire which will in turn enable/disable additional `Steps` with new events and so on until the `TestProcedure` is complete. `Event`'s can also define a set of `Check` objects (see doco below) that can restrict an `Event` from triggering if any `Check` is returning False/fail.
102
+
103
+ When a `TestProcedure` first starts, normally only a single `Step` will be active but more can be enabled/disabled in response to client behaviour.
104
+
105
+ Step Schema:
106
+ ```
107
+ Steps:
108
+ DESCRIPTIVE_TITLE_OF_STEP: # This is used to reference this step in other parts of this test procedure
109
+ event: #
110
+ type: # string identifier of the event type - see table below
111
+ parameters: # Any parameters to modify the default behaviour of the event - see table below
112
+ checks: # A list of Check definitions that will need to be true for this event to trigger - see section on Checks below
113
+ actions:
114
+ # See action schema in the Action section below
115
+ ```
116
+
117
+ These are the currently defined `Event` types that a `Step` can define
118
+ | **name** | **params** | **description** |
119
+ | -------- | ---------- | --------------- |
120
+ | `GET-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a GET request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
121
+ | `POST-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a POST request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
122
+ | `PUT-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a PUT request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
123
+ | `DELETE-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a DELETE request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
124
+ | `wait` | `duration_seconds: str` | Triggers `duration_seconds` after being initially activated |
125
+
126
+ **NOTE:** The `endpoint` parameter used by the various `-request-received` events supports a rudimentary `*` wildcard. This will match a single "component" of the path (portion deliminated by `/` characters).
127
+
128
+ eg:
129
+
130
+ * `/edev/*/derp/456/derc` will match `/edev/123/derp/456/derc`
131
+ * `/edev/*` will NOT match `/edev/123/derp/456/derc` (the `*` will only match the `123` portion - not EVERYTHING)
132
+
133
+
134
+ ### Actions
135
+
136
+ These are the currently defined `Action` elements that can be included in a test. `Action`'s can trigger at the beginning of a test (as a precondition) or whenever a `Step`'s `Event` is triggered.
137
+
138
+ `Action`'s are defined with the following schema, always as a list under an element called `actions`
139
+ ```
140
+ actions:
141
+ - type: # string identifier of the action type - see table below
142
+ parameters: # Any parameters to supply to the executed Action - see table below
143
+ ```
144
+
145
+ This is an example of two `Action` elements that will enable a different Step and create a DERControl:
146
+
147
+ ```
148
+ actions:
149
+ - type: enable-steps
150
+ parameters:
151
+ steps: NAME_OF_STEP_TO_ENABLE
152
+ - type: create-der-control
153
+ parameters:
154
+ start: $now
155
+ duration_seconds: 300
156
+ opModExpLimW: 2000
157
+ ```
158
+
159
+
160
+ | **name** | **params** | **description** |
161
+ | -------- | ---------- | --------------- |
162
+ | `enable-steps` | `steps: list[str]` | The names of `Step`'s that will be activated |
163
+ | `remove-steps` | `steps: list[str]` | The names of `Step`'s that will be deactivated (if active) |
164
+ | `finish-test` | None | When activated, the current test will be finished (shutdown) and all `Criteria` evaluated as if the client had requested finalization. |
165
+ | `set-default-der-control` | `derp_id: int/None` `opModImpLimW: float/None` `opModExpLimW: float/None` `opModLoadLimW: float/None` `setGradW: float/None` `cancelled: bool/None` `opModStorageTargetW: float/None` | Updates the DefaultDERControl's parameters with the specified values. If `cancelled` is `true`, all unspecified values will be set to None. If `derp_id` is specified, this will apply to the DERProgram with that value, otherwise it will apply to all DERPrograms |
166
+ | `create-der-control` | `start: datetime` `duration_seconds: int` `pow_10_multipliers: int/None` `primacy: int/None` `fsa_id: int/None` `randomizeStart_seconds: int/None` `ramp_time_seconds: float/None` `opModEnergize: bool/None` `opModConnect: bool/None` `opModImpLimW: float/None` `opModExpLimW: float/None` `opModGenLimW: float/None` `opModLoadLimW: float/None` `opModFixedW: float/None` `opModStorageTargetW: float/None` | Creates a DERControl with the specified start/duration and values. A new DERProgram will be created with primacy (and optionally under FunctionSetAssignment `fsa_id`) if no such DERProgram already exists |
167
+ | `create-der-program` | `primacy: int` `fsa_id: int/None` | Creates a DERProgram with the specified primacy. Will be assigned under FunctionSetAssignment 1 unless `fsa_id` says otherwise. |
168
+ | `cancel-active-der-controls` | None | Cancels all active DERControls |
169
+ | `set-comms-rate` | `dcap_poll_seconds: int/None` `edev_post_seconds: int/None` `edev_list_poll_seconds: int/None` `fsa_list_poll_seconds: int/None` `derp_list_poll_seconds: int/None` `der_list_poll_seconds: int/None` `mup_post_seconds: int/None` | Updates one or more post/poll rates for various resources. For non list resources, the rate will apply to all resources. Unspecified values will not update existing server values. |
170
+ | `communications-status` | `enabled: bool` | If `enabled: false` simulates a full outage for the server (from the perspective of the client). There are many potential outage classes (eg: networking, DNS, software, performance issues) - for consistency the recommended outage simulation is for all requests to be served with a HTTP 500. Defaults to `enabled: true` at test start |
171
+ | `edev-registration-links` | `enabled: bool` | If `enabled: false` `EndDevice` entities will NOT encode `RegistrationLink` elements. Defaults to `enabled: true` at test start |
172
+ | `register-end-device` | `nmi: str/None` `registration_pin: int/None` `aggregator_lfdi: HexBinary/None` `aggregator_sfdi: int/None` | Creates a new `EndDevice`, optionally with the specified details. `aggregator_lfdi` / `aggregator_sfdi` will ONLY apply to an Aggregator certificate test with the `aggregator_lfdi` being rewritten with the client's PEN. |
173
+
174
+
175
+ ### Checks
176
+
177
+ A `Check` is a boolean test of the state of the utility server. They are typically defined as a success/failure condition to be run at the end of a `TestProcedure`.
178
+
179
+ `Check`'s are defined with the following schema, always as a list under an element called `checks`
180
+ ```
181
+ checks:
182
+ - type: # string identifier of the check type - see table below
183
+ parameters: # Any parameters to supply to the executed Check - see table below
184
+ ```
185
+
186
+
187
+ This is an example of two `Check` elements that will check that all steps are marked as complete and that there has been a DERStatus submitted with specific values:
188
+
189
+ ```
190
+ checks:
191
+ - type: all-steps-complete
192
+ parameters: {}
193
+ - type: der-status-contents
194
+ parameters:
195
+ genConnectStatus: 1
196
+ ```
197
+
198
+ | **name** | **params** | **description** |
199
+ | -------- | ---------- | --------------- |
200
+ | `all-steps-complete` | `ignored_steps: list[str]/None` | True if every `Step` in a `TestProcedure` has been deactivated (excepting any ignored steps) |
201
+ | `all-notifications-transmitted` | None | True if every transmitted notification (pub/sub) has been received with a HTTP success code response from the subscription notification URI |
202
+ | `end-device-contents` | `has_connection_point_id: bool/None` `deviceCategory_anyset: hex/none` `check_lfdi: bool/None` | True if an `EndDevice` is registered and optionally has the specified contents. `has_connection_point_id` (if True) will check whether the active `EndDevice` has `ConnectionPoint.id` specified. `check_lfdi` will do a deep inspection on the supplied LFDI - checking PEN and derived SFDI. |
203
+ | `der-settings-contents` | `setGradW: int/None` `doeModesEnabled_set: hex/none` `doeModesEnabled_unset: hex/none` `doeModesEnabled: bool/none` `modesEnabled_set: hex/none` `modesEnabled_unset: hex/none` `setMaxVA: bool/none` `setMaxVar: bool/none` `setMaxW: bool/none` `setMaxChargeRateW: bool/none` `setMaxDischargeRateW: bool/none` `setMaxWh: bool/none` `setMinWh: bool/none` `vppModesEnabled_set: hexbinary/none` `vppModesEnabled_unset: hexbinary/none` `setMaxVarNeg: bool/none` `setMinPFOverExcited: bool/none` `setMinPFUnderExcited: bool/none` | True if a `DERSettings` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
204
+ | `der-capability-contents` | `doeModesSupported_set: hex/none` `doeModesSupported_unset: hex/none` `doeModesSupported: bool/none` `modesSupported_set: hex/none` `modesSupported_unset: hex/none` `rtgMaxVA: bool/none` `rtgMaxVar: bool/none` `rtgMaxW: bool/none` `rtgMaxChargeRateW: bool/none` `rtgMaxDischargeRateW: bool/none` `rtgMaxWh: bool/none` `vppModesSupported_set: hexbinary/none` `vppModesSupported_unset: hexbinary/none` `rtgMaxVarNeg: bool/none` `rtgMinPFOverExcited: bool/none` `rtgMinPFUnderExcited: bool/none` | True if a `DERCapability` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
205
+ | `der-status-contents` | `genConnectStatus: int/None` `operationalModeStatus: int/None` `alarmStatus: int/None` | True if a `DERStatus` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
206
+ | `readings-site-active-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide active power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
207
+ | `readings-site-reactive-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide reactive power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
208
+ | `readings-voltage` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide voltage OR DER voltage with `minimum_count` entries (at least one is required) |
209
+ | `readings-der-active-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER active power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
210
+ | `readings-der-reactive-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER reactive power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
211
+ | `response-contents` | `latest: bool/None` `status: int/None` `all: bool/None` | True if at least one received Response matches the filter. `latest` will only consider the most recent received Response. `all` will look for a nominated status match for every `DERControl` |
212
+ | `subscription-contents` | `subscribed_resource: str` | True if a subscription to `subscribed_resource` has been created |
213
+
214
+ The following are csipaus.org/ns/v1.3-beta/storage extension specific checks implemented
215
+
216
+ | **name** | **params** | **description** |
217
+ | -------- | ---------- | --------------- |
218
+ | `readings-der-stored-energy` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER stored energy with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
219
+ <br>
220
+
221
+ #### Hexbinary Parameters for Bitwise Operations
222
+ `doeModesEnabled_set` `modesEnabled_set` `doeModesSupported_set` and `modesSupported_set` all expect a hexbinary string to be supplied, which contains the hi assertion bits to be equal to one e.g. `doeModesEnabled_set: "03"` would test to ensure that at least bits 0 and 1 are set hi (==1) for the given `DERSetting.doeModesEnabled`, ignoring all others
223
+ The corresponding `_unset` performs the inverse operation such that every bit set to 1 in the mask is expected to correspond to a zero in the corresponding value e.g. `doeModesEnabled_unset: "03"` would test to ensure that at least bits 0 and 1 are set lo (==0) for the given `DERSetting.doeModesEnabled`, ignoring all others
224
+
225
+ If a common bit is set between a `_set` and `_unset` corresponding pair of parameters, the check will always fail.
226
+
227
+ ### Parameter Variable Resolution
228
+
229
+ Any `parameter` element expects a series of name/value pairs to pass to the "parent" `Action`, `Check` or `Event`. For example:
230
+
231
+ ```
232
+ parameters:
233
+ number_param: 123
234
+ text_param: Text Content
235
+ date_param: 2020-01-02 03:04:05Z
236
+
237
+ ```
238
+
239
+ But placeholder variables may also be used to reference things that aren't known until the test is underway. For example, the following would instead set `number_param` to the current DERSetting.setMaxW supplied by the client while `date_param` would be set to the moment in time that the `Action`, `Check` or `Event` is being evaluated.
240
+
241
+ ```
242
+ parameters:
243
+ number_param: $setMaxW
244
+ text_param: Text Content
245
+ date_param: $now
246
+
247
+ ```
248
+
249
+ The following are all the `NamedVariable` types currently implemented
250
+
251
+ | **name** | **description** |
252
+ | -------- | --------------- |
253
+ | `$now` | Resolves to the current moment in time (timezone aware). Returns a datetime |
254
+ | `$this` | Self reference to a parameter that is supplied as the key for the parameter check. Must have a corresponding NamedVariable that it can resolve to, derived from the key e.g `setMaxW`
255
+ | `$setMaxW` | Resolves to the last supplied value to `DERSetting.setMaxW` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
256
+ | `$setMaxVA` | Resolves to the last supplied value to `DERSetting.setMaxVA` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
257
+ | `$setMaxVar` | Resolves to the last supplied value to `DERSetting.setMaxVar` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
258
+ | `$setMaxChargeRateW` | Resolves to the last supplied value to `DERSetting.setMaxChargeRateW` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
259
+ | `$setMaxDischargeRateW` | Resolves to the last supplied value to `DERSetting.setMaxDischargeRateW` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
260
+ | `$setMaxWh` | Resolves to the last supplied value to `DERSetting.setMaxWh` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
261
+ | `$rtgMaxVA` | Resolves to last supplied `DERCapability.rtgMaxVA` as a number. Raises exceptions if value hasn't been set, causing test to fail.
262
+ | `$rtgMaxVar` | Resolves to last supplied `DERCapability.rtgMaxVar` as a number. Raises exceptions if value hasn't been set, causing test to fail.
263
+ | `$rtgMaxW` | Resolves to last supplied `DERCapability.rtgMaxW` as a number. Raises exceptions if value hasn't been set, causing test to fail.
264
+ | `$rtgMaxChargeRateW` | Resolves to last supplied `DERCapability.rtgMaxChargeRateW` as a number. Raises exceptions if value hasn't been set, causing test to fail.
265
+ | `$rtgMaxDischargeRateW` | Resolves to last supplied `DERCapability.rtgMaxDischargeRateW` as a number. Raises exceptions if value hasn't been set, causing test to fail.
266
+ | `$rtgMaxWh` | Resolves to last supplied `DERCapability.rtgMaxWh` as a number. Raises exceptions if value hasn't been set, causing test to fail.
267
+
268
+ The following are csipaus.org/ns/v1.3-beta/storage extension specific `NamedVariable` types implemented
269
+
270
+ | **name** | **description** |
271
+ | -------- | --------------- |
272
+ | `$setMinWh` | Resolves to the last supplied value to `DERSetting.setMinWh` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail)
273
+
274
+
275
+ Placeholder variables can also be used in some rudimentary expressions to make variations on the returned value. For example:
276
+
277
+ ```
278
+ parameters:
279
+ number_param: $(setMaxW / 2)
280
+ text_param: Text Content
281
+ date_param: $(now - '5 mins')
282
+ setMaxW: $(this < rtgMaxW)
283
+ setMaxVA: $(this >= rtgMaxWh)
284
+ ```
285
+
286
+ Would resolve similar to above, but instead `number_param` will be half of the last supplied value to `DERSetting.setMaxW` and `date_param` will be set to 5 minutes prior to now.
287
+ `setMaxW` param will return boolean result `DERSettings.setMaxW` is less than `DERCapability.rtgMaxW`.
288
+ `setMaxVA` param will return boolean result `DERSettings.setMaxVA` is greather than or equal to `DERCapability.rtgMaxWh`.
@@ -0,0 +1,247 @@
1
+ # Cactus Test Definitions
2
+
3
+ This repository contains YAML test procedure definitions for use with the CSIP-AUS Client/Server Test Harnesses.
4
+
5
+ This repository also provides Python dataclasses to make it easier for Python code to work with these definitions. In addition, there are also helper functions for creating valid instances of these dataclasses directly from the YAML test procedure definition files.
6
+
7
+ **Client Test Procedures** can be found in the [cactus_test_definitions/client/procedures/](cactus_test_definitions/client/procedures/) directory
8
+
9
+ **Server Test Procedures** can be found in the [cactus_test_definitions/server/procedures/](cactus_test_definitions/server/procedures/) directory
10
+
11
+
12
+ ## Development / Testing
13
+
14
+ This repository also contains a small number of tests that verify that test definitions can be sucessfully converted to their equivalent python dataclasses.
15
+
16
+ First install the development and testing dependencies with,
17
+
18
+ ```sh
19
+ python -m pip install --editable .[dev,test]
20
+ ```
21
+
22
+ Once installed, run the tests with,
23
+
24
+ ```sh
25
+ pytest
26
+ ```
27
+
28
+ ## Server Test Procedure Schema
29
+
30
+ See [cactus_test_definitions/server/README.md](README)
31
+
32
+ ## Client Test Procedure Schema
33
+
34
+ A `TestProcedure` is a [YAML](https://yaml.org) configuration that describes how a CSIP-Aus Client test case should be implemented by a server / compliance body. It's designed to be human readable but interpretable by a test harness for administering a test. At its most basic level, a `TestProcedure` is a series of a "events" that a client must trigger in sequence in order to demonstrate compliance.
35
+
36
+ Here is a minimalist definition of a test case
37
+
38
+ ```
39
+ Description: Minimal Test Case Definition
40
+ Category: Explaining Schemas
41
+ Classes:
42
+ - Descriptive Test Tag 1
43
+ - Descriptive Test Tag 2
44
+ Preconditions:
45
+ # See definitions below for more info
46
+ actions:
47
+ checks:
48
+ Criteria:
49
+ # See definitions below for more info
50
+ checks:
51
+ Steps:
52
+ # See definitions below for more info
53
+ STEP_NAME:
54
+ ```
55
+
56
+ For how to actually interpret and "run" these test cases against a CSIP-Aus Server implementation, please see [cactus-runner](https://github.com/bsgip/cactus-runner) for a reference implementation.
57
+
58
+ ## Steps/Events Schema
59
+
60
+ The most basic building block of a `TestProcedure` is a `Step`. Each `Step` will always define an `Event` which dictates some form of trigger based on client behavior (eg sending a particular request). When an `Event` is triggered, each of it's `Action` elements will fire which will in turn enable/disable additional `Steps` with new events and so on until the `TestProcedure` is complete. `Event`'s can also define a set of `Check` objects (see doco below) that can restrict an `Event` from triggering if any `Check` is returning False/fail.
61
+
62
+ When a `TestProcedure` first starts, normally only a single `Step` will be active but more can be enabled/disabled in response to client behaviour.
63
+
64
+ Step Schema:
65
+ ```
66
+ Steps:
67
+ DESCRIPTIVE_TITLE_OF_STEP: # This is used to reference this step in other parts of this test procedure
68
+ event: #
69
+ type: # string identifier of the event type - see table below
70
+ parameters: # Any parameters to modify the default behaviour of the event - see table below
71
+ checks: # A list of Check definitions that will need to be true for this event to trigger - see section on Checks below
72
+ actions:
73
+ # See action schema in the Action section below
74
+ ```
75
+
76
+ These are the currently defined `Event` types that a `Step` can define
77
+ | **name** | **params** | **description** |
78
+ | -------- | ---------- | --------------- |
79
+ | `GET-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a GET request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
80
+ | `POST-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a POST request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
81
+ | `PUT-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a PUT request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
82
+ | `DELETE-request-received` | `endpoint: str` `serve_request_first: bool/None` | Triggers when a client sends a DELETE request to the nominated endpoint. Will trigger BEFORE serving request to server unless `serve_request_first` is `True` in which case the event will be triggered AFTER the utility server has served the request (but before being proxied back to the device client) |
83
+ | `wait` | `duration_seconds: str` | Triggers `duration_seconds` after being initially activated |
84
+
85
+ **NOTE:** The `endpoint` parameter used by the various `-request-received` events supports a rudimentary `*` wildcard. This will match a single "component" of the path (portion deliminated by `/` characters).
86
+
87
+ eg:
88
+
89
+ * `/edev/*/derp/456/derc` will match `/edev/123/derp/456/derc`
90
+ * `/edev/*` will NOT match `/edev/123/derp/456/derc` (the `*` will only match the `123` portion - not EVERYTHING)
91
+
92
+
93
+ ### Actions
94
+
95
+ These are the currently defined `Action` elements that can be included in a test. `Action`'s can trigger at the beginning of a test (as a precondition) or whenever a `Step`'s `Event` is triggered.
96
+
97
+ `Action`'s are defined with the following schema, always as a list under an element called `actions`
98
+ ```
99
+ actions:
100
+ - type: # string identifier of the action type - see table below
101
+ parameters: # Any parameters to supply to the executed Action - see table below
102
+ ```
103
+
104
+ This is an example of two `Action` elements that will enable a different Step and create a DERControl:
105
+
106
+ ```
107
+ actions:
108
+ - type: enable-steps
109
+ parameters:
110
+ steps: NAME_OF_STEP_TO_ENABLE
111
+ - type: create-der-control
112
+ parameters:
113
+ start: $now
114
+ duration_seconds: 300
115
+ opModExpLimW: 2000
116
+ ```
117
+
118
+
119
+ | **name** | **params** | **description** |
120
+ | -------- | ---------- | --------------- |
121
+ | `enable-steps` | `steps: list[str]` | The names of `Step`'s that will be activated |
122
+ | `remove-steps` | `steps: list[str]` | The names of `Step`'s that will be deactivated (if active) |
123
+ | `finish-test` | None | When activated, the current test will be finished (shutdown) and all `Criteria` evaluated as if the client had requested finalization. |
124
+ | `set-default-der-control` | `derp_id: int/None` `opModImpLimW: float/None` `opModExpLimW: float/None` `opModLoadLimW: float/None` `setGradW: float/None` `cancelled: bool/None` `opModStorageTargetW: float/None` | Updates the DefaultDERControl's parameters with the specified values. If `cancelled` is `true`, all unspecified values will be set to None. If `derp_id` is specified, this will apply to the DERProgram with that value, otherwise it will apply to all DERPrograms |
125
+ | `create-der-control` | `start: datetime` `duration_seconds: int` `pow_10_multipliers: int/None` `primacy: int/None` `fsa_id: int/None` `randomizeStart_seconds: int/None` `ramp_time_seconds: float/None` `opModEnergize: bool/None` `opModConnect: bool/None` `opModImpLimW: float/None` `opModExpLimW: float/None` `opModGenLimW: float/None` `opModLoadLimW: float/None` `opModFixedW: float/None` `opModStorageTargetW: float/None` | Creates a DERControl with the specified start/duration and values. A new DERProgram will be created with primacy (and optionally under FunctionSetAssignment `fsa_id`) if no such DERProgram already exists |
126
+ | `create-der-program` | `primacy: int` `fsa_id: int/None` | Creates a DERProgram with the specified primacy. Will be assigned under FunctionSetAssignment 1 unless `fsa_id` says otherwise. |
127
+ | `cancel-active-der-controls` | None | Cancels all active DERControls |
128
+ | `set-comms-rate` | `dcap_poll_seconds: int/None` `edev_post_seconds: int/None` `edev_list_poll_seconds: int/None` `fsa_list_poll_seconds: int/None` `derp_list_poll_seconds: int/None` `der_list_poll_seconds: int/None` `mup_post_seconds: int/None` | Updates one or more post/poll rates for various resources. For non list resources, the rate will apply to all resources. Unspecified values will not update existing server values. |
129
+ | `communications-status` | `enabled: bool` | If `enabled: false` simulates a full outage for the server (from the perspective of the client). There are many potential outage classes (eg: networking, DNS, software, performance issues) - for consistency the recommended outage simulation is for all requests to be served with a HTTP 500. Defaults to `enabled: true` at test start |
130
+ | `edev-registration-links` | `enabled: bool` | If `enabled: false` `EndDevice` entities will NOT encode `RegistrationLink` elements. Defaults to `enabled: true` at test start |
131
+ | `register-end-device` | `nmi: str/None` `registration_pin: int/None` `aggregator_lfdi: HexBinary/None` `aggregator_sfdi: int/None` | Creates a new `EndDevice`, optionally with the specified details. `aggregator_lfdi` / `aggregator_sfdi` will ONLY apply to an Aggregator certificate test with the `aggregator_lfdi` being rewritten with the client's PEN. |
132
+
133
+
134
+ ### Checks
135
+
136
+ A `Check` is a boolean test of the state of the utility server. They are typically defined as a success/failure condition to be run at the end of a `TestProcedure`.
137
+
138
+ `Check`'s are defined with the following schema, always as a list under an element called `checks`
139
+ ```
140
+ checks:
141
+ - type: # string identifier of the check type - see table below
142
+ parameters: # Any parameters to supply to the executed Check - see table below
143
+ ```
144
+
145
+
146
+ This is an example of two `Check` elements that will check that all steps are marked as complete and that there has been a DERStatus submitted with specific values:
147
+
148
+ ```
149
+ checks:
150
+ - type: all-steps-complete
151
+ parameters: {}
152
+ - type: der-status-contents
153
+ parameters:
154
+ genConnectStatus: 1
155
+ ```
156
+
157
+ | **name** | **params** | **description** |
158
+ | -------- | ---------- | --------------- |
159
+ | `all-steps-complete` | `ignored_steps: list[str]/None` | True if every `Step` in a `TestProcedure` has been deactivated (excepting any ignored steps) |
160
+ | `all-notifications-transmitted` | None | True if every transmitted notification (pub/sub) has been received with a HTTP success code response from the subscription notification URI |
161
+ | `end-device-contents` | `has_connection_point_id: bool/None` `deviceCategory_anyset: hex/none` `check_lfdi: bool/None` | True if an `EndDevice` is registered and optionally has the specified contents. `has_connection_point_id` (if True) will check whether the active `EndDevice` has `ConnectionPoint.id` specified. `check_lfdi` will do a deep inspection on the supplied LFDI - checking PEN and derived SFDI. |
162
+ | `der-settings-contents` | `setGradW: int/None` `doeModesEnabled_set: hex/none` `doeModesEnabled_unset: hex/none` `doeModesEnabled: bool/none` `modesEnabled_set: hex/none` `modesEnabled_unset: hex/none` `setMaxVA: bool/none` `setMaxVar: bool/none` `setMaxW: bool/none` `setMaxChargeRateW: bool/none` `setMaxDischargeRateW: bool/none` `setMaxWh: bool/none` `setMinWh: bool/none` `vppModesEnabled_set: hexbinary/none` `vppModesEnabled_unset: hexbinary/none` `setMaxVarNeg: bool/none` `setMinPFOverExcited: bool/none` `setMinPFUnderExcited: bool/none` | True if a `DERSettings` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
163
+ | `der-capability-contents` | `doeModesSupported_set: hex/none` `doeModesSupported_unset: hex/none` `doeModesSupported: bool/none` `modesSupported_set: hex/none` `modesSupported_unset: hex/none` `rtgMaxVA: bool/none` `rtgMaxVar: bool/none` `rtgMaxW: bool/none` `rtgMaxChargeRateW: bool/none` `rtgMaxDischargeRateW: bool/none` `rtgMaxWh: bool/none` `vppModesSupported_set: hexbinary/none` `vppModesSupported_unset: hexbinary/none` `rtgMaxVarNeg: bool/none` `rtgMinPFOverExcited: bool/none` `rtgMinPFUnderExcited: bool/none` | True if a `DERCapability` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
164
+ | `der-status-contents` | `genConnectStatus: int/None` `operationalModeStatus: int/None` `alarmStatus: int/None` | True if a `DERStatus` has been set for the `EndDevice` under test (and if certain elements have been set to certain values) |
165
+ | `readings-site-active-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide active power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
166
+ | `readings-site-reactive-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide reactive power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
167
+ | `readings-voltage` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for site wide voltage OR DER voltage with `minimum_count` entries (at least one is required) |
168
+ | `readings-der-active-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER active power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
169
+ | `readings-der-reactive-power` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER reactive power with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
170
+ | `response-contents` | `latest: bool/None` `status: int/None` `all: bool/None` | True if at least one received Response matches the filter. `latest` will only consider the most recent received Response. `all` will look for a nominated status match for every `DERControl` |
171
+ | `subscription-contents` | `subscribed_resource: str` | True if a subscription to `subscribed_resource` has been created |
172
+
173
+ The following are csipaus.org/ns/v1.3-beta/storage extension specific checks implemented
174
+
175
+ | **name** | **params** | **description** |
176
+ | -------- | ---------- | --------------- |
177
+ | `readings-der-stored-energy` | `minimum_count: int/none` `minimum_level: float/none` `maximum_level: float/none` `window_seconds: uint/none` | True if any MirrorUsagePoint has a MirrorMeterReading for DER stored energy with `minimum_count` entries and/or readings all above and/or below `minimum_level`/`maximum_level` respectively; optionally for `window_seconds` |
178
+ <br>
179
+
180
+ #### Hexbinary Parameters for Bitwise Operations
181
+ `doeModesEnabled_set` `modesEnabled_set` `doeModesSupported_set` and `modesSupported_set` all expect a hexbinary string to be supplied, which contains the hi assertion bits to be equal to one e.g. `doeModesEnabled_set: "03"` would test to ensure that at least bits 0 and 1 are set hi (==1) for the given `DERSetting.doeModesEnabled`, ignoring all others
182
+ The corresponding `_unset` performs the inverse operation such that every bit set to 1 in the mask is expected to correspond to a zero in the corresponding value e.g. `doeModesEnabled_unset: "03"` would test to ensure that at least bits 0 and 1 are set lo (==0) for the given `DERSetting.doeModesEnabled`, ignoring all others
183
+
184
+ If a common bit is set between a `_set` and `_unset` corresponding pair of parameters, the check will always fail.
185
+
186
+ ### Parameter Variable Resolution
187
+
188
+ Any `parameter` element expects a series of name/value pairs to pass to the "parent" `Action`, `Check` or `Event`. For example:
189
+
190
+ ```
191
+ parameters:
192
+ number_param: 123
193
+ text_param: Text Content
194
+ date_param: 2020-01-02 03:04:05Z
195
+
196
+ ```
197
+
198
+ But placeholder variables may also be used to reference things that aren't known until the test is underway. For example, the following would instead set `number_param` to the current DERSetting.setMaxW supplied by the client while `date_param` would be set to the moment in time that the `Action`, `Check` or `Event` is being evaluated.
199
+
200
+ ```
201
+ parameters:
202
+ number_param: $setMaxW
203
+ text_param: Text Content
204
+ date_param: $now
205
+
206
+ ```
207
+
208
+ The following are all the `NamedVariable` types currently implemented
209
+
210
+ | **name** | **description** |
211
+ | -------- | --------------- |
212
+ | `$now` | Resolves to the current moment in time (timezone aware). Returns a datetime |
213
+ | `$this` | Self reference to a parameter that is supplied as the key for the parameter check. Must have a corresponding NamedVariable that it can resolve to, derived from the key e.g `setMaxW`
214
+ | `$setMaxW` | Resolves to the last supplied value to `DERSetting.setMaxW` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
215
+ | `$setMaxVA` | Resolves to the last supplied value to `DERSetting.setMaxVA` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
216
+ | `$setMaxVar` | Resolves to the last supplied value to `DERSetting.setMaxVar` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
217
+ | `$setMaxChargeRateW` | Resolves to the last supplied value to `DERSetting.setMaxChargeRateW` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
218
+ | `$setMaxDischargeRateW` | Resolves to the last supplied value to `DERSetting.setMaxDischargeRateW` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
219
+ | `$setMaxWh` | Resolves to the last supplied value to `DERSetting.setMaxWh` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail) |
220
+ | `$rtgMaxVA` | Resolves to last supplied `DERCapability.rtgMaxVA` as a number. Raises exceptions if value hasn't been set, causing test to fail.
221
+ | `$rtgMaxVar` | Resolves to last supplied `DERCapability.rtgMaxVar` as a number. Raises exceptions if value hasn't been set, causing test to fail.
222
+ | `$rtgMaxW` | Resolves to last supplied `DERCapability.rtgMaxW` as a number. Raises exceptions if value hasn't been set, causing test to fail.
223
+ | `$rtgMaxChargeRateW` | Resolves to last supplied `DERCapability.rtgMaxChargeRateW` as a number. Raises exceptions if value hasn't been set, causing test to fail.
224
+ | `$rtgMaxDischargeRateW` | Resolves to last supplied `DERCapability.rtgMaxDischargeRateW` as a number. Raises exceptions if value hasn't been set, causing test to fail.
225
+ | `$rtgMaxWh` | Resolves to last supplied `DERCapability.rtgMaxWh` as a number. Raises exceptions if value hasn't been set, causing test to fail.
226
+
227
+ The following are csipaus.org/ns/v1.3-beta/storage extension specific `NamedVariable` types implemented
228
+
229
+ | **name** | **description** |
230
+ | -------- | --------------- |
231
+ | `$setMinWh` | Resolves to the last supplied value to `DERSetting.setMinWh` as a number. Can raise exceptions if this value hasn't been set (which will trigger a test evaluation to fail)
232
+
233
+
234
+ Placeholder variables can also be used in some rudimentary expressions to make variations on the returned value. For example:
235
+
236
+ ```
237
+ parameters:
238
+ number_param: $(setMaxW / 2)
239
+ text_param: Text Content
240
+ date_param: $(now - '5 mins')
241
+ setMaxW: $(this < rtgMaxW)
242
+ setMaxVA: $(this >= rtgMaxWh)
243
+ ```
244
+
245
+ Would resolve similar to above, but instead `number_param` will be half of the last supplied value to `DERSetting.setMaxW` and `date_param` will be set to 5 minutes prior to now.
246
+ `setMaxW` param will return boolean result `DERSettings.setMaxW` is less than `DERCapability.rtgMaxW`.
247
+ `setMaxVA` param will return boolean result `DERSettings.setMaxVA` is greather than or equal to `DERCapability.rtgMaxWh`.
@@ -0,0 +1,39 @@
1
+ from cactus_test_definitions.csipaus import CSIPAusVersion
2
+ from cactus_test_definitions.errors import (
3
+ TestProcedureDefinitionError,
4
+ UnparseableVariableExpressionError,
5
+ UnresolvableVariableError,
6
+ )
7
+ from cactus_test_definitions.variable_expressions import (
8
+ Constant,
9
+ ConstantType,
10
+ Expression,
11
+ NamedVariable,
12
+ NamedVariableType,
13
+ OperationType,
14
+ parse_binary_expression,
15
+ parse_time_delta,
16
+ parse_unary_expression,
17
+ parse_variable_expression_body,
18
+ try_extract_variable_expression,
19
+ )
20
+
21
+ __version__ = "1.5.0"
22
+
23
+ __all__ = [
24
+ "TestProcedureDefinitionError",
25
+ "CSIPAusVersion",
26
+ "Expression",
27
+ "Constant",
28
+ "ConstantType",
29
+ "NamedVariable",
30
+ "OperationType",
31
+ "UnresolvableVariableError",
32
+ "UnparseableVariableExpressionError",
33
+ "NamedVariableType",
34
+ "try_extract_variable_expression",
35
+ "parse_variable_expression_body",
36
+ "parse_time_delta",
37
+ "parse_binary_expression",
38
+ "parse_unary_expression",
39
+ ]