X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwcal%2Fplugins%2Fvala%2Frwcal_openstack%2Frwcal_openstack.py;h=8a2d275a18de5bb0283fbc32a680e022071beb2a;hb=9a6c59279b572f61301e54014b0eb1dc72407a68;hp=19eea3b305824b21a57aff2389467c434eba8f19;hpb=055eabb8205cf0707a139f394f0afb5dbfa7423c;p=osm%2FSO.git diff --git a/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py b/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py index 19eea3b3..8a2d275a 100644 --- a/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py +++ b/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py @@ -26,6 +26,7 @@ import rw_status import rift.cal.rwcal_status as rwcal_status import rwlogger import neutronclient.common.exceptions as NeutronException +import keystoneclient.exceptions as KeystoneExceptions from gi.repository import ( GObject, @@ -88,6 +89,9 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud): tenant_name = account.openstack.tenant, mgmt_network = account.openstack.mgmt_network, cert_validate = account.openstack.cert_validate ) + except (KeystoneExceptions.Unauthorized, KeystoneExceptions.AuthorizationFailure, + NeutronException.NotFound) as e: + raise except Exception as e: self.log.error("RwcalOpenstackPlugin: OpenstackDriver init failed. Exception: %s" %(str(e))) raise @@ -118,11 +122,27 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud): Validation Code and Details String """ status = RwcalYang.CloudConnectionStatus() - try: with self._use_driver(account) as drv: drv.validate_account_creds() + except KeystoneExceptions.Unauthorized as e: + self.log.error("Invalid credentials given for VIM account %s" %account.name) + status.status = "failure" + status.details = "Invalid Credentials: %s" % str(e) + + except KeystoneExceptions.AuthorizationFailure as e: + self.log.error("Bad authentication URL given for VIM account %s. Given auth url: %s" % ( + account.name, account.openstack.auth_url)) + status.status = "failure" + status.details = "Invalid auth url: %s" % str(e) + + except NeutronException.NotFound as e: + self.log.error("Given management network %s could not be found for VIM account %s" % ( + account.openstack.mgmt_network, account.name)) + status.status = "failure" + status.details = "mgmt network does not exist: %s" % str(e) + except openstack_drv.ValidationError as e: self.log.error("RwcalOpenstackPlugin: OpenstackDriver credential validation failed. Exception: %s", str(e)) status.status = "failure"