Support for vifs being in 'spec' and 'status' objects.

In order to move vif information from 'spec' to 'status', we need
to support both for the transition time.

Change-Id: I2cb66e25534e44b79f660b10498086aa88ad805c
This commit is contained in:
Roman Dobosz 2020-07-31 12:10:35 +02:00 committed by Maysa de Macedo Souza
parent 2fe1791ff2
commit 53f01c482c

View File

@ -282,8 +282,16 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
namespace=namespace,
plural=KURYR_PORT_CRD_PLURAL,
name=pod_name))
vif = [v['vif'].get('versioned_object.data', {}).get('id')
for k, v in crd['spec']['vifs'].items() if v.get('default')]
try:
vif = [v['vif'].get('versioned_object.data', {}).get('id')
for k, v in crd['status']['vifs'].items()
if v.get('default')]
except KeyError:
# TODO(gryf): Remove this after moving vifs to status succeed.
vif = [v['vif'].get('versioned_object.data', {}).get('id')
for k, v in crd['spec']['vifs'].items()
if v.get('default')]
if vif and vif[0]:
return vif[0]
else: