aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormrichomme <morgan.richomme@orange.com>2020-09-01 11:30:43 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2020-09-04 09:26:19 +0000
commit6022ac2e68ece3720bcfa57b290d73ac0eb238c1 (patch)
treed451fe90d22c602f54e9f5b26d327837fe391f99 /src
parent27db04b176e4f9657603528c06e1febb04b5dd4d (diff)
Add proxy support for pythonsdk-tests
Issue-ID: TEST-253 Signed-off-by: mrichomme <morgan.richomme@orange.com> Change-Id: Icc411e8418a698dd031bc5338d38311b85da113b Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'src')
-rw-r--r--src/onaptests/configuration/settings.py2
-rw-r--r--src/onaptests/steps/base.py17
2 files changed, 17 insertions, 2 deletions
diff --git a/src/onaptests/configuration/settings.py b/src/onaptests/configuration/settings.py
index 0e69b4e..2765415 100644
--- a/src/onaptests/configuration/settings.py
+++ b/src/onaptests/configuration/settings.py
@@ -68,3 +68,5 @@ PLATFORM = "sdktests_platform"
SERVICE_INSTANCE_NAME = "sdktests_service_instance_name"
SERVICE_YAML_TEMPLATE = "templates/vnf-services/ubuntu16test-service.yaml"
+
+# SOCK_HTTP = "socks5h://127.0.0.1:8080"
diff --git a/src/onaptests/steps/base.py b/src/onaptests/steps/base.py
index 5f66935..5407a85 100644
--- a/src/onaptests/steps/base.py
+++ b/src/onaptests/steps/base.py
@@ -4,6 +4,7 @@ import logging.config
from abc import ABC, abstractmethod
from typing import List
from onapsdk.configuration import settings
+from onapsdk.aai.business import Customer
class BaseStep(ABC):
"""Base step class."""
@@ -18,6 +19,12 @@ class BaseStep(ABC):
super().__init_subclass__()
cls._logger: logging.Logger = logging.getLogger("")
logging.config.dictConfig(settings.LOG_CONFIG)
+ # Setup Proxy if SOCK_HTTP is defined in settings
+ try:
+ cls.set_proxy(settings.SOCK_HTTP)
+ except AttributeError:
+ pass
+
def __init__(self, cleanup: bool = False) -> None:
"""Step initialization.
@@ -30,8 +37,6 @@ class BaseStep(ABC):
self._cleanup: bool = cleanup
self._parent: "BaseStep" = None
-
-
def add_step(self, step: "BaseStep") -> None:
"""Add substep.
@@ -83,6 +88,14 @@ class BaseStep(ABC):
for step in self._steps:
step.cleanup()
+ @classmethod
+ def set_proxy(cls, sock_http):
+ """Set sock proxy."""
+ onap_proxy = {}
+ onap_proxy['http'] = sock_http
+ onap_proxy['https'] = sock_http
+ Customer.set_proxy(onap_proxy)
+
class YamlTemplateBaseStep(BaseStep, ABC):
"""Base YAML template step."""