blob: 940ab01469f6034e43fa22bb2ba3c089c5aff3a5 [file] [log] [blame]
Matteo Scandolofe748612020-01-28 14:54:05 -08001
2# Copyright 2017-present Open Networking Foundation
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
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# 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
16
17from xosapi.orm import register_convenience_wrapper
18from xosapi.convenience.service import ORMWrapperService
19
20class ORMWrapperOnosService(ORMWrapperService):
21
22 """ Calling convention. Assume the subscribing service does approximately (needs some checks to see
23 if the methods exist before calling them) the following in its model_policy:
24
25 if not eastbound_service.validate_links(self):
26 eastbound_service.acquire_service_instance(self)
27 """
28
29 def acquire_service_instance(self, subscriber_service_instance):
30 """
31 Never acquire a ServiceInstance on the ONOS Service,
32 those are ONOS apps, simply return true
33 """
34 return True
35
36 def validate_links(self, subscriber_service_instance):
37 """
38 In the case of the ONOS service there are no links between ServiceInstances and ONOSApps,
39 so alway return an empty list
40 """
41 return []
42
43register_convenience_wrapper("ONOSService", ORMWrapperOnosService)