Rework match role condition. 70/70270/4
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Sun, 1 Apr 2018 10:43:24 +0000 (12:43 +0200)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Tue, 3 Apr 2018 15:55:55 +0000 (15:55 +0000)
Make condition support from peer role and
to peer role evaluation at once.
Improving performance.

Change-Id: I2e3c69e82e17d651aca962f478901ec4aed63b88
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/config-example/src/main/resources/initial/routing-policy-config.xml
bgp/openconfig-api/src/main/yang/odl-bgp-default-policy.yang
bgp/openconfig-rp-impl/src/test/resources/initial/routing-policy-config.xml
bgp/openconfig-rp-spi/src/test/resources/initial/routing-policy-config.xml
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchRoleSetHandler.java
bgp/openconfig-rp-statement/src/test/resources/initial/routing-policy-config.xml

index 458b46ec8765666060af79be0f8fd6728e4eb3d6..7a3c127dde7bee15926c85495ce3847a19b5a174 100644 (file)
@@ -17,7 +17,9 @@
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
-                                <match-set-options>INVERT</match-set-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                    <match-set-options>INVERT</match-set-options>
+                                </from-role>
                             </match-role-set>
                             <!--https://tools.ietf.org/html/rfc4456#section-8-->
                             <match-originator-id-set-condition xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
@@ -60,8 +64,9 @@
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
index b027f997a7a8e305fc1fb65c2c8bd97e21c4e816..2dce469f4e637cefa39a7a358d2d46dfdf14ff65 100644 (file)
@@ -31,35 +31,29 @@ module odl-bgp-policy {
             "ODL BGP policy models";
     }
 
