neutron-l3-agent之关键信息

Juno版本l3-agent之关键信息
一、无外部网关
1. router的 第一个关键信息
 
> /usr/lib/python2.7/dist-packages/neutron/agent/l3_agent.py(1767)_process_routers()
-> pool = eventlet.GreenPool()
(Pdb) pp routers
[{u'_interfaces': [{u'admin_state_up': True,
                    u'allowed_address_pairs': [],
                    u'binding:host_id': u'',
                    u'binding:profile': {},
                    u'binding:vif_details': {},
                    u'binding:vif_type': u'distributed',
                    u'binding:vnic_type': u'normal',
                    u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
                    u'device_owner': u'network:router_interface_distributed',
                    u'extra_dhcp_opts': [],
                    u'extra_subnets': [],
                    u'fixed_ips': [{u'ip_address': u'192.168.1.1',
                                    u'subnet_id': u'7352ee48-dbc8-4060-a770-ac9c175f7557'}],
                    u'id': u'1d72424c-1081-4185-ab10-d4cb89fb5aa0',
                    u'mac_address': u'fa:16:3e:71:31:7c',
                    u'name': u'',
                    u'network_id': u'3607c99f-dc7a-4082-a15e-cb9f01d96f54',
                    u'security_groups': [],
                    u'status': u'ACTIVE',
                    u'subnet': {u'cidr': u'192.168.1.0/24',
                                u'gateway_ip': u'192.168.1.1',
                                u'id': u'7352ee48-dbc8-4060-a770-ac9c175f7557',
                                u'ipv6_ra_mode': None},
                    u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}],
  u'admin_state_up': True,
  u'distributed': True,
  u'external_gateway_info': None,
  u'gw_port_id': None,
  u'ha': False,
  u'ha_vr_id': 0,
  u'id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
  u'name': u'router1',
  u'routes': [],
  u'status': u'ACTIVE',
  u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}]



2. router的第二个关键信息
> /usr/lib/python2.7/dist-packages/neutron/agent/l3_agent.py(864)process_router()
-> if 'distributed' not in ri.router:
(Pdb) p dir(ri)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_router', '_snat_action', '_snat_enabled', '_verify_ha', 'disable_keepalived', 'dist_fip_count', 'ex_gw_port', 'floating_ips', 'floating_ips_dict', 'ha_port', 'ha_priority', 'ha_state', 'ha_vr_id', 'internal_ports', 'iptables_manager', 'is_ha', 'keepalived_manager', 'ns_name', 'perform_snat_action', 'root_helper', 'router', 'router_id', 'routes', 'rtr_fip_subnet', 'snat_iptables_manager', 'snat_ports', 'spawn_keepalived', 'use_namespaces']

(Pdb) pp ri.router
{u'_interfaces': [{u'admin_state_up': True,
                   u'allowed_address_pairs': [],
                   u'binding:host_id': u'',
                   u'binding:profile': {},
                   u'binding:vif_details': {},
                   u'binding:vif_type': u'distributed',
                   u'binding:vnic_type': u'normal',
                   u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
                   u'device_owner': u'network:router_interface_distributed',
                   u'extra_dhcp_opts': [],
                   u'extra_subnets': [],
                   u'fixed_ips': [{u'ip_address': u'192.168.1.1',
                                   u'subnet_id': u'7352ee48-dbc8-4060-a770-ac9c175f7557'}],
                   u'id': u'1d72424c-1081-4185-ab10-d4cb89fb5aa0',
                   u'mac_address': u'fa:16:3e:71:31:7c',
                   u'name': u'',
                   u'network_id': u'3607c99f-dc7a-4082-a15e-cb9f01d96f54',
                   u'security_groups': [],
                   u'status': u'ACTIVE',
                   u'subnet': {u'cidr': u'192.168.1.0/24',
                               u'gateway_ip': u'192.168.1.1',
                               u'id': u'7352ee48-dbc8-4060-a770-ac9c175f7557',
                               u'ipv6_ra_mode': None},
                   u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}],
 u'admin_state_up': True,
 u'distributed': True,
 u'external_gateway_info': None,
 u'gw_port_id': None,
 u'ha': False,
 u'ha_vr_id': 0,
 u'id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
 u'name': u'router1',
 u'routes': [],
 u'status': u'ACTIVE',
 u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}

(Pdb) pp ri.router_id
u'9c2304b2-3c3d-455e-8675-bcccb2834e14'
(Pdb) pp ri.ex_gw_port
None
(Pdb) pp ri.routes    
[]

