Bug 1655369

Summary: OVN: lsp-set-addresses support for dynamic MAC + static IP
Product: Red Hat Enterprise Linux 7 Reporter: Dan Williams <dcbw>
Component: openvswitchAssignee: lorenzo bianconi <lorenzo.bianconi>
Status: CLOSED ERRATA QA Contact: haidong li <haili>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.6CC: atragler, ctrautma, fleitner, lorenzo.bianconi, ovs-qe, pvauter, qding
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openvswitch-2.9.0-92.el7fdn Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1662975 1664028 (view as bug list) Environment:
Last Closed: 2019-03-06 10:56:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1662975, 1664028    
Attachments:
Description Flags
0001-OVN-add-the-possibility-to-configure-a-static-IPv4-a.patch none

Description Dan Williams 2018-12-03 03:05:43 UTC
Some container use-cases would like to set a static IP but leave the MAC assignment up to OVN.  eg "lsp-set-addresses <port> dynamic 1.2.3.4" or something like that that.

Comment 4 haidong li 2019-02-15 07:20:14 UTC
I have tested on the latest version and have some questions,can you please help check them?Thanks!

[root@dell-per730-19 ~]# uname -a
Linux dell-per730-19.rhts.eng.pek2.redhat.com 3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@dell-per730-19 ~]# rpm -qa  | grep openvswitch
kernel-kernel-networking-openvswitch-ovs_qinq_dpdk-1.3-35.noarch
openvswitch-ovn-common-2.9.0-95.el7fdp.x86_64
openvswitch-selinux-extra-policy-1.0-10.el7fdp.noarch
openvswitch-2.9.0-95.el7fdp.x86_64
openvswitch-ovn-central-2.9.0-95.el7fdp.x86_64
openvswitch-ovn-host-2.9.0-95.el7fdp.x86_64
[root@dell-per730-19 ~]# 
[root@dell-per730-19 ~]# ovn-nbctl  get NB_Global . options:mac_prefix
"00:11:22:33:44:55"
[root@dell-per730-19 ~]# ovn-nbctl  get Logical-Switch s1 other_config:subnet
"172.16.0.0/16"
[root@dell-per730-19 ~]# ovn-nbctl  get Logical-Switch s1 other_config:ipv6_prefix
"3000::0"
[root@dell-per730-19 ~]# 


