always push down metadata rules for router, not just if gateway exists
always push down metadata rules for router, not just if gateway exists

bug 1051842

the l3-agent only pushes down some of the DNAT rules for metadata mapping
if there is a gateway set on a router. However, the nova-api server could
itself be running in the local router namespace (or on the same box as
the quantum-l3-agent in the case were namespaces are disabled. In fact,
with namespaces disabled, this is the likely setup for a simple
environment). Thus, we should simply always push down the metadata nat
rules for a router, router than waiting until a gateway is added.

This patch also refactors the actions taken by the l3-agent when a router
is added or removed into a separate function for improved readability,
as add/removing the nat rules made these code segments even longer.

Change-Id: I3c6eb35b51df3babf747dbcff7f943b850e69838

ntt-sic/neutron,vveerava/Openstack,armando-migliaccio/neutron,yamahata/tacker,Metaswitch/calico-neutron,virtualopensystems/neutron,NeCTAR-RC/neutron,asgard-lab/neutron,swdream/neutron,virtualopensystems/neutron,Stavitsky/neutron,Juniper/contrail-dev-neutron,mahak/neutron,MaximNevrov/neutron,netscaler/neutron,neoareslinux/neutron,jacknjzhou/neutron,SamYaple/neutron,oeeagle/quantum,Comcast/neutron,bgxavier/neutron,pnavarro/neutron,cloudbase/neutron,JianyuWang/neutron,MaximNevrov/neutron,beagles/neutron_hacking,armando-migliaccio/neutron,yuewko/neutron,redhat-openstack/neutron,vijayendrabvs/hap,openstack/neutron,CiscoSystems/vespa,rickerc/neutron_audit,magic0704/neutron,silenci/neutron,kaiweifan/vse-lbaas-plugin-poc,apporc/neutron,sebrandon1/neutron,yamahata/neutron,leeseulstack/openstack,aristanetworks/arista-ovs-quantum,shahbazn/neutron,dims/neutron,vveerava/Openstack,waltBB/neutron_read,glove747/liberty-neutron,sebrandon1/neutron,blueboxgroup/neutron,paninetworks/neutron,wenhuizhang/neutron,shahbazn/neutron,takeshineshiro/neutron,gkotton/neutron,CiscoSystems/quantum,JioCloud/neutron,openstack/neutron,vbannai/neutron,yamahata/tacker,Comcast/neutron,takeshineshiro/neutron,leeseulstack/openstack,apporc/neutron,yamt/neutron,tpaszkowski/quantum,mattt416/neutron,zhhf/charging,yamt/neutron,pnavarro/neutron,beagles/neutron_hacking,noironetworks/neutron,kaiweifan/neutron,aristanetworks/arista-ovs-quantum,ykaneko/quantum,bgxavier/neutron,sajuptpm/neutron-ipam,JioCloud/neutron,vivekanand1101/neutron,vbannai/neutron,kaiweifan/neutron,ntt-sic/neutron,citrix-openstack-build/neutron,igor-toga/local-snat,asgard-lab/neutron,wenhuizhang/neutron,wolverineav/neutron,Juniper/neutron,liqin75/vse-vpnaas-plugin,rossella/neutron,vijayendrabvs/ssl-neutron,dhanunjaya/neutron,chitr/neutron,Brocade-OpenSource/OpenStack-DNRM-Neutron,liqin75/vse-vpnaas-plugin,leeseuljeong/leeseulstack_neutron,cloudbase/neutron,paninetworks/neutron,blueboxgroup/neutron,openstack/neutron,klmitch/neutron,jumpojoy/neutron,mahak/neutron,Brocade-OpenSource/OpenStack-DNRM-Neutron,kaiweifan/vse-lbaas-plugin-poc,aristanetworks/neutron,jerryz1982/neutron,rossella/neutron,netscaler/neutron,vveerava/Openstack,waltBB/neutron_read,neoareslinux/neutron,Comcast/neutron,chitr/neutron,mandeepdhami/neutron,mattt416/neutron,adelina-t/neutron,CiscoSystems/quantum,SmartInfrastructures/neutron,SmartInfrastructures/neutron,huntxu/neutron,SamYaple/neutron,vbannai/neutron,mahak/neutron,projectcalico/calico-neutron,dhanunjaya/neutron,zhhf/charging,barnsnake351/neutron,sajuptpm/neutron-ipam,liqin75/vse-vpnaas-plugin,Juniper/contrail-dev-neutron,ntt-sic/neutron,eayunstack/neutron,CiscoSystems/neutron,skyddv/neutron,tpaszkowski/quantum,adelina-t/neutron,yanheven/neutron,magic0704/neutron,gkotton/neutron,aristanetworks/arista-ovs-quantum,klmitch/neutron,barnsnake351/neutron,redhat-openstack/neutron,cernops/neutron,sajuptpm/neutron-ipam,citrix-openstack-build/neutron,gopal1cloud/neutron,netscaler/neutron,Metaswitch/calico-neutron,aristanetworks/neutron,yamt/neutron,vijayendrabvs/ssl-neutron,mandeepdhami/neutron,tpaszkowski/quantum,yamahata/neutron,vijayendrabvs/ssl-neutron,glove747/liberty-neutron,rdo-management/neutron,ykaneko/quantum,Stavitsky/neutron,rossella/neutron,Juniper/contrail-dev-neutron,rickerc/neutron_audit,skyddv/neutron,Juniper/neutron,vijayendrabvs/hap,yanheven/neutron,infobloxopen/neutron,rossella/neutron,wolverineav/neutron,alexandrucoman/vbox-neutron-agent,eonpatapon/neutron,sasukeh/neutron,yamahata/neutron,cloudbase/neutron-virtualbox,mmnelemane/neutron,oeeagle/quantum,gopal1cloud/neutron,leeseulstack/openstack,leeseuljeong/leeseulstack_neutron,liqin75/vse-vpnaas-plugin,rdo-management/neutron,CiscoSystems/quantum,vivekanand1101/neutron,ykaneko/quantum,projectcalico/calico-neutron,leeseuljeong/leeseulstack_neutron,CiscoSystems/neutron,cloudbase/neutron-virtualbox,CiscoSystems/neutron,rickerc/neutron_audit,jacknjzhou/neutron,javaos74/neutron,kaiweifan/vse-lbaas-plugin-poc,sasukeh/neutron,suneeth51/neutron,cisco-openstack/neutron,swdream/neutron,beagles/neutron_hacking,noironetworks/neutron,cernops/neutron,NeCTAR-RC/neutron,Brocade-OpenSource/OpenStack-DNRM-Neutron,CiscoSystems/vespa,ykaneko/neutron,Juniper/neutron,ykaneko/quantum,armando-migliaccio/neutron,infobloxopen/neutron,eayunstack/neutron,CiscoSystems/vespa,ykaneko/neutron,jumpojoy/neutron,suneeth51/neutron,eonpatapon/neutron,aristanetworks/arista-ovs-quantum,gkotton/neutron,yuewko/neutron,kaiweifan/neutron,virtualopensystems/neutron,miyakz1192/neutron,antonioUnina/neutron,watonyweng/neutron,antonioUnina/neutron,vijayendrabvs/hap,huntxu/neutron,yamt/neutron,cisco-openstack/neutron,blueboxgroup/neutron,kaiweifan/vse-lbaas-plugin-poc,citrix-openstack-build/neutron,silenci/neutron,dims/neutron,armando-migliaccio/neutron,ykaneko/neutron,jerryz1982/neutron,bigswitch/neutron,miyakz1192/neutron,igor-toga/local-snat,tpaszkowski/quantum,mmnelemane/neutron,JianyuWang/neutron,bigswitch/neutron,javaos74/neutron,zhhf/charging,alexandrucoman/vbox-neutron-agent,watonyweng/neutron,yamahata/tacker