[openstack-dev] [sdk] issues with using OpenStack SDK Python client
gerard.damm at wipro.com
gerard.damm at wipro.com
Fri May 4 22:25:59 UTC 2018
Many thanks for the welcome ;)
And many thanks for the speedy and very useful response !
Details below.
Best regards,
Gerard
--------------------------------------------------------------------
For add_gateway_to_router():
So I tried this:
external_network = conn.network.find_network(EXTERNAL_NETWORK_NAME)
network_dict_body = {'network_id' : external_network.id}
conn.network.add_gateway_to_router(onap_router, **network_dict_body)
==> no errors, but the router is not updated (no gateway is set)
(external_gateway_info is still None)
(same with conn.network.add_gateway_to_router(onap_router, network_id=external_network.id) )
Is the body parameter for add_gateway_to_router() expected to correspond to a Network ?
(from a router point of view, a "gateway" is an external network)
Should the network's subnet(s) be also specified in the dictionary ? Maybe only
if certain specific subnets are desired for the gateway role. Otherwise,
the default would apply: there is usually only 1 subnet, and that's the one
to be used. So network_id would be enough to specify a gateway used in a standard way.
Maybe more details about what is expected in this body dictionary should be documented
in the add_gateway_to_router() section?
In Horizon, when selecting a router, and selecting "Set Gateway", the user is only
asked to pick an external network from a dropdown list. Then, a router interface is
implicitly created, with an IP@ picked from the subnet of that network.
--------------------------------------------------------------------
For router deletion: it looks like it's the "!= None" test on the returned object that has an issue
onap_router = conn.network.find_router(ONAP_ROUTER_NAME)
if onap_router != None:
print('Deleting ONAP router...')
conn.network.delete_router(onap_router.id)
else:
print('No ONAP router found...')
I added traceback printouts in the code.
printing the router before trying to delete it:
onap_router:
openstack.network.v2.router.Router(updated_at=2018-05-04T21:07:23Z, description=Router created for ONAP, status=ACTIVE, ha=False, name=ONAP_router, created_at=2018-05-04T21:07:20Z, tenant_id=03aa47d3bcfd48199e0470b1c86a7f5b, availability_zone_hints=[], admin_state_up=True, availability_zones=['nova'], tags=[], revision=3, routes=[], id=675abd14-096a-4b28-b764-31ca7098913b, external_gateway_info=None, distributed=False, flavor_id=None)
*** Exception: <class 'AttributeError'> 'NoneType' object has no attribute '_body'
*** traceback.print_tb():
File "auto_script_config_openstack_for_onap.py", line 141, in delete_all_ONAP
if onap_router != None:
File "/usr/local/lib/python3.5/dist-packages/openstack/resource.py", line 358, in __eq__
return all([self._body.attributes == comparand._body.attributes,
*** traceback.print_exception():
Traceback (most recent call last):
File "auto_script_config_openstack_for_onap.py", line 141, in delete_all_ONAP
if onap_router != None:
File "/usr/local/lib/python3.5/dist-packages/openstack/resource.py", line 358, in __eq__
return all([self._body.attributes == comparand._body.attributes,
AttributeError: 'NoneType' object has no attribute '_body'
--------------------------------------------------------------------
For identity_api_version=3 :
yes, that worked !
Could that identity_api_version parameter also/instead be specified in the clouds.yaml file ?
--------------------------------------------------------------------
Here's the traceback info for the flavor error, also on the "!= None" test :
*** Exception: <class 'AttributeError'> 'NoneType' object has no attribute '_body'
*** traceback.print_tb():
File "auto_script_config_openstack_for_onap.py", line 537, in configure_all_ONAP
if tiny_flavor != None:
File "/usr/local/lib/python3.5/dist-packages/openstack/resource.py", line 358, in __eq__
return all([self._body.attributes == comparand._body.attributes,
*** traceback.print_exception():
Traceback (most recent call last):
File "auto_script_config_openstack_for_onap.py", line 537, in configure_all_ONAP
if tiny_flavor != None:
File "/usr/local/lib/python3.5/dist-packages/openstack/resource.py", line 358, in __eq__
return all([self._body.attributes == comparand._body.attributes,
AttributeError: 'NoneType' object has no attribute '_body'
--------------------------------------------------------------------
For the image creation:
ah, OK, indeed, there is an image proxy (even 2: v1, v2),
and maybe the compute / image operations are redundant (or maybe not, for convenience) ?
and yes, it worked ! There was no need for additional parameters.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
More information about the OpenStack-dev
mailing list