palo_alto 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b68e035e0f51de7ec25732169187fae61088d874498b3f04aa8c0729f3ff31ce
4
- data.tar.gz: f9a00e1a28101f24b8ec95f2d226bec3b6d8f25226aabfaeef9c47183de2e240
3
+ metadata.gz: 783ea2d46ba8b4ad6b68ca42ac611d96a73b22585c0fe0da0abb01a547617638
4
+ data.tar.gz: 2be0229664b9c6c2cacad27a0d003867a9ea65bafa30117ff08924b1ea45acbe
5
5
  SHA512:
6
- metadata.gz: 23c323a9076ee9f963a25eb6582b83110a95a1bb8c5f9ee65121d7afaf3c24639f682e93d602d7730968c0eec7de7f73651702e1996b658ffc69508fe8d21b34
7
- data.tar.gz: 5fe403c5af1998c3a8696326ff46045a3990784f42ba209baa8f36a5a0f2247693e092820489d5a8c68304329ab6a149707eb62f9c2b2ba344ef1fc267d3965f
6
+ metadata.gz: aee427bd8157bd7d739322333bb3daeeea9dbad9d84b45f7540ed8b6a7d7751b0a440ba55d226dc5d9efc2d1360c2bc29f5460f0d4d457ad5c87a8abadc231b3
7
+ data.tar.gz: 69ce66f69c0b3cc641fa215cb33dcd66f834be2de2f521886b7b95ffd0712750a4d45bfcc824432c2b87e9649732ffb6da18d53803c82ba1955c3cd666b78af1
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
1
  Works for me :)
2
2
 
3
+ - Version 0.2.x: Panorama 10.0
4
+ - Version 0.3.x: Panorama 10.1
5
+
3
6
  You can find examples on how to use this module in the examples/ directory
@@ -1,6 +1,7 @@
1
1
  require 'palo_alto'
2
2
 
3
- client = PaloAlto::XML.new(host: "panorama-test", username: "admin", password: "Admin123!", debug: [:sent, :received, :statistics])
3
+ client = PaloAlto::XML.new(host: 'panorama-test', username: 'admin', password: 'Admin123!',
4
+ debug: %i[sent received statistics])
4
5
  dg = 'PLAYGROUND'
5
6
 
6
7
  # create a tag
@@ -43,7 +44,7 @@ pp rules
43
44
  pp rules.length
44
45
 
45
46
  pp rules.first.api_attributes # attributes like uuid and loc
46
- pp rules.first.values() # values as hash
47
+ pp rules.first.values # values as hash
47
48
 
48
49
  rule = rules.first
49
50
  rule.tag.member = [new_tag.name]
@@ -59,5 +60,5 @@ pp rule.name
59
60
  exit 0
60
61
 
61
62
  # create a new template
62
- new_template = client.config.devices.entry(name:'localhost.localdomain').template.entry(name: 'testtemplate').create!
63
+ new_template = client.config.devices.entry(name: 'localhost.localdomain').template.entry(name: 'testtemplate').create!
63
64
  new_template.push!
data/examples/test_op.rb CHANGED
@@ -1,63 +1,62 @@
1
1
  require 'palo_alto'
2
2
 
3
- a= {commit: { partial:[
4
- {'admin': ['admin']},
5
- 'no-template',
6
- 'no-template-stack',
7
- 'no-log-collector',
8
- 'no-log-collector-group',
9
- 'no-wildfire-appliance',
10
- 'no-wildfire-appliance-cluster',
11
- {'device-and-network': 'excluded'},
12
- {'shared-object': 'excluded'}
13
- ]}}
14
-
15
- b= { show: {devices: 'all' } }
16
-
17
- c = {revert: { config: {
18
- partial:[
19
- {'admin': ['admin']},
20
- 'no-template',
21
- 'no-template-stack',
22
- 'no-log-collector',
23
- 'no-log-collector-group',
24
- 'no-wildfire-appliance',
25
- 'no-wildfire-appliance-cluster',
26
- {'device-and-network': 'excluded'},
27
- {'shared-object': 'excluded'}
28
- ]}}}
29
-
30
- d = {commit: nil}
3
+ a = { commit: { partial: [
4
+ { admin: ['admin'] },
5
+ 'no-template',
6
+ 'no-template-stack',
7
+ 'no-log-collector',
8
+ 'no-log-collector-group',
9
+ 'no-wildfire-appliance',
10
+ 'no-wildfire-appliance-cluster',
11
+ { 'device-and-network': 'excluded' },
12
+ { 'shared-object': 'excluded' }
13
+ ] } }
14
+
15
+ b = { show: { devices: 'all' } }
16
+
17
+ c = { revert: { config: {
18
+ partial: [
19
+ { admin: ['admin'] },
20
+ 'no-template',
21
+ 'no-template-stack',
22
+ 'no-log-collector',
23
+ 'no-log-collector-group',
24
+ 'no-wildfire-appliance',
25
+ 'no-wildfire-appliance-cluster',
26
+ { 'device-and-network': 'excluded' },
27
+ { 'shared-object': 'excluded' }
28
+ ]
29
+ } } }
30
+
31
+ d = { commit: nil }
31
32
 
