diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | vyroute/Router.py | 34 | ||||
-rw-r--r-- | vyroute/basic_function/DeleteRoute.py | 4 | ||||
-rw-r--r-- | vyroute/basic_function/Modifylo.py | 2 | ||||
-rw-r--r-- | vyroute/basic_function/OSPFRoute.py | 12 | ||||
-rw-r--r-- | vyroute/basic_function/RIPRoute.py | 2 | ||||
-rw-r--r-- | vyroute/basic_function/StaticRoute.py | 2 |
7 files changed, 29 insertions, 28 deletions
@@ -1,5 +1,6 @@ # Compiled python modules. *.pyc +*.bak # Generate by setuptools dist/ diff --git a/vyroute/Router.py b/vyroute/Router.py index 28b3184..0b92002 100644 --- a/vyroute/Router.py +++ b/vyroute/Router.py @@ -103,7 +103,7 @@ class BasicRouter(Router): return {"Result": "Login successfully."} else: return {"Error": "Connect Failed."} - except Exception, e: + except Exception as e: return {"Error": e} def logout(self): @@ -116,7 +116,7 @@ class BasicRouter(Router): self.__status["object"] = "logout" self.__status["configure"] = None return {"Result": "Logout successfully."} - except Exception, e: + except Exception as e: return {"Error": e} def configure(self): @@ -134,7 +134,7 @@ class BasicRouter(Router): return {"Error": "In configure mode now!"} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def commit_config(self): @@ -157,7 +157,7 @@ class BasicRouter(Router): return {"Error": "Router not in configure mode!"} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def save_config(self): @@ -183,7 +183,7 @@ class BasicRouter(Router): return {"Error": "Router not in configure mode!"} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def exit_config(self, force=False): @@ -217,7 +217,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode,need not exit."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def lo(self, data): @@ -250,7 +250,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def delete_route(self, data): @@ -283,7 +283,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def static_route(self, data): @@ -316,7 +316,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def rip_route(self, data): @@ -349,7 +349,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def ospf_area(self, data): @@ -382,7 +382,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def router_id(self, data): @@ -415,7 +415,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def ospf_redistribute(self, data): @@ -448,7 +448,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def ospf_adjacency(self): @@ -476,7 +476,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def ospf_default_route(self, data): @@ -509,7 +509,7 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: + except Exception as e: return {"Error": e} def ospf_route_map(self, data): @@ -542,5 +542,5 @@ class BasicRouter(Router): return {"Error": "You are not in configure mode."} else: return {"Error": "Router object not connect to a router."} - except Exception, e: - return {"Error": e}
\ No newline at end of file + except Exception as e: + return {"Error": e} diff --git a/vyroute/basic_function/DeleteRoute.py b/vyroute/basic_function/DeleteRoute.py index d612466..da3f8e9 100644 --- a/vyroute/basic_function/DeleteRoute.py +++ b/vyroute/basic_function/DeleteRoute.py @@ -38,5 +38,5 @@ def deleteroute(obj, data): return {"Result": "Delete successfully."} else: return {"Error": "Nonsupport protocols type."} - except Exception, e: - return {"Error": e}
\ No newline at end of file + except Exception as e: + return {"Error": e} diff --git a/vyroute/basic_function/Modifylo.py b/vyroute/basic_function/Modifylo.py index b2a7959..f835c3e 100644 --- a/vyroute/basic_function/Modifylo.py +++ b/vyroute/basic_function/Modifylo.py @@ -17,5 +17,5 @@ def modifylo(obj, data): # Configure loopback interface lo address obj.execute(lo_basic_configuration % data['config']) return {"Result": "Modify successfully."} - except Exception, e: + except Exception as e: return {'Error': e} diff --git a/vyroute/basic_function/OSPFRoute.py b/vyroute/basic_function/OSPFRoute.py index 1290467..0c3367c 100644 --- a/vyroute/basic_function/OSPFRoute.py +++ b/vyroute/basic_function/OSPFRoute.py @@ -16,7 +16,7 @@ def ospfarea(obj, data): # Configure ospf area obj.execute(ospf_basic_configuration % (data['config']['area'], data['config']['network'])) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} @@ -36,7 +36,7 @@ def router_id(obj, data): # Configure router id obj.execute(router_id_configuration % data['config']['id']) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} @@ -58,7 +58,7 @@ def ospf_redistribute(obj, data): obj.execute(redistribute_configuration['0'] % data['config']['type']) obj.execute(redistribute_configuration['1']) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} @@ -72,7 +72,7 @@ def ospf_adjacency(obj): try: obj.execute(log_adjacency_changes_configuration) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} @@ -97,7 +97,7 @@ def ospf_default_route(obj, data): obj.execute(default_route_configuration['1'] % data['config']['metric']) obj.execute(default_route_configuration['2'] % data['config']['metric-type']) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} @@ -119,5 +119,5 @@ def ospf_route_map(obj, data): obj.execute(route_map_configuration['0'] % data['config']['rule']) obj.execute(route_map_configuration['1'] % (data['config']['rule'], data['config']['interface'])) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} diff --git a/vyroute/basic_function/RIPRoute.py b/vyroute/basic_function/RIPRoute.py index 2ce73cd..a493eac 100644 --- a/vyroute/basic_function/RIPRoute.py +++ b/vyroute/basic_function/RIPRoute.py @@ -17,5 +17,5 @@ def riproute(obj, data): obj.execute(rip_basic_configuration % data['config']) obj.execute(redistribute_configuration) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {"Error": e} diff --git a/vyroute/basic_function/StaticRoute.py b/vyroute/basic_function/StaticRoute.py index ac6627d..6240877 100644 --- a/vyroute/basic_function/StaticRoute.py +++ b/vyroute/basic_function/StaticRoute.py @@ -18,5 +18,5 @@ def staticroute(obj, data): data['config']['next-hop'], data['config']['distance'])) return {"Result": "Configured successfully"} - except Exception, e: + except Exception as e: return {'Error': e}
\ No newline at end of file |