1. Can I configure dynamic mac and static ipv6 without ipv4 ? It seems failed when I configured it.
[root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2 "dynamic 3000::99"
ovn-nbctl: dynamic 3000::99: Invalid address format. See ovn-nb(5). Hint: An Ethernet address must be listed before an IP address, together as a single argument.


2.I configure the static ipv4 and ipv6 together,but the port can't get dynamic mac address:
[root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2 "dynamic 172.16.0.99 3000::99"
[root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2 dynamic_addresses
[]
[root@dell-per730-19 ~]#
[root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2 addresses
["dynamic 172.16.0.99 3000::99"]
[root@dell-per730-19 ~]#


3.I find that if I remove the "other_config" configuration,the port can't get mac anymore.Is it expected?
[root@dell-per730-19 ~]# ovn-nbctl clear Logical-switch s1 other_config
[root@dell-per730-19 ~]# ovn-nbctl lsp-del lsp2
[root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2 "dynamic"
[root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2 dynamic_addresses
[]
[root@dell-per730-19 ~]#
[root@dell-per730-19 ~]# ovn-nbctl  set Logical-Switch s1 other_config:subnet=172.16.0.0/16
[root@dell-per730-19 ~]# ovn-nbctl  set Logical-Switch s1 other_config:ipv6_prefix=3000::0
[root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2 dynamic_addresses
"00:11:22:10:00:03 172.16.0.2 3000::211:22ff:fe10:3"
[root@dell-per730-19 ~]#

Comment 5 lorenzo bianconi 2019-02-18 16:49:22 UTC
Hi Hidong,

> I have tested on the latest version and have some questions,can you please
> help check them?Thanks!
> 
> [root@dell-per730-19 ~]# uname -a
> Linux dell-per730-19.rhts.eng.pek2.redhat.com 3.10.0-957.el7.x86_64 #1 SMP
> Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
> [root@dell-per730-19 ~]# rpm -qa  | grep openvswitch
> kernel-kernel-networking-openvswitch-ovs_qinq_dpdk-1.3-35.noarch
> openvswitch-ovn-common-2.9.0-95.el7fdp.x86_64
> openvswitch-selinux-extra-policy-1.0-10.el7fdp.noarch
> openvswitch-2.9.0-95.el7fdp.x86_64
> openvswitch-ovn-central-2.9.0-95.el7fdp.x86_64
> openvswitch-ovn-host-2.9.0-95.el7fdp.x86_64
> [root@dell-per730-19 ~]# 
> [root@dell-per730-19 ~]# ovn-nbctl  get NB_Global . options:mac_prefix
> "00:11:22:33:44:55"
> [root@dell-per730-19 ~]# ovn-nbctl  get Logical-Switch s1 other_config:subnet
> "172.16.0.0/16"
> [root@dell-per730-19 ~]# ovn-nbctl  get Logical-Switch s1
> other_config:ipv6_prefix
> "3000::0"
> [root@dell-per730-19 ~]# 
> 
> 
> 1. Can I configure dynamic mac and static ipv6 without ipv4 ? It seems
> failed when I configured it.
> [root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2
> "dynamic 3000::99"
> ovn-nbctl: dynamic 3000::99: Invalid address format. See ovn-nb(5). Hint: An
> Ethernet address must be listed before an IP address, together as a single
> argument.

correct, static ip + dynamic mac is currently supported just for ipv4

> 
> 
> 2.I configure the static ipv4 and ipv6 together,but the port can't get
> dynamic mac address:
> [root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2
> "dynamic 172.16.0.99 3000::99"
> [root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2
> dynamic_addresses
> []
> [root@dell-per730-19 ~]#
> [root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2 addresses
> ["dynamic 172.16.0.99 3000::99"]
> [root@dell-per730-19 ~]#

have you configured other_config:subnet? ipv4 static ip should belong to the configured subnet field

> 
> 
> 3.I find that if I remove the "other_config" configuration,the port can't
> get mac anymore.Is it expected?
> [root@dell-per730-19 ~]# ovn-nbctl clear Logical-switch s1 other_config
> [root@dell-per730-19 ~]# ovn-nbctl lsp-del lsp2
> [root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2
> "dynamic"
> [root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2
> dynamic_addresses
> []
> [root@dell-per730-19 ~]#
> [root@dell-per730-19 ~]# ovn-nbctl  set Logical-Switch s1
> other_config:subnet=172.16.0.0/16
> [root@dell-per730-19 ~]# ovn-nbctl  set Logical-Switch s1
> other_config:ipv6_prefix=3000::0
> [root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2
> dynamic_addresses
> "00:11:22:10:00:03 172.16.0.2 3000::211:22ff:fe10:3"
> [root@dell-per730-19 ~]#

yes, you need to provide other_config:subnet

Comment 6 haidong li 2019-02-19 06:51:13 UTC
(In reply to lorenzo bianconi from comment #5)

> > 2.I configure the static ipv4 and ipv6 together,but the port can't get
> > dynamic mac address:
> > [root@dell-per730-19 ~]# ovn-nbctl lsp-add s1 lsp2 -- lsp-set-addresses lsp2
> > "dynamic 172.16.0.99 3000::99"
> > [root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2
> > dynamic_addresses
> > []
> > [root@dell-per730-19 ~]#
> > [root@dell-per730-19 ~]# ovn-nbctl get Logical-Switch-Port lsp2 addresses
> > ["dynamic 172.16.0.99 3000::99"]
> > [root@dell-per730-19 ~]#
> 
> have you configured other_config:subnet? ipv4 static ip should belong to the
> configured subnet field

Yes,I have configured both other_config:subnet and other_config:ipv6_prefix,at the first time the dynamic address is not assigned.
But once I change to set dynamic mac and ipv4 static ip only,the address can be assigned:

[root@dell-per730-57 ~]# ovn-nbctl clear Logical-Switch s2 other_config
[root@dell-per730-57 ~]# ovn-nbctl lsp-del lsp1
[root@dell-per730-57 ~]# ovn-nbctl  set Logical-Switch s2 other_config:subnet=192.168.0.0/16
[root@dell-per730-57 ~]# ovn-nbctl set Logical-switch s2 other_config:ipv6_prefix=2003::0
[root@dell-per730-57 ~]#  ovn-nbctl lsp-add s2 lsp1 -- lsp-set-addresses lsp1 "dynamic 192.168.0.99 2003::99"
[root@dell-per730-57 ~]# ovn-nbctl get Logical-Switch-Port lsp1 dynamic_addresses
[]
[root@dell-per730-57 ~]#  ovn-nbctl get Logical-Switch s2 other_config
{"ipv6_prefix"="2003::0", subnet="192.168.0.0/16"}
[root@dell-per730-57 ~]#
[root@dell-per730-57 ~]# ovn-nbctl get Logical-Switch-Port lsp1 dynamic_addresses
[]
[root@dell-per730-57 ~]#  ovn-nbctl lsp-set-addresses lsp1 "dynamic 192.168.0.99"
[root@dell-per730-57 ~]# ovn-nbctl get Logical-Switch-Port lsp1 dynamic_addresses
"00:00:22:a8:00:64 192.168.0.99 2003::200:22ff:fea8:64"
[root@dell-per730-57 ~]#

Comment 7 lorenzo bianconi 2019-02-20 17:27:06 UTC
Created attachment 1536784 [details]
0001-OVN-add-the-possibility-to-configure-a-static-IPv4-a.patch

Could you please try the attached patch?

Comment 8 haidong li 2019-02-21 03:49:07 UTC
Hi,there is error when I use this patch.Are you using the version  openvswitch-2.9.0-95.el7fdp.src.rpm ?
Since this is a issue,I think we can close this bug as verified since ipv4 static can work now.And I will open another one to track it.
Already submit bz1679386.

Comment 10 errata-xmlrpc 2019-03-06 10:56:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0466