Skip to content

Commit 4da694f

Browse files
authored
Merge pull request #1 from lampwins/master
Initial pack submission
2 parents 88d8e7a + 02f1b55 commit 4da694f

19 files changed

+489
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dist/
1515
downloads/
1616
eggs/
1717
.eggs/
18-
lib/
18+
./lib/
1919
lib64/
2020
parts/
2121
sdist/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 John Anderson
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# stackstorm-netbox
2+
Stackstorm pack for netbox integration
3+
4+
## Actions
5+
6+
### DCIM
7+
- **dcim_get_devices**: Get device(s) via optional parameters
8+
- **dcim_get_interfaces**: Get interface(s) via optional parameters
9+
- **dcim_get_sites**: Get site(s) via optional parameters
10+
11+
### IPAM
12+
- **ipam_get_ip_addresses**: Get IP Address(es) via optional parameters
13+
- **ipam_get_vlan_groups**: Get VLAN Group(s) via optional parameters
14+
- **ipam_get_vlans**: Get VLAN(s) via optional parameters
15+
- **ipam_get_vrfs**: Get VRF(s) via optional parameters
16+
- **ipam_get_prefixes**: Get Prefix(es) via optional parameters

actions/base_get_action.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
from lib.action import NetboxBaseAction
3+
4+
5+
class NetboxBaseGetAction(NetboxBaseAction):
6+
"""Base get action"""
7+
8+
def run(self, endpoint_uri, **kwargs):
9+
"""Base get action
10+
endpoint_uri is pased from metadata file
11+
"""
12+
return self.get(endpoint_uri, **kwargs)

actions/dcim_get_devices.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
name: dcim_get_devices
3+
pack: netbox
4+
runner_type: "python-script"
5+
description: Get device(s) from netbox
6+
enabled: true
7+
entry_point: base_get_action.py
8+
parameters:
9+
endpoint_uri:
10+
immutable: true
11+
default: /api/dcim/devices/
12+
name:
13+
type: string
14+
description: Name of the device
15+
serial:
16+
type: string
17+
description: Serial number of the device
18+
asset_tag:
19+
type: string
20+
description: Asset Tag of the device
21+
q:
22+
type: string
23+
description: Device query
24+
mac_address:
25+
type: string
26+
description: Mac Address of the device
27+
site_id:
28+
type: integer
29+
description: ID of the Site for devices
30+
site:
31+
type: string
32+
description: Site slug for devices
33+
rack_group_id:
34+
type: integer
35+
description: ID of the Rack Group for devices
36+
rack_id:
37+
type: integer
38+
description: ID of the Rack for devices
39+
role_id:
40+
type: integer
41+
description: ID of the Role for devices
42+
rack:
43+
type: string
44+
description: Rack of devices
45+
tenant_id:
46+
type: integer
47+
description: ID of the Tenant for devices
48+
tenant:
49+
type: string
50+
description: Tenant of devices
51+
device_type_id:
52+
type: integer
53+
description: ID of the Device Type for devices
54+
manufacturer_id:
55+
type: integer
56+
description: ID of the Manufacturer for devices
57+
manufacturer:
58+
type: string
59+
description: Manufacturer of devices
60+
model:
61+
type: string
62+
description: Model of devices
63+
platform_id:
64+
type: integer
65+
description: ID of the Platform for devices
66+
platform:
67+
type: string
68+
description: Platform of devices
69+
is_console_server:
70+
type: boolean
71+
description: Device is a Console Server (T/F)
72+
is_pdu:
73+
type: boolean
74+
description: Device is a PDU (T/F)
75+
is_network_device:
76+
type: boolean
77+
description: Device is a Network Device (T/F)
78+
has_primary_ip:
79+
type: boolean
80+
description: Device has a Primary IP assigned (T/F)
81+
status:
82+
type: string
83+
description: Status of devices
84+
id__in:
85+
type: array
86+
description: List of Device IDs

actions/dcim_get_interfaces.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: dcim_get_interfaces
3+
pack: netbox
4+
runner_type: "python-script"
5+
description: Get interface(s) from netbox
6+
enabled: true
7+
entry_point: base_get_action.py
8+
parameters:
9+
endpoint_uri:
10+
immutable: true
11+
default: /api/dcim/interfaces/
12+
form_factor:
13+
type: integer
14+
description: Form factor value
15+
device_id:
16+
type: integer
17+
description: ID of the device
18+
device:
19+
type: string
20+
description: Name of the device
21+
name:
22+
type: string
23+
description: ID of the interface(s)
24+
mac_address:
25+
type: string
26+
description: MAC Address of the interface
27+
id__in:
28+
type: array
29+
description: List of Interface IDs

