blob: 2203db1ea4dc198f4216af778a5abf829800865b [file] [log] [blame]
Matteo Scandolo8f6aa122018-05-10 09:50:48 -07001# 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
Matteo Scandolo8f6aa122018-05-10 09:50:48 -070015class Helpers():
16 @staticmethod
17 def format_url(url):
18 if 'http' in url:
19 return url
20 else:
21 return 'http://%s' % url
22 @staticmethod
Scott Baker382366d2019-02-04 10:58:43 -080023 def get_onos_fabric_service(model_accessor):
Matteo Scandolo6739b512018-05-30 18:55:29 -070024 # FIXME do not select by name but follow ServiceDependency
Scott Baker382366d2019-02-04 10:58:43 -080025 fabric_service = model_accessor.Service.objects.get(name="fabric")
Scott Bakerafdf11d2018-08-16 15:47:55 -070026 onos_fabric_service = fabric_service.provider_services[0].leaf_model
27 return onos_fabric_service