Matteo Scandolo | fcf842e | 2017-08-08 13:05:25 -0700 | [diff] [blame] | 1 | |
| 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 | |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 17 | from services.metronetwork.models import * |
| 18 | from synchronizers.metronetwork.invokers.networkmultipointtomultipointinvoker import NetworkMultipointToMultipointInvoker |
| 19 | from synchronizers.metronetwork.invokers.networkedgetoedgepointinvoker import NetworkEdgeToEdgePointInvoker |
| 20 | from synchronizers.metronetwork.invokers.networkedgetomultipointinvoker import NetworkEdgeToMultipointInvoker |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame] | 21 | from synchronizers.metronetwork.invokers.servicespokeinvoker import ServiceSpokeInvoker |
| 22 | from synchronizers.metronetwork.invokers.vnodglobalserviceinvoker import VnodGlobalServiceInvoker |
| 23 | from synchronizers.metronetwork.invokers.remoteportinvoker import RemotePortInvoker |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 24 | |
| 25 | |
| 26 | class InvokerFactory(object): |
| 27 | @staticmethod |
| 28 | def getinvoker(obj): |
| 29 | # |
| 30 | # Here is where we build various invokers |
| 31 | # |
| 32 | if isinstance(obj, NetworkMultipointToMultipointConnection): |
| 33 | return NetworkMultipointToMultipointInvoker() |
| 34 | elif isinstance(obj, NetworkEdgeToEdgePointConnection): |
| 35 | return NetworkEdgeToEdgePointInvoker() |
| 36 | elif isinstance(obj, NetworkEdgeToMultipointConnection): |
| 37 | return NetworkEdgeToMultipointInvoker() |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame] | 38 | elif isinstance(obj, ServiceSpoke): |
| 39 | return ServiceSpokeInvoker() |
| 40 | elif isinstance(obj, VnodGlobalService): |
| 41 | return VnodGlobalServiceInvoker() |
| 42 | elif isinstance(obj, RemotePort): |
| 43 | return RemotePortInvoker() |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 44 | else: |
| 45 | return None |