Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
f-interop-contributors
myslicelib
Commits
837fcd14
Commit
837fcd14
authored
Feb 13, 2017
by
Loic Baron
Browse files
print -> logs
parent
4e73b0c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
myslicelib/api/sfaam.py
View file @
837fcd14
...
...
@@ -18,6 +18,9 @@ from myslicelib.error import MysParameterIsRequiredError
# self.Shutdown
# self.Delete
import
logging
logger
=
logging
.
getLogger
(
__name__
)
class
SfaAm
(
SfaApi
):
def
__init__
(
self
,
endpoint
=
None
,
registry
=
None
):
...
...
@@ -75,7 +78,7 @@ class SfaAm(SfaApi):
result
=
getattr
(
self
,
"_"
+
entity
)(
urn
)
except
Exception
as
e
:
result
=
[]
print
(
self
.
endpoint
.
name
)
#
print(self.endpoint.name)
#traceback.print_exc()
self
.
logs
.
append
({
'endpoint'
:
self
.
endpoint
.
name
,
...
...
@@ -110,8 +113,10 @@ class SfaAm(SfaApi):
else
:
raise
SfaError
(
result
)
except
Exception
as
e
:
print
(
self
.
endpoint
.
name
)
traceback
.
print_exc
()
#print(self.endpoint.name)
logger
.
error
(
self
.
endpoint
.
name
)
logger
.
exception
(
e
)
#traceback.print_exc()
self
.
logs
.
append
({
'endpoint'
:
self
.
endpoint
.
name
,
'url'
:
self
.
endpoint
.
url
,
...
...
@@ -147,8 +152,10 @@ class SfaAm(SfaApi):
raise
Exception
(
res
)
# XXX Check result
except
Exception
as
e
:
print
(
self
.
endpoint
.
name
)
traceback
.
print_exc
()
logger
.
error
(
self
.
endpoint
.
name
)
logger
.
exception
(
e
)
#print(self.endpoint.name)
#traceback.print_exc()
self
.
logs
.
append
({
'endpoint'
:
self
.
endpoint
.
name
,
'url'
:
self
.
endpoint
.
url
,
...
...
@@ -176,6 +183,8 @@ class SfaAm(SfaApi):
# v3 sfa update
api_options
[
'geni_rspec_version'
]
=
{
'type'
:
'GENI'
,
'version'
:
'3'
}
#print("-"*20)
#pprint(rspec)
result
=
self
.
_proxy
.
Allocate
(
urn
,
[
self
.
slice_credential
],
rspec
,
api_options
)
if
self
.
isResultOk
(
result
):
# another call id
...
...
@@ -188,8 +197,8 @@ class SfaAm(SfaApi):
result
=
[]
if
'testbeds'
not
in
record_dict
or
'urn'
not
in
self
.
_version
or
self
.
_version
[
'urn'
]
not
in
record_dict
[
'testbeds'
]:
print
(
"testbed is not concerned or is offline"
)
pprint
(
self
.
version
())
#
print("testbed is not concerned or is offline")
#
pprint(self.version())
return
{
'data'
:
result
,
'errors'
:
self
.
logs
}
try
:
if
entity
!=
'slice'
:
...
...
@@ -223,8 +232,10 @@ class SfaAm(SfaApi):
result
=
self
.
_parse_xml
(
result
,
'slice'
)
except
Exception
as
e
:
print
(
self
.
endpoint
.
name
)
traceback
.
print_exc
()
logger
.
error
(
self
.
endpoint
.
name
)
logger
.
exception
(
e
)
#print(self.endpoint.name)
#traceback.print_exc()
self
.
logs
.
append
({
'endpoint'
:
self
.
endpoint
.
name
,
'url'
:
self
.
endpoint
.
url
,
...
...
@@ -249,8 +260,10 @@ class SfaAm(SfaApi):
else
:
raise
NotImplementedError
(
'This AM version does not support PerformOperationalAction'
)
except
Exception
as
e
:
print
(
self
.
endpoint
.
name
)
traceback
.
print_exc
()
logger
.
error
(
self
.
endpoint
.
name
)
logger
.
exception
(
e
)
#print(self.endpoint.name)
#traceback.print_exc()
self
.
logs
.
append
({
'endpoint'
:
self
.
endpoint
.
name
,
'url'
:
self
.
endpoint
.
url
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment