aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/vnf/router/vyos_vrouter.py
blob: 94a3ecfd8577c2fdd31865772c3726a9d2e3587a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
#
#  Copyright 2017 Okinawa Open Laboratory
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
import functest.core.feature_base as base
import json
import os

RESULT_DETAILS_FILE = "test_result.json"


class VrouterVnf(base.FeatureBase):
    def __init__(self):
        super(VrouterVnf, self).__init__(project='vRouter',
                                         case='vyos_vrouter',
                                         repo='dir_repo_vrouter')
        self.cmd = 'cd %s && ./run.sh' % self.repo

    def set_result_details(self):
        filepath = os.path.join(self.repo, RESULT_DETAILS_FILE)
        if os.path.exists(filepath):
            f = open(filepath, 'r')
            self.details = json.load(f)
            f.close()

    def log_results(self):
        if self.criteria == 'PASS':
            self.set_result_details()
        super(VrouterVnf, self).log_results()