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.List;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.HexString;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.AddressFamily;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv6AddressFamily;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.PAddressPMulticastGroup;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.bgp.rib.route.PmsiTunnelAugmentationBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.PmsiTunnelBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.BidirPimTreeBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.IngressReplicationBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpMp2mpLspBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLspBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSmTreeBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSsmTreeBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.RsvpTeP2mpLspBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValue;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValueBuilder;
37 import org.opendaylight.yangtools.yang.common.Uint16;
38 import org.opendaylight.yangtools.yang.common.Uint32;
39 import org.opendaylight.yangtools.yang.common.Uint8;
41 final class PMSITunnelAttributeHandlerTestUtil {
42 private static final MplsLabel MPLS_LABEL = new MplsLabel(Uint32.valueOf(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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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) 0xc0, (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 IpAddressNoZone P_MULTICAST = new IpAddressNoZone(new Ipv4AddressNoZone("23.1.1.1"));
255 private static final IpAddressNoZone IP_ADDRESS = new IpAddressNoZone(new Ipv4AddressNoZone("1.1.1.1"));
256 private static final Uint8 NO_SUPPORTED_OPAQUE = Uint8.valueOf(200);
257 private static final Uint8 GENERIC_LSP_IDENTIFIER = Uint8.ONE;
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 IpAddressNoZone IPV6 = new IpAddressNoZone(new Ipv6AddressNoZone("2001::1"));
262 private static final Uint8 EXTENDED_TYPE = Uint8.MAX_VALUE;
264 private PMSITunnelAttributeHandlerTestUtil() {
268 private static PAddressPMulticastGroup buildPAddressPMulticastGroup() {
269 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.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()
283 .addAugmentation(new PmsiTunnelAugmentationBuilder().setPmsiTunnel(pmsiTunnelBuilder.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
291 .pmsi.tunnel.rev200120.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.rev200120.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.rev200120.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 IpAddressNoZone 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
353 .pmsi.tunnel.rev200120.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
362 .pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.rsvp.te.p2mp.lsp
363 .RsvpTeP2mpLspBuilder()
364 .setP2mpId(Uint32.valueOf(3458)).setTunnelId(Uint16.valueOf(15))
365 .setExtendedTunnelId(IP_ADDRESS).build()).build());
366 return buildAttribute(pmsiTunnelBuilder);
369 static Attributes buildIngressReplicationAttribute() {
370 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
371 pmsiTunnelBuilder.setTunnelIdentifier(new IngressReplicationBuilder().setIngressReplication(new org
372 .opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi
373 .tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
374 .setReceivingEndpointAddress(IP_ADDRESS).build()).build());
375 return buildAttribute(pmsiTunnelBuilder);
378 static Attributes buildMldpMP2mpLspWrongAttribute() {
379 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
380 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
381 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
382 .mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE)
384 return buildAttribute(pmsiTunnelBuilder);
387 static Attributes buildMLDpMp2mPLspAttribute() {
388 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
389 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
390 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel
391 .identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST)
392 .setOpaqueType(Uint8.ONE).build()).build());
393 return buildAttribute(pmsiTunnelBuilder);
396 private static List<OpaqueValue> createOpaqueList() {
397 final List<OpaqueValue> opaqueValues = new ArrayList<>();
398 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST)
399 .setOpaqueType(GENERIC_LSP_IDENTIFIER).build());
400 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
401 .setOpaqueType(Uint8.TWO).setOpaqueType(EXTENDED_TYPE)
402 .setOpaqueExtendedType(Uint16.valueOf(4)).build());
406 static Attributes buildWOTunnelInfAttribute() {
407 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
408 return buildAttribute(pmsiTunnelBuilder);
411 private interface NonSupportedAddressFamily extends AddressFamily {