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.evpn.impl.attributes.tunnel.identifier;
11 import static java.util.Collections.singletonList;
12 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.IPV6;
13 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MPLS_LABEL;
14 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.OpaqueUtilTest.OPAQUE_TEST;
15 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.OpaqueUtilTest.OPAQUE_TEST2;
17 import java.util.ArrayList;
18 import java.util.Collections;
19 import java.util.List;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
21 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.L2vpnAddressFamily;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.PmsiTunnelAugmentation;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.PmsiTunnelAugmentationBuilder;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.PAddressPMulticastGroup;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.PmsiTunnelBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.BidirPimTreeBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.IngressReplicationBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpMp2mpLspBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.MldpP2mpLspBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSmTreeBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.PimSsmTreeBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.RsvpTeP2mpLspBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValue;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValueBuilder;
42 import org.opendaylight.yangtools.yang.binding.DataContainer;
44 final class PMSITunnelAttributeHandlerTestUtil {
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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (byte) 0x16, (byte) 0x35,
114 (byte) 0x01, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
115 (byte) 0x06, (byte) 0x00, (byte) 0x19, (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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (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) 0x80, (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
257 static final IpAddress P_MULTICAST = new IpAddress(new Ipv4Address("23.1.1.1"));
258 static final IpAddress IP_ADDRESS = new IpAddress(new Ipv4Address("1.1.1.1"));
259 private static final Short NO_SUPPORTED_OPAQUE = 200;
261 static class MockTunnelIdentifier implements TunnelIdentifier {
263 public Class<? extends DataContainer> getImplementedInterface() {
264 return MockTunnelIdentifier.class;
268 private abstract static class NonSupportedAddressFamily extends AddressFamily {
271 private static PAddressPMulticastGroup buildPAddressPMulticastGroup() {
272 return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
273 .pmsi.tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder()
274 .setPAddress(IP_ADDRESS).setPMulticastGroup(P_MULTICAST).build();
277 private static PmsiTunnelBuilder getPmsiTunnelBuilder() {
278 final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
279 pmsiTunnelBuilder.setLeafInformationRequired(true);
280 pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
281 return pmsiTunnelBuilder;
284 private static Attributes buildAttribute(final PmsiTunnelBuilder pmsiTunnelBuilder) {
285 return new AttributesBuilder().setUnrecognizedAttributes(Collections.emptyList())
286 .addAugmentation(PmsiTunnelAugmentation.class,
287 new PmsiTunnelAugmentationBuilder().setPmsiTunnel(pmsiTunnelBuilder.build()).build()).build();
290 static Attributes buildBidirPimTreeAttribute() {
291 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
292 pmsiTunnelBuilder.setTunnelIdentifier(new BidirPimTreeBuilder()
293 .setBidirPimTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
294 .rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree
295 .BidirPimTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
296 return buildAttribute(pmsiTunnelBuilder);
299 static Attributes buildPimSMTreeAttribute() {
300 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
301 pmsiTunnelBuilder.setTunnelIdentifier(new PimSmTreeBuilder().setPimSmTree(new org.opendaylight.yang.gen.v1
302 .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel
303 .identifier.pim.sm.tree.PimSmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
304 return buildAttribute(pmsiTunnelBuilder);
307 static Attributes buildPimSSMTreeAttribute() {
308 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
309 pmsiTunnelBuilder.setTunnelIdentifier(new PimSsmTreeBuilder().setPimSsmTree(new org.opendaylight.yang.gen.v1
310 .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel
311 .identifier.pim.ssm.tree.PimSsmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
312 return buildAttribute(pmsiTunnelBuilder);
315 static Attributes buildNoSupportedOpaqueAttribute() {
316 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
317 final List<OpaqueValue> nonSupported = singletonList(new OpaqueValueBuilder()
318 .setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build());
319 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, nonSupported));
320 return buildAttribute(pmsiTunnelBuilder);
323 static Attributes buildNoSupportedFamilyAttribute() {
324 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
325 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, NonSupportedAddressFamily.class,
326 createOpaqueList()));
327 return buildAttribute(pmsiTunnelBuilder);
330 static Attributes buildMldpP2mpLspIpv4Attribute() {
331 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
332 pmsiTunnelBuilder.setTunnelIdentifier(
333 buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
334 return buildAttribute(pmsiTunnelBuilder);
337 static Attributes buildMldpP2mpLspIpv6Attribute() {
338 final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
339 pmsiTunnelBuilder.setLeafInformationRequired(true);
340 pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
341 pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IPV6, Ipv6AddressFamily.class, createOpaqueList()));
342 return buildAttribute(pmsiTunnelBuilder);
345 static Attributes buildMldpp2MPLspL2vpnAttribute() {
346 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
347 pmsiTunnelBuilder.setTunnelIdentifier(
348 buildMldpP2mpLsp(IP_ADDRESS, L2vpnAddressFamily.class, createOpaqueList()));
349 return buildAttribute(pmsiTunnelBuilder);
352 private static TunnelIdentifier buildMldpP2mpLsp(final IpAddress ipAddress,
353 final Class<? extends AddressFamily> family, final List<OpaqueValue> opaqueList) {
354 return new MldpP2mpLspBuilder().setMldpP2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
355 .ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLspBuilder()
356 .setRootNodeAddress(ipAddress).setAddressFamily(family).setOpaqueValue(opaqueList).build()).build();
359 static Attributes buildRsvpTep2MPLspAttribute() {
360 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
361 pmsiTunnelBuilder.setTunnelIdentifier(new RsvpTeP2mpLspBuilder()
362 .setRsvpTeP2mpLps(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
363 .rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.rsvp.te.p2mp.lsp.RsvpTeP2mpLpsBuilder()
364 .setP2mpId(3458L).setTunnelId(15).setExtendedTunnelId(IP_ADDRESS).build()).build());
365 return buildAttribute(pmsiTunnelBuilder);
368 static Attributes buildIngressReplicationAttribute() {
369 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
370 pmsiTunnelBuilder.setTunnelIdentifier(new IngressReplicationBuilder().setIngressReplication(new org
371 .opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
372 .tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
373 .setReceivingEndpointAddress(IP_ADDRESS).build()).build());
374 return buildAttribute(pmsiTunnelBuilder);
377 static Attributes buildMldpMP2mpLspWrongAttribute() {
378 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
379 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
380 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
381 .mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE)
383 return buildAttribute(pmsiTunnelBuilder);
386 static Attributes buildMLDpMp2mPLspAttribute() {
387 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
388 pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
389 .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel
390 .identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST)
391 .setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build()).build());
392 return buildAttribute(pmsiTunnelBuilder);
395 private static List<OpaqueValue> createOpaqueList() {
396 final List<OpaqueValue> opaqueValues = new ArrayList<>();
397 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST)
398 .setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build());
399 opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
400 .setOpaqueType((short) 2).setOpaqueType(OpaqueUtil.EXTENDED_TYPE)
401 .setOpaqueExtendedType(4).build());
405 static Attributes buildWOTunnelInfAttribute() {
406 final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
407 return buildAttribute(pmsiTunnelBuilder);