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
0b1baae7
Commit
0b1baae7
authored
3 years ago
by
Michal Hažlinský
Browse files
Options
Downloads
Patches
Plain Diff
updated CSD backend
parent
c0e7c7cc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opennsa/backends/junoscsd.py
+4
-8
4 additions, 8 deletions
opennsa/backends/junoscsd.py
with
4 additions
and
8 deletions
opennsa/backends/junoscsd.py
+
4
−
8
View file @
0b1baae7
...
@@ -165,11 +165,6 @@ def _extractErrorMessage(failure):
...
@@ -165,11 +165,6 @@ def _extractErrorMessage(failure):
return
failure
.
getErrorMessage
()
return
failure
.
getErrorMessage
()
class
WebClientContextFactory
(
opennsaTlsContext
):
def
getContext
(
self
):
return
opennsaTlsContext
.
getContext
(
self
)
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
):
...
@@ -224,11 +219,12 @@ class CSDConnectionManager:
...
@@ -224,11 +219,12 @@ class CSDConnectionManager:
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
()
return
headers
return
headers
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
=
WebClientContextFactory
(
config
.
DEFAULT_CERTIFICATE_DIR
,
Non
e
)
contextFactory
=
opennsaTlsContext
(
config
.
DEFAULT_CERTIFICATE_DIR
,
Fals
e
)
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 +246,7 @@ class CSDConnectionManager:
...
@@ -250,7 +246,7 @@ class CSDConnectionManager:
headers
[
"
Accept
"
]
=
"
*/*
"
headers
[
"
Accept
"
]
=
"
*/*
"
headers
[
"
Authorization
"
]
=
self
.
_createAuthzHeader
()
headers
[
"
Authorization
"
]
=
self
.
_createAuthzHeader
()
serviceID
=
None
serviceID
=
None
contextFactory
=
WebClientContextFactory
(
config
.
DEFAULT_CERTIFICATE_DIR
,
Non
e
)
contextFactory
=
opennsaTlsContext
(
config
.
DEFAULT_CERTIFICATE_DIR
,
Fals
e
)
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 +261,7 @@ class CSDConnectionManager:
...
@@ -265,7 +261,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
=
WebClientContextFactory
(
config
.
DEFAULT_CERTIFICATE_DIR
,
Non
e
)
contextFactory
=
opennsaTlsContext
(
config
.
DEFAULT_CERTIFICATE_DIR
,
Fals
e
)
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
)
...
...
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