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-descriptor-packages", default
="", help="location of descriptor packages")
24 parser
.addoption("--osm-vnfd-descriptor-packages", default
="", help="vnfd packages to test")
25 parser
.addoption("--osm-nsd-descriptor-packages", default
="", help="nsd package to test")
26 parser
.addoption("--osmfile", action
="store", default
="", help="osm json data file")
27 parser
.addoption("--osm-ns-name-prefix", action
="store", default
="", help="ns name prefix to apply")
32 from osmclient.common import OsmAPI
33 with open(request.config.getoption("--osm")) as json_data:
34 osmdict=json.load(json_data)
35 return OsmAPI.OsmAPI(osmdict['ip'])
41 from lib
.osm
import osm
42 osmhost
=request
.config
.getoption("--osmhost")
43 descriptors_dir
=request
.config
.getoption("--osm-descriptor-packages")
44 vnfd_descriptors_list
=request
.config
.getoption("--osm-vnfd-descriptor-packages").split(',')
45 nsd_descriptors_list
=request
.config
.getoption("--osm-nsd-descriptor-packages").split(',')
46 ns_name_prefix
=request
.config
.getoption("--osm-ns-name-prefix")
47 return osm
.Osm(osmhost
,
48 descriptors_dir
=descriptors_dir
,
49 vnfd_descriptors_list
=vnfd_descriptors_list
,
50 nsd_descriptors_list
=nsd_descriptors_list
,
51 ns_name_prefix
=ns_name_prefix
)