X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO-plugin%2Fosm_ro_plugin%2Fsdn_failing.py;h=8c373e6a1170102f5965c08fb4ad68925f2180ec;hb=08c81cf0d426c695e67942ec9dceeeb4458ba582;hp=b8ea42f1d8d4c98b79a5e9631a3f7d3b4b94836d;hpb=7277486065c905f91477bb064da86855a8fa269a;p=osm%2FRO.git diff --git a/RO-plugin/osm_ro_plugin/sdn_failing.py b/RO-plugin/osm_ro_plugin/sdn_failing.py index b8ea42f1..8c373e6a 100644 --- a/RO-plugin/osm_ro_plugin/sdn_failing.py +++ b/RO-plugin/osm_ro_plugin/sdn_failing.py @@ -36,7 +36,6 @@ we need a replacement for it, that will throw an error every time we try to execute any action """ -import json from osm_ro_plugin.sdnconn import SdnConnectorError @@ -48,6 +47,7 @@ class SdnFailingConnector(object): This way we can make sure that all the other parts of the program will work but the user will have all the information available to fix the problem. """ + def __init__(self, error_msg): self.error_msg = error_msg @@ -58,31 +58,34 @@ class SdnFailingConnector(object): raise Exception(self.error_msg) def check_credentials(self): - raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg) + raise SdnConnectorError("Impossible to use WIM:\n" + self.error_msg) def get_connectivity_service_status(self, service_uuid, _conn_info=None): - raise SdnConnectorError('Impossible to retrieve status for {}\n\n{}' - .format(service_uuid, self.error_msg)) + raise SdnConnectorError( + "Impossible to retrieve status for {}: {}".format( + service_uuid, self.error_msg + ) + ) def create_connectivity_service(self, service_uuid, *args, **kwargs): - raise SdnConnectorError('Impossible to connect {}.\n{}\n{}\n{}' - .format(service_uuid, self.error_msg, - json.dumps(args, indent=4), - json.dumps(kwargs, indent=4))) + raise SdnConnectorError( + "Impossible to create connectivity: {}".format(self.error_msg) + ) def delete_connectivity_service(self, service_uuid, _conn_info=None): - raise SdnConnectorError('Impossible to disconnect {}\n\n{}' - .format(service_uuid, self.error_msg)) + raise SdnConnectorError( + "Impossible to delete {}: {}".format(service_uuid, self.error_msg) + ) def edit_connectivity_service(self, service_uuid, *args, **kwargs): - raise SdnConnectorError('Impossible to change connection {}.\n{}\n' - '{}\n{}' - .format(service_uuid, self.error_msg, - json.dumps(args, indent=4), - json.dumps(kwargs, indent=4))) + raise SdnConnectorError( + "Impossible to change connection {}: {}".format( + service_uuid, self.error_msg + ) + ) def clear_all_connectivity_services(self): - raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg) + raise SdnConnectorError("Impossible to use WIM: {}".format(self.error_msg)) def get_all_active_connectivity_services(self): - raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg) + raise SdnConnectorError("Impossible to use WIM: {}".format(self.error_msg))