OVN Northbound DB简介及其相关命令示例


Northbound DB 是 OVN 和 CMS 之间的接口,Northbound DB 里面的几乎所有的内容都是由 CMS 产生的,ovn-northd 监听这个数据库的内容变化,然后翻译,保存到 Southbound DB 里面。

Northbound DB 里面主要有如下几张表:

  • Logical_Switch:每一行代表一个逻辑交换机,逻辑交换机有两种,一种是 overlay logical switches,对应于 neutron network,每创建一个 neutron network,networking-ovn 会在这张表里增加一行;另一种是 bridged logical switch,连接物理网络和逻辑网络,被 VTEP gateway 使用。Logical_Switch 里面保存了它包含的 logical port(指向 Logical_Port table)和应用在它上面的 ACL(指向 ACL table)。
  • Logical_Port:每一行代表一个逻辑端口,每创建一个 neutron port,networking-ovn 会在这张表里增加一行,每行保存的信息有端口的类型,比如 patch port,localnet port,端口的 IP 和 MAC 地址,端口的状态 UP/Down。
  • ACL:每一行代表一个应用到逻辑交换机上的 ACL 规则,如果逻辑交换机上面的所有端口都没有配置 security group,那么这个逻辑交换机上不应用 ACL。每条 ACL 规则包含匹配的内容,方向,还有动作。
  • Logical_Router:每一行代表一个逻辑路由器,每创建一个 neutron router,networking-ovn 会在这张表里增加一行,每行保存了它包含的逻辑的路由器端口。
  • Logical_Router_Port:每一行代表一个逻辑路由器端口,每创建一个 router interface,networking-ovn 会在这张表里加一行,它主要保存了路由器端口的 IP 和 MAC。



[root@controller ~]# ovn-nbctl list NB_Global 
_uuid               : ca862cbd-1dbd-40ad-9d58-a5b9b1e48d57
connections         : [0de31edd-7c5c-449e-8c38-aee2e334b27c]
external_ids        : {}
hv_cfg              : 0
nb_cfg              : 0
sb_cfg              : 0
ssl                 : []
---------------------——————————————————————
[root@controller ~]# ovn-nbctl list Logical_Switch
_uuid               : 97f6a204-0e7f-4cc2-ae96-9249f29a232b
acls                : []
external_ids        : {"neutron:network_name"=public}
load_balancer       : []
name                : "neutron-03268213-b908-4122-9f86-b207882cbc78"
other_config        : {}
ports               : [2cad61a8-5758-4143-bbcb-17fef176f334, 8f98a049-1720-4a4d-b688-51bbdf6cc737, 93cf7aad-b0f0-4f49-a96c-e325e9bf365d, d857c800-181d-4cf8-8dcb-93edc2e96567]
qos_rules           : []

_uuid               : e7347be1-3ebc-4a42-928e-4a6fb0474ec6
acls                : [0220e827-848f-43fe-82f3-1261034cf1d2, 2bcfcd33-c3e2-4c5f-80db-35a88efc55ff, 35ce7158-22bf-444b-b15f-adbc7c4314a8, 3bead700-ce34-4ac1-890b-f7a6143cc4e6, 3d353de4-5c38-459b-ac6b-f12d7ed90a53, 4140e1d8-e8a5-4891-b47d-3a85ec9b0be5, 414bd248-310c-4cec-ac86-e6a6d03816a7, 477e7013-997c-494f-82a0-60ea993c139b, 5002db39-6417-47c3-9945-33b74e8f2057, 62c01c55-69b0-4bef-99e3-650ac8a848bd, 9264e0c0-e689-46f7-8274-cd6c2f3ea149, a2ffad3d-e8b9-4a15-835d-0884b94d352e, ce74fc4d-c7c1-49b6-ac2a-0787234d1970, febbd2f3-1958-4c18-8730-8244dbed4846]
external_ids        : {"neutron:network_name"=private}
load_balancer       : []
name                : "neutron-ae165671-c2f0-41f2-a6ad-617d062b86be"
other_config        : {}
ports               : [8014370c-e8d1-4045-b57f-3f91e34efb5b, 9a748e64-b5ad-405a-a564-767192d60041, a0fa17ef-da38-43f5-8de3-79c8cc009cb9]
qos_rules           : []

