blob: 6735eccdb7d11cf9e61e9c6481e15ac65a2c1a83 [file] [log] [blame]
Rizwan Haider51fdb3f2016-11-09 18:29:32 -05001import sys
2
3from services.vnodlocal.models import VnodLocalSystem
4from synchronizers.vnodlocal.pseudowireproviders.metronetworkpseudowireprovider import MetronetworkPseudowireProvider
5from synchronizers.vnodlocal.pseudowireproviders.segmentroutingvlanxconnectpseudowireprovider import SegmentRoutingVlanXconnectPseudowireProvider
6
7
8class 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