Rizwan Haider | 51fdb3f | 2016-11-09 18:29:32 -0500 | [diff] [blame] | 1 | import sys |
| 2 | |
| 3 | from services.vnodlocal.models import VnodLocalSystem |
| 4 | from synchronizers.vnodlocal.pseudowireproviders.metronetworkpseudowireprovider import MetronetworkPseudowireProvider |
| 5 | from synchronizers.vnodlocal.pseudowireproviders.segmentroutingvlanxconnectpseudowireprovider import SegmentRoutingVlanXconnectPseudowireProvider |
| 6 | |
| 7 | |
| 8 | class ProviderFactory(object): |
| 9 | @staticmethod |
| 10 | def getprovider(): |
| 11 | |
| 12 | # We look up the VnodLocal Configuration to see what to do |
| 13 | vnodlocalsystems = VnodLocalSystem.objects.all() |
| 14 | if not vnodlocalsystems: |
| 15 | return None |
| 16 | |
| 17 | vnodlocalsystem = vnodlocalsystems[0] |
| 18 | |
| 19 | if vnodlocalsystem.pseudowireprovider == 'metronetwork': |
| 20 | return MetronetworkPseudowireProvider() |
| 21 | elif vnodlocalsystem.pseudowireprovider == 'segmentroutingxconnect': |
| 22 | return SegmentRoutingVlanXconnectPseudowireProvider() |
| 23 | else: |
| 24 | return None |