use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6 in project netvirt by opendaylight.
the class NeutronPortChangeListenerTest method addPort__Ipv6FixedIps.
@Test
public void addPort__Ipv6FixedIps() throws Exception {
PortBuilder pb = new PortBuilder();
pb.setUuid(new Uuid("12345678-1234-1234-1234-123456789012"));
pb.setNetworkId(new Uuid("12345678-1234-1234-1234-123456789012"));
pb.setMacAddress(new MacAddress("AA:BB:CC:DD:EE:FF"));
IpAddress ipv6 = new IpAddress(new Ipv6Address("1::1"));
FixedIpsBuilder fib = new FixedIpsBuilder();
fib.setIpAddress(ipv6);
List<FixedIps> fixedIps = new ArrayList<>();
fixedIps.add(fib.build());
pb.setFixedIps(fixedIps);
Port port = pb.build();
neutronPortChangeListener.add(InstanceIdentifier.create(Port.class), port);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6 in project bgpcep by opendaylight.
the class EthSegRParserTest method parser2Test.
@Test
public void parser2Test() {
final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IPV6).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<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
choice.withNodeIdentifier(EthSegRParser.ES_ROUTE_NID);
final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID).addChild(LanParserTest.createLanChoice()).addChild(createValueBuilder(IPV6_MODEL, ORI_NID).build()).build();
final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
assertEquals(expected, modelResult);
final EvpnChoice keyResult = this.parser.createRouteKey(arbitraryC);
assertEquals(expected, keyResult);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6 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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6 in project bgpcep by opendaylight.
the class NextHopUtilTest method testParseNextHop.
@Test
public void testParseNextHop() {
CNextHop hop = null;
try {
hop = NextHopUtil.parseNextHop(Unpooled.wrappedBuffer(IPV4B));
} catch (final IllegalArgumentException e) {
fail("This exception should not happen");
}
assertEquals(IPV4, ((Ipv4NextHopCase) hop).getIpv4NextHop().getGlobal());
try {
hop = NextHopUtil.parseNextHop(Unpooled.wrappedBuffer(IPV6B));
} catch (final IllegalArgumentException e) {
fail("This exception should not happen");
}
assertEquals(IPV6, ((Ipv6NextHopCase) hop).getIpv6NextHop().getGlobal());
assertNull(((Ipv6NextHopCase) hop).getIpv6NextHop().getLinkLocal());
try {
hop = NextHopUtil.parseNextHop(Unpooled.wrappedBuffer(IPV6LB));
} catch (final IllegalArgumentException e) {
fail("This exception should not happen");
}
assertEquals(IPV6, ((Ipv6NextHopCase) hop).getIpv6NextHop().getGlobal());
assertEquals(IPV6L, ((Ipv6NextHopCase) hop).getIpv6NextHop().getLinkLocal());
final byte[] wrong = new byte[] { (byte) 0x20, (byte) 0x01, (byte) 0x0d };
try {
NextHopUtil.parseNextHop(Unpooled.wrappedBuffer(wrong));
fail("Exception should happen");
} catch (final IllegalArgumentException e) {
assertEquals("Cannot parse NEXT_HOP attribute. Wrong bytes length: 3", e.getMessage());
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6 in project bgpcep by opendaylight.
the class BGPParserTest method testEORIpv6.
/*
* End of Rib for Ipv6 consists of empty MP_UNREACH_NLRI, with AFI 2 and SAFI 1
*
* ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
* 00 1d <- length (29) - including header
* 02 <- message type
* 00 00 <- withdrawn routes length
* 00 06 <- total path attribute length
* 80 <- attribute flags
* 0f <- attribute type (15 - MP_UNREACH_NLRI)
* 03 <- attribute length
* 00 02 <- value (AFI 2: IPv6)
* 01 <- value (SAFI 1)
*/
@Test
public void testEORIpv6() throws Exception {
final byte[] body = ByteArray.cutBytes(inputBytes.get(6), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(6), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);
final Class<? extends AddressFamily> afi = message.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getAfi();
final Class<? extends SubsequentAddressFamily> safi = message.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getSafi();
assertEquals(Ipv6AddressFamily.class, afi);
assertEquals(UnicastSubsequentAddressFamily.class, safi);
final ByteBuf buffer = Unpooled.buffer();
BGPParserTest.updateParser.serializeMessage(message, buffer);
assertArrayEquals(inputBytes.get(6), ByteArray.readAllBytes(buffer));
}
Aggregations