2 * Copyright (c) 2016 Cisco Systems, Inc. and others. 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.mvpn.impl.attributes;
10 import static java.util.Collections.singletonList;
12 import java.util.ArrayList;
13 import java.util.Collections;
14 import java.util.List;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.PAddressPMulticastGroup;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.bgp.rib.route.PmsiTunnelAugmentation;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.bgp.rib.route.PmsiTunnelAugmentationBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.PmsiTunnelBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.BidirPimTreeBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.IngressReplicationBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpMp2mpLspBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLspBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSmTreeBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSsmTreeBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.RsvpTeP2mpLspBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValue;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValueBuilder;
39 import org.opendaylight.yangtools.yang.common.Uint16;
40 import org.opendaylight.yangtools.yang.common.Uint32;
41 import org.opendaylight.yangtools.yang.common.Uint8;
43 final class PMSITunnelAttributeHandlerTestUtil {
44 private static final MplsLabel MPLS_LABEL = new MplsLabel(Uint32.valueOf(24001L));
46 * ATT - TYPE - ATT LENGTH.
47 * PMSI FLAG - PMSI TYPE 0- MPLS LABEL
48 * No tunnel information present
50 static final byte[] NO_TUNNEL_INFORMATION_PRESENT_EXPECTED = {
51 (byte) 0xc0, (byte) 0x16, (byte) 0x05,
52 (byte) 0x01, (byte) 0x00, (byte) 0x05, (byte) 0xdc, (byte) 0x10
55 * ATT - TYPE - ATT LENGTH.
56 * PMSI FLAG - PMSI TYPE 1- MPLS LABEL
59 static final byte[] RSVP_TE_P2MP_LSP_LSP_EXPECTED = {
60 (byte) 0xc0, (byte) 0x16, (byte) 0x11,
61 (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
62 (byte) 0x00, (byte) 0x00, (byte) 0x0d, (byte) 0x82,
63 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0f,
64 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
67 * ATT - TYPE - ATT LENGTH.
68 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
71 static final byte[] M_LDP_P2MP_LSP_EXPECTED_IPV4 = {
72 (byte) 0xc0, (byte) 0x16, (byte) 0x35,
73 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
74 (byte) 0x06, (byte) 0x00, (byte) 0x01, (byte) 0x04,
75 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
76 (byte) 0x00, (byte) 0x26, //Opaque Values Length
77 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
78 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
79 (byte) 0x00, (byte) 0x00, (byte) 0x01,
80 (byte) 0x00, (byte) 0x00, (byte) 0x00,
81 (byte) 0x01, (byte) 0x00, (byte) 0x00,
82 (byte) 0x00, (byte) 0x00,
83 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
84 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
85 (byte) 0x00, (byte) 0x00, (byte) 0x01,
86 (byte) 0x00, (byte) 0x00, (byte) 0x00,
87 (byte) 0x01, (byte) 0x00, (byte) 0x00,
88 (byte) 0x00, (byte) 0x00, (byte) 0x01,
92 * ATT - TYPE - ATT LENGTH.
93 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
96 static final byte[] M_LDP_P2MP_LSP_EXPECTED_WRONG_FAMILY = {
97 (byte) 0xc0, (byte) 0x16, (byte) 0x20,
98 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
99 (byte) 0x06, (byte) 0x00, (byte) 0xfc, (byte) 0x04,
100 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
101 (byte) 0x00, (byte) 0x11, //Opaque Values Length
102 (byte) 0x01, (byte) 0x00, (byte) 0x03, // Opaque Type - Length
103 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, //Value
104 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x06, // Opaque Type -Ext Type - Length
105 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, (byte) 0xd7, (byte) 0x6d, (byte) 0xf8, //Value
108 * ATT - TYPE - ATT LENGTH.
109 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
110 * mLDP P2MP LSP L2VPN
112 static final byte[] M_LDP_P2MP_LSP_EXPECTED_L2VPN = {
113 (byte) 0xc0, (byte) 0x16, (byte) 0x35,
114 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
115 (byte) 0x06, (byte) 0x00, (byte) 0x01, (byte) 0x04,
116 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
117 (byte) 0x00, (byte) 0x26, //Opaque Values Length
118 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
119 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
120 (byte) 0x00, (byte) 0x00, (byte) 0x01,
121 (byte) 0x00, (byte) 0x00, (byte) 0x00,
122 (byte) 0x01, (byte) 0x00, (byte) 0x00,
123 (byte) 0x00, (byte) 0x00,
124 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
125 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
126 (byte) 0x00, (byte) 0x00, (byte) 0x01,
127 (byte) 0x00, (byte) 0x00, (byte) 0x00,
128 (byte) 0x01, (byte) 0x00, (byte) 0x00,
129 (byte) 0x00, (byte) 0x00, (byte) 0x01,
133 * ATT - TYPE - ATT LENGTH.
134 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
137 static final byte[] M_LDP_P2MP_LSP_EXPECTED_IPV4_2 = {
138 (byte) 0xc0, (byte) 0x16, (byte) 0x3b,
139 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
140 (byte) 0x06, (byte) 0x00, (byte) 0x01, (byte) 0x04,
141 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
142 (byte) 0x00, (byte) 0x2c, //Opaque Values Length
143 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
144 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
145 (byte) 0x00, (byte) 0x00, (byte) 0x01,
146 (byte) 0x00, (byte) 0x00, (byte) 0x00,
147 (byte) 0x01, (byte) 0x00, (byte) 0x00,
148 (byte) 0x00, (byte) 0x00,
149 (byte) 0xfc, (byte) 0x00, (byte) 0x03, // Wrong Opaque Type - Length
150 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, //Value
151 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
152 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
153 (byte) 0x00, (byte) 0x00, (byte) 0x01,
154 (byte) 0x00, (byte) 0x00, (byte) 0x00,
155 (byte) 0x01, (byte) 0x00, (byte) 0x00,
156 (byte) 0x00, (byte) 0x00, (byte) 0x01,
160 * ATT - TYPE - ATT LENGTH.
161 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
164 static final byte[] M_LDP_P2MP_LSP_EXPECTED_IPV6 = {
165 (byte) 0xc0, (byte) 0x16, (byte) 0x41,
166 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
167 (byte) 0x06, (byte) 0x00, (byte) 0x02, (byte) 0x10,
168 (byte) 0x20, (byte) 0x01, (byte) 0x00, (byte) 0x00,
169 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
170 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
171 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
172 (byte) 0x00, (byte) 0x26, //Opaque Values Length
173 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
174 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
175 (byte) 0x00, (byte) 0x00, (byte) 0x01,
176 (byte) 0x00, (byte) 0x00, (byte) 0x00,
177 (byte) 0x01, (byte) 0x00, (byte) 0x00,
178 (byte) 0x00, (byte) 0x00,
179 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
180 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
181 (byte) 0x00, (byte) 0x00, (byte) 0x01,
182 (byte) 0x00, (byte) 0x00, (byte) 0x00,
183 (byte) 0x01, (byte) 0x00, (byte) 0x00,
184 (byte) 0x00, (byte) 0x00, (byte) 0x01,
188 * ATT - TYPE - ATT LENGTH.
189 * PMSI FLAG - PMSI TYPE 3- MPLS LABEL
192 static final byte[] PIM_SSM_TREE_EXPECTED = {
193 (byte) 0xc0, (byte) 0x16, (byte) 0x0d,
194 (byte) 0x01, (byte) 0x03, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
195 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
196 (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
199 * ATT - TYPE - ATT LENGTH.
200 * PMSI FLAG - PMSI TYPE 4- MPLS LABEL
203 static final byte[] PIM_SM_TREE_EXPECTED = {
204 (byte) 0xc0, (byte) 0x16, (byte) 0x0d,
205 (byte) 0x01, (byte) 0x04, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
206 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
207 (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
210 * ATT - TYPE - ATT LENGTH.
211 * PMSI FLAG - PMSI TYPE 5- MPLS LABEL
214 static final byte[] BIDIR_PIM_EXPECTED = {
215 (byte) 0xc0, (byte) 0x16, (byte) 0x0d,
216 (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
217 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
218 (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
221 * ATT - TYPE - ATT LENGTH.
222 * PMSI FLAG - PMSI TYPE 6- MPLS LABEL
223 * Ingress Replication
225 static final byte[] INGRESS_REPLICATION_EXPECTED = {
226 (byte) 0xc0, (byte) 0x16, (byte) 0x09,
227 (byte) 0x01, (byte) 0x06, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
228 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01
231 * ATT - TYPE - ATT LENGTH.
232 * PMSI FLAG - PMSI TYPE 7- MPLS LABEL
235 static final byte[] M_LDP_MP_2_MP_LSP_EXPECTED = {
236 (byte) 0xc0, (byte) 0x16, (byte) 0x16,
237 (byte) 0x01, (byte) 0x07, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
238 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
239 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
240 (byte) 0x00, (byte) 0x00, (byte) 0x01,
241 (byte) 0x00, (byte) 0x00, (byte) 0x00,
242 (byte) 0x01, (byte) 0x00, (byte) 0x00,
243 (byte) 0x00, (byte) 0x00
246 * ATT - TYPE - ATT LENGTH.
247 * PMSI FLAG - PMSI TYPE 7- MPLS LABEL
250 static final byte[] M_LDP_MP_2_MP_LSP_WRONG = {
251 (byte) 0xc0, (byte) 0x16, (byte) 0x0b,
252 (byte) 0x01, (byte) 0x07, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
253 (byte) 0xfc, (byte) 0x00, (byte) 0x03, // Opaque Type - Length
254 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, //Value
256 private static final IpAddress P_MULTICAST = new IpAddress(new Ipv4Address("23.1.1.1"));
257 private static final IpAddress IP_ADDRESS = new IpAddress(new Ipv4Address("1.1.1.1"));
258 private static final Uint8 NO_SUPPORTED_OPAQUE = Uint8.valueOf(200);
259 private static final Uint8 GENERIC_LSP_IDENTIFIER = Uint8.ONE;
260 private static final HexString OPAQUE_TEST = new HexString("07:00:0b:00:00:01:00:00:00:01:00:00:00:00");
261 private static final HexString OPAQUE_TEST2
262 = new HexString("07:00:0b:00:00:01:00:00:00:01:00:00:00:00:01:02");
263 private static final IpAddress IPV6 = new IpAddress(new Ipv6Address("2001::1"));
264 private static final Uint8 EXTENDED_TYPE = Uint8.MAX_VALUE;
266 private PMSITunnelAttributeHandlerTestUtil() {
267 throw new UnsupportedOperationException();
270 private static PAddressPMulticastGroup buildPAddressPMulticastGroup() {
271 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel
272 .pmsi.tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder()
273 .setPAddress(IP_ADDRESS).setPMulticastGroup(P_MULTICAST).build();
276 private static PmsiTunnelBuilder getPmsiTunnelBuilder() {
277 final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
278 pmsiTunnelBuilder.setLeafInformationRequired(true);
279 pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
280 return pmsiTunnelBuilder;
283 private static Attributes buildAttribute(final PmsiTunnelBuilder pmsiTunnelBuilder) {
284 return new AttributesBuilder().setUnrecognizedAttributes(Collections.emptyList())
285 .addAugmentation(PmsiTunnelAugmentation.class,
286 new PmsiTunnelAugmentationBuilder().setPmsiTunnel(pmsiTunnelBuilder.build()).build()).build();
289 static Attributes buildBidirPimTreeAttribute() {
290 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
291 pmsiTunnelBuilder.setTunnelIdentifier(new BidirPimTreeBuilder()
292 .setBidirPimTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
293 .rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree
294 .BidirPimTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
295 return buildAttribute(pmsiTunnelBuilder);
298 static Attributes buildPimSMTreeAttribute() {
299 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
300 pmsiTunnelBuilder.setTunnelIdentifier(new PimSmTreeBuilder().setPimSmTree(new org.opendaylight.yang.gen.v1
301 .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel
302 .identifier.pim.sm.tree.PimSmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
303 return buildAttribute(pmsiTunnelBuilder);
306 static Attributes buildPimSSMTreeAttribute() {
307 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
308 pmsiTunnelBuilder.setTunnelIdentifier(new PimSsmTreeBuilder().setPimSsmTree(new org.opendaylight.yang.gen.v1
309 .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel
310 .identifier.pim.ssm.tree.PimSsmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
311 return buildAttribute(pmsiTunnelBuilder);
314 static Attributes buildNoSupportedOpaqueAttribute() {
315 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
316 final List<OpaqueValue> nonSupported = singletonList(new OpaqueValueBuilder()
317 .setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build());
318 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, nonSupported));
319 return buildAttribute(pmsiTunnelBuilder);
322 static Attributes buildNoSupportedFamilyAttribute() {
323 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
324 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, NonSupportedAddressFamily.class,
325 createOpaqueList()));
326 return buildAttribute(pmsiTunnelBuilder);
329 static Attributes buildMldpP2mpLspIpv4Attribute() {
330 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
331 pmsiTunnelBuilder.setTunnelIdentifier(
332 buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
333 return buildAttribute(pmsiTunnelBuilder);
336 static Attributes buildMldpP2mpLspIpv6Attribute() {
337 final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
338 pmsiTunnelBuilder.setLeafInformationRequired(true);
339 pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
340 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IPV6, Ipv6AddressFamily.class, createOpaqueList()));
341 return buildAttribute(pmsiTunnelBuilder);
344 static Attributes buildMldpp2MPLspL2vpnAttribute() {
345 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
346 pmsiTunnelBuilder.setTunnelIdentifier(
347 buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
348 return buildAttribute(pmsiTunnelBuilder);
351 private static TunnelIdentifier buildMldpP2mpLsp(final IpAddress ipAddress,
352 final Class<? extends AddressFamily> family, final List<OpaqueValue> opaqueList) {
353 return new MldpP2mpLspBuilder()
354 .setMldpP2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
355 .rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLspBuilder()
356 .setRootNodeAddress(ipAddress).setAddressFamily(family).setOpaqueValue(opaqueList).build())
360 static Attributes buildRsvpTep2MPLspAttribute() {
361 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
362 pmsiTunnelBuilder.setTunnelIdentifier(new RsvpTeP2mpLspBuilder()
363 .setRsvpTeP2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
364 .rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.rsvp.te.p2mp.lsp.RsvpTeP2mpLspBuilder()
365 .setP2mpId(Uint32.valueOf(3458)).setTunnelId(Uint16.valueOf(15))
366 .setExtendedTunnelId(IP_ADDRESS).build()).build());
367 return buildAttribute(pmsiTunnelBuilder);
370 static Attributes buildIngressReplicationAttribute() {
371 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
372 pmsiTunnelBuilder.setTunnelIdentifier(new IngressReplicationBuilder().setIngressReplication(new org
373 .opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi
374 .tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
375 .setReceivingEndpointAddress(IP_ADDRESS).build()).build());
376 return buildAttribute(pmsiTunnelBuilder);
379 static Attributes buildMldpMP2mpLspWrongAttribute() {
380 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
381 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
382 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
383 .mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE)
385 return buildAttribute(pmsiTunnelBuilder);
388 static Attributes buildMLDpMp2mPLspAttribute() {
389 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
390 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
391 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel
392 .identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST)
393 .setOpaqueType(Uint8.ONE).build()).build());
394 return buildAttribute(pmsiTunnelBuilder);
397 private static List<OpaqueValue> createOpaqueList() {
398 final List<OpaqueValue> opaqueValues = new ArrayList<>();
399 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST)
400 .setOpaqueType(GENERIC_LSP_IDENTIFIER).build());
401 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
402 .setOpaqueType(Uint8.TWO).setOpaqueType(EXTENDED_TYPE)
403 .setOpaqueExtendedType(Uint16.valueOf(4)).build());
407 static Attributes buildWOTunnelInfAttribute() {
408 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
409 return buildAttribute(pmsiTunnelBuilder);
412 private interface NonSupportedAddressFamily extends AddressFamily {