1 # Copyright 2017 Sandvine
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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
21 def osm_add_options(parser
):
22 parser
.addoption("--osmhost", default
="", help="osm hostname")
23 parser
.addoption("--osm_ro_host", default
="", help="osm ro_host")
24 parser
.addoption("--osm-descriptor-packages", default
="", help="location of descriptor packages")
25 parser
.addoption("--osm-vnfd-descriptor-packages", default
="", help="vnfd packages to test")
26 parser
.addoption("--osm-nsd-descriptor-packages", default
="", help="nsd package to test")
27 parser
.addoption("--osmfile", action
="store", default
="", help="osm json data file")
28 parser
.addoption("--osm-ns-name-prefix", action
="store", default
="", help="ns name prefix to apply")
33 from osmclient.common import OsmAPI
34 with open(request.config.getoption("--osm")) as json_data:
35 osmdict=json.load(json_data)
36 return OsmAPI.OsmAPI(osmdict['ip'])
42 from lib
.osm
import osm
43 osmhost
=request
.config
.getoption("--osmhost")
44 osm_ro_host
=request
.config
.getoption("--osm_ro_host")
45 descriptors_dir
=request
.config
.getoption("--osm-descriptor-packages")
46 vnfd_descriptors_list
=request
.config
.getoption("--osm-vnfd-descriptor-packages").split(',')
47 nsd_descriptors_list
=request
.config
.getoption("--osm-nsd-descriptor-packages").split(',')
48 ns_name_prefix
=request
.config
.getoption("--osm-ns-name-prefix")
49 return osm
.Osm(osmhost
,
51 descriptors_dir
=descriptors_dir
,
52 vnfd_descriptors_list
=vnfd_descriptors_list
,
53 nsd_descriptors_list
=nsd_descriptors_list
,
54 ns_name_prefix
=ns_name_prefix
)