Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
opennsa3
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
Michal Hažlinský
opennsa3
Commits
e930ea66
Commit
e930ea66
authored
3 years ago
by
Michal Hažlinský
Browse files
Options
Downloads
Patches
Plain Diff
addd configurable certsd ir for CSD backend
parent
0f15ee4b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opennsa/backends/junoscsd.py
+7
-9
7 additions, 9 deletions
opennsa/backends/junoscsd.py
opennsa/config.py
+1
-0
1 addition, 0 deletions
opennsa/config.py
with
8 additions
and
9 deletions
opennsa/backends/junoscsd.py
+
7
−
9
View file @
e930ea66
...
@@ -171,7 +171,7 @@ def _extractErrorMessage(failure):
...
@@ -171,7 +171,7 @@ def _extractErrorMessage(failure):
class
CSDConnectionManager
:
class
CSDConnectionManager
:
def
__init__
(
self
,
port_map
,
space_user
,
space_password
,
space_api_url
,
space_routers
,
csd_service_def
,
csd_customer_id
,
network_name
,
csd_descriptions
):
def
__init__
(
self
,
port_map
,
space_user
,
space_password
,
space_api_url
,
space_routers
,
csd_service_def
,
csd_customer_id
,
network_name
,
csd_descriptions
,
csd_certs_dir
):
self
.
network_name
=
network_name
self
.
network_name
=
network_name
self
.
port_map
=
port_map
self
.
port_map
=
port_map
self
.
space_user
=
space_user
self
.
space_user
=
space_user
...
@@ -181,6 +181,7 @@ class CSDConnectionManager:
...
@@ -181,6 +181,7 @@ class CSDConnectionManager:
self
.
csd_service_def
=
csd_service_def
self
.
csd_service_def
=
csd_service_def
self
.
csd_customer_id
=
csd_customer_id
self
.
csd_customer_id
=
csd_customer_id
self
.
csd_descriptions
=
csd_descriptions
self
.
csd_descriptions
=
csd_descriptions
self
.
csd_certs_dir
=
csd_certs_dir
def
getResource
(
self
,
port
,
label
):
def
getResource
(
self
,
port
,
label
):
...
@@ -228,7 +229,7 @@ class CSDConnectionManager:
...
@@ -228,7 +229,7 @@ class CSDConnectionManager:
def
setupLink
(
self
,
connection_id
,
source_target
,
dest_target
,
bandwidth
):
def
setupLink
(
self
,
connection_id
,
source_target
,
dest_target
,
bandwidth
):
payload
=
createCSDPayload
(
connection_id
,
source_target
,
dest_target
,
self
.
csd_service_def
,
self
.
csd_customer_id
,
self
.
space_routers
,
self
.
csd_descriptions
)
payload
=
createCSDPayload
(
connection_id
,
source_target
,
dest_target
,
self
.
csd_service_def
,
self
.
csd_customer_id
,
self
.
space_routers
,
self
.
csd_descriptions
)
headers
=
self
.
_createHeaders
()
headers
=
self
.
_createHeaders
()
contextFactory
=
opennsaTlsContext
(
config
.
DEFAULT_CERTIFICATE_DIR
,
False
)
contextFactory
=
opennsaTlsContext
(
self
.
csd_certs_dir
,
False
)
def
linkUp
(
data
):
def
linkUp
(
data
):
log
.
msg
(
'
Link %s -> %s up
'
%
(
source_target
,
dest_target
),
system
=
LOG_SYSTEM
)
log
.
msg
(
'
Link %s -> %s up
'
%
(
source_target
,
dest_target
),
system
=
LOG_SYSTEM
)
...
@@ -250,7 +251,7 @@ class CSDConnectionManager:
...
@@ -250,7 +251,7 @@ class CSDConnectionManager:
headers
[
"
Accept
"
]
=
"
*/*
"
headers
[
"
Accept
"
]
=
"
*/*
"
headers
[
"
Authorization
"
]
=
self
.
_createAuthzHeader
()
headers
[
"
Authorization
"
]
=
self
.
_createAuthzHeader
()
serviceID
=
None
serviceID
=
None
contextFactory
=
opennsaTlsContext
(
config
.
DEFAULT_CERTIFICATE_DIR
,
False
)
contextFactory
=
opennsaTlsContext
(
self
.
csd_certs_dir
,
False
)
def
linkDown
(
data
):
def
linkDown
(
data
):
log
.
msg
(
'
Link %s -> %s down
'
%
(
source_target
,
dest_target
),
system
=
LOG_SYSTEM
)
log
.
msg
(
'
Link %s -> %s down
'
%
(
source_target
,
dest_target
),
system
=
LOG_SYSTEM
)
...
@@ -265,7 +266,7 @@ class CSDConnectionManager:
...
@@ -265,7 +266,7 @@ class CSDConnectionManager:
headers
=
{}
headers
=
{}
#headers["Content-Type"] = "application/vnd.net.juniper.space.service-management.service-order+xml;version=2;charset=UTF-8"
#headers["Content-Type"] = "application/vnd.net.juniper.space.service-management.service-order+xml;version=2;charset=UTF-8"
headers
[
"
Authorization
"
]
=
self
.
_createAuthzHeader
()
headers
[
"
Authorization
"
]
=
self
.
_createAuthzHeader
()
contextFactory
=
opennsaTlsContext
(
config
.
DEFAULT_CERTIFICATE_DIR
,
False
)
contextFactory
=
opennsaTlsContext
(
self
.
csd_certs_dir
,
False
)
serviceID
=
0
serviceID
=
0
nsmap
=
{
'
a
'
:
'
services.schema.networkapi.jmp.juniper.net
'
}
nsmap
=
{
'
a
'
:
'
services.schema.networkapi.jmp.juniper.net
'
}
services
=
etree
.
fromstring
(
data
).
xpath
(
"
/a:Data/a:ServiceResource/a:Service
"
,
namespaces
=
nsmap
)
services
=
etree
.
fromstring
(
data
).
xpath
(
"
/a:Data/a:ServiceResource/a:Service
"
,
namespaces
=
nsmap
)
...
@@ -313,6 +314,7 @@ def JunosCSDBackend(network_name, nrm_ports, parent_requester, cfg):
...
@@ -313,6 +314,7 @@ def JunosCSDBackend(network_name, nrm_ports, parent_requester, cfg):
csd_service_def
=
cfg
[
config
.
CSD_SERVICE_DEF
]
csd_service_def
=
cfg
[
config
.
CSD_SERVICE_DEF
]
csd_customer_id
=
cfg
[
config
.
CSD_CUSTOMER_ID
]
csd_customer_id
=
cfg
[
config
.
CSD_CUSTOMER_ID
]
csd_descriptions
=
cfg
.
get
(
config
.
JUNOS_DESCRIPTIONS
,
"
OpenNSA
"
)
csd_descriptions
=
cfg
.
get
(
config
.
JUNOS_DESCRIPTIONS
,
"
OpenNSA
"
)
csd_certs_dir
=
cfg
[
config
.
CSD_CERTS_DIR
]
space_routers
=
dict
()
space_routers
=
dict
()
...
@@ -323,10 +325,6 @@ def JunosCSDBackend(network_name, nrm_ports, parent_requester, cfg):
...
@@ -323,10 +325,6 @@ def JunosCSDBackend(network_name, nrm_ports, parent_requester, cfg):
log
.
msg
(
"
%s
"
%
(
junosspace_router
))
log
.
msg
(
"
%s
"
%
(
junosspace_router
))
space_routers
[
r
]
=
junosspace_router
space_routers
[
r
]
=
junosspace_router
# csd_services_url = str(cfg[config.NCS_SERVICES_URL]) # convert from unicode
cm
=
CSDConnectionManager
(
port_map
,
space_user
,
space_password
,
space_api_url
,
space_routers
,
csd_service_def
,
csd_customer_id
,
network_name
,
csd_descriptions
,
csd_certs_dir
)
# user = cfg[config.NCS_USER]
# password = cfg[config.NCS_PASSWORD]
cm
=
CSDConnectionManager
(
port_map
,
space_user
,
space_password
,
space_api_url
,
space_routers
,
csd_service_def
,
csd_customer_id
,
network_name
,
csd_descriptions
)
return
genericbackend
.
GenericBackend
(
network_name
,
nrm_map
,
cm
,
parent_requester
,
name
)
return
genericbackend
.
GenericBackend
(
network_name
,
nrm_map
,
cm
,
parent_requester
,
name
)
This diff is collapsed.
Click to expand it.
opennsa/config.py
+
1
−
0
View file @
e930ea66
...
@@ -155,6 +155,7 @@ SPACE_CONFIGLET_ACTIVATE_REMOTE = 'configlet_activate_remote'
...
@@ -155,6 +155,7 @@ SPACE_CONFIGLET_ACTIVATE_REMOTE = 'configlet_activate_remote'
SPACE_CONFIGLET_DEACTIVATE_LOCAL
=
'
configlet_deactivate_local
'
SPACE_CONFIGLET_DEACTIVATE_LOCAL
=
'
configlet_deactivate_local
'
SPACE_CONFIGLET_DEACTIVATE_REMOTE
=
'
configlet_deactivate_remote
'
SPACE_CONFIGLET_DEACTIVATE_REMOTE
=
'
configlet_deactivate_remote
'
#For Junos SPACE CSD plugin backend
#For Junos SPACE CSD plugin backend
CSD_CERTS_DIR
=
'
csd_certs_dir
'
CSD_SERVICE_DEF
=
'
csd_service_def
'
CSD_SERVICE_DEF
=
'
csd_service_def
'
CSD_CUSTOMER_ID
=
'
csd_customer_id
'
CSD_CUSTOMER_ID
=
'
csd_customer_id
'
...
...
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