import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import java.math.BigInteger;
import java.util.List;
import org.junit.Test;
import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator;
-import org.opendaylight.protocol.bgp.linkstate.spi.AbstractTeLspNlriCodec;
import org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkNlriParser;
import org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkstateNlriParser;
import org.opendaylight.protocol.bgp.linkstate.impl.nlri.NodeNlriParser;
-import org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry;
+import org.opendaylight.protocol.bgp.linkstate.spi.AbstractTeLspNlriCodec;
import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
+import org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
-import org.opendaylight.protocol.rsvp.parser.spi.pojo.ServiceLoaderRSVPExtensionProviderContext;
+import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.DomainIdentifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.OspfRouteType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.ProtocolId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.TopologyIdentifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.isis.lan.identifier.IsIsRouterIdentifierBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.destination.CLinkstateDestination;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.LinkCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.NodeCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.PrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.TeLspCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LinkDescriptors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LocalNodeDescriptors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.RemoteNodeDescriptors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.node._case.NodeDescriptors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.prefix._case.AdvertisingNodeDescriptors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.prefix._case.PrefixDescriptors;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.te.lsp._case.address.family.Ipv4Case;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.CRouterIdentifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.IsisNodeCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.IsisPseudonodeCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.OspfNodeCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.isis.node._case.IsisNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.node.identifier.c.router.identifier.ospf.node._case.OspfNodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlriBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlriBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.OspfRouteType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.ProtocolId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.TopologyIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.isis.lan.identifier.IsIsRouterIdentifierBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.LinkCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.NodeCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.PrefixCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.TeLspCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LocalNodeDescriptors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.RemoteNodeDescriptors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.node._case.NodeDescriptors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.prefix._case.AdvertisingNodeDescriptors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.prefix._case.PrefixDescriptors;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.te.lsp._case.address.family.Ipv4Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.CRouterIdentifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.IsisNodeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.IsisPseudonodeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.OspfNodeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.isis.node._case.IsisNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.isis.pseudonode._case.IsisPseudonodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.ospf.node._case.OspfNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReachBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreachBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.MpReachNlriBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.IsoSystemIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder;
private static final NodeIdentifier C_LINKSTATE_NID = new NodeIdentifier(CLinkstateDestination.QNAME);
private static final NodeIdentifier C_ROUTER_ID_NID = new NodeIdentifier(CRouterIdentifier.QNAME);
- private final byte[] nodeNlri = new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x02, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x23,
- (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02, (byte) 0x01,
- (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x02, (byte) 0x00, (byte) 0x04,
- (byte) 0x00, (byte) 0x29, (byte) 0x29, (byte) 0x29, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x39, (byte) 0x05 };
+ private final byte[] nodeNlri = new byte[] {
+ (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+ (byte) 0x23, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x48, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28,
+ (byte) 0x28, (byte) 0x02, (byte) 0x02, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x29, (byte) 0x29,
+ (byte) 0x29, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x39, (byte) 0x05 };
+
+ private final byte[] linkNlri = new byte[] {
+ (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x85, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
- private final byte[] linkNlri = new byte[] { (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x85, (byte) 0x02, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
// local node descriptors
(byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x2a,
- (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02, (byte) 0x01,
- (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06,
+ (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
+ (byte) 0x02, (byte) 0x01,
+ (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03,
+ (byte) 0x00, (byte) 0x06,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42,
2, 4, 0, 4, 1, 1, 1, 1,
2, 5, 0, 4, 0, 0, 1, 2,
// remote node descriptors
(byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x28,
- (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02, (byte) 0x01,
- (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x04,
+ (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
+ (byte) 0x02, (byte) 0x01,
+ (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03,
+ (byte) 0x00, (byte) 0x04,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40,
2, 4, 0, 4, 1, 1, 1, 2,
2, 5, 0, 4, 0, 0, 1, 3,
// link descriptors
1, 2, 0, 8, 1, 2, 3, 4, 0x0a,
- 0x0b, 0x0c, 0x0d, (byte) 0x01, (byte) 0x03, (byte) 0x00, (byte) 0x04, (byte) 0xc5, (byte) 0x14, (byte) 0xa0, (byte) 0x2a,
+ 0x0b, 0x0c, 0x0d, (byte) 0x01, (byte) 0x03, (byte) 0x00, (byte) 0x04, (byte) 0xc5, (byte) 0x14, (byte) 0xa0,
+ (byte) 0x2a,
(byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x04, (byte) 0xc5, (byte) 0x14, (byte) 0xa0, (byte) 0x28,
1, 7, 0, 2, 0, 3 };
- private final byte[] prefixNlri = new byte[] { (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x39, (byte) 0x02, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00,
- (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02,
- (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00,
- (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42, (byte) 0x01, (byte) 0x07, (byte) 0x00,
- (byte) 0x02, (byte) 0x00, (byte) 0x0F, (byte) 0x01, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x09,
- (byte) 0x00, (byte) 0x03, (byte) 0x10, (byte) 0xFF, (byte) 0xFF };
-
- private final byte[] teLspNlri = new byte[] { (byte) 0x00, (byte) 0x05, //NLRI Type Te-IPV4
+ private final byte[] prefixNlri = new byte[] {
+ (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x39, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x48, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28,
+ (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x00, (byte) 0x00, (byte) 0x42, (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00,
+ (byte) 0x0F, (byte) 0x01, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x09,
+ (byte) 0x00, (byte) 0x03, (byte) 0x10, (byte) 0xFF, (byte) 0xFF
+ };
+
+ private final byte[] teLspNlri = new byte[] {
+ (byte) 0x00, (byte) 0x05, //NLRI Type Te-IPV4
(byte) 0x00, (byte) 0x15, // length
(byte) 0x08, //Protocol-ID
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, // Identifier
+ // Identifier
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
(byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, //IPv4 Tunnel Sender Address
(byte) 0x00, (byte) 0x01, //Tunnel ID
(byte) 0x00, (byte) 0x01, //LSP ID
final LinkstateNlriParser parser = new LinkstateNlriParser();
final MpReachNlriBuilder builder = new MpReachNlriBuilder();
this.registry = SimpleNlriTypeRegistry.getInstance();
- final BGPActivator act = new BGPActivator(true, ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
+ final BGPActivator act = new BGPActivator(new SimpleRSVPExtensionProviderContext());
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
act.start(context);
parser.parseNlri(Unpooled.copiedBuffer(data), builder, null);
- final DestinationLinkstate ls = ((DestinationLinkstateCase) builder.getAdvertizedRoutes().getDestinationType()).getDestinationLinkstate();
+ final DestinationLinkstate ls = ((DestinationLinkstateCase) builder.getAdvertizedRoutes().getDestinationType())
+ .getDestinationLinkstate();
assertEquals(1, ls.getCLinkstateDestination().size());
this.dest = ls.getCLinkstateDestination().get(0);
// test BA form
assertNull(this.dest.getRouteDistinguisher());
assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
- assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
- final NodeCase nCase = ((NodeCase) this.dest.getObjectType());
+ assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
+ final NodeCase nCase = (NodeCase) this.dest.getObjectType();
final NodeDescriptors nodeD = nCase.getNodeDescriptors();
- assertEquals(new AsNumber(72L), nodeD.getAsNumber());
- assertEquals(new DomainIdentifier(0x28282828L), nodeD.getDomainId());
+ assertEquals(new AsNumber(Uint32.valueOf(72)), nodeD.getAsNumber());
+ assertEquals(new DomainIdentifier(Uint32.valueOf(0x28282828L)), nodeD.getDomainId());
assertEquals(new IsisPseudonodeCaseBuilder().setIsisPseudonode(
- new IsisPseudonodeBuilder().setPsn((short) 5).setIsIsRouterIdentifier(
- new IsIsRouterIdentifierBuilder().setIsoSystemId(new IsoSystemIdentifier(new byte[] { 0, 0, 0, 0, 0, (byte) 0x39 })).build()).build()).build(), nodeD.getCRouterIdentifier());
+ new IsisPseudonodeBuilder().setPsn(Uint8.valueOf(5)).setIsIsRouterIdentifier(
+ new IsIsRouterIdentifierBuilder().setIsoSystemId(
+ new IsoSystemIdentifier(new byte[] { 0, 0, 0, 0, 0, (byte) 0x39 })).build()).build()).build(),
+ nodeD.getCRouterIdentifier());
final ByteBuf buffer = Unpooled.buffer();
this.registry.serializeNlriType(this.dest, buffer);
assertArrayEquals(this.nodeNlri, ByteArray.readAllBytes(buffer));
// test BI form
- final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder
- .create();
+ final DataContainerNodeBuilder<NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+ ImmutableUnkeyedListEntryNodeBuilder.create();
linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
protocolId.withValue("isis-level2");
linkstateBI.addChild(protocolId.build());
- final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
- identifier.withValue(BigInteger.ONE);
+ identifier.withValue(Uint64.ONE);
linkstateBI.addChild(identifier.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> nodeDescriptors = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> nodeDescriptors = Builders.containerBuilder();
nodeDescriptors.withNodeIdentifier(LinkstateNlriParser.NODE_DESCRIPTORS_NID);
- final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
- asNumber.withValue(72L);
+ asNumber.withValue(Uint32.valueOf(72));
nodeDescriptors.addChild(asNumber.build());
- final ImmutableLeafNodeBuilder<Long> areaID = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> areaID = new ImmutableLeafNodeBuilder<>();
areaID.withNodeIdentifier(NodeNlriParser.AREA_NID);
- areaID.withValue(2697513L); nodeDescriptors.addChild(areaID.build());
+ areaID.withValue(Uint32.valueOf(2697513L));
+ nodeDescriptors.addChild(areaID.build());
- final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
- domainID.withValue(0x28282828L);
+ domainID.withValue(Uint32.valueOf(0x28282828L));
nodeDescriptors.addChild(domainID.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
crouterId.withNodeIdentifier(C_ROUTER_ID_NID);
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
isisNode.withNodeIdentifier(NodeNlriParser.ISIS_PSEUDONODE_NID);
final ImmutableLeafNodeBuilder<byte[]> isoSystemID = new ImmutableLeafNodeBuilder<>();
isoSystemID.withNodeIdentifier(NodeNlriParser.ISO_SYSTEM_NID);
isoSystemID.withValue(new byte[]{0, 0, 0, 0, 0, (byte) 0x39});
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisPseudoRouter = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> isisPseudoRouter =
+ Builders.containerBuilder();
isisPseudoRouter.withNodeIdentifier(NodeNlriParser.ISIS_ROUTER_NID);
isisPseudoRouter.addChild(isoSystemID.build());
isisNode.addChild(isisPseudoRouter.build());
- isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue((short) 5).build());
+ isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue(Uint8.valueOf(5))
+ .build());
crouterId.addChild(isisNode.build());
nodeDescriptors.addChild(crouterId.build());
// test BA form
assertNull(this.dest.getRouteDistinguisher());
assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
- assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+ assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
- final LinkCase lCase = ((LinkCase) this.dest.getObjectType());
+ final LinkCase lCase = (LinkCase) this.dest.getObjectType();
final LocalNodeDescriptors local = lCase.getLocalNodeDescriptors();
- assertEquals(new AsNumber(72L), local.getAsNumber());
- assertEquals(new DomainIdentifier(0x28282828L), local.getDomainId());
+ assertEquals(new AsNumber(Uint32.valueOf(72)), local.getAsNumber());
+ assertEquals(new DomainIdentifier(Uint32.valueOf(0x28282828L)), local.getDomainId());
assertEquals(
new IsisNodeCaseBuilder().setIsisNode(
- new IsisNodeBuilder().setIsoSystemId(
- new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
+ new IsisNodeBuilder().setIsoSystemId(new IsoSystemIdentifier(new byte[] {
+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42 })).build()).build(),
+ local.getCRouterIdentifier());
assertEquals("1.1.1.1", local.getBgpRouterId().getValue());
- assertEquals(new AsNumber(258L), local.getMemberAsn());
+ assertEquals(new AsNumber(Uint32.valueOf(258)), local.getMemberAsn());
final RemoteNodeDescriptors remote = lCase.getRemoteNodeDescriptors();
- assertEquals(new AsNumber(72L), remote.getAsNumber());
- assertEquals(new DomainIdentifier(0x28282828L), remote.getDomainId());
- assertEquals(new OspfNodeCaseBuilder().setOspfNode(new OspfNodeBuilder().setOspfRouterId(0x00000040L).build()).build(),
- remote.getCRouterIdentifier());
- assertEquals(new AsNumber(259L), remote.getMemberAsn());
+ assertEquals(new AsNumber(Uint32.valueOf(72)), remote.getAsNumber());
+ assertEquals(new DomainIdentifier(Uint32.valueOf(0x28282828L)), remote.getDomainId());
+ assertEquals(new OspfNodeCaseBuilder().setOspfNode(new OspfNodeBuilder()
+ .setOspfRouterId(Uint32.valueOf(0x00000040L)).build())
+ .build(), remote.getCRouterIdentifier());
+ assertEquals(new AsNumber(Uint32.valueOf(259)), remote.getMemberAsn());
assertEquals("1.1.1.2", remote.getBgpRouterId().getValue());
final LinkDescriptors ld = lCase.getLinkDescriptors();
assertArrayEquals(this.linkNlri, ByteArray.readAllBytes(buffer));
// test BI form
- final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+ ImmutableUnkeyedListEntryNodeBuilder.create();
linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
protocolId.withValue("isis-level2");
linkstateBI.addChild(protocolId.build());
- final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
- identifier.withValue(BigInteger.ONE);
+ identifier.withValue(Uint64.ONE);
linkstateBI.addChild(identifier.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
// local node descriptors
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> localNodeDescriptors = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> localNodeDescriptors =
+ Builders.containerBuilder();
localNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.LOCAL_NODE_DESCRIPTORS_NID);
- final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
- asNumber.withValue(72L);
+ asNumber.withValue(Uint32.valueOf(72));
localNodeDescriptors.addChild(asNumber.build());
- final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
- domainID.withValue(0x28282828L);
+ domainID.withValue(Uint32.valueOf(0x28282828L));
localNodeDescriptors.addChild(domainID.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
crouterId.withNodeIdentifier(C_ROUTER_ID_NID);
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
isisNode.withNodeIdentifier(NodeNlriParser.ISIS_NODE_NID);
final ImmutableLeafNodeBuilder<byte[]> isoSystemID = new ImmutableLeafNodeBuilder<>();
bgpRouterId.withNodeIdentifier(NodeNlriParser.BGP_ROUTER_NID);
bgpRouterId.withValue("1.1.1.1");
- final ImmutableLeafNodeBuilder<Long> memberAsn = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> memberAsn = new ImmutableLeafNodeBuilder<>();
memberAsn.withNodeIdentifier(NodeNlriParser.MEMBER_ASN_NID);
- memberAsn.withValue(258L);
+ memberAsn.withValue(Uint32.valueOf(258L));
localNodeDescriptors.addChild(bgpRouterId.build());
localNodeDescriptors.addChild(memberAsn.build());
// remote descriptors
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> remoteNodeDescriptors = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> remoteNodeDescriptors =
+ Builders.containerBuilder();
remoteNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.REMOTE_NODE_DESCRIPTORS_NID);
remoteNodeDescriptors.addChild(asNumber.build());
remoteNodeDescriptors.addChild(domainID.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId2 = Builders.choiceBuilder();
crouterId2.withNodeIdentifier(C_ROUTER_ID_NID);
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> ospfNode = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> ospfNode = Builders.containerBuilder();
ospfNode.withNodeIdentifier(NodeNlriParser.OSPF_NODE_NID);
- final ImmutableLeafNodeBuilder<Long> ospfRouterId = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> ospfRouterId = new ImmutableLeafNodeBuilder<>();
ospfRouterId.withNodeIdentifier(NodeNlriParser.OSPF_ROUTER_NID);
- ospfRouterId.withValue(0x00000040L);
+ ospfRouterId.withValue(Uint32.valueOf(0x00000040L));
ospfNode.addChild(ospfRouterId.build());
crouterId2.addChild(ospfNode.build());
remoteNodeDescriptors.addChild(crouterId2.build());
bgpRouterIdRemote.withValue("1.1.1.2");
remoteNodeDescriptors.addChild(bgpRouterIdRemote.build());
- final ImmutableLeafNodeBuilder<Long> memberAsnRemote = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> memberAsnRemote = new ImmutableLeafNodeBuilder<>();
memberAsnRemote.withNodeIdentifier(NodeNlriParser.MEMBER_ASN_NID);
- memberAsnRemote.withValue(259L);
+ memberAsnRemote.withValue(Uint32.valueOf(259));
remoteNodeDescriptors.addChild(memberAsnRemote.build());
// link descritpors
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> linkDescriptors = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> linkDescriptors = Builders.containerBuilder();
linkDescriptors.withNodeIdentifier(LinkstateNlriParser.LINK_DESCRIPTORS_NID);
- final ImmutableLeafNodeBuilder<Long> linkLocalIdentifier = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> linkLocalIdentifier = new ImmutableLeafNodeBuilder<>();
linkLocalIdentifier.withNodeIdentifier(LinkNlriParser.LINK_LOCAL_NID);
- linkLocalIdentifier.withValue(16909060L);
+ linkLocalIdentifier.withValue(Uint32.valueOf(16909060L));
- final ImmutableLeafNodeBuilder<Long> linkRemoteIdentifier = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> linkRemoteIdentifier = new ImmutableLeafNodeBuilder<>();
linkRemoteIdentifier.withNodeIdentifier(LinkNlriParser.LINK_REMOTE_NID);
- linkRemoteIdentifier.withValue(168496141L);
+ linkRemoteIdentifier.withValue(Uint32.valueOf(168496141L));
final ImmutableLeafNodeBuilder<String> ipv4InterfaceAddress = new ImmutableLeafNodeBuilder<>();
ipv4InterfaceAddress.withNodeIdentifier(LinkNlriParser.IPV4_IFACE_NID);
ipv4NeighborAddress.withNodeIdentifier(LinkNlriParser.IPV4_NEIGHBOR_NID);
ipv4NeighborAddress.withValue("197.20.160.40");
- final ImmutableLeafNodeBuilder<Integer> multiTopologyId = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint16> multiTopologyId = new ImmutableLeafNodeBuilder<>();
multiTopologyId.withNodeIdentifier(TlvUtil.MULTI_TOPOLOGY_NID);
- multiTopologyId.withValue(3);
+ multiTopologyId.withValue(Uint16.valueOf(3));
linkDescriptors.addChild(linkLocalIdentifier.build());
linkDescriptors.addChild(linkRemoteIdentifier.build());
// test BA form
assertNull(this.dest.getRouteDistinguisher());
assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
- assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+ assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
- final PrefixCase pCase = ((PrefixCase) this.dest.getObjectType());
+ final PrefixCase pCase = (PrefixCase) this.dest.getObjectType();
final AdvertisingNodeDescriptors local = pCase.getAdvertisingNodeDescriptors();
- assertEquals(new AsNumber(72L), local.getAsNumber());
- assertEquals(new DomainIdentifier(0x28282828L), local.getDomainId());
+ assertEquals(new AsNumber(Uint32.valueOf(72)), local.getAsNumber());
+ assertEquals(new DomainIdentifier(Uint32.valueOf(0x28282828L)), local.getDomainId());
assertEquals(
- new IsisNodeCaseBuilder().setIsisNode(
- new IsisNodeBuilder().setIsoSystemId(
- new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
+ new IsisNodeCaseBuilder().setIsisNode(new IsisNodeBuilder().setIsoSystemId(
+ new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+ (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
final PrefixDescriptors pd = pCase.getPrefixDescriptors();
assertEquals(OspfRouteType.External1, pd.getOspfRouteType());
- assertEquals(new TopologyIdentifier(15), pd.getMultiTopologyId());
+ assertEquals(new TopologyIdentifier(Uint16.valueOf(15)), pd.getMultiTopologyId());
assertEquals(new Ipv4Prefix("255.255.0.0/16"), pd.getIpReachabilityInformation().getIpv4Prefix());
final ByteBuf buffer = Unpooled.buffer();
assertArrayEquals(this.prefixNlri, ByteArray.readAllBytes(buffer));
// test BI form
- final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+ ImmutableUnkeyedListEntryNodeBuilder.create();
linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
protocolId.withValue("isis-level2");
linkstateBI.addChild(protocolId.build());
- final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
- identifier.withValue(BigInteger.ONE);
+ identifier.withValue(Uint64.ONE);
linkstateBI.addChild(identifier.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
// advertising node descriptors
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> advertisingNodeDescriptors = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> advertisingNodeDescriptors =
+ Builders.containerBuilder();
advertisingNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.ADVERTISING_NODE_DESCRIPTORS_NID);
- final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
- asNumber.withValue(72L);
+ asNumber.withValue(Uint32.valueOf(72));
advertisingNodeDescriptors.addChild(asNumber.build());
- final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
- domainID.withValue(673720360L);
+ domainID.withValue(Uint32.valueOf(673720360L));
advertisingNodeDescriptors.addChild(domainID.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
crouterId.withNodeIdentifier(C_ROUTER_ID_NID);
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
isisNode.withNodeIdentifier(NodeNlriParser.ISIS_NODE_NID);
final ImmutableLeafNodeBuilder<byte[]> isoSystemID = new ImmutableLeafNodeBuilder<>();
advertisingNodeDescriptors.addChild(crouterId.build());
// prefix descriptors
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> prefixDescriptors = Builders.containerBuilder();
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> prefixDescriptors =
+ Builders.containerBuilder();
prefixDescriptors.withNodeIdentifier(LinkstateNlriParser.PREFIX_DESCRIPTORS_NID);
prefixDescriptors.addChild(asNumber.build());
prefixDescriptors.addChild(domainID.build());
- final ImmutableLeafNodeBuilder<Integer> multiTopologyId = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint16> multiTopologyId = new ImmutableLeafNodeBuilder<>();
multiTopologyId.withNodeIdentifier(TlvUtil.MULTI_TOPOLOGY_NID);
- multiTopologyId.withValue(15);
+ multiTopologyId.withValue(Uint16.valueOf(15));
prefixDescriptors.addChild(multiTopologyId.build());
// test BA form
assertNull(this.dest.getRouteDistinguisher());
assertEquals(ProtocolId.RsvpTe, this.dest.getProtocolId());
- assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
+ assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
final TeLspCase teCase = (TeLspCase) this.dest.getObjectType();
- assertEquals(new LspId(1L), teCase.getLspId());
- assertEquals(new TunnelId(1), teCase.getTunnelId());
+ assertEquals(new LspId(Uint32.ONE), teCase.getLspId());
+ assertEquals(new TunnelId(Uint16.ONE), teCase.getTunnelId());
assertEquals(new Ipv4Address("1.2.3.4"), ((Ipv4Case) teCase.getAddressFamily()).getIpv4TunnelSenderAddress());
assertEquals(new Ipv4Address("4.3.2.1"), ((Ipv4Case) teCase.getAddressFamily()).getIpv4TunnelEndpointAddress());
// test BI form
- final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+ ImmutableUnkeyedListEntryNodeBuilder.create();
linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
protocolId.withValue("rsvp-te");
linkstateBI.addChild(protocolId.build());
- final ImmutableLeafNodeBuilder<BigInteger> identifier = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
- identifier.withValue(BigInteger.ONE);
+ identifier.withValue(Uint64.ONE);
linkstateBI.addChild(identifier.build());
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> objectType = Builders.choiceBuilder();
objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
- final ImmutableLeafNodeBuilder<Long> lspId = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint32> lspId = new ImmutableLeafNodeBuilder<>();
lspId.withNodeIdentifier(AbstractTeLspNlriCodec.LSP_ID);
- lspId.withValue(1L);
+ lspId.withValue(Uint32.ONE);
- final ImmutableLeafNodeBuilder<Integer> tunnelId = new ImmutableLeafNodeBuilder<>();
+ final ImmutableLeafNodeBuilder<Uint16> tunnelId = new ImmutableLeafNodeBuilder<>();
tunnelId.withNodeIdentifier(AbstractTeLspNlriCodec.TUNNEL_ID);
- tunnelId.withValue(1);
+ tunnelId.withValue(Uint16.ONE);
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> addressFamily = Builders.choiceBuilder();
addressFamily.withNodeIdentifier(AbstractTeLspNlriCodec.ADDRESS_FAMILY);
linkstateBI.addChild(objectType.build());
assertEquals(this.dest, LinkstateNlriParser.extractLinkstateDestination(linkstateBI.build()));
}
+
@Test
public void testSerializeAttribute() throws BGPParsingException {
final LinkstateNlriParser parser = new LinkstateNlriParser();
setUp(this.prefixNlri);
final List<CLinkstateDestination> dests = Lists.newArrayList(this.dest);
- final DestinationLinkstateCase dlc = new DestinationLinkstateCaseBuilder().setDestinationLinkstate(new DestinationLinkstateBuilder().setCLinkstateDestination(dests).build()).build();
+ final DestinationLinkstateCase dlc = new DestinationLinkstateCaseBuilder().setDestinationLinkstate(
+ new DestinationLinkstateBuilder().setCLinkstateDestination(dests).build()).build();
final AdvertizedRoutes aroutes = new AdvertizedRoutesBuilder().setDestinationType(dlc).build();
- final Attributes1 reach = new Attributes1Builder().setMpReachNlri(new MpReachNlriBuilder().setAdvertizedRoutes(aroutes).build()).build();
- Attributes pa = new AttributesBuilder().addAugmentation(Attributes1.class, reach).build();
+ Attributes pa = new AttributesBuilder()
+ .addAugmentation(new AttributesReachBuilder()
+ .setMpReachNlri(new MpReachNlriBuilder().setAdvertizedRoutes(aroutes).build())
+ .build())
+ .build();
ByteBuf result = Unpooled.buffer();
parser.serializeAttribute(pa, result);
setUp(this.nodeNlri);
final List<CLinkstateDestination> destsU = Lists.newArrayList(this.dest);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase dlcU =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder().setDestinationLinkstate(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(destsU).build()).build();
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase dlcU =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update
+ .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder()
+ .setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .bgp.linkstate.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+ .destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(destsU)
+ .build()).build();
final WithdrawnRoutes wroutes = new WithdrawnRoutesBuilder().setDestinationType(dlcU).build();
- final Attributes2 unreach = new Attributes2Builder().setMpUnreachNlri(new MpUnreachNlriBuilder().setWithdrawnRoutes(wroutes).build()).build();
- pa = new AttributesBuilder().addAugmentation(Attributes2.class, unreach).build();
+ pa = new AttributesBuilder()
+ .addAugmentation(new AttributesUnreachBuilder()
+ .setMpUnreachNlri(new MpUnreachNlriBuilder().setWithdrawnRoutes(wroutes).build())
+ .build())
+ .build();
result = Unpooled.buffer();
parser.serializeAttribute(pa, result);
assertArrayEquals(this.nodeNlri, ByteArray.getAllBytes(result));
}
-
}