Skip to content

Commit

Permalink
Merge pull request #1337 from garberg/fix_missing_vrf
Browse files Browse the repository at this point in the history
Handle edit_prefix without VRF
  • Loading branch information
garberg authored Oct 6, 2023
2 parents 6154bea + 948ec59 commit a8a78a2
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions nipap/nipap/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2749,13 +2749,14 @@ def edit_prefix(self, auth, spec, attr):
'name': None
}

# Handle VRF - find the correct one and remove bad VRF keys.
vrf = self._get_vrf(auth, attr)
if 'vrf_rt' in attr:
del(attr['vrf_rt'])
if 'vrf_name' in attr:
del(attr['vrf_name'])
attr['vrf_id'] = vrf['id']
# Handle VRF in attributes - find the correct one and remove bad VRF keys.
if 'vrf_rt' in attr or 'vrf_name' in attr or 'vrf_id' in attr:
vrf = self._get_vrf(auth, attr)
if 'vrf_rt' in attr:
del(attr['vrf_rt'])
if 'vrf_name' in attr:
del(attr['vrf_name'])
attr['vrf_id'] = vrf['id']

self._check_attr(attr, [], _prefix_attrs)

Expand All @@ -2780,9 +2781,6 @@ def edit_prefix(self, auth, spec, attr):
'authenticated_as': auth.authenticated_as,
'full_name': auth.full_name,
'authoritative_source': auth.authoritative_source,
'vrf_id': vrf['id'],
'vrf_rt': vrf['rt'],
'vrf_name': vrf['name']
}

for p in prefixes:
Expand Down

0 comments on commit a8a78a2

Please sign in to comment.