二、存在外部网关
1. router的 第一个关键信息
> /usr/lib/python2.7/dist-packages/neutron/agent/l3_agent.py(1767)_process_routers()
-> pool = eventlet.GreenPool()
(Pdb) pp routers
[{u'_interfaces': [{u'admin_state_up': True,
                    u'allowed_address_pairs': [],
                    u'binding:host_id': u'',
                    u'binding:profile': {},
                    u'binding:vif_details': {},
                    u'binding:vif_type': u'distributed',
                    u'binding:vnic_type': u'normal',
                    u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
                    u'device_owner': u'network:router_interface_distributed',
                    u'extra_dhcp_opts': [],
                    u'extra_subnets': [],
                    u'fixed_ips': [{u'ip_address': u'192.168.1.1',
                                    u'subnet_id': u'7352ee48-dbc8-4060-a770-ac9c175f7557'}],
                    u'id': u'1d72424c-1081-4185-ab10-d4cb89fb5aa0',
                    u'mac_address': u'fa:16:3e:71:31:7c',
                    u'name': u'',
                    u'network_id': u'3607c99f-dc7a-4082-a15e-cb9f01d96f54',
                    u'security_groups': [],
                    u'status': u'DOWN',
                    u'subnet': {u'cidr': u'192.168.1.0/24',
                                u'gateway_ip': u'192.168.1.1',
                                u'id': u'7352ee48-dbc8-4060-a770-ac9c175f7557',
                                u'ipv6_ra_mode': None},
                    u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}],
  u'_snat_router_interfaces': [{u'admin_state_up': True,
                                u'allowed_address_pairs': [],
                                u'binding:host_id': u'',
                                u'binding:profile': {},
                                u'binding:vif_details': {},
                                u'binding:vif_type': u'unbound',
                                u'binding:vnic_type': u'normal',
                                u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
                                u'device_owner': u'network:router_centralized_snat',
                                u'extra_dhcp_opts': [],
                                u'extra_subnets': [],
                                u'fixed_ips': [{u'ip_address': u'192.168.1.5',
                                                u'subnet_id': u'7352ee48-dbc8-4060-a770-ac9c175f7557'}],
                                u'id': u'6aea2463-07c8-4283-b3fc-b1859ade363b',
                                u'mac_address': u'fa:16:3e:2d:f8:ea',
                                u'name': u'',
                                u'network_id': u'3607c99f-dc7a-4082-a15e-cb9f01d96f54',
                                u'security_groups': [],
                                u'status': u'DOWN',
                                u'subnet': {u'cidr': u'192.168.1.0/24',
                                            u'gateway_ip': u'192.168.1.1',
                                            u'id': u'7352ee48-dbc8-4060-a770-ac9c175f7557',
                                            u'ipv6_ra_mode': None},
                                u'tenant_id': u''}],
  u'admin_state_up': True,
  u'distributed': True,
  u'enable_snat': True,
  u'external_gateway_info': {u'enable_snat': True,
                             u'external_fixed_ips': [{u'ip_address': u'10.10.0.3',
                                                      u'subnet_id': u'3173bd8a-e8b1-40a0-86e0-dd923ac515ec'}],
                             u'network_id': u'af22d26e-c971-4e66-9f4b-3168441e6b1e'},
  u'gw_port': {u'admin_state_up': True,
               u'allowed_address_pairs': [],
               u'binding:host_id': u'',
               u'binding:profile': {},
               u'binding:vif_details': {},
               u'binding:vif_type': u'unbound',
               u'binding:vnic_type': u'normal',
               u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
               u'device_owner': u'network:router_gateway',
               u'extra_dhcp_opts': [],
               u'extra_subnets': [],
               u'fixed_ips': [{u'ip_address': u'10.10.0.3',
                               u'subnet_id': u'3173bd8a-e8b1-40a0-86e0-dd923ac515ec'}],
               u'id': u'4f703b88-3e09-4d41-8575-e3c6de1c58c1',
               u'mac_address': u'fa:16:3e:7d:0f:44',
               u'name': u'',
               u'network_id': u'af22d26e-c971-4e66-9f4b-3168441e6b1e',
               u'security_groups': [],
               u'status': u'DOWN',
               u'subnet': {u'cidr': u'10.10.0.0/24',
                           u'gateway_ip': u'10.10.0.1',
                           u'id': u'3173bd8a-e8b1-40a0-86e0-dd923ac515ec',
                           u'ipv6_ra_mode': None},
               u'tenant_id': u''},
  u'gw_port_host': u'openstack',
  u'gw_port_id': u'4f703b88-3e09-4d41-8575-e3c6de1c58c1',
  u'ha': False,
  u'ha_vr_id': 0,
  u'id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
  u'name': u'router1',
  u'routes': [],
  u'status': u'ACTIVE',
  u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}]

2. router的第二个关键信息
> /usr/lib/python2.7/dist-packages/neutron/agent/l3_agent.py(864)process_router()
-> if 'distributed' not in ri.router:
(Pdb) p dir(ri)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_router', '_snat_action', '_snat_enabled', '_verify_ha', 'disable_keepalived', 'dist_fip_count', 'enable_snat', 'ex_gw_port', 'floating_ips', 'floating_ips_dict', 'ha_port', 'ha_priority', 'ha_state', 'ha_vr_id', 'internal_ports', 'iptables_manager', 'is_ha', 'keepalived_manager', 'ns_name', 'perform_snat_action', 'root_helper', 'router', 'router_id', 'routes', 'rtr_fip_subnet', 'snat_iptables_manager', 'snat_ports', 'spawn_keepalived', 'use_namespaces']

