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