Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
38b73455
Verified
Commit
38b73455
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
add Infoblox service
parent
ba464de9
No related branches found
No related tags found
1 merge request
!65
Feature/add infoblox service
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/services/infoblox.py
+47
-0
47 additions, 0 deletions
gso/services/infoblox.py
setup.py
+2
-2
2 additions, 2 deletions
setup.py
with
49 additions
and
2 deletions
gso/services/infoblox.py
0 → 100644
+
47
−
0
View file @
38b73455
import
ipaddress
from
infoblox_client
import
connector
,
objects
from
gso.settings
import
load_oss_params
def
_setup_connection
()
->
connector
.
Connector
:
oss
=
load_oss_params
()
options
=
{
"
host
"
:
oss
.
IPAM
.
INFOBLOX
.
host
,
"
username
"
:
oss
.
IPAM
.
INFOBLOX
.
username
,
"
password
"
:
oss
.
IPAM
.
INFOBLOX
.
password
,
"
wapi_version
"
:
oss
.
IPAM
.
INFOBLOX
.
wapi_version
[
1
:],
# remove the 'v' in front of the version number
"
ssl_verify
"
:
True
if
oss
.
IPAM
.
INFOBLOX
.
scheme
==
"
https
"
else
False
,
}
return
connector
.
Connector
(
options
)
def
allocate_network
(
ip_network
:
ipaddress
.
IPv4Network
|
ipaddress
.
IPv6Network
)
->
objects
.
Network
:
conn
=
_setup_connection
()
return
objects
.
Network
.
create
(
conn
,
str
(
ip_network
))
def
delete_network
(
ip_network
:
ipaddress
.
IPv4Network
|
ipaddress
.
IPv6Network
)
->
None
:
conn
=
_setup_connection
()
network
=
objects
.
Network
.
search
(
conn
,
cidr
=
str
(
ip_network
))
network
.
delete
()
def
allocate_host
(
hostname
:
str
,
net_cidr
:
ipaddress
.
IPv4Network
|
ipaddress
.
IPv6Network
)
->
objects
.
HostRecord
:
conn
=
_setup_connection
()
address
=
objects
.
IPAllocation
.
next_available_ip_from_cidr
(
"
default
"
,
net_cidr
)
ip_object
=
objects
.
IP
.
create
(
address
,
"
00:00:00:00:00:00
"
,
configure_for_dhcp
=
False
)
return
objects
.
HostRecord
.
create
(
conn
,
name
=
hostname
,
ip
=
ip_object
)
def
delete_host_by_ip
(
ip_addr
:
ipaddress
.
IPv4Address
|
ipaddress
.
IPv6Address
)
->
None
:
conn
=
_setup_connection
()
host
=
objects
.
HostRecord
.
search
(
conn
,
ipv4addr
=
ip_addr
)
host
.
delete
()
def
delete_host_by_fqdn
(
fqdn
:
str
)
->
None
:
conn
=
_setup_connection
()
host
=
objects
.
HostRecord
.
search
(
conn
,
name
=
fqdn
)
host
.
delete
()
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
2
View file @
38b73455
...
...
@@ -10,8 +10,8 @@ setup(
packages
=
find_packages
(),
install_requires
=
[
"
orchestrator-core==1.2.2
"
,
"
pydantic
"
,
"
requests
"
,
"
requests~=2.31.0
"
,
"
infoblox-client~=0.6.0
"
,
"
pycountry
"
,
],
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment