From: Aman Kumar Date: Fri, 9 Jan 2015 09:16:59 +0000 (-0800) Subject: Code improvement in type_vxlan.py and type_gre.py files X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d580f78a0ed59cfa9273403197be776a10941d97;p=openstack-build%2Fneutron-build.git 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 Change-Id: I12cbb4737e4938b8da808cb19f5e9d1e290f2559 --- diff --git a/neutron/plugins/ml2/drivers/type_gre.py b/neutron/plugins/ml2/drivers/type_gre.py index 076bd2b26..96a6715eb 100644 --- a/neutron/plugins/ml2/drivers/type_gre.py +++ b/neutron/plugins/ml2/drivers/type_gre.py @@ -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) diff --git a/neutron/plugins/ml2/drivers/type_vxlan.py b/neutron/plugins/ml2/drivers/type_vxlan.py index 5c38d63eb..563179de1 100644 --- a/neutron/plugins/ml2/drivers/type_vxlan.py +++ b/neutron/plugins/ml2/drivers/type_vxlan.py @@ -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)