2 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
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
9 package org.opendaylight.protocol.bgp.openconfig.routing.policy.statement;
11 import org.junit.Ignore;
14 public class PrefixMatchTest extends AbstractStatementRegistryConsumerTest {/*
16 private BGPRouteEntryExportParameters exportParameters;
17 private List<Statement> basicStatements;
18 private PolicyRIBBaseParametersImpl baseAttributes;
22 public void setUp() throws Exception {
24 this.basicStatements = loadStatement("basic-statements-test");
25 this.baseAttributes = new PolicyRIBBaseParametersImpl(LOCAL_AS, IPV4, CLUSTER);
29 public void testPrefixRange() {
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(
39 this.exportParameters,
42 assertNull(result.getAttributes());
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(
49 this.exportParameters,
52 assertNotNull(result.getAttributes());
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();
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(
66 this.exportParameters,
69 assertNull(result.getAttributes());
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(
76 this.exportParameters,
79 assertNotNull(result.getAttributes());
83 public void testPrefixInverse() {
84 /* final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(createClusterInput());
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(
93 this.exportParameters,
96 assertNotNull(result.getAttributes());
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(
103 this.exportParameters,
106 assertNull(result.getAttributes());