use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.
the class SimpleEvpnNlriRegistryTest method registryTest.
@Test
public void registryTest() {
final ByteBuf buff = SimpleEvpnNlriRegistry.getInstance().serializeEvpn(ETHERNET_AD_ROUTE_CASE, Unpooled.wrappedBuffer(ROUDE_DISTIN));
assertArrayEquals(EthADRParserTest.RESULT, ByteArray.getAllBytes(buff));
final EvpnChoice resultModel = SimpleEvpnNlriRegistry.getInstance().serializeEvpnModel(createEthADRModel());
assertEquals(ETHERNET_AD_ROUTE_CASE, resultModel);
final NlriType type = NlriType.forValue(buff.readUnsignedByte());
// length + RD
buff.skipBytes(VALUE_SIZE);
assertEquals(ETHERNET_AD_ROUTE_CASE, SimpleEvpnNlriRegistry.getInstance().parseEvpn(type, buff));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.
the class LeafADHandler method parseMvpn.
@Override
public LeafADCase parseMvpn(final ByteBuf buffer) {
final NlriType type = NlriType.forValue(buffer.readUnsignedByte());
final short length = buffer.readUnsignedByte();
final MvpnChoice key = SimpleMvpnNlriRegistry.getInstance().parseMvpn(type, buffer.readSlice(length));
final LeafADRouteKey routeKey;
if (type == NlriType.InterAsIPmsiAD) {
routeKey = new InterAsIPmsiADCaseBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.InterAsIPmsiADCase) key).build();
} else {
routeKey = new SPmsiADCaseBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.mvpn.mvpn.choice.SPmsiADCase) key).build();
}
return new LeafADCaseBuilder().setLeafAD(new LeafADBuilder().setLeafADRouteKey(routeKey).setOrigRouteIp(IpAddressUtil.addressForByteBufWOLength(buffer)).build()).build();
}
Aggregations