Skip to content

Commit

Permalink
[WIP] Highlight example touch-ups with model changes for review later…
Browse files Browse the repository at this point in the history
… today.
  • Loading branch information
aj-stein-nist committed Aug 22, 2022
1 parent 59bd5c5 commit 283f838
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 52 deletions.
46 changes: 29 additions & 17 deletions src/metaschema/examples/rules-component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,65 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/1.0 ../../../xml/schema/oscal_complete_schema.xsd" uuid="3559d200-4849-41ac-a420-28b2ffa22c52">
<metadata>
<title></title>
<last-modified></last-modified>
<version></version>
<oscal-version></oscal-version>
<title>Example Component Definition with Rules and Tests Linked to Component</title>
<last-modified>2022-08-22T00:00:00.000000000-04:00</last-modified>
<version>0.0.1-alpha</version>
<oscal-version>1.2.0</oscal-version>
</metadata>
<rule uuid="97a52f09-0248-45f4-8ac7-b7566170d733">
<title>Important Rule 1</title>
<description>This is a description of Important Rule 1.</description>
<description>
<p> is a description of Important Rule 1.</p>
</description>
</rule>
<test uuid="7d50cd70-f0b3-4922-a566-3526d5eba97b">
<title>Test A for Rule 1</title>
<description>This is Test A, it can be executed to demonstrate a system meets requirements for Rule 1.</description>
<description>
<p>This is Test A, it can be executed to demonstrate a system meets requirements for Rule 1.</p>
</description>
</test>
<test uuid="2388cb25-ccbc-4de0-9630-675de624593f">
<title>Test B for Rule 1</title>
<description>This is Test B, it can be executed to demonstrate a system meets requirements for Rule 1.</description>
<description>
<p>This is Test B, it can be executed to demonstrate a system meets requirements for Rule 1.</p>
</description>
</test>
<test uuid="b426642a-7ff0-42a0-9ef5-ceed4e14f326">
<title>Test C for Rule 1</title>
<description>This is Test C, it can be optionally executed to demonstrate a system meets requirements for Rule 1.</description>
<description>
<p>This is Test C, it can be optionally executed to demonstrate a system meets requirements for Rule 1.</p>
</description>
</test>
<test uuid="2f6c5c71-13fb-43c8-beca-1e79498b34c4">
<title>Test D for Rule 1</title>
<description>This is Test C, it can be optionally executed to demonstrate a system meets requirements for Rule 1.</description>
<description>
<p>This is Test D, it can be optionally executed to demonstrate a system meets requirements for Rule 1.</p>
</description>
</test>
<!--
The testing-scenarios below exhibit three common usage patterns:
The scenarios below exhibit three common usage patterns:
1. A simple scenario where one test (Test A) is sufficient for one rule (Rule 1).
2. A complex scenario where one test (Test B) is sufficient for one rule (Rule 1), and that test depends on a prerequisite test (Test A).
3. A complex scenario with a condition, where one of either Test C or Test D, is sufficient for one rule (Rule 1).
-->
<!-- Testing Scenario Usage Pattern 1 -->
<testing-scenario uuid="0666cbf2-2b76-4e9d-ba99-a783419ff1fe" rule-uuid="97a52f09-0248-45f4-8ac7-b7566170d733">
<test-reference test-uuid="7d50cd70-f0b3-4922-a566-3526d5eba97b" />
<testing-scenario rule-uuid="15ea20bc-75d5-43b0-a98d-cab984afeeb9" uuid="0666cbf2-2b76-4e9d-ba99-a783419ff1fe"> <!-- TODOD: Discuss that We don't need rule-uuid anymore? -->
<condition operator="and"> <!-- TODO: Discuss that We can't have a default operator to Metaschema defaults merged? -->
<test-reference uuid="9d0a52e3-2bb6-4b39-9614-2dfa72271b57" test-uuid="7d50cd70-f0b3-4922-a566-3526d5eba97b" /> <!-- TODO: Discuss we need a uuid here now too? -->
</condition>
</testing-scenario>
<!-- Testing Scenario Usage Pattern 2 -->
<testing-scenario uuid="ccb267c8-f672-4aac-b522-5bbaef26f8e4" rule-uuid="97a52f09-0248-45f4-8ac7-b7566170d733">
<testing-scenario rule-uuid="" uuid="ccb267c8-f672-4aac-b522-5bbaef26f8e4">
<condition operator="and">
<pre-requisite>
<pre-condition operator="and"> <!-- TODO: Discuss we changed pre-requisite to pre-condition intentionally, right? -->
<test-reference test-uuid="7d50cd70-f0b3-4922-a566-3526d5eba97b" />
</pre-requisite>
<test-reference test-uuid="2388cb25-ccbc-4de0-9630-675de624593f" />
</pre-condition>
<test-reference uuid="9376b219-659f-4846-88ad-130b8c9074b9" test-uuid="2388cb25-ccbc-4de0-9630-675de624593f" />
</condition>
</testing-scenario>
<!-- Testing Scenario Usage Pattern 3 -->
<testing-scenario uuid="f3edfdbf-b3b4-48c9-8733-fd3ebdeed43c" rule-uuid="97a52f09-0248-45f4-8ac7-b7566170d733">
<testing-scenario rule-uuid="" uuid="f3edfdbf-b3b4-48c9-8733-fd3ebdeed43c">
<condition operator="or">
<test-reference test-uuid="b426642a-7ff0-42a0-9ef5-ceed4e14f326" />
<test-reference test-uuid="2f6c5c71-13fb-43c8-beca-1e79498b34c4" />
Expand Down
177 changes: 142 additions & 35 deletions src/metaschema/oscal_rules-common_metaschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@
<formal-name>Rule Definition Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
<model>
<define-field name="title" as-type="markup-line" min-occurs="1">
<formal-name>Rule Title</formal-name>
<description>A name given to the rule, which may be used by a tool for display and navigation.</description>
</define-field>
<define-field name="description" as-type="markup-multiline" min-occurs="1" in-xml="WITH_WRAPPER">
<formal-name>Rule Description</formal-name>
<description>A summary of the rule, including the requirement(s) to be met when evaluating the rule against a target that the rule applies to.</description>
</define-field>
<assembly ref="property" max-occurs="unbounded">
<group-as name="props" in-json="ARRAY"/>
</assembly>
<assembly ref="link" max-occurs="unbounded">
<group-as name="links" in-json="ARRAY"/>
</assembly>
<define-field ref="remarks"/>
</model>
<constraint>
<allowed-values target="prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name">
<enum value="version">A string that identifies the revision of the rule.</enum>
</allowed-values>
<allowed-values target="link/@rel">
<enum value="source">A pointer to the resource that this rule is derived from.</enum>
</allowed-values>
</constraint>
</define-assembly>
<define-assembly name="test-definition">
<formal-name>Test Definition</formal-name>
Expand All @@ -24,82 +49,164 @@
<formal-name>Test Definition Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
<model>
<define-field name="title" as-type="markup-line" min-occurs="0" max-occurs="1">
<formal-name>Test Title</formal-name>
<description>A name given to the test, which may be used by a tool for display and navigation.</description>
</define-field>
<define-field name="description" as-type="markup-multiline" in-xml="WITH_WRAPPER">
<formal-name>Test Description</formal-name>
<description>A summary of the test, including implementation details of how its use examines an aspect or trait of a system.</description>
</define-field>
<assembly ref="property" max-occurs="unbounded">
<group-as name="props" in-json="ARRAY"/>
</assembly>
<assembly ref="link" max-occurs="unbounded">
<group-as name="links" in-json="ARRAY"/>
</assembly>
<!-- TODO: address activities and actions -->
<define-field ref="remarks"/>
</model>
<constraint>
<allowed-values target="prop[has-oscal-namespace('http://csrc.nist.gov/ns/oscal')]/@name">
<enum value="version">A string that identifies the revision of the test.</enum>
</allowed-values>
<allowed-values target="link/@rel">
<enum value="source">A pointer to the resource that this test is derived from.</enum>
</allowed-values>
</constraint>
</define-assembly>
<define-assembly name="testing-scenario">
<formal-name>Rule Testing Scenario</formal-name>
<description>A rule testing scenario</description>
<use-name>scenario</use-name>
<define-flag name="uuid" required="yes" as-type="uuid">
<formal-name>Testing Scenario Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
<define-flag name="rule-uuid" required="yes" as-type="uuid">
<formal-name>Testing Scenario Rule Universally Unique Identifier Reference</formal-name>
<description>TODO</description>
</define-flag>
<model>
<assembly ref="rule-condition" min-occurs="1">
<use-name>condition</use-name>
<assembly ref="property" max-occurs="unbounded">
<group-as name="props" in-json="ARRAY"/>
</assembly>
<assembly ref="link" max-occurs="unbounded">
<group-as name="links" in-json="ARRAY"/>
</assembly>
<choice>
<assembly ref="rule-condition" min-occurs="1">
<use-name>condition</use-name>
</assembly>
<assembly ref="test-reference" min-occurs="1"/>
</choice>
<define-field ref="remarks"/>
</model>
</define-assembly>
<define-assembly name="test-reference" min-occurs="1" max-occurs="unbounded">
<formal-name>Test Reference</formal-name>
<description>TODO</description>
<!-- TODO: Consider if we need a specific uuid per test-reference for each ref in final impl.
<define-flag name="uuid" required="yes" as-type="uuid">
<formal-name>Test Reference Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
-->
<define-flag name="test-uuid" required="yes" as-type="uuid">
<formal-name>Test Universally Unique Identifier Reference</formal-name>
<description>A test UUID reference</description>
</define-flag>
</define-assembly>
<define-assembly name="rule-condition">
<formal-name>Rule Condition</formal-name>
<description>A rule implementation condition</description>
<define-flag name="operator" required="yes" as-type="token">
<define-flag name="negate" required="no" as-type="boolean" default="false">
<formal-name>Rule Condition Negation Flag</formal-name>
<description>TODO</description>
<remarks>
<p>
<h1>Negate Truth Table</h1>
<p>true -> false, false -> true, error -> error, not-applicable -> not-applicable</p>
</p>
</remarks>
</define-flag>
<define-flag name="operator" required="yes" as-type="token" default="and">
<formal-name>Rule Condition Operator</formal-name>
<description>TODO</description>
<constraint>
<allowed-values allow-other="no">
<enum value="and">and</enum>
<enum value="or">or</enum>
<enum value="not">not</enum>
</allowed-values>
</constraint>
<remarks>
<p>
<h1>Operator Truth Table</h1>
<p></p>
</p>
<p>What is eager evaluation and why does it matter?</p>
<p>How do prerequisites work in the processing of condition operators and precedence.</p>
</remarks>
</define-flag>
<model>
<assembly ref="property" max-occurs="unbounded">
<group-as name="props" in-json="ARRAY"/>
</assembly>
<assembly ref="link" max-occurs="unbounded">
<group-as name="links" in-json="ARRAY"/>
</assembly>
<assembly ref="rule-condition">
<use-name>pre-condition</use-name>
<use-name>prerequisite</use-name>
</assembly>
<choice>
<!-- TODO: consider making this a multi-choice if that feature is implemented. -->
<assembly ref="rule-condition">
<use-name>condition</use-name>
</assembly>
<define-assembly name="test-reference" min-occurs="1" max-occurs="unbounded">
<formal-name>Test Reference</formal-name>
<description>TODO</description>
<define-flag name="uuid" required="yes" as-type="uuid">
<formal-name>Test Reference Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
<define-flag name="test-uuid" required="yes" as-type="uuid">
<formal-name>Test Universally Unique Identifier Reference</formal-name>
<description>A test UUID reference</description>
</define-flag>
</define-assembly>
<assembly ref="test-reference" min-occurs="1" max-occurs="unbounded"/>
<assembly ref="testing-scenario-reference" min-occurs="1" max-occurs="unbounded"/>
</choice>
<define-field ref="remarks"/>
</model>
</define-assembly>
<define-flag name="testing-scenario-uuid" as-type="uuid" scope="local">
<formal-name>Testing Scenario Universally Unique Identifier Reference</formal-name>
<description>A testing scenario UUID reference</description>
</define-flag>
<define-field name="testing-scenario-uuid" required="yes" as-type="uuid" scope="local">
<formal-name>Testing Scenario Universally Unique Identifier</formal-name>
<description>A testing scenari UUID reference</description>
</define-field>
<define-assembly name="testing-scenario-reference">
<formal-name>Testing Scenario Reference</formal-name>
<description>A reference to a testing scenario.</description>
<define-flag name="uuid" required="yes" as-type="uuid">
<formal-name>Testing Scenario Universally Unique Identifier Reference</formal-name>
<description>TODO</description>
</define-flag>
<flag ref="testing-scenario-uuid" required="yes"/>
</define-assembly>