-------------------------------------------------------------------------------------------
[root@controller ~]# ovn-nbctl list Logical_Switch_Port
_uuid               : 9a748e64-b5ad-405a-a564-767192d60041
addresses           : ["fa:16:3e:cb:75:9d 11.0.0.1"]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : true
external_ids        : {"neutron:port_name"=""}
name                : "23b099a8-5949-40ce-a1bc-c2675a4eaf4c"
options             : {}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : ""
up                  : true

_uuid               : 8014370c-e8d1-4045-b57f-3f91e34efb5b
addresses           : ["fa:16:3e:7a:c5:16 11.0.0.5"]
dhcpv4_options      : 5e170c47-70a6-4816-a082-87e7ec22ac5a
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : true
external_ids        : {"neutron:port_name"=""}
name                : "e97d6b05-987d-4e62-a590-7accc480cf97"
options             : {}
parent_name         : []
port_security       : ["fa:16:3e:7a:c5:16 11.0.0.5"]
tag                 : []
tag_request         : []
type                : ""
up                  : true

_uuid               : d857c800-181d-4cf8-8dcb-93edc2e96567
addresses           : [unknown]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : []
external_ids        : {}
name                : "provnet-03268213-b908-4122-9f86-b207882cbc78"
options             : {network_name=public}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : localnet
up                  : false

_uuid               : 2cad61a8-5758-4143-bbcb-17fef176f334
addresses           : ["fa:16:3e:e6:68:b0 192.168.200.140"]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : true
external_ids        : {"neutron:port_name"=""}
name                : "0c80bccb-84ee-4aae-a87d-5aacf1d49df5"
options             : {}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : ""
up                  : false

_uuid               : 93cf7aad-b0f0-4f49-a96c-e325e9bf365d
addresses           : ["fa:16:3e:a4:14:5d 192.168.200.135"]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : true
external_ids        : {"neutron:port_name"=""}
name                : "9c2c1945-0d3d-48a5-b2d9-987427d003fe"
options             : {}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : ""
up                  : true

_uuid               : 8f98a049-1720-4a4d-b688-51bbdf6cc737
addresses           : ["fa:16:3e:d9:85:46 192.168.200.136"]
dhcpv4_options      : []
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : true
external_ids        : {"neutron:port_name"=""}
name                : "7b4a2a12-618b-4e56-958e-6cf90ae78623"
options             : {}
parent_name         : []
port_security       : []
tag                 : []
tag_request         : []
type                : ""
up                  : false

_uuid               : a0fa17ef-da38-43f5-8de3-79c8cc009cb9
addresses           : ["fa:16:3e:14:ba:56 11.0.0.3"]
dhcpv4_options      : 5e170c47-70a6-4816-a082-87e7ec22ac5a
dhcpv6_options      : []
dynamic_addresses   : []
enabled             : true
external_ids        : {"neutron:port_name"=""}
name                : "607fa0b2-244c-46d6-b515-5ebe73ebbc4c"
options             : {}
parent_name         : []
port_security       : ["fa:16:3e:14:ba:56 11.0.0.3"]
tag                 : []
tag_request         : []
type                : ""
up                  : true
————————————————————————————————————
[root@controller ~]# ovn-nbctl list ACL
_uuid               : 9264e0c0-e689-46f7-8274-cd6c2f3ea149
action              : allow-related
direction           : to-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "outport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip6 && ip6.src == $as_ip6_8cb690a4_472a_4cd7_8394_edf0e8926df6"
priority            : 1002

_uuid               : 35ce7158-22bf-444b-b15f-adbc7c4314a8
action              : allow-related
direction           : to-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "outport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip4 && ip4.src == 0.0.0.0/0"
priority            : 1002

_uuid               : 3bead700-ce34-4ac1-890b-f7a6143cc4e6
action              : drop
direction           : to-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "outport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip"
priority            : 1001

_uuid               : 4140e1d8-e8a5-4891-b47d-3a85ec9b0be5
action              : allow-related
direction           : from-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "inport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip6"
priority            : 1002

_uuid               : 414bd248-310c-4cec-ac86-e6a6d03816a7
action              : drop
direction           : from-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "inport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip"
priority            : 1001

_uuid               : 5002db39-6417-47c3-9945-33b74e8f2057
action              : allow-related
direction           : from-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "inport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip4"
priority            : 1002

_uuid               : febbd2f3-1958-4c18-8730-8244dbed4846
action              : allow-related
direction           : from-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "inport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip4"
priority            : 1002

_uuid               : 2bcfcd33-c3e2-4c5f-80db-35a88efc55ff
action              : allow-related
direction           : to-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "outport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip4 && ip4.src == $as_ip4_8cb690a4_472a_4cd7_8394_edf0e8926df6"
priority            : 1002

_uuid               : 477e7013-997c-494f-82a0-60ea993c139b
action              : allow-related
direction           : to-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "outport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip4 && ip4.src == 0.0.0.0/0"
priority            : 1002

_uuid               : 3d353de4-5c38-459b-ac6b-f12d7ed90a53
action              : allow-related
direction           : to-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "outport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip6 && ip6.src == $as_ip6_8cb690a4_472a_4cd7_8394_edf0e8926df6"
priority            : 1002

_uuid               : ce74fc4d-c7c1-49b6-ac2a-0787234d1970
action              : allow-related
direction           : from-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "inport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip6"
priority            : 1002

_uuid               : a2ffad3d-e8b9-4a15-835d-0884b94d352e
action              : drop
direction           : to-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "outport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip"
priority            : 1001

_uuid               : 62c01c55-69b0-4bef-99e3-650ac8a848bd
action              : allow-related
direction           : to-lport
external_ids        : {"neutron:lport"="607fa0b2-244c-46d6-b515-5ebe73ebbc4c"}
log                 : false
match               : "outport == \"607fa0b2-244c-46d6-b515-5ebe73ebbc4c\" && ip4 && ip4.src == $as_ip4_8cb690a4_472a_4cd7_8394_edf0e8926df6"
priority            : 1002

_uuid               : 0220e827-848f-43fe-82f3-1261034cf1d2
action              : drop
direction           : from-lport
external_ids        : {"neutron:lport"="e97d6b05-987d-4e62-a590-7accc480cf97"}
log                 : false
match               : "inport == \"e97d6b05-987d-4e62-a590-7accc480cf97\" && ip"
priority            : 1001
_____________________________________________________________________________

[root@controller ~]# ovn-nbctl list Address_Set
_uuid               : e259afc4-3bc8-494a-b611-6ac20142af0e
addresses           : []
external_ids        : {"neutron:security_group_name"=default}
name                : "as_ip6_cb9182b1_96bf_4ae9_bcd9_a2a9347ea0da"

_uuid               : b4674b35-a8bf-4d00-97be-608c8e53537f
addresses           : []
external_ids        : {"neutron:security_group_name"=default}
name                : "as_ip6_8cb690a4_472a_4cd7_8394_edf0e8926df6"

_uuid               : 370cb8db-610a-4a62-916d-a32d4cedfe52
addresses           : []
external_ids        : {"neutron:security_group_name"=default}
name                : "as_ip4_cb9182b1_96bf_4ae9_bcd9_a2a9347ea0da"

_uuid               : 210a1c63-b28d-47c5-9295-5d1408f79a8a
addresses           : ["11.0.0.3", "11.0.0.5"]
external_ids        : {"neutron:security_group_name"=default}
name                : "as_ip4_8cb690a4_472a_4cd7_8394_edf0e8926df6"
_____________________________________________________________________________
[root@controller ~]# ovn-nbctl list Connection  配置数据库连接到ovsdb客户端
_uuid               : 0de31edd-7c5c-449e-8c38-aee2e334b27c
external_ids        : {}
inactivity_probe    : []
is_connected        : true
max_backoff         : []
other_config        : {}
status              : {bound_port="6641", n_connections="11", sec_since_connect="0", sec_since_disconnect="0"}
target              : "ptcp:6641:192.168.200.68"

_____________________________________________________________________________
[root@controller ~]# ovn-nbctl list DHCP_Options
_uuid               : e6e2df66-b6ec-4f02-aa31-5843c7931331
cidr                : "192.168.200.0/24"
external_ids        : {subnet_id="b7696073-d34b-4137-a19d-d3f261c7d716"}
options             : {lease_time="43200", mtu="1500", router="192.168.200.1", server_id="192.168.200.1", server_mac="fa:16:3e:f9:80:31"}


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值