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
8 package org.opendaylight.protocol.bgp.openconfig.routing.policy.statement;
10 import java.util.Arrays;
11 import java.util.Collections;
12 import java.util.List;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.AsPathBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ClusterId;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ClusterIdBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginatorId;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.OriginatorIdBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.as.path.Segments;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.as.path.SegmentsBuilder;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
26 public final class ExportAttributeTestUtil {
27 public static final long REMOTE_AS = 8;
28 public static final AsNumber LOCAL_AS = new AsNumber(65L);
29 public static final Ipv4Address IPV4 = new Ipv4Address("1.2.3.4");
30 public static final ClusterIdentifier CLUSTER = new ClusterIdentifier(IPV4);
32 private ExportAttributeTestUtil() {
33 throw new UnsupportedOperationException();
37 * container cluster-id. {
39 * type cluster-identifier;
42 * container originator-id {
49 public static Attributes createInputWithOriginator() {
50 return new AttributesBuilder().setClusterId(createClusterId()).setOriginatorId(createOriginatorId()).build();
53 public static Attributes createClusterInput() {
54 return new AttributesBuilder().setClusterId(createClusterIdInput()).build();
57 private static ClusterId createClusterId() {
58 final ClusterIdentifier cluster1 = new ClusterIdentifier(new Ipv4Address("1.1.1.1"));
59 final ClusterIdentifier cluster2 = new ClusterIdentifier(new Ipv4Address("1.1.1.2"));
60 return new ClusterIdBuilder().setCluster(Arrays.asList(CLUSTER, cluster1, cluster2)).build();
63 private static ClusterId createClusterIdInput() {
64 final ClusterIdentifier cluster1 = new ClusterIdentifier(new Ipv4Address("1.1.1.1"));
65 final ClusterIdentifier cluster2 = new ClusterIdentifier(new Ipv4Address("1.1.1.2"));
66 return new ClusterIdBuilder().setCluster(Arrays.asList(cluster1, cluster2)).build();
69 private static OriginatorId createOriginatorId() {
70 return new OriginatorIdBuilder().setOriginator(IPV4).build();
76 static Attributes createPathInputWithAs() {
77 return createPathInput(createSequenceWithLocalAs());
80 static Attributes createPathInput(final List<Segments> segB) {
81 return new AttributesBuilder().setAsPath(new AsPathBuilder().setSegments(segB).build()).build();
84 private static List<Segments> createSequenceWithLocalAs() {
85 return Collections.singletonList(new SegmentsBuilder()
86 .setAsSequence(Arrays.asList(new AsNumber(LOCAL_AS), new AsNumber(REMOTE_AS))).build());