aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/pub/msapi/aai.py9
-rw-r--r--lcm/pub/utils/restcall.py5
2 files changed, 12 insertions, 2 deletions
diff --git a/lcm/pub/msapi/aai.py b/lcm/pub/msapi/aai.py
index 93a1421f..2f8cf935 100644
--- a/lcm/pub/msapi/aai.py
+++ b/lcm/pub/msapi/aai.py
@@ -14,6 +14,7 @@
import json
import logging
+import uuid
from lcm.pub.exceptions import NSLCMException
from lcm.pub.utils import restcall
@@ -23,11 +24,17 @@ logger = logging.getLogger(__name__)
def call_aai(resource, method, content=''):
+ additional_headers = {
+ 'X-FromAppId': 'VFC-NFVO-LCM',
+ 'X-TransactionId': str(uuid.uuid1())
+ }
return restcall.call_req(base_url=AAI_BASE_URL,
user=AAI_USER,
passwd=AAI_PASSWD,
auth_type=restcall.rest_no_auth,
resource=resource,
method=method,
- content=content)
+ content=content,
+ additional_headers=additional_headers)
+
diff --git a/lcm/pub/utils/restcall.py b/lcm/pub/utils/restcall.py
index 0ef20561..d05d30b3 100644
--- a/lcm/pub/utils/restcall.py
+++ b/lcm/pub/utils/restcall.py
@@ -29,7 +29,8 @@ HTTP_404_NOTFOUND, HTTP_403_FORBIDDEN, HTTP_401_UNAUTHORIZED, HTTP_400_BADREQUES
logger = logging.getLogger(__name__)
-def call_req(base_url, user, passwd, auth_type, resource, method, content=''):
+def call_req(base_url, user, passwd, auth_type, resource, method,
+ content='', additional_headers={}):
callid = str(uuid.uuid1())
logger.debug("[%s]call_req('%s','%s','%s',%s,'%s','%s','%s')" % (
callid, base_url, user, passwd, auth_type, resource, method, content))
@@ -41,6 +42,8 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content=''):
if user:
headers['Authorization'] = 'Basic ' + ('%s:%s' % (user, passwd)).encode("base64")
ca_certs = None
+ if additional_headers:
+ headers.update(additional_headers)
for retry_times in range(3):
http = httplib2.Http(ca_certs=ca_certs, disable_ssl_certificate_validation=(auth_type == rest_no_auth))
http.follow_all_redirects = True