actions/dcim_get_sites.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: dcim_get_sites
3+
pack: netbox
4+
runner_type: "python-script"
5+
description: Get site(s) from netbox
6+
enabled: true
7+
entry_point: base_get_action.py
8+
parameters:
9+
endpoint_uri:
10+
immutable: true
11+
default: /api/dcim/sites/
12+
name:
13+
type: string
14+
description: Name of the site
15+
q:
16+
type: string
17+
description: Site query
18+
facility:
19+
type: string
20+
description: Facility for the Site
21+
asn:
22+
type: integer
23+
description: ASN assigned to the Site
24+
tenant_id:
25+
type: integer
26+
description: ID of the Tenant for Sites
27+
tenant:
28+
type: string
29+
description: Tenant of Sites
30+
region_id:
31+
type: integer
32+
description: ID of the Region
33+
region:
34+
type: string
35+
description: Region of devices
36+
id__in:
37+
type: array
38+
description: List of Site IDs

actions/ipam_get_ip_addresses.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: ipam_get_ip_addresses
3+
pack: netbox
4+
runner_type: "python-script"
5+
description: Get ip addresses from netbox
6+
enabled: true
7+
entry_point: base_get_action.py
8+
parameters:
9+
endpoint_uri:
10+
immutable: true
11+
default: /api/ipam/ip-addresses/
12+
family:
13+
type: string
14+
description: IP Address family
15+
q:
16+
type: string
17+
description: IP Address query
18+
parent:
19+
type: string
20+
description: IP Address parent prefix
21+
mask_length:
22+
type: integer
23+
description: Subnet mask length (CIRD bits)
24+
vrf_id:
25+
type: integer
26+
description: ID of the VRF
27+
vrf:
28+
type: string
29+
description: Name of the VRF
30+
tenant_id:
31+
type: integer
32+
description: ID of the Tenant
33+
tenant:
34+
type: string
35+
description: Name of the Tenant
36+
device_id:
37+
type: integer
38+
description: ID of the Device
39+
device:
40+
type: string
41+
description: Name of the Device
42+
interface_id:
43+
type: integer
44+
description: ID of the Interface
45+
status:
46+
type: string
47+
description: Status of the IP Address
48+
id__in:
49+
type: array
50+
description: List of IP Address IDs

actions/ipam_get_prefixes.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: ipam_get_prefixes
3+
pack: netbox
4+
runner_type: "python-script"
5+
description: Get prefixes from netbox
6+
enabled: true
7+
entry_point: base_get_action.py
8+
parameters:
9+
endpoint_uri:
10+
immutable: true
11+
default: /api/ipam/prefixes/
12+
family:
13+
type: string
14+
description: Prefix family
15+
q:
16+
type: string
17+
description: Prefix query
18+
parent:
19+
type: string
20+
description: Parent prefix
21+
mask_length:
22+
type: integer
23+
description: Subnet mask length (CIRD bits)
24+
vrf_id:
25+
type: integer
26+
description: ID of the VRF
27+
vrf:
28+
type: string
29+
description: Name of the VRF
30+
tenant_id:
31+
type: integer
32+
description: ID of the Tenant
33+
tenant:
34+
type: string
35+
description: Name of the Tenant
36+
site_id:
37+
type: integer
38+
description: ID of the SIte
39+
site:
40+
type: string
41+
description: Name of the Site
42+
vlan_id:
43+
type: integer
44+
description: ID of the VLAN
45+
vlan_vid:
46+
type: integer
47+
description: VLAN ID number (VID)
48+
role_id:
49+
type: integer
50+
description: ID of the Role
51+
role:
52+
type: string
53+
description: Name of the Role
54+
status:
55+
type: string
56+
description: Status of the IP Address
57+
id__in:
58+
type: array
59+
description: List of IP Address IDs

actions/ipam_get_vlan_groups.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: ipam_get_vlan_groups
3+
pack: netbox
4+
runner_type: "python-script"
5+
description: Get VLAN Group(s) from netbox
6+
enabled: true
7+
entry_point: base_get_action.py
8+
parameters:
9+
endpoint_uri:
10+
immutable: true
11+
default: /api/ipam/vlan-groups/
12+
name:
13+
type: string
14+
description: Name of the VLAN Group(s)
15+
site:
16+
type: string
17+
description: Name of the site
18+
site_id:
19+
type: integer
20+
description: ID of the site

0 commit comments

Comments
 (0)