Skip to content

Commit aef07e6

Browse files
committed
Merge branch 'release/0.3.3'
2 parents dac0f45 + a529304 commit aef07e6

File tree

5 files changed

+87
-14
lines changed

5 files changed

+87
-14
lines changed

HISTORY.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
History
44
=======
55

6+
0.3.3
7+
-----
8+
9+
Released: 2016-04-15
10+
11+
Status: Alpha
12+
13+
New objects:
14+
15+
* objects.Tag
16+
17+
Updated objects:
18+
19+
* policies.Rulebase
20+
621
0.3.2
722
-----
823

pandevice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
__author__ = 'Brian Torres-Gil'
2626
__email__ = 'btorres-gil@paloaltonetworks.com'
27-
__version__ = '0.3.2'
27+
__version__ = '0.3.3'
2828

2929

3030
import logging

pandevice/objects.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,58 @@ def variables(cls):
8181
Var("dynamic/filter", "dynamic_value"),
8282
Var("description"),
8383
)
84+
85+
86+
class Tag(PanObject):
87+
"""Administrative tag
88+
89+
Args:
90+
name (str): Name of the tag
91+
color (str): Color ID or name (eg. 'color1', 'color4', 'purple')
92+
comments (str): Comments
93+
94+
"""
95+
ROOT = Root.VSYS
96+
XPATH = "/tag"
97+
SUFFIX = ENTRY
98+
99+
COLOR = {
100+
"red": 1,
101+
"green": 2,
102+
"blue": 3,
103+
"yello": 4,
104+
"copper": 5,
105+
"orange": 6,
106+
"purple": 7,
107+
"gray": 8,
108+
"light green": 9,
109+
"cyan": 10,
110+
"light gray": 11,
111+
"blue gray": 12,
112+
"lime": 13,
113+
"black": 14,
114+
"gold": 15,
115+
"brown": 16,
116+
}
117+
118+
def __init__(self, *args, **kwargs):
119+
super(Tag, self).__init__(*args, **kwargs)
120+
if not hasattr(self, "_color"):
121+
self._color = None
122+
123+
@classmethod
124+
def variables(cls):
125+
return (
126+
Var("color"),
127+
Var("comments"),
128+
)
129+
130+
@property
131+
def color(self):
132+
if self._color in self.COLOR:
133+
return "color"+str(self.COLOR[self._color])
134+
return self._color
135+
136+
@color.setter
137+
def color(self, value):
138+
self._color = value

pandevice/policies.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ class SecurityRule(PanObject):
7070
7171
Args:
7272
name (str): Name of the rule
73-
from (list): From zones
74-
to (list): To zones
73+
fromzone (list): From zones
74+
tozone (list): To zones
7575
source (list): Source addresses
7676
destination (list): Destination addresses
7777
application (list): Applications
78-
service (list): Destination services (ports)
78+
service (list): Destination services (ports) (Default: application-default)
7979
category (list): Destination URL Categories
8080
action (str): Action to take (deny, allow, drop, reset-client, reset-server, reset-both)
8181
Note: Not all options are available on all PAN-OS versions.
@@ -84,43 +84,46 @@ class SecurityRule(PanObject):
8484
log_end (bool): Log at session end
8585
description (str): Description of this rule
8686
type (str): 'universal', 'intrazone', or 'intrazone' (Default: universal)
87+
tag (list): Administrative tags
8788
negate_source (bool): Match on the reverse of the 'source' attribute
8889
negate_destination (bool): Match on the reverse of the 'destination' attribute
8990
disabled (bool): Disable this rule
90-
schedule (str): Schedule for this rule
91-
icmp-unreachable (bool): Send ICMP Unreachable
91+
schedule (str): Schedule Profile
92+
icmp_unreachable (bool): Send ICMP Unreachable
9293
disable_server_response_inspection (bool): Disable server response inspection
9394
group (str): Security Profile Group
9495
virus (str): Antivirus Security Profile
9596
spyware (str): Anti-Spyware Security Profile
9697
vulnerability (str): Vulnerability Protection Security Profile
97-
url-filtering (str): URL Filtering Security Profile
98-
file-blocking (str): File Blocking Security Profile
99-
wildfire-analysis (str): Wildfire Analysis Security Profile
100-
data-filtering (str): Data Filtering Security Profile
98+
url_filtering (str): URL Filtering Security Profile
99+
file_blocking (str): File Blocking Security Profile
100+
wildfire_analysis (str): Wildfire Analysis Security Profile
101+
data_filtering (str): Data Filtering Security Profile
101102
102103
"""
104+
# TODO: Add QoS variables
103105
XPATH = "/security/rules"
104106
SUFFIX = ENTRY
105107

106108
@classmethod
107109
def variables(cls):
108110
return (
109-
Var("from", vartype="member", default=("any",)),
110-
Var("to", vartype="member", default=("any",)),
111+
Var("from", "fromzone", vartype="member", default=("any",)),
112+
Var("to", "tozone", vartype="member", default=("any",)),
111113
Var("source", vartype="member", default=("any",)),
112114
Var("source-user", vartype="member", default=("any",)),
113115
Var("hip-profiles", vartype="member", default=("any",)),
114116
Var("destination", vartype="member", default=("any",)),
115117
Var("application", vartype="member", default=("any",)),
116-
Var("service", vartype="member", default=("any",)),
118+
Var("service", vartype="member", default=("application-default",)),
117119
Var("category", vartype="member", default=("any",)),
118120
Var("action"),
119121
Var("log-setting"),
120122
Var("log-start", vartype="bool"),
121123
Var("log-end", vartype="bool"),
122124
Var("description"),
123125
Var("rule-type", "type", default="universal"),
126+
Var("tag", vartype="member"),
124127
Var("negate-source", vartype="bool"),
125128
Var("negate-destination", vartype="bool"),
126129
Var("disabled", vartype="bool"),

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
setup(
2424
name='pandevice',
25-
version='0.3.2',
25+
version='0.3.3',
2626
description='Framework for interacting with Palo Alto Networks devices via API',
2727
long_description='The Palo Alto Networks Device Framework is a way to interact with Palo Alto Networks devices (including Next-generation Firewalls and Panorama) using the device API that is object oriented and conceptually similar to interaction with the device via the GUI or CLI.',
2828
author='Brian Torres-Gil',

0 commit comments

Comments
 (0)