Fixed incorrect list of l3policies
Added link for Network Service Policy details. Change-Id: I42b4e4e295a70eeddd4f6a12b6486e8010a71b88 Closes-Bug:1487200 (cherry picked from commitbc244d1e66
) (cherry picked from commit12766a666f
)
This commit is contained in:
parent
d86cf0decd
commit
f6f40389cd
@ -439,7 +439,7 @@ def update_externalconnectivity(request, external_connectivity_id, **kwargs):
|
||||
body = {'external_segment': kwargs}
|
||||
ec = gbpclient(request).update_external_segment(
|
||||
external_connectivity_id, body).get('external_segment')
|
||||
return NetworkServicePolicy(ec)
|
||||
return ExternalConnectivity(ec)
|
||||
|
||||
|
||||
def create_networkservice_policy(request, **kwargs):
|
||||
|
@ -114,15 +114,15 @@ class L3PolicyDetailsView(tables.MultiTableView):
|
||||
return self.get(request, *args, **kwargs)
|
||||
|
||||
def get_l2policy_table_data(self):
|
||||
policies = []
|
||||
l2_policies = []
|
||||
try:
|
||||
policies = client.l2policy_list(self.request,
|
||||
tenant_id=self.request.user.tenant_id)
|
||||
condition = {'l3_policy_id': self.kwargs['l3policy_id']}
|
||||
l2_policies = client.l2policy_list(self.request,
|
||||
tenant_id=self.request.user.tenant_id, **condition)
|
||||
except Exception:
|
||||
policies = []
|
||||
exceptions.handle(self.tab_group.request,
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve l2 policy list.'))
|
||||
return policies
|
||||
return l2_policies
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(L3PolicyDetailsView, self).get_context_data(**kwargs)
|
||||
|
@ -86,22 +86,24 @@ class PTGDetailsTab(tabs.Tab):
|
||||
|
||||
def get_context_data(self, request):
|
||||
policy_targetid = self.tab_group.kwargs['policy_target_id']
|
||||
nsp = ''
|
||||
try:
|
||||
policy_target = client.policy_target_get(request, policy_targetid)
|
||||
l3list = client.l3policy_list(request,
|
||||
tenant_id=request.user.tenant_id)
|
||||
l2list = client.l2policy_list(request,
|
||||
tenant_id=request.user.tenant_id)
|
||||
l2list = [
|
||||
item for item in l2list
|
||||
if item.id == policy_target.l2_policy_id]
|
||||
l2_policy = client.l2policy_get(request,
|
||||
policy_target["l2_policy_id"])
|
||||
l3_policy = client.l3policy_get(request,
|
||||
l2_policy["l3_policy_id"])
|
||||
if policy_target['network_service_policy_id']:
|
||||
nsp_id = policy_target['network_service_policy_id']
|
||||
nsp = client.get_networkservice_policy(request, nsp_id)
|
||||
except Exception:
|
||||
exceptions.handle(
|
||||
request, _('Unable to retrieve group details.'),
|
||||
redirect=self.failure_url)
|
||||
return {'policy_target': policy_target,
|
||||
'l3list': l3list,
|
||||
'l2list': l2list}
|
||||
'l3_policy': l3_policy,
|
||||
'l2_policy': l2_policy,
|
||||
'nsp': nsp}
|
||||
|
||||
|
||||
class PTGDetailsTabs(tabs.TabGroup):
|
||||
|
@ -15,28 +15,32 @@
|
||||
|
||||
<dt>{% trans "Project ID" %}</dt>
|
||||
<dd>{{ policy_target.tenant_id }}</dd>
|
||||
|
||||
<dt>{% trans "Network Service Policy" %}</dt>
|
||||
<dd>{% if nsp %}
|
||||
<a href="{% url 'horizon:project:network_policy:service_policy_details' nsp.id %}">{{nsp.name}}</a>
|
||||
{% else %}
|
||||
{{ _("-") }}
|
||||
{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
{% if l3list %}
|
||||
{% if l3_policy %}
|
||||
<div class='panel panel-default'>
|
||||
<div class='panel-heading'>{% trans "L3 Policies" %}</div>
|
||||
<div class='panel-body'>
|
||||
<ul class="unstyled">
|
||||
{% for l3 in l3list %}
|
||||
<li><a href="{% url 'horizon:project:network_policy:l3policy_details' l3.id %}">{{l3.name}}:{{l3.id}}</a></li>
|
||||
|
||||
{% endfor %}
|
||||
<li><a href="{% url 'horizon:project:network_policy:l3policy_details' l3_policy.id %}">{{l3_policy.name}}:{{l3_policy.id}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if l2list %}
|
||||
|
||||
{% if l2_policy %}
|
||||
<div class='panel panel-default'>
|
||||
<div class='panel-heading'>{% trans "L2 Policies" %}</div>
|
||||
<div class='panel-body'>
|
||||
<ul class="unstyled">
|
||||
{% for l2 in l2list %}
|
||||
<li><a href="{% url 'horizon:project:network_policy:l2policy_details' l2.id %}">{{l2.name}}:{{l2.id}}</a></li>
|
||||
{% endfor %}
|
||||
<li><a href="{% url 'horizon:project:network_policy:l2policy_details' l2_policy.id %}">{{l2_policy.name}}:{{l2_policy.id}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user