rename FeatureBase to Feature
[functest.git] / functest / opnfv_tests / vnf / router / vyos_vrouter.py
1 #!/usr/bin/env python
2 #
3 #  Copyright 2017 Okinawa Open Laboratory
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 import functest.core.feature as base
10 import json
11 import os
12
13 RESULT_DETAILS_FILE = "test_result.json"
14
15
16 class VrouterVnf(base.Feature):
17     def __init__(self):
18         super(VrouterVnf, self).__init__(project='functest',
19                                          case='vyos_vrouter',
20                                          repo='dir_repo_vrouter')
21         self.cmd = 'cd %s && ./run.sh' % self.repo
22
23     def set_result_details(self):
24         filepath = os.path.join(self.repo, RESULT_DETAILS_FILE)
25         if os.path.exists(filepath):
26             f = open(filepath, 'r')
27             self.details = json.load(f)
28             f.close()
29
30     def log_results(self):
31         if self.criteria == 'PASS':
32             self.set_result_details()
33         super(VrouterVnf, self).log_results()