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
9 package org.opendaylight.protocol.bgp.mvpn.impl.attributes;
11 import static java.util.Collections.singletonList;
13 import java.util.ArrayList;
14 import java.util.Collections;
15 import java.util.List;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.PAddressPMulticastGroup;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.bgp.rib.route.PmsiTunnelAugmentation;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.bgp.rib.route.PmsiTunnelAugmentationBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.PmsiTunnelBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.BidirPimTreeBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.IngressReplicationBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpMp2mpLspBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLspBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSmTreeBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSsmTreeBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.RsvpTeP2mpLspBuilder;
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.OpaqueValue;
39 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;
41 final class PMSITunnelAttributeHandlerTestUtil {
42 private static final MplsLabel MPLS_LABEL = new MplsLabel(24001L);
44 * ATT - TYPE - ATT LENGTH.
45 * PMSI FLAG - PMSI TYPE 0- MPLS LABEL
46 * No tunnel information present
48 static final byte[] NO_TUNNEL_INFORMATION_PRESENT_EXPECTED = {
49 (byte) 0x80, (byte) 0x16, (byte) 0x05,
50 (byte) 0x01, (byte) 0x00, (byte) 0x05, (byte) 0xdc, (byte) 0x10
53 * ATT - TYPE - ATT LENGTH.
54 * PMSI FLAG - PMSI TYPE 1- MPLS LABEL
57 static final byte[] RSVP_TE_P2MP_LSP_LSP_EXPECTED = {
58 (byte) 0x80, (byte) 0x16, (byte) 0x11,
59 (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
60 (byte) 0x00, (byte) 0x00, (byte) 0x0d, (byte) 0x82,
61 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0f,
62 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
65 * ATT - TYPE - ATT LENGTH.
66 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
69 static final byte[] M_LDP_P2MP_LSP_EXPECTED_IPV4 = {
70 (byte) 0x80, (byte) 0x16, (byte) 0x35,
71 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
72 (byte) 0x06, (byte) 0x00, (byte) 0x01, (byte) 0x04,
73 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
74 (byte) 0x00, (byte) 0x26, //Opaque Values Length
75 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
76 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
77 (byte) 0x00, (byte) 0x00, (byte) 0x01,
78 (byte) 0x00, (byte) 0x00, (byte) 0x00,
79 (byte) 0x01, (byte) 0x00, (byte) 0x00,
80 (byte) 0x00, (byte) 0x00,
81 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
82 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
83 (byte) 0x00, (byte) 0x00, (byte) 0x01,
84 (byte) 0x00, (byte) 0x00, (byte) 0x00,
85 (byte) 0x01, (byte) 0x00, (byte) 0x00,
86 (byte) 0x00, (byte) 0x00, (byte) 0x01,
90 * ATT - TYPE - ATT LENGTH.
91 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
94 static final byte[] M_LDP_P2MP_LSP_EXPECTED_WRONG_FAMILY = {
95 (byte) 0x80, (byte) 0x16, (byte) 0x20,
96 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
97 (byte) 0x06, (byte) 0x00, (byte) 0xfc, (byte) 0x04,
98 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
99 (byte) 0x00, (byte) 0x11, //Opaque Values Length
100 (byte) 0x01, (byte) 0x00, (byte) 0x03, // Opaque Type - Length
101 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, //Value
102 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x06, // Opaque Type -Ext Type - Length
103 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, (byte) 0xd7, (byte) 0x6d, (byte) 0xf8, //Value
106 * ATT - TYPE - ATT LENGTH.
107 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
108 * mLDP P2MP LSP L2VPN
110 static final byte[] M_LDP_P2MP_LSP_EXPECTED_L2VPN = {
111 (byte) 0x80, (byte) 0x16, (byte) 0x35,
112 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
113 (byte) 0x06, (byte) 0x00, (byte) 0x01, (byte) 0x04,
114 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
115 (byte) 0x00, (byte) 0x26, //Opaque Values Length
116 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
117 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
118 (byte) 0x00, (byte) 0x00, (byte) 0x01,
119 (byte) 0x00, (byte) 0x00, (byte) 0x00,
120 (byte) 0x01, (byte) 0x00, (byte) 0x00,
121 (byte) 0x00, (byte) 0x00,
122 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
123 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
124 (byte) 0x00, (byte) 0x00, (byte) 0x01,
125 (byte) 0x00, (byte) 0x00, (byte) 0x00,
126 (byte) 0x01, (byte) 0x00, (byte) 0x00,
127 (byte) 0x00, (byte) 0x00, (byte) 0x01,
131 * ATT - TYPE - ATT LENGTH.
132 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
135 static final byte[] M_LDP_P2MP_LSP_EXPECTED_IPV4_2 = {
136 (byte) 0x80, (byte) 0x16, (byte) 0x3b,
137 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
138 (byte) 0x06, (byte) 0x00, (byte) 0x01, (byte) 0x04,
139 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
140 (byte) 0x00, (byte) 0x2c, //Opaque Values Length
141 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
142 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
143 (byte) 0x00, (byte) 0x00, (byte) 0x01,
144 (byte) 0x00, (byte) 0x00, (byte) 0x00,
145 (byte) 0x01, (byte) 0x00, (byte) 0x00,
146 (byte) 0x00, (byte) 0x00,
147 (byte) 0xfc, (byte) 0x00, (byte) 0x03, // Wrong Opaque Type - Length
148 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, //Value
149 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
150 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
151 (byte) 0x00, (byte) 0x00, (byte) 0x01,
152 (byte) 0x00, (byte) 0x00, (byte) 0x00,
153 (byte) 0x01, (byte) 0x00, (byte) 0x00,
154 (byte) 0x00, (byte) 0x00, (byte) 0x01,
158 * ATT - TYPE - ATT LENGTH.
159 * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
162 static final byte[] M_LDP_P2MP_LSP_EXPECTED_IPV6 = {
163 (byte) 0x80, (byte) 0x16, (byte) 0x41,
164 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
165 (byte) 0x06, (byte) 0x00, (byte) 0x02, (byte) 0x10,
166 (byte) 0x20, (byte) 0x01, (byte) 0x00, (byte) 0x00,
167 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
168 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
169 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
170 (byte) 0x00, (byte) 0x26, //Opaque Values Length
171 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
172 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
173 (byte) 0x00, (byte) 0x00, (byte) 0x01,
174 (byte) 0x00, (byte) 0x00, (byte) 0x00,
175 (byte) 0x01, (byte) 0x00, (byte) 0x00,
176 (byte) 0x00, (byte) 0x00,
177 (byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x10, // Opaque Type -Ext Type - Length
178 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
179 (byte) 0x00, (byte) 0x00, (byte) 0x01,
180 (byte) 0x00, (byte) 0x00, (byte) 0x00,
181 (byte) 0x01, (byte) 0x00, (byte) 0x00,
182 (byte) 0x00, (byte) 0x00, (byte) 0x01,
186 * ATT - TYPE - ATT LENGTH.
187 * PMSI FLAG - PMSI TYPE 3- MPLS LABEL
190 static final byte[] PIM_SSM_TREE_EXPECTED = {
191 (byte) 0x80, (byte) 0x16, (byte) 0x0d,
192 (byte) 0x01, (byte) 0x03, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
193 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
194 (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
197 * ATT - TYPE - ATT LENGTH.
198 * PMSI FLAG - PMSI TYPE 4- MPLS LABEL
201 static final byte[] PIM_SM_TREE_EXPECTED = {
202 (byte) 0x80, (byte) 0x16, (byte) 0x0d,
203 (byte) 0x01, (byte) 0x04, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
204 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
205 (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
208 * ATT - TYPE - ATT LENGTH.
209 * PMSI FLAG - PMSI TYPE 5- MPLS LABEL
212 static final byte[] BIDIR_PIM_EXPECTED = {
213 (byte) 0x80, (byte) 0x16, (byte) 0x0d,
214 (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
215 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
216 (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
219 * ATT - TYPE - ATT LENGTH.
220 * PMSI FLAG - PMSI TYPE 6- MPLS LABEL
221 * Ingress Replication
223 static final byte[] INGRESS_REPLICATION_EXPECTED = {
224 (byte) 0x80, (byte) 0x16, (byte) 0x09,
225 (byte) 0x01, (byte) 0x06, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
226 (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01
229 * ATT - TYPE - ATT LENGTH.
230 * PMSI FLAG - PMSI TYPE 7- MPLS LABEL
233 static final byte[] M_LDP_MP_2_MP_LSP_EXPECTED = {
234 (byte) 0x80, (byte) 0x16, (byte) 0x16,
235 (byte) 0x01, (byte) 0x07, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
236 (byte) 0x01, (byte) 0x00, (byte) 0x0e, // Opaque Type - Length
237 (byte) 0x07, (byte) 0x00, (byte) 0x0B, //Value
238 (byte) 0x00, (byte) 0x00, (byte) 0x01,
239 (byte) 0x00, (byte) 0x00, (byte) 0x00,
240 (byte) 0x01, (byte) 0x00, (byte) 0x00,
241 (byte) 0x00, (byte) 0x00
244 * ATT - TYPE - ATT LENGTH.
245 * PMSI FLAG - PMSI TYPE 7- MPLS LABEL
248 static final byte[] M_LDP_MP_2_MP_LSP_WRONG = {
249 (byte) 0x80, (byte) 0x16, (byte) 0x0b,
250 (byte) 0x01, (byte) 0x07, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
251 (byte) 0xfc, (byte) 0x00, (byte) 0x03, // Opaque Type - Length
252 (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, //Value
254 private static final IpAddress P_MULTICAST = new IpAddress(new Ipv4Address("23.1.1.1"));
255 private static final IpAddress IP_ADDRESS = new IpAddress(new Ipv4Address("1.1.1.1"));
256 private static final Short NO_SUPPORTED_OPAQUE = 200;
257 private static final short GENERIC_LSP_IDENTIFIER = 1;
258 private static final HexString OPAQUE_TEST = new HexString("07:00:0b:00:00:01:00:00:00:01:00:00:00:00");
259 private static final HexString OPAQUE_TEST2
260 = new HexString("07:00:0b:00:00:01:00:00:00:01:00:00:00:00:01:02");
261 private static final IpAddress IPV6 = new IpAddress(new Ipv6Address("2001::1"));
262 private static final short EXTENDED_TYPE = 255;
264 private PMSITunnelAttributeHandlerTestUtil() {
265 throw new UnsupportedOperationException();
268 private static PAddressPMulticastGroup buildPAddressPMulticastGroup() {
269 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel
270 .pmsi.tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder()
271 .setPAddress(IP_ADDRESS).setPMulticastGroup(P_MULTICAST).build();
274 private static PmsiTunnelBuilder getPmsiTunnelBuilder() {
275 final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
276 pmsiTunnelBuilder.setLeafInformationRequired(true);
277 pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
278 return pmsiTunnelBuilder;
281 private static Attributes buildAttribute(final PmsiTunnelBuilder pmsiTunnelBuilder) {
282 return new AttributesBuilder().setUnrecognizedAttributes(Collections.emptyList())
283 .addAugmentation(PmsiTunnelAugmentation.class,
284 new PmsiTunnelAugmentationBuilder().setPmsiTunnel(pmsiTunnelBuilder.build()).build()).build();
287 static Attributes buildBidirPimTreeAttribute() {
288 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
289 pmsiTunnelBuilder.setTunnelIdentifier(new BidirPimTreeBuilder()
290 .setBidirPimTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
291 .rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree
292 .BidirPimTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
293 return buildAttribute(pmsiTunnelBuilder);
296 static Attributes buildPimSMTreeAttribute() {
297 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
298 pmsiTunnelBuilder.setTunnelIdentifier(new PimSmTreeBuilder().setPimSmTree(new org.opendaylight.yang.gen.v1
299 .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel
300 .identifier.pim.sm.tree.PimSmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
301 return buildAttribute(pmsiTunnelBuilder);
304 static Attributes buildPimSSMTreeAttribute() {
305 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
306 pmsiTunnelBuilder.setTunnelIdentifier(new PimSsmTreeBuilder().setPimSsmTree(new org.opendaylight.yang.gen.v1
307 .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel
308 .identifier.pim.ssm.tree.PimSsmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
309 return buildAttribute(pmsiTunnelBuilder);
312 static Attributes buildNoSupportedOpaqueAttribute() {
313 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
314 final List<OpaqueValue> nonSupported = singletonList(new OpaqueValueBuilder()
315 .setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build());
316 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, nonSupported));
317 return buildAttribute(pmsiTunnelBuilder);
320 static Attributes buildNoSupportedFamilyAttribute() {
321 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
322 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, NonSupportedAddressFamily.class,
323 createOpaqueList()));
324 return buildAttribute(pmsiTunnelBuilder);
327 static Attributes buildMldpP2mpLspIpv4Attribute() {
328 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
329 pmsiTunnelBuilder.setTunnelIdentifier(
330 buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
331 return buildAttribute(pmsiTunnelBuilder);
334 static Attributes buildMldpP2mpLspIpv6Attribute() {
335 final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
336 pmsiTunnelBuilder.setLeafInformationRequired(true);
337 pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
338 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IPV6, Ipv6AddressFamily.class, createOpaqueList()));
339 return buildAttribute(pmsiTunnelBuilder);
342 static Attributes buildMldpp2MPLspL2vpnAttribute() {
343 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
344 pmsiTunnelBuilder.setTunnelIdentifier(
345 buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
346 return buildAttribute(pmsiTunnelBuilder);
349 private static TunnelIdentifier buildMldpP2mpLsp(final IpAddress ipAddress,
350 final Class<? extends AddressFamily> family, final List<OpaqueValue> opaqueList) {
351 return new MldpP2mpLspBuilder()
352 .setMldpP2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
353 .rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLspBuilder()
354 .setRootNodeAddress(ipAddress).setAddressFamily(family).setOpaqueValue(opaqueList).build())
358 static Attributes buildRsvpTep2MPLspAttribute() {
359 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
360 pmsiTunnelBuilder.setTunnelIdentifier(new RsvpTeP2mpLspBuilder()
361 .setRsvpTeP2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
362 .rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.rsvp.te.p2mp.lsp.RsvpTeP2mpLspBuilder()
363 .setP2mpId(3458L).setTunnelId(15).setExtendedTunnelId(IP_ADDRESS).build()).build());
364 return buildAttribute(pmsiTunnelBuilder);
367 static Attributes buildIngressReplicationAttribute() {
368 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
369 pmsiTunnelBuilder.setTunnelIdentifier(new IngressReplicationBuilder().setIngressReplication(new org
370 .opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi
371 .tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
372 .setReceivingEndpointAddress(IP_ADDRESS).build()).build());
373 return buildAttribute(pmsiTunnelBuilder);
376 static Attributes buildMldpMP2mpLspWrongAttribute() {
377 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
378 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
379 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
380 .mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE)
382 return buildAttribute(pmsiTunnelBuilder);
385 static Attributes buildMLDpMp2mPLspAttribute() {
386 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
387 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
388 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel
389 .identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST)
390 .setOpaqueType(GENERIC_LSP_IDENTIFIER).build()).build());
391 return buildAttribute(pmsiTunnelBuilder);
394 private static List<OpaqueValue> createOpaqueList() {
395 final List<OpaqueValue> opaqueValues = new ArrayList<>();
396 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST)
397 .setOpaqueType(GENERIC_LSP_IDENTIFIER).build());
398 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
399 .setOpaqueType((short) 2).setOpaqueType(EXTENDED_TYPE)
400 .setOpaqueExtendedType(4).build());
404 static Attributes buildWOTunnelInfAttribute() {
405 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
406 return buildAttribute(pmsiTunnelBuilder);
409 private interface NonSupportedAddressFamily extends AddressFamily {