use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class EvpnNlriParserTest method testExtractRouteKey.
@Test
public void testExtractRouteKey() throws BGPParsingException {
final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI = ImmutableUnkeyedListEntryNodeBuilder.create();
evpnBI.withNodeIdentifier(EVPN_CHOICE_NID);
evpnBI.withChild(createValueBuilder(RD_MODEL, RD_NID).build());
evpnBI.withChild(createMACIpAdvChoice());
final EvpnDestination destResult = EvpnNlriParser.extractRouteKeyDestination(evpnBI.build());
final EvpnDestination expected = new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(MACIpAdvRParserTest.createdExpectedRouteKey()).build();
assertEquals(expected, destResult);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class EvpnNlriParserTest method testExtractEvpnDestination.
@Test
public void testExtractEvpnDestination() throws BGPParsingException {
final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI = ImmutableUnkeyedListEntryNodeBuilder.create();
evpnBI.withNodeIdentifier(EVPN_NID);
evpnBI.withChild(createMACIpAdvChoice());
evpnBI.withChild(createValueBuilder(RD_MODEL, RD_NID).build());
final EvpnDestination destResult = EvpnNlriParser.extractEvpnDestination(evpnBI.build());
final EvpnDestination expected = new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(MACIpAdvRParserTest.createdExpectedResult()).build();
assertEquals(expected, destResult);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class IncMultEthTagRParserTest method parserTest.
@Test
public void parserTest() {
final IncMultiEthernetTagResCase expected = IncMultEthTagRParserTest.createIncMultiCase();
assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
assertEquals(expected, result);
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
choice.withNodeIdentifier(IncMultEthTagRParser.INC_MULT_ROUTE_NID);
final ContainerNode incMult = createContBuilder(IncMultEthTagRParser.INC_MULT_ROUTE_NID).addChild(createEti()).addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
final EvpnChoice modelResult = this.parser.serializeEvpnModel(incMult);
assertEquals(expected, modelResult);
final EvpnChoice keyResult = this.parser.createRouteKey(incMult);
assertEquals(expected, keyResult);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class MACIpAdvRParserTest method parserCase2Test.
@Test
public void parserCase2Test() {
final MacIpAdvRouteCase expected = new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setEthernetTagId(ETI).setMacAddress(MAC).setIpAddress(IPV6).setMplsLabel1(MPLS_LABEL).build()).build();
assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE2));
assertEquals(expected, result);
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
choice.withNodeIdentifier(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID);
final ContainerNode macIp = createContBuilder(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID).addChild(LanParserTest.createLanChoice()).addChild(createEti()).addChild(createValueBuilder(MAC_MODEL, MAC_NID).build()).addChild(createValueBuilder(IPV6_MODEL, IP_NID).build()).addChild(createValueBuilder(MPLS_LABEL_MODEL, MPLS1_NID).build()).build();
final EvpnChoice modelResult = this.parser.serializeEvpnModel(macIp);
assertEquals(expected, modelResult);
}
use of org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier in project bgpcep by opendaylight.
the class ASGenParserTest method parserTest.
@Test
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
final AsGeneratedCase asGen = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder().setAs(AS_NUMBER).setLocalDiscriminator(LD).build()).build();
this.parser.serializeEsi(asGen, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
assertEquals(asGen, acResult);
final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME)).addChild(createValueBuilder(AS_MODEL, AS_NID).build()).addChild(createValueBuilder(LD, LD_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
assertEquals(asGen, acmResult);
}
Aggregations