Skip to content

Commit 7d5bc33

Browse files
Merge pull request #458 from globocom/develop
Develop
2 parents 68ca363 + 9e3c85d commit 7d5bc33

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

networkapi/api_deploy/facade.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ def _applyconfig(equipment, filename, equipment_access=None, source_server=None,
6565

6666
# TODO: Handle exceptions from the following methods and generate response
6767
# for the caller
68+
tipo_acesso = EquipamentoAcesso.search(None,
69+
equipment,
70+
).uniqueResult()
71+
if tipo_acesso is None:
72+
return 'Equipment has no Access.'
6873

69-
equip_plugin = PluginFactory.factory(equipment)
74+
equip_plugin = PluginFactory.factory(equipment, tipo_acesso=tipo_acesso.tipo_acesso.protocolo)
7075
equip_plugin.connect()
7176
equip_plugin.ensure_privilege_level()
7277
vrf = equip_plugin.equipment_access.vrf.internal_name if equip_plugin.equipment_access.vrf else None

networkapi/plugins/factory.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def plugin_exists(cls, **kwargs):
3535
@classmethod
3636
def get_plugin(cls, **kwargs):
3737

38+
if 'tipo_acesso' in kwargs and kwargs.get('tipo_acesso') == 'netconf':
39+
from .Netconf.plugin import GenericNetconf
40+
return GenericNetconf
3841
if 'modelo' in kwargs:
3942
modelo = kwargs.get('modelo')
4043

@@ -61,9 +64,9 @@ def get_plugin(cls, **kwargs):
6164

6265
if 'marca' in kwargs:
6366
marca = kwargs.get('marca')
64-
if re.search('HUAWEI', marca.upper(), re.DOTALL):
65-
from .Netconf.plugin import GenericNetconf
66-
return GenericNetconf
67+
# if re.search('HUAWEI', marca.upper(), re.DOTALL):
68+
# from .Netconf.plugin import GenericNetconf
69+
# return GenericNetconf
6770
if re.search('F5', marca.upper(), re.DOTALL):
6871
from .F5.Generic import Generic
6972
return Generic

0 commit comments

Comments
 (0)