message = _("While retrieving NAT rules, %(actual_rules)s were found "
"whereas rules in the (%(min_rules)s,%(max_rules)s) interval "
"were expected")
+
+
+class NvpInvalidAttachmentType(NvpPluginException):
+ message = _("Invalid NVP attachment type '%(attachment_type)s'")
if attachment_vlan:
attach_obj['vlan_id'] = attachment_vlan
else:
- # TODO(salv-orlando): avoid raising generic exception
- raise Exception(_("Invalid NVP attachment type '%s'"),
- nvp_attachment_type)
+ raise nvp_exc.NvpInvalidAttachmentType(
+ attachment_type=nvp_attachment_type)
return do_request(HTTP_PUT, uri, json.dumps(attach_obj), cluster=cluster)
lrouter_port = nvplib.create_router_lport(
self.fake_cluster, lrouter['uuid'], 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'])
- self.assertRaises(Exception,
+ self.assertRaises(nvp_exc.NvpInvalidAttachmentType,
nvplib.plug_router_port_attachment,
self.fake_cluster, lrouter['uuid'],
lrouter_port['uuid'], 'gw_att', 'BadType')
with mock.patch.object(self.fake_cluster.api_client,
'get_nvp_version',
new=lambda: '2.0'):
- self.assertRaises(Exception,
+ self.assertRaises(AttributeError,
nvplib.create_lrouter_snat_rule,
self.fake_cluster, lrouter['uuid'],
'10.0.0.2', '10.0.0.2', order=200,