Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

including advanced net, dhcp and dns policies to automated tests #908

Merged
merged 6 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 35 additions & 22 deletions python-test/docs/development_guide.md

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion python-test/docs/integration/apply_multiple_policies.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
## Scenario: apply multiple policies to agents subscribed to a group
## 1- Scenario: apply multiple advanced policies to agents subscribed to a group

Steps:
-
1. Provision an agent with tags
2. Create a group with same tags as agent
3. Create a sink
4. Create multiple advanced policies (with filters, source pcap)
5. Create a dataset linking the group, the sink and one of the policies
6. Create another dataset linking the same group, sink and the other policy

Expected result:
-
- All the policies must be applied to the agent (orb-agent API response)
- The container logs contain the message "policy applied successfully" referred to each policy
- The container logs that were output after all policies have been applied contain the message "scraped metrics for policy" referred to each applied policy
- Referred sink must have active state on response
- Datasets related to all existing policies have validity valid


## 2- Scenario: apply multiple simple policies to agents subscribed to a group

Steps:
-
Expand Down
47 changes: 44 additions & 3 deletions python-test/docs/policies/create_policy_with_dhcp_handler.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,53 @@
## Scenario: Create policy with dhcp handler
## Steps:
## 1 - Create a policy dhcp with description, host specification, bpf filter, pcap source, only qname suffix and only rcode
manrodrigues marked this conversation as resolved.
Show resolved Hide resolved

1 - Create a policy with dhcp handler
- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 2 - Create a policy dhcp with host specification, bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 3 - Scenario: Create a policy dhcp with bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created

## 4 - Scenario: Create a policy dhcp with pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 5 - Scenario: Create a policy dhcp with only qname suffix

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


## Expected Result:
### Expected Result:
- Request must have status code 201 (created) and the policy must be created
48 changes: 45 additions & 3 deletions python-test/docs/policies/create_policy_with_dns_handler.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
## Scenario: Create policy with dns handler
## Steps:

1 - Create a policy with dns handler
## 1 - Create a policy dns with description, host specification, bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


## Expected Result:
### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 2 - Create a policy dns with host specification, bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 3 - Scenario: Create a policy dns with bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created

## 4 - Scenario: Create a policy dns with pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 5 - Scenario: Create a policy dns with only qname suffix

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created
48 changes: 45 additions & 3 deletions python-test/docs/policies/create_policy_with_net_handler.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
## Scenario: Create policy with net handler
## Steps:

1 - Create a policy with net handler
## 1 - Create a policy net with description, host specification, bpf filter, pcap source, only qname suffix and only rcode
manrodrigues marked this conversation as resolved.
Show resolved Hide resolved

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


## Expected Result:
### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 2 - Create a policy net with host specification, bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 3 - Scenario: Create a policy net with bpf filter, pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created

## 4 - Scenario: Create a policy net with pcap source, only qname suffix and only rcode

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created


## 5 - Scenario: Create a policy net with only qname suffix

- REST API Method: POST
- endpoint: /policies/agent/
- header: {authorization:token}


### Expected Result:
- Request must have status code 201 (created) and the policy must be created
2 changes: 1 addition & 1 deletion python-test/features/datasets.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: datasets creation
And that an agent with 1 orb tag(s) already exists and is online
And referred agent is subscribed to a group
And that a sink already exists
And that a policy already exists
And that a policy using: handler=dns, description='policy_dns', host_specification=10.0.1.0/24,10.0.2.1/32,2001:db8::/64, bpf_filter_expression=udp port 53, pcap_source=libpcap, only_qname_suffix=[.foo.com/ .example.com], only_rcode=0 already exists
When a new dataset is created using referred group, sink and policy ID
Then the container logs should contain the message "managing agent policy from core" within 10 seconds
And the container logs should contain the message "policy applied successfully" within 10 seconds
Expand Down
7 changes: 5 additions & 2 deletions python-test/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

def before_scenario(context, scenario):
cleanup_container()
context.containers_id = dict()
context.agent_groups = dict()


def after_scenario(context, scenario):
context.execute_steps('''
Given the Orb user logs in
Then cleanup agents
Expand All @@ -12,8 +17,6 @@ def before_scenario(context, scenario):
Then cleanup policies
Then cleanup datasets
''')
context.containers_id = dict()
context.agent_groups = dict()


def after_feature(context, feature):
Expand Down
Loading