Skip to content

Commit 2b18119

Browse files
authored
policies scenarios description (#251)
* policies scenarios description
1 parent 7254e92 commit 2b18119

7 files changed

+147
-5
lines changed

automated_tests/docs/development_guide.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22
## **PKTVISOR**
33

44

5-
| Scenario | Automated | Smoke | Sanity |
6-
|:------------------------------------------------------------------------------------------------------------------:|:---------:|:-----:|:------:|
7-
| [Run pktvisor instance using docker command](pktvisor/run_pktvisor_instance_using_docker_command.md) | 👍 | 👍 | 👍 |
8-
| [Run multiple pktvisors instances using different ports](pktvisor/run_multiple_pktvisors_instances_using_different_ports.md) | 👍 | 👍 | 👍 |
9-
| [Run multiple pktvisors instances using the same ports](pktvisor/run_multiple_pktvisors_instances_using_the_same_ports.md) | 👍 | 👍 | 👍 |
5+
| Scenario | Automated | Smoke | Sanity |
6+
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------:|:-----:|:------:|
7+
| [Run pktvisor instance using docker command](pktvisor/run_pktvisor_instance_using_docker_command.md) | 👍 | 👍 | 👍 |
8+
| [Run multiple pktvisors instances using different ports](pktvisor/run_multiple_pktvisors_instances_using_different_ports.md) | 👍 | 👍 | 👍 |
9+
| [Run multiple pktvisors instances using the same ports](pktvisor/run_multiple_pktvisors_instances_using_the_same_ports.md) | 👍 | 👍 | 👍 |
10+
| [Create a policy using admin permission with all handlers](pktvisor/create_a_policy_using_admin_permission_with_all_handlers.md) | 👍 | 👍 | 👍 |
11+
| [Create a policy using admin permission with only dns handler](pktvisor/create_a_policy_using_admin_permission_with_only_one_handler.md) | | | |
12+
| [Create a policy using admin permission with only net handler](pktvisor/create_a_policy_using_admin_permission_with_only_one_handler.md) | | | |
13+
| [Create a policy using admin permission with only dhcp handler](pktvisor/create_a_policy_using_admin_permission_with_only_one_handler.md) | | | |
14+
| [Create a policy using admin permission with only pcap handler](pktvisor/create_a_policy_using_admin_permission_with_only_one_handler.md) | | | |
15+
| [Remove all policies using admin permission from pktvisor instance](pktvisor/remove_policies_using_admin_permission_from_pktvisor_instance.md) | 👍 | 👍 | 👍 |
16+
| [Remove one policy using admin permission from pktvisor instance](pktvisor/remove_policies_using_admin_permission_from_pktvisor_instance.md) | 👍 | 👍 | 👍 |
17+
| [Create a policy without admin permission](pktvisor/create_a_policy_without_admin_permission.md) | | | |
18+
| [Remove a policy without admin permission](pktvisor/remove_a_policy_without_admin_permission.md) | | | |
19+
| [Disable pktvisor's metrics](pktvisor/disable_pktvisor's_metrics.md) | | | |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Scenario: Create a policy using admin permission with all handlers
2+
## Steps:
3+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
4+
- Create a policy with all handlers through a post request on the endpoint: `/api/v1/policies`
5+
- Check our method `generate_pcap_policy_with_all_handlers` on [policies.py](../../features/steps/policies.py) in order to have examples of how to do it
6+
- Make a get request to the same endpoint
7+
8+
## Expected Result:
9+
- pktvisor instance must be running on port 10853
10+
- Response of post request must have 201 as status code
11+
- 2 policies must be running on the pktvisor instance (the default one and the created one)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Scenario: Create a policy using admin permission with only one handler
2+
3+
4+
--------------------
5+
DNS:
6+
7+
## Steps:
8+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
9+
- Create a policy with dns handler through a post request on the endpoint: `/api/v1/policies`
10+
- Make a get request to the same endpoint
11+
12+
## Expected Result:
13+
- pktvisor instance must be running on port 10853
14+
- Response of post request must have 201 as status code
15+
- 2 policies must be running on the pktvisor instance (the default one and the created one)
16+
17+
18+
--------------------
19+
NET:
20+
21+
## Steps:
22+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
23+
- Create a policy with net handler through a post request on the endpoint: `/api/v1/policies`
24+
- Make a get request to the same endpoint
25+
26+
## Expected Result:
27+
- pktvisor instance must be running on port 10853
28+
- Response of post request must have 201 as status code
29+
- 2 policies must be running on the pktvisor instance (the default one and the created one)
30+
31+
32+
--------------------
33+
DHCP:
34+
35+
36+
## Steps:
37+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
38+
- Create a policy with dhcp handler through a post request on the endpoint: `/api/v1/policies`
39+
- Make a get request to the same endpoint
40+
41+
## Expected Result:
42+
- pktvisor instance must be running on port 10853
43+
- Response of post request must have 201 as status code
44+
- 2 policies must be running on the pktvisor instance (the default one and the created one)
45+
46+
--------------------
47+
PCAP:
48+
49+
50+
## Steps:
51+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
52+
- Create a policy with pcap handler through a post request on the endpoint: `/api/v1/policies`
53+
- Make a get request to the same endpoint
54+
55+
## Expected Result:
56+
- pktvisor instance must be running on port 10853
57+
- Response of post request must have 201 as status code
58+
- 2 policies must be running on the pktvisor instance (the default one and the created one)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Scenario: Create a policy without admin permission
2+
3+
## Steps:
4+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord <net_interface>`
5+
- Try to create a policy through a post request on the endpoint: `/api/v1/policies`
6+
- Make a get request to the same endpoint
7+
8+
## Expected Result:
9+
- pktvisor instance must be running on port 10853
10+
- User should be able to make the get request (status code 200) and the default policy must be running
11+
- Response of post request must have 404 (Not Found) as status code and no policy must be created
12+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Scenario: Disable pktvisor's metrics
2+
## Steps:
3+
4+
5+
## Expected Result:
6+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Scenario: Remove a policy without admin permission
2+
3+
## Steps:
4+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord <net_interface>`
5+
- Try to remove the default policy through a DELETE request on the endpoint: `/api/v1/policies/{name_of_the_policy}`
6+
- Make a get request to the same endpoint
7+
8+
## Expected Result:
9+
- pktvisor instance must be running on port 10853
10+
- User should be able to make the get request (status code 200) and the default policy must be running
11+
- Response of DELETE request must have 404 (Not Found) as status code and no policy must be removed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## Scenario: Remove policies using admin permission from pktvisor instance
2+
3+
4+
--------------
5+
All policies
6+
7+
## Steps:
8+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
9+
- Remove the default policy through a DELETE request on the endpoint: `/api/v1/policies/{name_of_the_policy}`
10+
- Make a get request to the same endpoint
11+
12+
## Expected Result:
13+
- pktvisor instance must be running on port 10853
14+
- User should be able to make the get request (status code 200) and no policies must be running
15+
- Response of DELETE request must have 204 (No Content) as status code and the default policy must be removed
16+
17+
18+
--------------
19+
One policy
20+
21+
22+
## Steps:
23+
- Provide a pktvisor instance using `docker run --net=host -d ns1labs/pktvisor pktvisord --admin-api <net_interface>`
24+
- Create a policy with all handlers through a post request on the endpoint: `/api/v1/policies`
25+
- Check our method `generate_pcap_policy_with_all_handlers` on [policies.py](../../features/steps/policies.py) in order to have examples of how to do it
26+
- Remove one of the running policies using a DELETE request on the endpoint: `/api/v1/policies/{name_of_the_policy}`
27+
- Make a get request to the same endpoint
28+
29+
30+
## Expected Result:
31+
- pktvisor instance must be running on port 10853
32+
- User should be able to make the get request (status code 200) and 1 policy must be running
33+
- Response of DELETE request must have 204 (No Content) as status code and the deleted policy must be removed
34+

0 commit comments

Comments
 (0)