Browse Source

Add UI support for inject_default_route attr in l2policy

Change-Id: Iac0ea63f034779e3dc93c0e72915d31178018498
Closes-Bug: #1527683
ank 3 years ago
parent
commit
f40047f4a7

+ 7
- 1
gbpui/panels/network_policy/forms.py View File

@@ -213,6 +213,9 @@ class AddL2PolicyForm(forms.SelfHandlingForm):
213 213
     description = forms.CharField(
214 214
         max_length=80, label=_("Description"), required=False)
215 215
     l3_policy_id = forms.ChoiceField(label=_("L3 Policy"), required=False)
216
+    inject_default_route = forms.BooleanField(label=_("Inject Default Route"),
217
+                                initial=True,
218
+                                required=False)
216 219
 
217 220
     def __init__(self, request, *args, **kwargs):
218 221
         super(AddL2PolicyForm, self).__init__(request, *args, **kwargs)
@@ -249,6 +252,8 @@ class UpdateL2PolicyForm(forms.SelfHandlingForm):
249 252
     description = forms.CharField(
250 253
         max_length=80, label=_("Description"), required=False)
251 254
     l3_policy_id = forms.ChoiceField(label=_("L3 Policy"), required=False)
255
+    inject_default_route = forms.BooleanField(label=_("Inject Default Route"),
256
+                                required=False)
252 257
 
253 258
     def __init__(self, request, *args, **kwargs):
254 259
         super(UpdateL2PolicyForm, self).__init__(request, *args, **kwargs)
@@ -260,7 +265,8 @@ class UpdateL2PolicyForm(forms.SelfHandlingForm):
260 265
             policies = [(item['id'], item['name'] + ":" + item['id'])
261 266
                         for item in policies]
262 267
             self.fields['l3_policy_id'].choices = policies
263
-            for item in ['name', 'description', 'l3_policy_id']:
268
+            for item in ['name', 'description', 'l3_policy_id',
269
+                        'inject_default_route']:
264 270
                 self.fields[item].initial = getattr(l2, item)
265 271
         except Exception:
266 272
             msg = _("Failed to get L3 policy list")

+ 2
- 0
gbpui/panels/network_policy/tables.py View File

@@ -50,6 +50,8 @@ class L2PolicyTable(tables.DataTable):
50 50
     id = tables.Column("id", verbose_name=_("ID"))
51 51
     l3_policy_id = tables.Column(
52 52
         "l3_policy_id", verbose_name=_("L3 Policy ID"))
53
+    inject_default_route = tables.Column(
54
+        "inject_default_route", verbose_name=_("Inject Default Route"))
53 55
 
54 56
     class Meta(object):
55 57
         name = "l2policy_table"

+ 3
- 0
gbpui/panels/network_policy/templates/network_policy/_l2_policy_details.html View File

@@ -12,6 +12,9 @@
12 12
 
13 13
 		<dt>{% trans "ID" %}</dt>
14 14
 		<dd>{{ l2policy.id }} </dd>
15
+
16
+                <dt>{% trans "Inject Default Route" %}</dt>
17
+                <dd>{{ l2policy.inject_default_route }} </dd>
15 18
 	</dl>
16 19
     {% if l2policy.ptgs %}
17 20
     <div class="panel panel-default">

Loading…
Cancel
Save