Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
The FDP team is no longer accepting new bugs in Bugzilla. Please report your issues under FDP project in Jira. Thanks.

Bug 1845109

Summary: [RFE] Need CLI support for --may-exist/--if-exists to lr-policy cmds
Product: Red Hat Enterprise Linux Fast Datapath Reporter: Tim Rozet <trozet>
Component: OVNAssignee: lorenzo bianconi <lorenzo.bianconi>
Status: CLOSED ERRATA QA Contact: Jianlin Shi <jishi>
Severity: low Docs Contact: Zhiqiang Fang <zfang>
Priority: medium    
Version: RHEL 8.0CC: ctrautma, lorenzo.bianconi, mmichels
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovn2.13-20.06.2-14.el7fdn Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 09:49:12 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:

Description Tim Rozet 2020-06-08 13:35:23 UTC
Description of problem:
lr-policy-add and lr-policy-del commands are missing support for --may-exist or --if-exists

See https://github.com/ovn-org/ovn/issues/49 for more info

Comment 3 Jianlin Shi 2020-10-10 05:27:41 UTC
tested with following script:

ovn-nbctl lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
ovn-nbctl lr-policy-add lr1 1000 ip6.src==3001::1 allow
ovn-nbctl lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
ovn-nbctl --may-exist lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
ovn-nbctl lr-policy-del lr1 1000 ip6.src==3001::1
ovn-nbctl lr-policy-del lr1 1000 ip6.src==3001::1
ovn-nbctl --if-exists lr-policy-del lr1 1000 ip6.src==3001::1

Verified on ovn2.13-20.09.0-1.el7fdp.x86_64:

[root@wsfd-advnetlab16 bz1845109]# rpm -qa | grep -E "openvswitch|ovn"
kernel-kernel-networking-openvswitch-ovn-common-1.0-9.noarch
ovn2.13-20.09.0-1.el7fdp.x86_64
kernel-kernel-networking-openvswitch-ovn-basic-1.0-30.noarch
openvswitch-selinux-extra-policy-1.0-15.el7fdp.noarch
openvswitch2.13-2.13.0-51.el7fdp.x86_64
ovn2.13-central-20.09.0-1.el7fdp.x86_64
ovn2.13-host-20.09.0-1.el7fdp.x86_64


+ ovn-nbctl lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow                                                                                                        
+ ovn-nbctl lr-policy-add lr1 1000 ip6.src==3001::1 allow
+ ovn-nbctl lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
ovn-nbctl: Same routing policy already existed on the logical router lr1.
+ ovn-nbctl --may-exist lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow  

<==== no error if --may-exist is used
        
+ ovn-nbctl lr-policy-del lr1 1000 ip6.src==3001::1                        
+ ovn-nbctl lr-policy-del lr1 1000 ip6.src==3001::1                 
+ ovn-nbctl --if-exists lr-policy-del lr1 1000 ip6.src==3001::1

<=== --if-exists is supported

[root@wsfd-advnetlab16 bz1845109]# ovn-nbctl list logical_router_policy
_uuid               : fb367baf-6d9e-4a7e-98c1-5465ea985ec7               
action              : allow                                           
external_ids        : {}                     
match               : "ip4.src==192.168.0.1"                        
nexthop             : []                                      
options             : {}                                    
priority            : 2000

Comment 4 Jianlin Shi 2020-10-10 05:35:36 UTC
also verified on rhel8 version:

[root@wsfd-advnetlab18 bz1845109]# rpm -qa | grep -E "openvswitch|ovn"
openvswitch-selinux-extra-policy-1.0-23.el8fdp.noarch
ovn2.13-20.09.0-1.el8fdp.x86_64
openvswitch2.13-2.13.0-60.el8fdp.x86_64
ovn2.13-central-20.09.0-1.el8fdp.x86_64
ovn2.13-host-20.09.0-1.el8fdp.x86_64

+ ovn-nbctl lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
+ ovn-nbctl lr-policy-add lr1 1000 ip6.src==3001::1 allow
+ ovn-nbctl lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
ovn-nbctl: Same routing policy already existed on the logical router lr1.
+ ovn-nbctl --may-exist lr-policy-add lr1 2000 ip4.src==192.168.0.1 allow
+ ovn-nbctl lr-policy-del lr1 1000 ip6.src==3001::1
+ ovn-nbctl lr-policy-del lr1 1000 ip6.src==3001::1
+ ovn-nbctl --if-exists lr-policy-del lr1 1000 ip6.src==3001::1

Comment 6 errata-xmlrpc 2020-10-27 09:49:12 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 (ovn2.13 bug fix and enhancement update), 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-2020:4356