blob: de7c72a6f271d357ae9f19e57038bcade737fc83 [file] [log] [blame]
A R Karthick65d950d2016-12-19 19:41:55 -08001#
A R Karthick07608ef2016-08-23 16:51:19 -07002# Copyright 2016-present Ciena Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
A R Karthick65d950d2016-12-19 19:41:55 -08007#
A R Karthick07608ef2016-08-23 16:51:19 -07008# http://www.apache.org/licenses/LICENSE-2.0
A R Karthick65d950d2016-12-19 19:41:55 -08009#
A R Karthick07608ef2016-08-23 16:51:19 -070010# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16import json
17import os
18import shutil
A R Karthick65d950d2016-12-19 19:41:55 -080019import platform
A R Karthick07608ef2016-08-23 16:51:19 -070020
21class TestManifest(object):
22
A R Karthick65d950d2016-12-19 19:41:55 -080023 def __init__(self, manifest = None, args = None):
A R Karthick07608ef2016-08-23 16:51:19 -070024 self.manifest = manifest
A R Karthick65d950d2016-12-19 19:41:55 -080025 if args is not None and manifest is None:
26 self.onos_ip = None
27 self.radius_ip = None
28 self.head_node = platform.node()
29 self.log_level = args.log_level.upper()
30 self.onos_instances = args.onos_instances
31 self.async_mode = args.async_mode
32 self.shared_volume = args.shared_volume
33 self.olt = args.olt
34 self.start_switch = args.start_switch
35 self.image_prefix = args.prefix
36 self.onos_image = args.onos
37 else:
38 with open(self.manifest, 'r') as fd:
39 data = json.load(fd)
40 self.onos_ip = data.get('onos', None)
41 self.radius_ip = data.get('radius', None)
42 self.head_node = data.get('head_node', platform.node())
43 self.log_level = data.get('log_level', 'INFO').upper()
44 self.onos_instances = data.get('onos_instances', 1)
45 self.shared_volume = data.get('shared_volume', True)
46 self.async_mode = True if self.onos_instances > 1 else False
47 self.olt = data.get('olt', True)
48 self.start_switch = data.get('start_switch', self.olt)
49 self.image_prefix = data.get('image_prefix', '')
50 self.onos_image = data.get('onos_image', 'onosproject/onos:latest')