(Pdb) pp ri.router
{u'_interfaces': [{u'admin_state_up': True,
                   u'allowed_address_pairs': [],
                   u'binding:host_id': u'',
                   u'binding:profile': {},
                   u'binding:vif_details': {},
                   u'binding:vif_type': u'distributed',
                   u'binding:vnic_type': u'normal',
                   u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
                   u'device_owner': u'network:router_interface_distributed',
                   u'extra_dhcp_opts': [],
                   u'extra_subnets': [],
                   u'fixed_ips': [{u'ip_address': u'192.168.1.1',
                                   u'subnet_id': u'7352ee48-dbc8-4060-a770-ac9c175f7557'}],
                   u'id': u'1d72424c-1081-4185-ab10-d4cb89fb5aa0',
                   u'mac_address': u'fa:16:3e:71:31:7c',
                   u'name': u'',
                   u'network_id': u'3607c99f-dc7a-4082-a15e-cb9f01d96f54',
                   u'security_groups': [],
                   u'status': u'DOWN',
                   u'subnet': {u'cidr': u'192.168.1.0/24',
                               u'gateway_ip': u'192.168.1.1',
                               u'id': u'7352ee48-dbc8-4060-a770-ac9c175f7557',
                               u'ipv6_ra_mode': None},
                   u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}],
 u'_snat_router_interfaces': [{u'admin_state_up': True,
                               u'allowed_address_pairs': [],
                               u'binding:host_id': u'',
                               u'binding:profile': {},
                               u'binding:vif_details': {},
                               u'binding:vif_type': u'unbound',
                               u'binding:vnic_type': u'normal',
                               u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
                               u'device_owner': u'network:router_centralized_snat',
                               u'extra_dhcp_opts': [],
                               u'extra_subnets': [],
                               u'fixed_ips': [{u'ip_address': u'192.168.1.5',
                                               u'subnet_id': u'7352ee48-dbc8-4060-a770-ac9c175f7557'}],
                               u'id': u'6aea2463-07c8-4283-b3fc-b1859ade363b',
                               u'mac_address': u'fa:16:3e:2d:f8:ea',
                               u'name': u'',
                               u'network_id': u'3607c99f-dc7a-4082-a15e-cb9f01d96f54',
                               u'security_groups': [],
                               u'status': u'DOWN',
                               u'subnet': {u'cidr': u'192.168.1.0/24',
                                           u'gateway_ip': u'192.168.1.1',
                                           u'id': u'7352ee48-dbc8-4060-a770-ac9c175f7557',
                                           u'ipv6_ra_mode': None},
                               u'tenant_id': u''}],
 u'admin_state_up': True,
 u'distributed': True,
 u'enable_snat': True,
 u'external_gateway_info': {u'enable_snat': True,
                            u'external_fixed_ips': [{u'ip_address': u'10.10.0.3',
                                                     u'subnet_id': u'3173bd8a-e8b1-40a0-86e0-dd923ac515ec'}],
                            u'network_id': u'af22d26e-c971-4e66-9f4b-3168441e6b1e'},
 u'gw_port': {u'admin_state_up': True,
              u'allowed_address_pairs': [],
              u'binding:host_id': u'',
              u'binding:profile': {},
              u'binding:vif_details': {},
              u'binding:vif_type': u'unbound',
              u'binding:vnic_type': u'normal',
              u'device_id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
              u'device_owner': u'network:router_gateway',
              u'extra_dhcp_opts': [],
              u'extra_subnets': [],
              u'fixed_ips': [{u'ip_address': u'10.10.0.3',
                              u'subnet_id': u'3173bd8a-e8b1-40a0-86e0-dd923ac515ec'}],
              u'id': u'4f703b88-3e09-4d41-8575-e3c6de1c58c1',
              u'mac_address': u'fa:16:3e:7d:0f:44',
              u'name': u'',
              u'network_id': u'af22d26e-c971-4e66-9f4b-3168441e6b1e',
              u'security_groups': [],
              u'status': u'DOWN',
              u'subnet': {u'cidr': u'10.10.0.0/24',
                          u'gateway_ip': u'10.10.0.1',
                          u'id': u'3173bd8a-e8b1-40a0-86e0-dd923ac515ec',
                          u'ipv6_ra_mode': None},
              u'tenant_id': u''},
 u'gw_port_host': u'openstack',
 u'gw_port_id': u'4f703b88-3e09-4d41-8575-e3c6de1c58c1',
 u'ha': False,
 u'ha_vr_id': 0,
 u'id': u'9c2304b2-3c3d-455e-8675-bcccb2834e14',
 u'name': u'router1',
 u'routes': [],
 u'status': u'ACTIVE',
 u'tenant_id': u'9cef00cbfb504af1a62d20579a160a5b'}

(Pdb) pp ri.snat_ports
[]
(Pdb) pp ri.router_id 
u'9c2304b2-3c3d-455e-8675-bcccb2834e14'
(Pdb) pp ri.routes
[]
(Pdb) pp ri.ns_name
u'qrouter-9c2304b2-3c3d-455e-8675-bcccb2834e14'


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值