<define-assembly name="rule-implementation">
<formal-name>Rule Implementation</formal-name>
<description>TODO</description>
<define-flag name="uuid" required="yes" as-type="uuid">
<formal-name>Rule Implementation Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
<define-field name="description" as-type="markup-multiline" min-occurs="1" in-xml="WITH_WRAPPER">
<formal-name>Rule Implementation Description</formal-name>
<description>A summary of the rule implementation.</description>
</define-field>
<model>
<define-assembly name="testing-scenario-reference">
<formal-name>Testing Scenario Reference</formal-name>
<description>A reference to a testing scenario.</description>
<define-flag name="uuid" required="yes" as-type="uuid">
<formal-name>Rule Reference Universally Unique Identifier</formal-name>
<description>TODO</description>
</define-flag>
<define-flag name="rule-uuid" required="yes" as-type="uuid">
<formal-name>Rule Universally Unique Identifier Reference</formal-name>
<description>A rule UUID reference</description>
</define-flag>
<define-flag name="test-scenario-uuid" required="yes" as-type="uuid">
<formal-name>Rule Universally Unique Identifier Reference</formal-name>
<description>A rule UUID reference</description>
</define-flag>
</define-assembly>
<assembly ref="property" max-occurs="unbounded">
<group-as name="props" in-json="ARRAY"/>
</assembly>
<assembly ref="link" max-occurs="unbounded">
<group-as name="links" in-json="ARRAY"/>
</assembly>
<assembly ref="testing-scenario-reference" min-occurs="1"/>
<define-field ref="remarks"/>
</model>
</define-assembly>
</METASCHEMA>
</METASCHEMA>

0 comments on commit 283f838

Please sign in to comment.