BGPCEP-754: Rework EffectiveRibInWriter
[bgpcep.git] / bgp / openconfig-rp-statement / src / test / java / org / opendaylight / protocol / bgp / openconfig / routing / policy / statement / PrefixMatchTest.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.protocol.bgp.openconfig.routing.policy.statement;
10
11 import org.junit.Ignore;
12
13 @Ignore
14 public class PrefixMatchTest extends AbstractStatementRegistryConsumerTest {/*
15     @Mock
16     private BGPRouteEntryExportParameters exportParameters;
17     private List<Statement> basicStatements;
18     private PolicyRIBBaseParametersImpl baseAttributes;
19
20     @Before
21     @Override
22     public void setUp() throws Exception {
23         super.setUp();
24         this.basicStatements = loadStatement("basic-statements-test");
25         this.baseAttributes = new PolicyRIBBaseParametersImpl(LOCAL_AS, IPV4, CLUSTER);
26     }
27
28     @Test
29     public void testPrefixRange() {
30         //RANGE
31        doReturn(new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
32                 ImmutableMap.of(QName.create(Ipv4Route.QNAME, "prefix").intern(), "10.3.191.0/22")))
33                 .when(this.exportParameters).getRouteId();
34         Statement statement = this.basicStatements.stream()
35                 .filter(st -> st.getName().equals("reject-prefix-test")).findFirst().get();
36         final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(createClusterInput());
37         RouteAttributeContainer result = this.statementRegistry.applyExportStatement(
38                 this.baseAttributes,
39                 this.exportParameters,
40                 attributeContainer,
41                 statement);
42         assertNull(result.getAttributes());
43
44         doReturn(new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
45                 ImmutableMap.of(QName.create(Ipv4Route.QNAME, "prefix").intern(), "14.3.191.0/22")))
46                 .when(this.exportParameters).getRouteId();
47         result = this.statementRegistry.applyExportStatement(
48                 this.baseAttributes,
49                 this.exportParameters,
50                 attributeContainer,
51                 statement);
52         assertNotNull(result.getAttributes());
53     }
54
55     @Test
56     public void testPrefixExact() {
57       /*  final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(createClusterInput());
58         Statement statement = this.basicStatements.stream()
59                 .filter(st -> st.getName().equals("reject-prefix-test")).findFirst().get();
60
61         doReturn(new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
62                 ImmutableMap.of(QName.create(Ipv4Route.QNAME, "prefix").intern(), "10.3.192.0/21")))
63                 .when(this.exportParameters).getRouteId();
64         RouteAttributeContainer result = this.statementRegistry.applyExportStatement(
65                 this.baseAttributes,
66                 this.exportParameters,
67                 attributeContainer,
68                 statement);
69         assertNull(result.getAttributes());
70
71         doReturn(new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
72                 ImmutableMap.of(QName.create(Ipv4Route.QNAME, "prefix").intern(), "11.3.192.0/21")))
73                 .when(this.exportParameters).getRouteId();
74         result = this.statementRegistry.applyExportStatement(
75                 this.baseAttributes,
76                 this.exportParameters,
77                 attributeContainer,
78                 statement);
79         assertNotNull(result.getAttributes());
80     }
81
82     @Test
83     public void testPrefixInverse() {
84        /* final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(createClusterInput());
85
86         doReturn(new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
87                 ImmutableMap.of(QName.create(Ipv4Route.QNAME, "prefix").intern(), "10.3.192.0/21")))
88                 .when(this.exportParameters).getRouteId();
89         final Statement statement = this.basicStatements.stream()
90                 .filter(st -> st.getName().equals("reject-prefix-inverse-test")).findFirst().get();
91         RouteAttributeContainer result = this.statementRegistry.applyExportStatement(
92                 this.baseAttributes,
93                 this.exportParameters,
94                 attributeContainer,
95                 statement);
96         assertNotNull(result.getAttributes());
97
98         doReturn(new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
99                 ImmutableMap.of(QName.create(Ipv4Route.QNAME, "prefix").intern(), "11.3.192.0/21")))
100                 .when(this.exportParameters).getRouteId();
101         result = this.statementRegistry.applyExportStatement(
102                 this.baseAttributes,
103                 this.exportParameters,
104                 attributeContainer,
105                 statement);
106         assertNull(result.getAttributes());
107 }*/
108 }