Skip to content

Commit 2d60719

Browse files
authored
Merge pull request #464 from globocom/develop
Develop
2 parents 84da5db + 370291d commit 2d60719

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

networkapi/api_deploy/facade.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +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.'
68+
# tipo_acesso = EquipamentoAcesso.search(None,
69+
# equipment,
70+
# ).uniqueResult()
71+
# if tipo_acesso is None:
72+
# return 'Equipment has no Access.'
7373

74-
equip_plugin = PluginFactory.factory(equipment, tipo_acesso=tipo_acesso.tipo_acesso.protocolo)
74+
equip_plugin = PluginFactory.factory(equipment)
7575
equip_plugin.connect()
7676
equip_plugin.ensure_privilege_level()
7777
vrf = equip_plugin.equipment_access.vrf.internal_name if equip_plugin.equipment_access.vrf else None

networkapi/plugins/factory.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616
import logging
1717
import re
18+
from networkapi.equipamento.models import Equipamento, EquipamentoAcesso
1819

1920
from networkapi.plugins.SDN.ODL.Generic import ODLPlugin
2021

@@ -34,8 +35,13 @@ def plugin_exists(cls, **kwargs):
3435

3536
@classmethod
3637
def get_plugin(cls, **kwargs):
37-
3838
if 'tipo_acesso' in kwargs and kwargs.get('tipo_acesso') == 'netconf':
39+
if 'bgp' in kwargs:
40+
bgp = kwargs.get('bgp')
41+
if bgp:
42+
from .Netconf.BGP.Cli import Generic
43+
return Generic
44+
3945
from .Netconf.plugin import GenericNetconf
4046
return GenericNetconf
4147
if 'modelo' in kwargs:
@@ -109,7 +115,14 @@ def factory(cls, equipment, **kwargs):
109115

110116
marca = equipment.modelo.marca.nome
111117
modelo = equipment.modelo.nome
112-
plugin_class = cls.get_plugin(modelo=modelo, marca=marca, **kwargs)
118+
tipo_acesso = EquipamentoAcesso.search(None,
119+
equipment,
120+
).uniqueResult()
121+
122+
if tipo_acesso is None:
123+
return 'Equipment has no Access.'
124+
125+
plugin_class = cls.get_plugin(modelo=modelo, marca=marca, tipo_acesso=tipo_acesso.tipo_acesso.protocolo, **kwargs)
113126

114127
if type(plugin_class) == type(ODLPlugin):
115128
version = 'BERYLLIUM'

0 commit comments

Comments
 (0)