Bug 515 improvement - Dependancy for pyangbind and osm-im added
[osm/devops.git] / systest / lib / osm / fixtures.py
1 # Copyright 2017 Sandvine
2 #
3 # All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
15 # under the License.
16
17 import pytest
18 import json
19
20
21 def osm_add_options(parser):
22 parser.addoption("--osmhost", default="", help="osm hostname")
23 parser.addoption("--sol005",action="store_true", help="enable sol005 API")
24 parser.addoption("--osm_ro_host", default="", help="osm ro_host")
25 parser.addoption("--osm-descriptor-packages", default="", help="location of descriptor packages")
26 parser.addoption("--osm-vnfd-descriptor-packages", default="", help="vnfd packages to test")
27 parser.addoption("--osm-nsd-descriptor-packages", default="", help="nsd package to test")
28 parser.addoption("--osmfile", action="store", default="", help="osm json data file")
29 parser.addoption("--osm-ns-name-prefix", action="store", default="", help="ns name prefix to apply")
30
31 '''
32 @pytest.fixture
33 def osm(request):
34 from osmclient.common import OsmAPI
35 with open(request.config.getoption("--osm")) as json_data:
36 osmdict=json.load(json_data)
37 return OsmAPI.OsmAPI(osmdict['ip'])
38
39 '''
40
41 @pytest.fixture
42 def osm(request):
43 from lib.osm import osm
44 osmhost=request.config.getoption("--osmhost")
45 sol005=request.config.getoption("--sol005")
46 osm_ro_host=request.config.getoption("--osm_ro_host")
47 descriptors_dir=request.config.getoption("--osm-descriptor-packages")
48 vnfd_descriptors_list=request.config.getoption("--osm-vnfd-descriptor-packages").split(',')
49 nsd_descriptors_list=request.config.getoption("--osm-nsd-descriptor-packages").split(',')
50 ns_name_prefix=request.config.getoption("--osm-ns-name-prefix")
51 return osm.Osm(osmhost,
52 ro_host=osm_ro_host,
53 sol005=sol005,
54 descriptors_dir=descriptors_dir,
55 vnfd_descriptors_list=vnfd_descriptors_list,
56 nsd_descriptors_list=nsd_descriptors_list,
57 ns_name_prefix=ns_name_prefix)