Merge "Code improvement in type_vxlan.py and type_gre.py files"

This commit is contained in:
Jenkins 2015-01-15 17:51:20 +00:00 committed by Gerrit Code Review
commit ce7b4f4005
2 changed files with 8 additions and 16 deletions

View File

@ -128,18 +128,14 @@ class GreTypeDriver(type_tunnel.TunnelTypeDriver):
def get_endpoint_by_host(self, host):
LOG.debug("get_endpoint_by_host() called for host %s", host)
session = db_api.get_session()
host_endpoint = (session.query(GreEndpoints).
filter_by(host=host).first())
return host_endpoint
return (session.query(GreEndpoints).
filter_by(host=host).first())
def get_endpoint_by_ip(self, ip):
LOG.debug("get_endpoint_by_ip() called for ip %s", ip)
session = db_api.get_session()
ip_endpoint = (session.query(GreEndpoints).
filter_by(ip_address=ip).first())
return ip_endpoint
return (session.query(GreEndpoints).
filter_by(ip_address=ip).first())
def add_endpoint(self, ip, host):
LOG.debug("add_gre_endpoint() called for ip %s", ip)

View File

@ -146,18 +146,14 @@ class VxlanTypeDriver(type_tunnel.TunnelTypeDriver):
def get_endpoint_by_host(self, host):
LOG.debug("get_endpoint_by_host() called for host %s", host)
session = db_api.get_session()
host_endpoint = (session.query(VxlanEndpoints).
filter_by(host=host).first())
return host_endpoint
return (session.query(VxlanEndpoints).
filter_by(host=host).first())
def get_endpoint_by_ip(self, ip):
LOG.debug("get_endpoint_by_ip() called for ip %s", ip)
session = db_api.get_session()
ip_endpoint = (session.query(VxlanEndpoints).
filter_by(ip_address=ip).first())
return ip_endpoint
return (session.query(VxlanEndpoints).
filter_by(ip_address=ip).first())
def add_endpoint(self, ip, host, udp_port=VXLAN_UDP_PORT):
LOG.debug("add_vxlan_endpoint() called for ip %s", ip)