Code improvement in type_vxlan.py and type_gre.py files

This patch set basically addressing the review comment
given in the following patch-set:
https://review.openstack.org/#/c/121000/

Co-Authored-By: Romil Gupta <romilg@hp.com>

Change-Id: I12cbb4737e4938b8da808cb19f5e9d1e290f2559
This commit is contained in:
Aman Kumar 2015-01-09 01:16:59 -08:00 committed by Romil Gupta
parent 6df7f5abf1
commit d580f78a0e
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)