Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 1 | import sys |
| 2 | |
| 3 | from synchronizers.metronetwork.providers.metronetworktestprovider import MetroNetworkTestProvider |
| 4 | from synchronizers.metronetwork.providers.metronetworkrestprovider import MetroNetworkRestProvider |
| 5 | |
| 6 | |
| 7 | class ProviderFactory(object): |
| 8 | @staticmethod |
| 9 | def getprovider(networkdevice): |
| 10 | |
| 11 | undertest = False |
| 12 | |
| 13 | # We either return Test or Rest |
| 14 | # By convention a NetworkDevice with name TestDomain will use test objects |
| 15 | if networkdevice.id == 'TestMetroNet' or networkdevice.id == 'TestCORD1Net' or networkdevice.id == 'TestCORD2Net': |
| 16 | undertest = True |
| 17 | |
| 18 | if undertest: |
| 19 | return MetroNetworkTestProvider(networkdevice) |
| 20 | else: |
| 21 | return MetroNetworkRestProvider(networkdevice) |