diff --git a/CadVlan/Rack/templates/datacenter/fabric.html b/CadVlan/Rack/templates/datacenter/fabric.html index 03a53dd9..b4c2e122 100644 --- a/CadVlan/Rack/templates/datacenter/fabric.html +++ b/CadVlan/Rack/templates/datacenter/fabric.html @@ -1,4 +1,18 @@ {% extends "menu.html" %} +{% block header %} + +{% endblock %} {% block content %}
@@ -135,8 +149,19 @@

+ + engineering + + + + + launch diff --git a/CadVlan/Rack/views.py b/CadVlan/Rack/views.py index c6da158c..7897c689 100644 --- a/CadVlan/Rack/views.py +++ b/CadVlan/Rack/views.py @@ -751,6 +751,23 @@ def deploy_rack_new (request, fabric_id, rack_id): return HttpResponseRedirect(reverse('fabric', args=[fabric_id])) +@log +@login_required +@has_perm([{"permission": EQUIPMENT_MANAGEMENT, "write": True}]) +def rack_foreman (request, fabric_id, rack_id): + + + auth = AuthSession(request.session) + client = auth.get_clientFactory() + try: + client.create_apirack().rack_foreman(rack_id) + messages.add_message(request, messages.SUCCESS, rack_messages.get("sucess_aplicar_config")) + except NetworkAPIClientError as e: + messages.add_message(request, messages.ERROR, "Erro ao registrar no Foremanr. Erro: %s" % e) + + return HttpResponseRedirect(reverse('fabric', args=[fabric_id])) + + @log @login_required @csrf_protect diff --git a/CadVlan/messages.py b/CadVlan/messages.py index 2bbcdce0..42025c75 100644 --- a/CadVlan/messages.py +++ b/CadVlan/messages.py @@ -68,6 +68,7 @@ 'can_not_aplicar_config': u'A configuracao não pode ser aplicada nos equipamentos do rack.', 'sucess_alocar_config': u'Os ambientes, vlans e redes do rack %s foram alocadas com sucesso.', 'can_not_alocar_config': u'Os ambientes, vlans e redes do rack %s não puderam ser alocadas.', + 'sucess-foreman': u'O ambiente foi registrado no Foreman.' } equip_access_messages = { diff --git a/CadVlan/urls.py b/CadVlan/urls.py index 3d00e917..23553239 100755 --- a/CadVlan/urls.py +++ b/CadVlan/urls.py @@ -841,6 +841,7 @@ url('^fabric/bgp/(?P\d+)[/]?$', 'fabric_bgp', name='fabric.bgp',), url('^fabric/(?P\d+)[/]?$', 'fabric', name='fabric',), url('^fabric/delete/(?P\d+)[/]?$', 'remove_fabric', name='fabric.delete', ), + url('^rack/foreman/(?P\d+)/(?P\d+)[/]?$', 'rack_foreman', name='rack.foreman.new', ), ) diff --git a/requirements.txt b/requirements.txt index 953b5796..4d2bf362 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ Django==1.4.15 -GloboNetworkAPI==0.9.2 +GloboNetworkAPI==0.9.3 py2-ipaddress==3.4.1 pycrypto==2.6 python-ldap==2.3.13