32
33
  e = 'commit'
33
34
 
34
- f = {revert: 'config'}
35
+ f = { revert: 'config' }
35
36
 
36
- g= {show: 'templates'}
37
+ g = { show: 'templates' }
37
38
 
38
- h= {show: 'devicegroups'}
39
+ h = { show: 'devicegroups' }
39
40
 
40
- j={show: {jobs: {id: 12431}}}
41
+ j = { show: { jobs: { id: 12_431 } } }
41
42
 
42
- k={check: 'full-commit-required'}
43
+ k = { check: 'full-commit-required' }
43
44
 
44
- push_to_device={ 'commit-all': { 'shared-policy': { 'device-group': [{name:'TEST-DG'}]}}}
45
+ push_to_device = { 'commit-all': { 'shared-policy': { 'device-group': [{ name: 'TEST-DG' }] } } }
45
46
 
46
- #validate:
47
- p={ 'commit-all':
48
- {
49
- 'shared-policy': [
50
- {'device-group': [{name:'PLAYGROUND'}]},
51
- {'include-template':'yes'},
52
- {'merge-with-candidate-cfg':'yes'},
53
- {'force-template-values':'no'},
54
- {'validate-only':'yes'}
55
- ]
56
- }
57
- }
58
-
59
- i = {show: {query: {result: {id: 10438 }}}}
47
+ # validate:
48
+ p = { 'commit-all':
49
+ {
50
+ 'shared-policy': [
51
+ { 'device-group': [{ name: 'PLAYGROUND' }] },
52
+ { 'include-template': 'yes' },
53
+ { 'merge-with-candidate-cfg': 'yes' },
54
+ { 'force-template-values': 'no' },
55
+ { 'validate-only': 'yes' }
56
+ ]
57
+ } }
60
58
 
59
+ i = { show: { query: { result: { id: 10_438 } } } }
61
60
 
62
61
  # hit counts:
63
62
  device_group = 'PLAYGROUND'
@@ -69,11 +68,11 @@ l = {
69
68
  entry: [{
70
69
  name: device_group
71
70
  }, {
72
- "pre-rulebase": [{
71
+ 'pre-rulebase': [{
73
72
  entry: [{
74
73
  name: 'security'
75
74
  }, {
76
- 'rules': 'all'
75
+ rules: 'all'
77
76
  }]
78
77
  }]
79
78
  }]
@@ -83,7 +82,7 @@ l = {
83
82
  }
84
83
 
85
84
  # hit count for one rule, with more details:
86
- rule_name = "Rule 27"
85
+ rule_name = 'Rule 27'
87
86
  l = {
88
87
  show: {
89
88
  'rule-hit-count': [{
@@ -91,12 +90,12 @@ l = {
91
90
  entry: [{
92
91
  name: device_group
93
92
  }, {
94
- "pre-rulebase": [{
93
+ 'pre-rulebase': [{
95
94
  entry: [{
96
95
  name: 'security'
97
96
  }, {
98
- 'rules': {
99
- "rule-name": [{
97
+ rules: {
98
+ 'rule-name': [{
100
99
  entry: [{
101
100
  name: rule_name
102
101
  }]
@@ -110,18 +109,16 @@ l = {
110
109
  }
111
110
  }
112
111
 
112
+ client = PaloAlto::XML.new(host: 'panorama-test', username: 'admin', password: 'Admin123!', debug: %i[sent received])
113
113
 
114
- client = PaloAlto::XML.new(host: "panorama-test", username: "admin", password: "Admin123!", debug: [:sent, :received])
115
-
116
- #pp client.op.execute(a)
117
- #pp client.op.execute(b)
118
- #pp client.op.execute(c)
114
+ # pp client.op.execute(a)
115
+ # pp client.op.execute(b)
116
+ # pp client.op.execute(c)
119
117
  pp client.op.execute(d)
120
- puts "---------------------------"
118
+ puts '---------------------------'
121
119
  pp client.op.execute(e)
122
- puts "---------------------------"
120
+ puts '---------------------------'
123
121
 
124
- #pp client.op.execute(f)
122
+ # pp client.op.execute(f)
125
123
 
126
124
  pp client.op.execute(k)
127
-