Merge "Improve the ssl connection handle log message. Fix auth header exception handl...
authorBin Yang <bin.yang@windriver.com>
Tue, 8 Nov 2022 09:07:27 +0000 (09:07 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 8 Nov 2022 09:07:27 +0000 (09:07 +0000)
o2common/authmw/authmiddleware.py
o2ims/service/command/notify_alarm_handler.py
o2ims/service/command/notify_handler.py
o2ims/service/command/registration_handler.py

index 13be910..032e735 100644 (file)
@@ -61,8 +61,7 @@ class authmiddleware():
         logger.info(__name__ + 'authentication middleware')
         req = Request(environ, populate_request=True, shallow=True)
         try:
-            auth_header = req.headers['Authorization']
-
+            auth_header = req.headers.get('Authorization', None)
             if auth_header:
                 auth_token = auth_header.split(" ")[1]
 
index 11729a4..b4e22a1 100644 (file)
@@ -69,8 +69,9 @@ def callback_smo(sub: AlarmSubscription, msg: AlarmEvent2SMO):
             return
         logger.error('Notify alarm Response code is: {}'.format(status))
     except ssl.SSLCertVerificationError as e:
-        logger.info(
-            'Notify alarm post data with trusted ca failed: {}'.format(e))
+        logger.debug(
+            'Notify alarm try to post data with trusted ca \
+                failed: {}'.format(e))
         if 'self signed' in str(e):
             conn = get_https_conn_selfsigned(o.netloc)
             try:
index fe22f2a..8f134af 100644 (file)
@@ -102,7 +102,8 @@ def callback_smo(sub: Subscription, msg: Message2SMO):
             return
         logger.error('Notify Response code is: {}'.format(status))
     except ssl.SSLCertVerificationError as e:
-        logger.info('Notify post data with trusted ca failed: {}'.format(e))
+        logger.debug(
+            'Notify try to post data with trusted ca failed: {}'.format(e))
         if 'self signed' in str(e):
             conn = get_https_conn_selfsigned(o.netloc)
             try:
index aead4cc..c144405 100644 (file)
@@ -108,7 +108,8 @@ def call_smo(reg_data: dict):
     try:
         return post_data(conn, o.path, callback_data)
     except ssl.SSLCertVerificationError as e:
-        logger.info('Register to smo with trusted ca failed: {}'.format(e))
+        logger.debug('Try to register to smo with \
+        trusted ca failed: {}'.format(e))
         if 'self signed' in str(e):
             conn = get_https_conn_selfsigned(o.netloc)
             try: