1. 程式人生 > >《ODL-Openstack學習系列-01》-odl-neutron北向抓包分析

《ODL-Openstack學習系列-01》-odl-neutron北向抓包分析

前言

odl-neutron是與openstack對接的北向模組,通過抓包分析openstack下發至odl-neutron的北向資料,可以大致瞭解到neutron的北向模型,以及各種請求的基本資料,便於我們進一步學習odl-netvirt程式碼,同時對於neutron的業務建立邏輯有一個更清楚的理解,特別是網路、子網、虛擬機器、路由器這些建立過程,openstack neutron到底做了什麼?基於這個疑問,將總結如下。

1 抓包過濾條件

  • 過濾ip和http http.request.method&& ip.src10.0.0.12 && ip.dst10.0.0.12

  • 過濾非get rest介面 http&&http.request.method!=GET && ip.src10.0.0.12 && ip.dst10.0.0.12

  • 過濾uri—最優推薦 http.request.uri matches “/controller/nb/v2/neutron/.*” http.request.uri contains “/controller/nb/v2/neutron”

    幫助資訊:

    a-點選右側過濾按鍵 b-搜尋search找到相關過濾規則名 c-在Relation找到匹配條件表示式, 這裡通常包含“==”、“!=”、“>=”、“<=”、“contains”、“matches”等表示式條件; d-在vlaue欄目中填入具體匹配條件,這裡支援正則表示式選項; e-點選ok則可以在相應位置生成相關資訊;

2 抓包過程總體分析

在這裡插入圖片描述 包含流程:

a.建立網路--network POST

b.建立子網--subnet POST

c.dhcp埠新增--ports POST\\ports PUT

d.vm建立--ports POST\\port PUT\\port PUT

c.建立路由--router POST

d.建立路由介面--ports POST\\port PUT

3 網路建立

network抓包描述:

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/networks]
    [HTTP request 1/2]
    [Response in frame: 28214]
    [Next request in frame: 28722]
    File Data: 801 bytes
JavaScript Object Notation: application/json
/*
    Object
        Member Key: network
            Object
                Member Key: provider:physical_network
                    Null value
                    Key: provider:physical_network
                Member Key: ipv6_address_scope
                    Null value
                    Key: ipv6_address_scope
                Member Key: revision_number
                    Number value: 2
                    Key: revision_number
                Member Key: port_security_enabled
                    True value
                    Key: port_security_enabled
                Member Key: provider:network_type
                    String value: vxlan
                    Key: provider:network_type
                Member Key: id
                    String value: 25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: id
                Member Key: router:external
                    False value
                    Key: router:external
                Member Key: availability_zone_hints
                    Array
                    Key: availability_zone_hints
                Member Key: availability_zones
                    Array
                    Key: availability_zones
                Member Key: ipv4_address_scope
                    Null value
                    Key: ipv4_address_scope
                Member Key: shared
                    False value
                    Key: shared
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: updated_at
                    String value: 2018-09-04T03:06:23Z
                    Key: updated_at
                Member Key: is_default
                    False value
                    Key: is_default
                Member Key: provider:segmentation_id
                    Number value: 59
                    Key: provider:segmentation_id
                Member Key: name
                    String value: network2
                    Key: name
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: created_at
                    String value: 2018-09-04T03:06:23Z
                    Key: created_at
                Member Key: mtu
                    Number value: 1450
                    Key: mtu
                Member Key: vlan_transparent
                    Null value
                    Key: vlan_transparent
            Key: network

*/

4 子網建立+使能DHCP

4.1 subnet add

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/subnets]
    [HTTP request 2/2]
    [Prev request in frame: 28205]
    [Response in frame: 29017]
    File Data: 807 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: subnet
            Object
                Member Key: updated_at
                    String value: 2018-09-04T03:06:24Z
                    Key: updated_at
                Member Key: ipv6_ra_mode
                    Null value
                    Key: ipv6_ra_mode
                Member Key: allocation_pools
                    Array
                        Object
                            Member Key: start
                                String value: 192.168.222.10
                                Key: start
                            Member Key: end
                                String value: 192.168.222.15
                                Key: end
                    Key: allocation_pools
                Member Key: host_routes
                    Array
                    Key: host_routes
                Member Key: revision_number
                    Number value: 0
                    Key: revision_number
                Member Key: ipv6_address_mode
                    Null value
                    Key: ipv6_address_mode
                Member Key: id
                    String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                    Key: id
                Member Key: dns_nameservers
                    Array
                    Key: dns_nameservers
                Member Key: gateway_ip
                    String value: 192.168.222.1
                    Key: gateway_ip
                Member Key: shared
                    False value
                    Key: shared
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: cidr
                    String value: 192.168.222.0/24
                    Key: cidr
                Member Key: service_types
                    Array
                    Key: service_types
                Member Key: name
                    String value: sub2
                    Key: name
                Member Key: enable_dhcp
                    True value
                    Key: enable_dhcp
                Member Key: network_id
                    String value: 25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: network_id
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: created_at
                    String value: 2018-09-04T03:06:24Z
                    Key: created_at
                Member Key: ip_version
                    Number value: 4
                    Key: ip_version
            Key: subnet

4.2 dhcp port add

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports]
    [HTTP request 1/2]
    [Response in frame: 31441]
    [Next request in frame: 31636]
    File Data: 868 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: port_security_enabled
                    False value
                    Key: port_security_enabled
                Member Key: binding:host_id
                    String value: host-1
                    Key: binding:host_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: network_id
                    String value: 25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: network_id
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: device_owner
                    String value: network:dhcp
                    Key: device_owner
                Member Key: mac_address
                    String value: fa:16:3e:66:d4:bd
                    Key: mac_address
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.10
                                Key: ip_address
                    Key: fixed_ips
                Member Key: id
                    String value: 4ce3dff2-f710-4108-af92-48207a5ab42c
                    Key: id
                Member Key: security_groups
                    Array
                    Key: security_groups
                Member Key: device_id
                    String value: dhcpf72400a4-a35a-5d17-b5ce-25036ebf0bbc-25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: device_id
            Key: port

4.3 dhcp port update

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports/4ce3dff2-f710-4108-af92-48207a5ab42c]
    [HTTP request 2/2]
    [Prev request in frame: 31091]
    [Response in frame: 31681]
    File Data: 858 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: extra_dhcp_opts
                    Array
                    Key: extra_dhcp_opts
                Member Key: updated_at
                    String value: 2018-09-04T03:06:25Z
                    Key: updated_at
                Member Key: device_owner
                    String value: network:dhcp
                    Key: device_owner
                Member Key: revision_number
                    Number value: 3
                    Key: revision_number
                Member Key: port_security_enabled
                    False value
                    Key: port_security_enabled
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.10
                                Key: ip_address
                    Key: fixed_ips
                Member Key: security_groups
                    Array
                    Key: security_groups
                Member Key: binding:vif_details
                    Object
                        Member Key: port_filter
                            True value
                            Key: port_filter
                    Key: binding:vif_details
                Member Key: binding:vif_type
                    String value: ovs
                    Key: binding:vif_type
                Member Key: mac_address
                    String value: fa:16:3e:66:d4:bd
                    Key: mac_address
                Member Key: binding:host_id
                    String value: host-1
                    Key: binding:host_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: device_id
                    String value: dhcpf72400a4-a35a-5d17-b5ce-25036ebf0bbc-25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: device_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: created_at
                    String value: 2018-09-04T03:06:24Z
                    Key: created_at
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
            Key: port

5 vm增加

第一次更新操作填入device_owner: compute:host-2

更新還加入vir_details\vif__type\mac_address\tags等資訊

第二次更新主要為vif_type變化由unbound---->ovs

5.1 vm埠增加

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports]
    [HTTP request 9/15]
    [Prev request in frame: 12261]
    [Response in frame: 50560]
    [Next request in frame: 51786]
    File Data: 882 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: port_security_enabled
                    True value
                    Key: port_security_enabled
                Member Key: binding:host_id
                    String value: 
                    Key: binding:host_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: network_id
                    String value: 25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: network_id
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: device_owner
                    String value: 
                    Key: device_owner
                Member Key: mac_address
                    String value: fa:16:3e:2b:ff:a6
                    Key: mac_address
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.11
                                Key: ip_address
                    Key: fixed_ips
                Member Key: id
                    String value: 86f838a8-e224-404a-9858-8b2f1c2a4667
                    Key: id
                Member Key: security_groups
                    Array
                        Object
                            Member Key: id
                                String value: ffa53b72-48c3-4f0b-93da-ff9ee2f8e795
                                Key: id
                    Key: security_groups
                Member Key: device_id
                    String value: 125c628e-5885-431e-86f0-c3fa713e0aea
                    Key: device_id
            Key: port

5.2 vm埠更新1

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports/86f838a8-e224-404a-9858-8b2f1c2a4667]
    [HTTP request 10/15]
    [Prev request in frame: 50549]
    [Response in frame: 51825]
    [Next request in frame: 52764]
    File Data: 865 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: extra_dhcp_opts
                    Array
                    Key: extra_dhcp_opts
                Member Key: updated_at
                    String value: 2018-09-04T03:07:06Z
                    Key: updated_at
                Member Key: device_owner
                    String value: compute:host-2
                    Key: device_owner
                Member Key: revision_number
                    Number value: 4
                    Key: revision_number
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: port_security_enabled
                    True value
                    Key: port_security_enabled
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.11
                                Key: ip_address
                    Key: fixed_ips
                Member Key: security_groups
                    Array
                        Object
                            Member Key: id
                                String value: ffa53b72-48c3-4f0b-93da-ff9ee2f8e795
                                Key: id
                    Key: security_groups
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: mac_address
                    String value: fa:16:3e:2b:ff:a6
                    Key: mac_address
                Member Key: binding:host_id
                    String value: host-2
                    Key: binding:host_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: device_id
                    String value: 125c628e-5885-431e-86f0-c3fa713e0aea
                    Key: device_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: created_at
                    String value: 2018-09-04T03:07:05Z
                    Key: created_at
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
            Key: port

5.3 vm埠更新2

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports/86f838a8-e224-404a-9858-8b2f1c2a4667]
    [HTTP request 11/15]
    [Prev request in frame: 51786]
    [Response in frame: 52781]
    [Next request in frame: 61762]
    File Data: 892 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: extra_dhcp_opts
                    Array
                    Key: extra_dhcp_opts
                Member Key: updated_at
                    String value: 2018-09-04T03:07:06Z
                    Key: updated_at
                Member Key: device_owner
                    String value: compute:host-2
                    Key: device_owner
                Member Key: revision_number
                    Number value: 4
                    Key: revision_number
                Member Key: port_security_enabled
                    True value
                    Key: port_security_enabled
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.11
                                Key: ip_address
                    Key: fixed_ips
                Member Key: security_groups
                    Array
                        Object
                            Member Key: id
                                String value: ffa53b72-48c3-4f0b-93da-ff9ee2f8e795
                                Key: id
                    Key: security_groups
                Member Key: binding:vif_details
                    Object
                        Member Key: port_filter
                            True value
                            Key: port_filter
                    Key: binding:vif_details
                Member Key: binding:vif_type
                    String value: ovs
                    Key: binding:vif_type
                Member Key: mac_address
                    String value: fa:16:3e:2b:ff:a6
                    Key: mac_address
                Member Key: binding:host_id
                    String value: host-2
                    Key: binding:host_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: device_id
                    String value: 125c628e-5885-431e-86f0-c3fa713e0aea
                    Key: device_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: created_at
                    String value: 2018-09-04T03:07:05Z
                    Key: created_at
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
            Key: port

6 路由增加

埠更新加入vir_details\vif__type\mac_address\tags等資訊

介面加入時候填入:router_interface

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/routers]
    [HTTP request 1/1]
    [Response in frame: 55128]
    File Data: 592 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: router
            Object
                Member Key: status
                    String value: ACTIVE
                    Key: status
                Member Key: external_gateway_info
                    Null value
                    Key: external_gateway_info
                Member Key: availability_zone_hints
                    Array
                    Key: availability_zone_hints
                Member Key: ha
                    False value
                    Key: ha
                Member Key: ha_vr_id
                    Number value: 0
                    Key: ha_vr_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: gw_port_id
                    Null value
                    Key: gw_port_id
                Member Key: tags
                    Array
                    Key: tags
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: created_at
                    String value: 2018-09-04T03:07:13Z
                    Key: created_at
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: distributed
                    False value
                    Key: distributed
                Member Key: updated_at
                    String value: 2018-09-04T03:07:13Z
                    Key: updated_at
                Member Key: revision_number
                    Number value: 0
                    Key: revision_number
                Member Key: routes
                    Array
                    Key: routes
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: id
                    String value: e785315f-965d-478e-9ca5-c7df70f73fee
                    Key: id
                Member Key: name
                    String value: router1
                    Key: name
            Key: router

7 路由介面關聯

埠更新加入vir_details\vif__type\mac_address\tags等資訊

介面加入時候填入:router_interface

7.1 介面1增加

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports]
    [HTTP request 12/15]
    [Prev request in frame: 52764]
    [Response in frame: 61792]
    [Next request in frame: 62505]
    File Data: 832 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: port_security_enabled
                    False value
                    Key: port_security_enabled
                Member Key: binding:host_id
                    String value: 
                    Key: binding:host_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: network_id
                    String value: 25601711-79ca-46aa-9a95-fbb02676cb4d
                    Key: network_id
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: device_owner
                    String value: network:router_interface
                    Key: device_owner
                Member Key: mac_address
                    String value: fa:16:3e:d3:1e:8c
                    Key: mac_address
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.1
                                Key: ip_address
                    Key: fixed_ips
                Member Key: id
                    String value: b75ee163-5c54-4d1c-87b6-a7d7fa2d2214
                    Key: id
                Member Key: security_groups
                    Array
                    Key: security_groups
                Member Key: device_id
                    String value: e785315f-965d-478e-9ca5-c7df70f73fee
                    Key: device_id
            Key: port

7.2 介面1更新

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports/b75ee163-5c54-4d1c-87b6-a7d7fa2d2214]
    [HTTP request 13/15]
    [Prev request in frame: 61762]
    [Response in frame: 62595]
    [Next request in frame: 65846]
    File Data: 795 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: extra_dhcp_opts
                    Array
                    Key: extra_dhcp_opts
                Member Key: updated_at
                    String value: 2018-09-04T03:07:33Z
                    Key: updated_at
                Member Key: device_owner
                    String value: network:router_interface
                    Key: device_owner
                Member Key: revision_number
                    Number value: 4
                    Key: revision_number
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: port_security_enabled
                    False value
                    Key: port_security_enabled
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 091a0a7c-60d8-4b55-be54-5d28e7cdfedb
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.222.1
                                Key: ip_address
                    Key: fixed_ips
                Member Key: security_groups
                    Array
                    Key: security_groups
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: mac_address
                    String value: fa:16:3e:d3:1e:8c
                    Key: mac_address
                Member Key: binding:host_id
                    String value: 
                    Key: binding:host_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: device_id
                    String value: e785315f-965d-478e-9ca5-c7df70f73fee
                    Key: device_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: created_at
                    String value: 2018-09-04T03:07:32Z
                    Key: created_at
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
            Key: port

介面2增加

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports]
    [HTTP request 14/15]
    [Prev request in frame: 62505]
    [Response in frame: 65948]
    [Next request in frame: 66623]
    File Data: 831 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: port_security_enabled
                    False value
                    Key: port_security_enabled
                Member Key: binding:host_id
                    String value: 
                    Key: binding:host_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: network_id
                    String value: 96c95d81-cbef-442e-a1d3-bfd5f6266231
                    Key: network_id
                Member Key: tenant_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: tenant_id
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: device_owner
                    String value: network:router_interface
                    Key: device_owner
                Member Key: mac_address
                    String value: fa:16:3e:3f:9b:f0
                    Key: mac_address
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: project_id
                    String value: b24f2b656ff24fd3aaab3a24a09dc3d6
                    Key: project_id
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 96d6c365-6582-4dbf-a26b-74a0f3bf106f
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.11.1
                                Key: ip_address
                    Key: fixed_ips
                Member Key: id
                    String value: 40eb7085-2d3b-4c4e-8b00-cb658b6ce62e
                    Key: id
                Member Key: security_groups
                    Array
                    Key: security_groups
                Member Key: device_id
                    String value: e785315f-965d-478e-9ca5-c7df70f73fee
                    Key: device_id
            Key: port

介面2更新

    [Full request URI: http://10.0.0.12:8181/controller/nb/v2/neutron/ports/40eb7085-2d3b-4c4e-8b00-cb658b6ce62e]
    [HTTP request 15/15]
    [Prev request in frame: 65846]
    [Response in frame: 66637]
    File Data: 794 bytes
/*
JavaScript Object Notation: application/json
    Object
        Member Key: port
            Object
                Member Key: allowed_address_pairs
                    Array
                    Key: allowed_address_pairs
                Member Key: extra_dhcp_opts
                    Array
                    Key: extra_dhcp_opts
                Member Key: updated_at
                    String value: 2018-09-04T03:07:43Z
                    Key: updated_at
                Member Key: device_owner
                    String value: network:router_interface
                    Key: device_owner
                Member Key: revision_number
                    Number value: 4
                    Key: revision_number
                Member Key: binding:profile
                    Object
                    Key: binding:profile
                Member Key: port_security_enabled
                    False value
                    Key: port_security_enabled
                Member Key: fixed_ips
                    Array
                        Object
                            Member Key: subnet_id
                                String value: 96d6c365-6582-4dbf-a26b-74a0f3bf106f
                                Key: subnet_id
                            Member Key: ip_address
                                String value: 192.168.11.1
                                Key: ip_address
                    Key: fixed_ips
                Member Key: security_groups
                    Array
                    Key: security_groups
                Member Key: binding:vif_details
                    Object
                    Key: binding:vif_details
                Member Key: binding:vif_type
                    String value: unbound
                    Key: binding:vif_type
                Member Key: mac_address
                    String value: fa:16:3e:3f:9b:f0
                    Key: mac_address
                Member Key: binding:host_id
                    String value: 
                    Key: binding:host_id
                Member Key: description
                    String value: 
                    Key: description
                Member Key: tags
                    Array
                    Key: tags
                Member Key: device_id
                    String value: e785315f-965d-478e-9ca5-c7df70f73fee
                    Key: device_id
                Member Key: name
                    String value: 
                    Key: name
                Member Key: admin_state_up
                    True value
                    Key: admin_state_up
                Member Key: created_at
                    String value: 2018-09-04T03:07:42Z
                    Key: created_at
                Member Key: binding:vnic_type
                    String value: normal
                    Key: binding:vnic_type
            Key: port

8 總結

8.1 device-owner總結

network:dhcp

router_interface

compute:host-2

8.2 細節分析

  • 建立網路子網,並不會產生埠,使能dhcp會增加相關dhcp介面,不管在openstack原生環境,還是odl環境都是如此;
  • 建立虛機會在ovs下發相關埠,從北向分析可知,會有兩次更新埠更新事件,相關埠device-owner歸屬在更新事件中確定。