use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandlerTest method serializeNoTunnelInfPresentExpected.
@Test
public void serializeNoTunnelInfPresentExpected() throws Exception {
final Attributes attributes = buildWOTunnelInfAttribute();
final ByteBuf actual = Unpooled.buffer();
this.handler.serializeAttribute(attributes, actual);
assertArrayEquals(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED, ByteArray.readAllBytes(actual));
final Attributes expected = buildWOTunnelInfAttribute();
final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED), null).getAttributes();
assertEquals(expected, actualAttr);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandlerTest method testMldpmP2MpLsp.
@Test
public void testMldpmP2MpLsp() throws Exception {
final Attributes expected = buildMLDpMp2mPLspAttribute();
final ByteBuf actual = Unpooled.buffer();
this.handler.serializeAttribute(expected, actual);
assertArrayEquals(M_LDP_MP_2_MP_LSP_EXPECTED, ByteArray.readAllBytes(actual));
final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_MP_2_MP_LSP_EXPECTED), null).getAttributes();
assertEquals(expected, actualAttr);
final Attributes actualWrong = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_MP_2_MP_LSP_WRONG), null).getAttributes();
assertEquals(buildWOTunnelInfAttribute(), actualWrong);
final Attributes wrongAttribute = buildMldpMP2mpLspWrongAttribute();
final ByteBuf actualWrongBuf = Unpooled.buffer();
this.handler.serializeAttribute(wrongAttribute, actualWrongBuf);
assertArrayEquals(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED, ByteArray.readAllBytes(actualWrongBuf));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class MvpnIpv4NlriHandler method serializeAttribute.
@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null && routes.getDestinationType() instanceof DestinationMvpnIpv4AdvertizedCase) {
final DestinationMvpnIpv4AdvertizedCase reach = (DestinationMvpnIpv4AdvertizedCase) routes.getDestinationType();
Ipv4NlriHandler.serializeNlri(reach.getDestinationMvpn().getMvpnDestination(), byteAggregator);
}
} else if (pathAttributes2 != null) {
final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof DestinationMvpnIpv4WithdrawnCase) {
final DestinationMvpnIpv4WithdrawnCase reach = (DestinationMvpnIpv4WithdrawnCase) withdrawnRoutes.getDestinationType();
Ipv4NlriHandler.serializeNlri(reach.getDestinationMvpn().getMvpnDestination(), byteAggregator);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class PEDistinguisherLabelsAttributeHandlerTest method testPEDistinguisherLabelsHandler.
@Test
public void testPEDistinguisherLabelsHandler() throws Exception {
final Attributes expected = buildPEDistinguisherLabelsAttributAttribute();
final ByteBuf actual = Unpooled.buffer();
this.handler.serializeAttribute(expected, actual);
assertArrayEquals(PE_DISTINGUISHER_LABELS, ByteArray.readAllBytes(actual));
final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(PE_DISTINGUISHER_LABELS), null).getAttributes();
assertEquals(expected, actualAttr);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandlerTestUtil method buildPimSMTreeAttribute.
static Attributes buildPimSMTreeAttribute() {
final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
pmsiTunnelBuilder.setTunnelIdentifier(new PimSmTreeBuilder().setPimSmTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev200120.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.sm.tree.PimSmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
return buildAttribute(pmsiTunnelBuilder);
}
Aggregations