blob: 6795068d9d9d8e3c37d4fc80e25bc8f7174b235c [file] [log] [blame]
Matteo Scandolo0a207b52018-01-29 13:39:43 -08001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15from xosconfig import Config
16from multistructlog import create_logger
17from synchronizers.new_base.modelaccessor import ProgranService
18
19log = create_logger(Config().get('logging'))
20
21class ProgranHelpers():
22
23 @staticmethod
24 def get_onos_info_from_si(service_instance):
25 progran_service = service_instance.owner.leaf_model
26 return ProgranHelpers.get_onos_info_from_service(progran_service)
27
28 @staticmethod
29 def get_progran_onos_info():
30 progran_service = ProgranService.objects.all()[0]
31 return ProgranHelpers.get_onos_info_from_service(progran_service)
32
33 @staticmethod
34 def get_onos_info_from_service(progran_service):
35 return {
36 'url': progran_service.onos_address,
37 'port': progran_service.onos_port,
38 'username': progran_service.onos_username,
39 'password': progran_service.onos_password,
40 }