X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwcal%2Fplugins%2Fvala%2Frwcal_openstack%2Frwcal_openstack.py;h=a83d6109e7533c365ccbdbda59693d0b2c0a9525;hb=refs%2Fchanges%2F35%2F735%2F1;hp=19eea3b305824b21a57aff2389467c434eba8f19;hpb=e5ce4ffee708ce25521d0a95280c25904ab94ddd;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..a83d6109 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" @@ -1159,6 +1179,8 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud): if ('fixed_ips' in port_info) and (len(port_info['fixed_ips']) >= 1): if 'ip_address' in port_info['fixed_ips'][0]: c_point.ip_address = port_info['fixed_ips'][0]['ip_address'] + if 'mac_address' in port_info : + c_point.mac_addr = port_info['mac_address'] if port_info['status'] == 'ACTIVE': c_point.state = 'active' else: