diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2017-05-24 17:00:49 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2017-06-06 14:02:11 +0200 |
commit | 58667cba215c2cb999d6bcaf891980bda4325b42 (patch) | |
tree | 43daaa0fac17d5a8e283126c9fe7d68d523f62c5 /functest/opnfv_tests/vnf/aaa/aaa.py | |
parent | d1fe9ae1d51537c73f3264cb1e01342888f5fd3f (diff) |
Refactor core VNF class
- Simplify processing
- Implement run method to inherit testcase methods
- Add unit tests
- Fix all pylint issues
It also obliges vnf and its uts to be rated 10/10 by pylint.
JIRA: FUNCTEST-830
Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com>
Change-Id: I8dd24eea55089277c9e5b2b51fb14dc377f2fcaf
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/vnf/aaa/aaa.py')
-rwxr-xr-x | functest/opnfv_tests/vnf/aaa/aaa.py | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/functest/opnfv_tests/vnf/aaa/aaa.py b/functest/opnfv_tests/vnf/aaa/aaa.py index 0030256c..71e3c972 100755 --- a/functest/opnfv_tests/vnf/aaa/aaa.py +++ b/functest/opnfv_tests/vnf/aaa/aaa.py @@ -8,15 +8,12 @@ # http://www.apache.org/licenses/LICENSE-2.0 import logging -import sys -import argparse - -import functest.core.testcase as testcase import functest.core.vnf as vnf class AaaVnf(vnf.VnfOnBoarding): + """AAA VNF sample""" logger = logging.getLogger(__name__) @@ -27,48 +24,18 @@ class AaaVnf(vnf.VnfOnBoarding): def deploy_orchestrator(self): self.logger.info("No VNFM needed to deploy a free radius here") - return None + return True -# TODO see how to use build in exception form releng module def deploy_vnf(self): self.logger.info("Freeradius VNF deployment") - # TODO apt-get update + config tuning - deploy_vnf = {} - deploy_vnf['status'] = "PASS" - deploy_vnf['result'] = {} - return deploy_vnf + # find a way to deploy freeradius and tester (heat,manual, ..) + deploy_vnf = {'status': 'PASS', 'version': 'xxxx'} + self.details['deploy_vnf'] = deploy_vnf + return True def test_vnf(self): self.logger.info("Run test towards freeradius") - # TODO: once the freeradius is deployed..make some tests - test_vnf = {} - test_vnf['status'] = "PASS" - test_vnf['result'] = {} - return test_vnf - - def main(self, **kwargs): - self.logger.info("AAA VNF onboarding") - self.execute() - if self.result is "PASS": - return self.EX_OK - else: - return self.EX_RUN_ERROR - - def run(self): - kwargs = {} - return self.main(**kwargs) - - -if __name__ == '__main__': - logging.basicConfig() - parser = argparse.ArgumentParser() - args = vars(parser.parse_args()) - aaa_vnf = AaaVnf() - try: - result = aaa_vnf.main(**args) - if result != testcase.TestCase.EX_OK: - sys.exit(result) - if args['pushtodb']: - sys.exit(aaa_vnf.push_to_db()) - except Exception: - sys.exit(testcase.TestCase.EX_RUN_ERROR) + # once the freeradius is deployed..make some tests + test_vnf = {'status': 'PASS', 'version': 'xxxx'} + self.details['test_vnf'] = test_vnf + return True |