<p>The <strong>Visibility Control API</strong> is a helper service within <strong>OpenCAPIF</strong>, allowing API Providers and administrators to define fine-grained rules that determine whether specific APIs can be discovered and consumed by API Invokers.</p>
<p>This test plan validates the lifecycle of the visibility control rules, ensuring that authentication, authorization logic, and mandatory parameters are correctly enforced.</p>
<hr/>
<h2id="test-case-1-get-visibility-control-rules-as-superadmin">Test Case 1: Get Visibility Control Rules as Superadmin</h2>
This test case verifies that the <strong>Superadmin</strong> can retrieve the registered rules. In this case, the response is an empty registry because no rules have been provisioned. It validates the basic connectivity and authentication flow for administrative roles.</p>
<p><strong>Pre-Conditions</strong>:
* The <strong>CAPIF</strong> helper service is deployed and reachable.
* Superadmin credentials (<code>SUPERADMIN_USERNAME</code>) are provisioned.
* The database is in a clean state (no rules existing).</p>
<p><strong>Execution Steps</strong>:
1. Authenticate as <strong>Superadmin</strong>.
2. Send a <strong>GET</strong> request to <code>{apiRoot}/helper/visibility-control/rules</code>.
3. Inspect the <strong>JSON</strong> response body.</p>
* <strong>Body</strong>: Returns a <strong>JSON</strong> object with a <code>rules</code> array. The length of this array must be <strong>0</strong>.</p>
<hr/>
<h2id="test-case-2-create-visibility-control-rule-invalid-dates-as-superadmin">Test Case 2: Create Visibility Control Rule Invalid Dates as Superadmin</h2>
<li>Register Provider at CCF, store certificates.</li>
<li>...</li>
</ol>
<p><strong>Information of Test</strong>:</p>
<ol>
<li>Perform <ahref="../common_operations/#register-a-provider"title="Provider Registration">Provider Registration</a> and <ahref="../common_operations/#onboard-an-invoker"title="Invoker Onboarding">Invoker Onboarding</a></li>
<li>...</li>
</ol>
<p><strong>Expected Result</strong>:</p>
<ol>
<li>...</li>
</ol>
<h2id="test-case-2-create-visibility-control-rule-with-invalid-dates-as-superadmin">Test Case 2: Create Visibility Control Rule with Invalid Dates as Superadmin</h2>
This test case validates the API's logic regarding time-range consistency. A visibility rule must have a logical duration; therefore, the service must reject any attempt to create a rule where the expiration date occurs before the start date.</p>
<p><strong>Pre-Conditions</strong>:
* The <strong>CAPIF</strong> helper service is deployed and reachable.
* Superadmin credentials (<code>SUPERADMIN_USERNAME</code>) are provisioned.</p>
<p><strong>Execution Steps</strong>:
1. Authenticate as <strong>Superadmin</strong>.
2. Send a <strong>POST</strong> request to <code>{apiRoot}/helper/visibility-control/rules</code>.
3. Use a payload where <code>startsAt</code> is later than <code>endsAt</code> (e.g., Starts: <code>2026</code>, Ends: <code>2025</code>).</p>
<p><strong>Expected Result</strong>:
* <strong>Status</strong>: <strong>400 Bad Request</strong>.
* <strong>Body</strong>: Must contain a <code>ProblemDetails</code> object with the <code>detail</code> field specifying <strong>"endsAt must be later than startsAt"</strong>.</p>
<hr/>
<h2id="test-case-3-create-visibility-control-rule">Test Case 3: Create Visibility Control Rule</h2>
This test case validates that an <strong>AMF Provider</strong> can list rules and that the system correctly maps the Provider's certificate (<strong>CN</strong>) to their registered identity to filter the results.</p>
<p><strong>Pre-Conditions</strong>:
* The <strong>CAPIF</strong> helper service is deployed and reachable.
* A <strong>Provider</strong> has been registered and onboarded at <strong>CCF</strong>.
* The <strong>Provider</strong> possesses a valid certificate (in this case <strong>AMF</strong> certificate).</p>
<p><strong>Execution Steps</strong>:
1. Authenticate using the <strong>AMF Provider Certificate</strong>.
2. Send a <strong>GET</strong> request to <code>{apiRoot}/helper/visibility-control/rules</code>.</p>
* <strong>Validation</strong>: The response body must only contain rules where the requester is the owner (<code>userName</code>).</p>
<hr/>
<h2id="test-case-5-create-visibility-control-rule-by-amf-provider-and-delete-by-superadmin">Test Case 5: Create Visibility Control Rule by AMF Provider and DELETE by superadmin</h2>
* <strong>Superadmin Deletion</strong>: <strong>204 No Content</strong>.
* <strong>Validation</strong>: The rule is successfully removed from the database.</p>
<hr/>
<h2id="test-case-6-create-and-delete-visibility-control-rule-by-amf-provider">Test Case 6: Create and Delete Visibility Control Rule by AMF Provider</h2>
This test validates that the <strong>Providers</strong> can create, delete, and obtain rules, ensuring that the identity-based authorization logic correctly identifies the owner of a resource and allows them to delete it without requiring <strong>Superadmin</strong> intervention.</p>
<p><strong>Pre-Conditions</strong>:
* The <strong>CAPIF</strong> helper service is deployed and reachable.
* A <strong>Provider</strong> has been registered and onboarded at <strong>CCF</strong>.
* The <strong>Provider</strong> possesses a valid certificate (in this case <strong>AMF</strong> certificate).</p>
<p><strong>Execution Steps</strong>:
1. <strong>AMF Provider</strong> creates a rule: <strong>POST</strong> request to <code>{apiRoot}/helper/visibility-control/rules</code>.
2. <strong>AMF Provider</strong> sends a <strong>DELETE</strong> request for the same rule using the same provider identity and the <code>ruleId</code>.</p>
<p><strong>Expected Result</strong>:
* <strong>Status</strong>: <strong>204 No Content</strong>.
* <strong>Validation</strong>: Subsequent list requests by the provider return an empty set.</p>
<hr/>
<h2id="test-case-7-create-update-and-delete-visibility-control-rule-by-amf-provider">Test Case 7: Create Update and Delete Visibility Control Rule by AMF Provider</h2>
This test validates the <strong>PATCH</strong> implementation. It ensures that <strong>Providers</strong> can perform partial updates to their rules and that the system correctly updates metadata like <code>updatedAt</code>.</p>
<p><strong>Pre-Conditions</strong>:
* The <strong>CAPIF</strong> helper service is deployed and reachable.
* A <strong>Provider</strong> has been registered and onboarded at <strong>CCF</strong>.
* The <strong>Provider</strong> possesses a valid certificate (in this case <strong>AMF</strong> certificate).</p>
<p><strong>Execution Steps</strong>:
1. <strong>AMF Provider</strong> creates a rule: <strong>POST</strong> request to <code>{apiRoot}/helper/visibility-control/rules</code>.
2. Send a <strong>PATCH</strong> request to <code>{apiRoot}/helper/visibility-control/rules/{ruleId}</code>.
3. <strong>Payload</strong>: Change <code>default_access</code> from <strong>"ALLOW"</strong> to <strong>"DENY"</strong>.
4. Verify the response contains the updated field.
5. <strong>AMF Provider</strong> sends a <strong>DELETE</strong> request for the same rule using the same provider identity and the <code>ruleId</code>.</p>
* <strong>Body</strong>: Returns the updated <code>Rule</code> object showing the new <code>default_access</code> value and a refreshed <code>updatedAt</code> timestamp, and finally the rule is successfully removed.</p>
<hr/>
<h2id="test-case-8-create-and-get-specific-visibility-control-rule">Test Case 8: Create and Get Specific Visibility Control Rule</h2>