-    typedef match-set-direction-options-type {
-        type enumeration {
-            enum FROM {
-              description "from neighbor";
-            }
-            enum TO {
-              description "to neighbor";
+    grouping match-role-condition-grouping {
+        leaf role-set {
+            type leafref {
+              path "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set/role-set-name";
+              require-instance true;
             }
+            description "References a defined neighbor roles set";
         }
-        default FROM;
+        uses rpol:match-set-options-restricted-group;
     }
 
     grouping match-role-set-condition-grouping {
-        description
-            "Match a list of referenced role-set according to the logic
-            defined in the match-set-options leaf";
-        list match-role-set {
-            leaf role-set {
-                type leafref {
-                  path "/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set/role-set-name";
-                  require-instance true;
-                }
-                description "References a defined neighbor roles set";
-            }
+        container match-role-set {
+            description
+                "Match a list of referenced role-set according to the logic
+                defined in the match-set-options leaf";
 
-            uses rpol:match-set-options-restricted-group;
+            container from-role {
+                uses match-role-condition-grouping;
+            }
 
-            leaf match-set-direction-options {
-              type match-set-direction-options-type;
+            container to-role {
+                uses match-role-condition-grouping;
             }
         }
     }
index 03dfc3d2ad8cc4cd72a43c2d0c84fae5b4127b36..b3a75acce4e693ba84f834aba0bd545afc5020eb 100644 (file)
@@ -19,7 +19,9 @@
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"</role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
index f10a6ba61003789ef657e5d61f2ab66d4a64f82a..2c768f2c9c1cb99dcfca485abb379ba106f26f2a 100644 (file)
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"</role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
index eeda4d0a34d30ad5534ffa6d837ae0ef71f09c85..20361355aed954ca6820ddc32e3f5f2655bed383 100644 (file)
@@ -17,8 +17,6 @@ import com.google.common.cache.LoadingCache;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
@@ -36,8 +34,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.BgpRoleSets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.MatchRoleSetCondition;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.MatchSetDirectionOptionsType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.role.set.condition.grouping.MatchRoleSet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.role.set.condition.grouping.match.role.set.FromRole;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.role.set.condition.grouping.match.role.set.ToRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.role.set.RoleSet;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.role.set.RoleSetKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.routing.policy.defined.sets.bgp.defined.sets.RoleSets;
@@ -64,17 +63,6 @@ public final class MatchRoleSetHandler implements BgpConditionsAugmentationPolic
         this.dataBroker = requireNonNull(dataBroker);
     }
 
-    private boolean matchRoleCondition(final MatchRoleSet roleMatch, @Nonnull final PeerRole role) {
-        final List<PeerRole> roles = this.roleSets.getUnchecked(StringUtils
-                .substringBetween(roleMatch.getRoleSet(), "=\"", "\""));
-        final boolean found = roles.contains(role);
-        if (roleMatch.getMatchSetOptions().equals(MatchSetOptionsRestrictedType.ANY)) {
-            return found;
-        }
-        //INVERT Case
-        return !found;
-    }
-
     private List<PeerRole> loadRoleSets(final String key) throws ExecutionException, InterruptedException {
         final ReadOnlyTransaction tr = this.dataBroker.newReadOnlyTransaction();
         final Optional<RoleSet> result = tr.read(LogicalDatastoreType.CONFIGURATION,
@@ -88,49 +76,58 @@ public final class MatchRoleSetHandler implements BgpConditionsAugmentationPolic
     @Override
     public boolean matchImportCondition(
             final RouteEntryBaseAttributes routeEntryInfo,
-            final BGPRouteEntryImportParameters routeEntryImportParameters,
+            final BGPRouteEntryImportParameters importParameters,
             final Void attributes,
             final MatchRoleSetCondition conditions) {
+        return matchNeighborRoleSetCondition(importParameters.getFromPeerRole(), null,
+                conditions.getMatchRoleSet());
+    }
 
-        final List<MatchRoleSet> neighCond = conditions.getMatchRoleSet();
+    private boolean matchNeighborRoleSetCondition(final PeerRole fromPeerRole, final PeerRole toPeerRole,
+            final MatchRoleSet matchRoleSet) {
 
-        for (final MatchRoleSet roleMatch : neighCond) {
-            if (roleMatch.getMatchSetDirectionOptions().equals(MatchSetDirectionOptionsType.TO)) {
-                return false;
-            } else {
-                if (!matchRoleCondition(roleMatch, routeEntryImportParameters.getFromPeerRole())) {
-                    return false;
-                }
-            }
+        final FromRole from = matchRoleSet.getFromRole();
+        Boolean match = null;
+        if (from != null) {
+            match = checkMatch(from.getRoleSet(), fromPeerRole, from.getMatchSetOptions());
+        }
+        if (match != null && !match) {
+            return false;
+        }
+
+        final ToRole to = matchRoleSet.getToRole();
+        if (to != null) {
+            match = checkMatch(to.getRoleSet(), toPeerRole, to.getMatchSetOptions());
         }
-        return true;
+
+        return match;
+    }
+
+    private boolean checkMatch(final String roleSetName, final PeerRole role,
+            final MatchSetOptionsRestrictedType matchSetOptions) {
+        final List<PeerRole> roles = this.roleSets.getUnchecked(StringUtils
+                .substringBetween(roleSetName, "=\"", "\""));
+
+        final boolean found = roles.contains(role);
+        if (MatchSetOptionsRestrictedType.ANY.equals(matchSetOptions)) {
+            return found;
+        }
+        //INVERT
+        return !found;
     }
 
     @Override
     public boolean matchExportCondition(
             final RouteEntryBaseAttributes routeEntryInfo,
-            final BGPRouteEntryExportParameters routeEntryExportParameters,
+            final BGPRouteEntryExportParameters exportParameters,
             final Void attributes,
             final MatchRoleSetCondition conditions) {
-        final List<MatchRoleSet> neighCond = conditions.getMatchRoleSet();
-
-        for (final MatchRoleSet roleMatch : neighCond) {
-            PeerRole role;
-            if (roleMatch.getMatchSetDirectionOptions().equals(MatchSetDirectionOptionsType.TO)) {
-                role = routeEntryExportParameters.getToPeerRole();
-            } else {
-                role = routeEntryExportParameters.getFromPeerRole();
-            }
-            if (!matchRoleCondition(roleMatch, role)) {
-                return false;
-            }
-        }
-        return true;
+        return matchNeighborRoleSetCondition(exportParameters.getFromPeerRole(),
+                exportParameters.getToPeerRole(), conditions.getMatchRoleSet());
     }
 
-    @Nullable
     @Override
-    public Void getConditionParameter(@Nonnull final Attributes attributes) {
+    public Void getConditionParameter(final Attributes attributes) {
         return null;
     }
 }
index d4ef5b550d5981c22afb136d066a3403ed8db251..d1ec5190641c68897fc29743a329e9390b1c34f4 100644 (file)
@@ -17,9 +17,9 @@
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"
-                                </role-set>
-                                <match-set-options>INVERT</match-set-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                    <match-set-options>INVERT</match-set-options>
+                                </from-role>
                             </match-role-set>
                             <!--https://tools.ietf.org/html/rfc4456#section-8-->
                             <match-originator-id-set-condition
                                     xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
                                 <originator-id-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name="local-originator-id"
+                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/originator-id-sets/originator-id-set[originator-set-name="local-originator-id"]
                                 </originator-id-set>
                                 <match-set-options>INVERT</match-set-options>
                             </match-originator-id-set-condition>
                             <match-cluster-id-set-condition
                                     xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
                                 <cluster-id-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name="local-cluster-id"
+                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/cluster-id-sets/cluster-id-set[cluster-set-name="local-cluster-id"]
                                 </cluster-id-set>
                                 <match-set-options>INVERT</match-set-options>
                             </match-cluster-id-set-condition>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-internal"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ibgp"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-ebgp"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"
-                                </role-set>
-                            </match-role-set>
-                            <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"
-                                </role-set>
-                                <match-set-direction-options>TO</match-set-direction-options>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="ibgp-rr-client"]</role-set>
+                                </from-role>
+                                <to-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="only-rr-client"]</role-set>
+                                </to-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <actions>
                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
                             <set-cluster-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
-                            <set-originator-id-prepend
-                                    xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
+                            <set-originator-id-prepend xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy"/>
                         </bgp-actions>
                     </actions>
                 </statement>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-ext-community-set>
                                 <ext-community-set>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
                                 </ext-community-set>
                                 <match-set-options>ANY</match-set-options>
                             </match-ext-community-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-ext-community-set>
                                 <ext-community-set>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
                                 </ext-community-set>
                                 <match-set-options>ALL</match-set-options>
                             </match-ext-community-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-ext-community-set>
                                 <ext-community-set>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
                                 </ext-community-set>
                                 <match-set-options>INVERT</match-set-options>
                             </match-ext-community-set>
                     <conditions>
                         <match-prefix-set>
                             <prefix-set>
-                                /rpol:routing-policy/rpol:defined-sets/rpol:prefix-sets/prefix-set[prefix-set-name="test-prefix-set"
+                                /rpol:routing-policy/rpol:defined-sets/rpol:prefix-sets/prefix-set[prefix-set-name="test-prefix-set"]
                             </prefix-set>
                         </match-prefix-set>
                     </conditions>
                     <conditions>
                         <match-prefix-set>
                             <prefix-set>
-                                /rpol:routing-policy/rpol:defined-sets/rpol:prefix-sets/prefix-set[prefix-set-name="test-prefix-set"
+                                /rpol:routing-policy/rpol:defined-sets/rpol:prefix-sets/prefix-set[prefix-set-name="test-prefix-set"]
                             </prefix-set>
                             <match-set-options>INVERT</match-set-options>
                         </match-prefix-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-as-path-set>
                                 <as-path-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="test-as-path-set"
+                                    /rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="test-as-path-set"]
                                 </as-path-set>
                                 <match-set-options>ANY</match-set-options>
                             </match-as-path-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-as-path-set>
                                 <as-path-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="test-as-path-set"
+                                    /rpol:routing-policy/rpol:defined-sets/bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/bgp-pol:as-path-set/[as-path-set-name="test-as-path-set"]
                                 </as-path-set>
                                 <match-set-options>ALL</match-set-options>
                             </match-as-path-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-community-set>
                                 <community-set>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"]
                                 </community-set>
                                 <match-set-options>ANY</match-set-options>
                             </match-community-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-community-set>
                                 <community-set>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"]
                                 </community-set>
                                 <match-set-options>ALL</match-set-options>
                             </match-community-set>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-community-set>
                                 <community-set>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"]
                                 </community-set>
                                 <match-set-options>INVERT</match-set-options>
                             </match-community-set>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
                             <set-community>
                                 <community-set-ref>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"]
                                 </community-set-ref>
                                 <options>ADD</options>
                             </set-community>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
                             <set-community>
                                 <community-set-ref>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"]
                                 </community-set-ref>
                                 <options>REPLACE</options>
                             </set-community>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
                             <set-community>
                                 <community-set-ref>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:community-sets/community-set[community-set-name="community-set-name-test"]
                                 </community-set-ref>
                                 <options>REMOVE</options>
                             </set-community>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
                             <set-ext-community>
                                 <ext-community-set-ref>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
                                 </ext-community-set-ref>
                                 <options>ADD</options>
                             </set-ext-community>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                         <bgp-actions xmlns="http://openconfig.net/yang/bgp-policy">
                             <set-ext-community>
                                 <ext-community-set-ref>
-                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"
+                                    /rpol:routing-policy/rpol:defined-sets/rpol:ext-community-sets/ext-community-set[ext-community-set-name="ext-community-set-name-test"]
                                 </ext-community-set-ref>
                                 <options>REPLACE</options>
                             </set-ext-community>
                     <conditions>
                         <bgp-conditions xmlns="http://openconfig.net/yang/bgp-policy">
                             <match-role-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
-                                <role-set>
-                                    /rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"
-                                </role-set>
+                                <from-role>
+                                    <role-set>/rpol:routing-policy/rpol:defined-sets/bgppol:bgp-defined-sets/role-sets/role-set[role-set-name="all"]</role-set>
+                                </from-role>
                             </match-role-set>
                         </bgp-conditions>
                     </conditions>
                             <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
                                 <from-neighbor>
                                     <neighbor-set>
-                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"
+                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"]
                                     </neighbor-set>
                                 </from-neighbor>
                             </match-bgp-neighbor-set>
                             <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
                                 <from-neighbor>
                                     <neighbor-set>
-                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"
+                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"]
                                     </neighbor-set>
                                     <match-set-options>INVERT</match-set-options>
                                 </from-neighbor>
                             <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
                                 <to-neighbor>
                                     <neighbor-set>
-                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"
+                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"]
                                     </neighbor-set>
                                 </to-neighbor>
                             </match-bgp-neighbor-set>
                             <match-bgp-neighbor-set xmlns="urn:opendaylight:params:xml:ns:yang:odl:bgp:default:policy">
                                 <to-neighbor>
                                     <neighbor-set>
-                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"
+                                        /rpol:routing-policy/rpol:defined-sets/rpol:neighbor-sets/neighbor-set[neighbor-set-name="test-bgp-neighbor-set"]
                                     </neighbor-set>
                                     <match-set-options>INVERT</match-set-options>
                                 </to-neighbor>