Skip to content

Commit dac0f45

Browse files
committed
Merge branch 'develop'
2 parents 452db79 + 890fba3 commit dac0f45

File tree

9 files changed

+67
-9
lines changed

9 files changed

+67
-9
lines changed

HISTORY.rst

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

6+
0.3.2
7+
-----
8+
9+
Released: 2016-04-13
10+
11+
Status: Alpha
12+
13+
New objects:
14+
15+
* policies.Rulebase
16+
* policies.PreRulebase
17+
* policies.PostRulebase
18+
619
0.3.1
720
-----
821

docs/configtree.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,10 @@ Network
5252

5353
.. graphviz:: _diagrams/pandevice.network.dot
5454

55+
.. _tree:
56+
57+
Policy
58+
------
59+
60+
.. graphviz:: _diagrams/pandevice.policy.dot
5561

docs/module-policies.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Inheritance diagram
77
.. inheritance-diagram:: pandevice.policies
88
:parts: 1
99

10+
Configuration tree diagram
11+
--------------------------
12+
13+
.. graphviz:: _diagrams/pandevice.policies.dot
14+
1015
Class Reference
1116
---------------
1217

docs/moduleref.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
'ha',
3131
'network',
3232
'panorama',
33+
'policies',
3334
]
3435

3536
tree_not_exists = [
3637
'base',
3738
'errors',
3839
'objects',
39-
'policies',
4040
'updater',
4141
'userid',
4242
]

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.1'
27+
__version__ = '0.3.2'
2828

2929

3030
import logging

pandevice/firewall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Firewall(PanDevice):
7171
"ha.HighAvailability",
7272
"objects.AddressObject",
7373
"objects.AddressGroup",
74-
"policies.SecurityRule",
74+
"policies.Rulebase",
7575
"network.EthernetInterface",
7676
"network.AggregateInterface",
7777
"network.LoopbackInterface",

pandevice/panorama.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class DeviceGroup(PanObject):
6363
"firewall.Firewall",
6464
"objects.AddressObject",
6565
"objects.AddressGroup",
66-
"policies.SecurityRule",
66+
"policies.PreRulebase",
67+
"policies.PostRulebase",
6768
)
6869

6970
@classmethod
@@ -97,7 +98,8 @@ class Panorama(base.PanDevice):
9798
"firewall.Firewall",
9899
"objects.AddressObject",
99100
"objects.AddressGroup",
100-
"policies.SecurityRule",
101+
"policies.PreRulebase",
102+
"policies.PostRulebase",
101103
)
102104

103105
def __init__(self,

pandevice/policies.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,43 @@
3131
logger.addHandler(logging.NullHandler())
3232

3333

34+
class Rulebase(PanObject):
35+
"""Rulebase for a Firewall
36+
37+
Firewall only. For Panorama, use :class:`pandevice.policies.PreRulebase` or
38+
:class:`pandevice.policies.PostRulebase`.
39+
40+
"""
41+
ROOT = Root.VSYS
42+
XPATH = "/rulebase"
43+
CHILDTYPES = (
44+
"policies.SecurityRule",
45+
)
46+
47+
48+
class PreRulebase(Rulebase):
49+
"""Pre-rulebase for a Panorama
50+
51+
Panorama only. For Firewall, use :class:`pandevice.policies.Rulebase`.
52+
53+
"""
54+
XPATH = "/pre-rulebase"
55+
56+
57+
class PostRulebase(Rulebase):
58+
"""Pre-rulebase for a Panorama
59+
60+
Panorama only. For Firewall, use :class:`pandevice.policies.Rulebase`.
61+
62+
"""
63+
XPATH = "/post-rulebase"
64+
65+
3466
class SecurityRule(PanObject):
3567
"""Security Rule
3668
69+
Firewall only. Use SecurityPreRule or SecurityPostRule with Panorama.
70+
3771
Args:
3872
name (str): Name of the rule
3973
from (list): From zones
@@ -66,9 +100,7 @@ class SecurityRule(PanObject):
66100
data-filtering (str): Data Filtering Security Profile
67101
68102
"""
69-
70-
ROOT = Root.VSYS
71-
XPATH = "/rulebase/security/rules"
103+
XPATH = "/security/rules"
72104
SUFFIX = ENTRY
73105

74106
@classmethod

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.1',
25+
version='0.3.2',
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)