Skip to content

Commit

Permalink
Merge pull request #110 from nutanix/fix/TestsDoc
Browse files Browse the repository at this point in the history
Fixed PBR documentation and added PBR test cases
  • Loading branch information
alaa-bish authored Feb 21, 2022
2 parents f1311cf + 63b7afb commit 0c94851
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 74 deletions.
101 changes: 64 additions & 37 deletions plugins/modules/ntnx_pbrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
type: str
default: present
wait:
description: This is the wait description.
description: Wait for pbr CRUD operation to complete.
type: bool
required: false
default: true
Expand All @@ -72,93 +72,113 @@
name:
description:
- VPC Name
- Mutually exclusive with (uuid)
- Mutually exclusive with C(uuid)
type: str
uuid:
description:
- VPC UUID
- Mutually exclusive with (name)
- Mutually exclusive with C(name)
type: str
source:
description: Where the traffic came from
description: Where the traffic come from
type: dict
suboptions:
any:
description: From any source
description:
- Traffic from any source with no specification
- Mutually exclusive with C(external) and C(network)
type: bool
external:
description: External Network
description:
- Traffic from external network
- Mutually exclusive with C(any) and C(network)
type: bool
network:
description: specfic network address
description:
- Traffic from specfic network address
- Mutually exclusive with C(any) and C(external)
type: dict
suboptions:
ip:
description: Subnet ip address
type: str
prefix:
description: ip address prefix length
description: IP address prefix length
type: str
destination:
type: dict
description: Where the traffic going to
description: Where the traffic going to
suboptions:
any:
description: From any destination
description:
- Traffic to any destination with no specification
- Mutually exclusive with C(external) and C(network)
type: bool
external:
description: External Network
description:
- Traffic to external network
- Mutually exclusive with C(any) and C(network)
type: bool
network:
description: specfic network address
description:
- Traffic to specfic network address
- Mutually exclusive with C(any) and C(external)
type: dict
suboptions:
ip:
description: Subnet ip address
type: str
prefix:
description: ip address prefix length
description: IP address prefix length
type: str
protocol:
type: dict
description: The Network Protocol that will used
description: The Network Protocol that will be used
suboptions:
any:
description: any protcol number
description:
- Any protcol number
- Mutually exclusive with C(tcp) and C(udp) and C(number) and C(icmp)
type: bool
tcp:
description: The Transmission Control will be used
description:
- The Transmission Control protocol will be used
- Mutually exclusive with C(any) and C(udp) and C(number) and C(icmp)
type: dict
suboptions:
src:
default: '*'
type: list
elements: str
description: Where the traffic came from
description: The source port
dst:
default: '*'
type: list
elements: str
description: Where the traffic going to
description: The destination port
udp:
description: User datagram protocol will be used
description:
- User Datagram protocol will be used
- Mutually exclusive with C(any) and C(tcp) and C(number) and C(icmp)
type: dict
suboptions:
src:
default: '*'
type: list
elements: str
description: Where the traffic came from
description: The source port
dst:
default: '*'
type: list
elements: str
description: Where the traffic going to
description: The destination port
number:
description:
- The internet protocol number
- Mutually exclusive with C(any) and C(tcp) and C(udp) and C(icmp)
type: int
description: The internet protocol number
icmp:
description: Internet Control Message Protocol will be used
description: Internet Control Message protocol will be used
type: dict
suboptions:
code:
Expand All @@ -179,14 +199,20 @@
description: The behavior on the request
suboptions:
deny:
description:
- Drop the request
- Mutually exclusive with C(allow) and C(reroute)
type: bool
description: Drop the request
allow:
description:
- Accept the request
- Mutually exclusive with C(deny) and C(reroute)
type: bool
description: Accept the request
reroute:
description:
- Change the request route
- Mutually exclusive with C(allow) and C(deny)
type: str
description: Change the request route
author:
- Prem Karat (@premkarat)
- Gevorg Khachatryan (@Gevorg-Khachatryan-97)
Expand Down Expand Up @@ -231,8 +257,9 @@
external: True
action:
allow: True
type: bool
protocol:
number: "{{protocol.number}}"
number: "{{ protocol.number }}"
- name: create PBR with vpc name with source external and destination network with reroute action and tcp port rangelist
ntnx_pbrs:
Expand All @@ -251,11 +278,11 @@
ip: "{{ network.ip }}"
prefix: "{{ network.prefix }}"
action:
reroute: "{{reroute_ip}}"
reroute: "{{ reroute_ip }}"
protocol:
tcp:
src: "{{tcp.port}}"
dst: "{{tcp.port_rangelist}}"
src: "{{ tcp.port }}"
dst: "{{ tcp.port_rangelist }}"
- name: create PBR with vpc name with source network and destination external with reroute action and udp port rangelist
ntnx_pbrs:
Expand All @@ -277,8 +304,8 @@
reroute: "{{reroute_ip}}"
protocol:
udp:
src: "{{udp.port_rangelist}}"
dst: "{{udp.port}}"
src: "{{ udp.port_rangelist }}"
dst: "{{ udp.port }}"
- name: create PBR with vpc name with source network and destination external with reroute action and icmp
ntnx_pbrs:
Expand All @@ -297,11 +324,11 @@
destination:
external: True
action:
reroute: "{{reroute_ip}}"
reroute: "{{ reroute_ip }}"
protocol:
icmp:
code: "{{icmp.code}}"
type: "{{icmp.type}}"
code: "{{ icmp.code }}"
type: "{{ icmp.type }}"
- name: Delete all Created pbrs
ntnx_pbrs:
Expand All @@ -320,7 +347,7 @@
type: str
sample: "3.1"
metadata:
description: The PBR metadata
description: The PBR metadata
returned: always
type: dict
sample: {
Expand Down Expand Up @@ -400,7 +427,7 @@
"state": "COMPLETE"
}
pbr_uuid:
description: The created VPC uuid
description: The created PBR uuid
returned: always
type: str
sample: "64c5a93d-7cd4-45f9-81e9-e0b08d35077a"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ flake8==4.0.1
isort==5.9.3
coverage==4.5.4
shyaml==0.6.2
markupsafe==2
Loading

0 comments on commit 0c94851

Please sign in to comment.