Convert rsvp-api to use ip-address-no-zone 65/72765/11
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 7 Jun 2018 15:28:52 +0000 (17:28 +0200)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Thu, 12 Jul 2018 09:39:24 +0000 (09:39 +0000)
First step in conversion, more to follow.

Change-Id: I94c7efcdb5fdb6248797105e73e4cacd5b7f5816
JIRA: BGPCEP-790
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 files changed:
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAttributeParserTest.java
pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PcRptMessageCodecTest.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07LSPIdentifierIpv4TlvParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07LSPIdentifierIpv6TlvParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07RSVPErrorSpecTlvParser.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPObjectParserTest.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPTlvParserTest.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPValidatorTest.java
rsvp/api/src/main/yang/rsvp.yang
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/AbstractAssociationParser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/AssociationObjectParserIPV4.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/AssociationObjectParserIPV6.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/DetourObjectIpv4Parser.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/te/DetourObjectIpv6Parser.java
util/src/main/java/org/opendaylight/protocol/util/Ipv4Util.java
util/src/main/java/org/opendaylight/protocol/util/Ipv6Util.java

index c50d63e1636c68262bdc7bd5227b9a6f11bc2b02..8702777d75fae3a44929bfbd950259cbc14a007d 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.protocol.rsvp.parser.spi.RSVPExtensionProviderContext;
 import org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.util.Ipv4Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
 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.inet.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
@@ -319,7 +319,7 @@ public class LinkstateAttributeParserTest {
 
         final AssociationObject associationObject = teLspAttributes.getAssociationObject();
         assertEquals(AssociationType.Recovery, associationObject.getAssociationType());
-        final IpAddress ipv4 = new IpAddress(Ipv4Util.addressForByteBuf(Unpooled.copiedBuffer(new byte[]{0x01, 0x02, 0x03, 0x04})));
+        final IpAddressNoZone ipv4 = new IpAddressNoZone(Ipv4Util.noZoneAddressForByteBuf(Unpooled.copiedBuffer(new byte[]{0x01, 0x02, 0x03, 0x04})));
         assertEquals(ipv4, associationObject.getIpAddress());
         final short associationId = 2;
         assertEquals(associationId, associationObject.getAssociationId().shortValue());
index 39501084c3fb133af46e500eb42fd68b12260920..b6d95ffda7f62fa863d7e581894ee1eda649af10 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
 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.Ipv4AddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.Bandwidth1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.bandwidth.usage.object.BandwidthUsage;
@@ -85,7 +86,7 @@ public class PcRptMessageCodecTest {
         final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
         final Ipv4Builder builder = new Ipv4Builder();
         builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
-        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
+        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4AddressNoZone("127.0.1.2")));
         builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
         final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
         final LspId lspId = new LspId(1L);
@@ -107,7 +108,7 @@ public class PcRptMessageCodecTest {
         final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
         final Ipv4Builder builder = new Ipv4Builder();
         builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
-        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
+        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4AddressNoZone("127.0.1.2")));
         builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
         final Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L)).build();
         final Ero ero = new EroBuilder().build();
index dba67fdf92193637cd512fd7ed281077324b7fd0..0c459dcdfa9175a7978798e475ccd534368d2e24 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.pcep.ietf.stateful07;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv4Address;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeShort;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -50,7 +51,7 @@ public final class Stateful07LSPIdentifierIpv4TlvParser implements TlvParser, Tl
         builder.setIpv4TunnelSenderAddress(Ipv4Util.addressForByteBuf(buffer));
         final LspId lspId = new LspId((long) buffer.readUnsignedShort());
         final TunnelId tunnelId = new TunnelId(buffer.readUnsignedShort());
-        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForByteBuf(buffer)));
+        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.noZoneAddressForByteBuf(buffer)));
         builder.setIpv4TunnelEndpointAddress(Ipv4Util.addressForByteBuf(buffer));
         final AddressFamily afi = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
         return new LspIdentifiersBuilder().setAddressFamily(afi).setLspId(lspId).setTunnelId(tunnelId).build();
index 9188601e9a48ce25e372693c6be3c0cf33281c77..7cd841dfc685cfeb71d2712a358cf724033390fb 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.pcep.ietf.stateful07;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeIpv6Address;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeShort;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -49,7 +50,7 @@ public final class Stateful07LSPIdentifierIpv6TlvParser implements TlvParser, Tl
         builder.setIpv6TunnelSenderAddress(Ipv6Util.addressForByteBuf(buffer));
         final LspId lspId = new LspId((long) buffer.readUnsignedShort());
         final TunnelId tunnelId = new TunnelId(buffer.readUnsignedShort());
-        builder.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForByteBuf(buffer)));
+        builder.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.noZoneAddressForByteBuf(buffer)));
         builder.setIpv6TunnelEndpointAddress(Ipv6Util.addressForByteBuf(buffer));
         final AddressFamily afi = new Ipv6CaseBuilder().setIpv6(builder.build()).build();
         return new LspIdentifiersBuilder().setAddressFamily(afi).setLspId(lspId).setTunnelId(tunnelId).build();
index ba709117796c6cf1bbcc5bd24e15b180aee30751..d7f6f0eb44e7a534cd3fef638687c1504eece020 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.protocol.util.BitArray;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.protocol.util.Ipv6Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.rsvp.error.spec.tlv.RsvpErrorSpec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.rsvp.error.spec.tlv.RsvpErrorSpecBuilder;
@@ -123,9 +123,9 @@ public final class Stateful07RSVPErrorSpecTlvParser implements TlvParser, TlvSer
     private static RsvpCase parseRsvp(final int classType, final ByteBuf buffer) {
         final RsvpErrorBuilder builder = new RsvpErrorBuilder();
         if (classType == RSVP_IPV4_ERROR_CLASS_TYPE) {
-            builder.setNode(new IpAddress(Ipv4Util.addressForByteBuf(buffer)));
+            builder.setNode(new IpAddressNoZone(Ipv4Util.noZoneAddressForByteBuf(buffer)));
         } else if (classType == RSVP_IPV6_ERROR_CLASS_TYPE) {
-            builder.setNode(new IpAddress(Ipv6Util.addressForByteBuf(buffer)));
+            builder.setNode(new IpAddressNoZone(Ipv6Util.noZoneAddressForByteBuf(buffer)));
         }
         final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
         builder.setFlags(new Flags(flags.get(IN_PLACE), flags.get(NOT_GUILTY)));
@@ -140,16 +140,16 @@ public final class Stateful07RSVPErrorSpecTlvParser implements TlvParser, TlvSer
         final BitArray flags = new BitArray(FLAGS_SIZE);
         flags.set(IN_PLACE, rsvp.getFlags().isInPlace());
         flags.set(NOT_GUILTY, rsvp.getFlags().isNotGuilty());
-        final IpAddress node = rsvp.getNode();
+        final IpAddressNoZone node = rsvp.getNode();
         Preconditions.checkArgument(node != null, "Node is mandatory.");
         final ByteBuf rsvpObjBuf = Unpooled.buffer();
         int type = 0;
-        if (node.getIpv4Address() != null) {
+        if (node.getIpv4AddressNoZone() != null) {
             type = RSVP_IPV4_ERROR_CLASS_TYPE;
-            writeIpv4Address(node.getIpv4Address(), rsvpObjBuf);
+            writeIpv4Address(node.getIpv4AddressNoZone(), rsvpObjBuf);
         } else {
             type = RSVP_IPV6_ERROR_CLASS_TYPE;
-            writeIpv6Address(node.getIpv6Address(), rsvpObjBuf);
+            writeIpv6Address(node.getIpv6AddressNoZone(), rsvpObjBuf);
         }
         flags.toByteBuf(rsvpObjBuf);
         Preconditions.checkArgument(rsvp.getCode() != null, "Code is mandatory.");
index 65458299ff8c7d20a12ac7b446cbb9ef834778dc..c30474c884cae6375d3debdb9935aef5e27b9b5e 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.ietf;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.io.IOException;
@@ -31,7 +32,7 @@ import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsLspObj
 import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsOpenObjectParser;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.util.Ipv4Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Stateful1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3;
@@ -190,13 +191,13 @@ public class PCEPObjectParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SymbolicPathName("Med".getBytes())).build();
         final Ipv4Builder afi = new Ipv4Builder();
         afi.setIpv4TunnelSenderAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
-        afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
+        afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
             (byte) 0x78 }))));
         afi.setIpv4TunnelEndpointAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
         final LspIdentifiers tlv3 = new LspIdentifiersBuilder().setAddressFamily(new Ipv4CaseBuilder().setIpv4(afi.build()).build()).setLspId(
             new LspId(65535L)).setTunnelId(new TunnelId(4660)).build();
         final RsvpErrorBuilder rsvpBuilder = new RsvpErrorBuilder();
-        rsvpBuilder.setNode(new IpAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }))));
+        rsvpBuilder.setNode(new IpAddressNoZone(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }))));
         rsvpBuilder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true));
         rsvpBuilder.setCode((short) 146);
         rsvpBuilder.setValue(5634);
index 336004c10136a2418bc1e51db3d38b2cfe3aae65..0082374ec49a2747e706edc3c7d17208d90d921e 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsCapabi
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.protocol.util.Ipv6Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.error.code.tlv.LspErrorCode;
@@ -131,7 +131,7 @@ public class PCEPTlvParserTest {
         final Stateful07LSPIdentifierIpv4TlvParser parser = new Stateful07LSPIdentifierIpv4TlvParser();
         final Ipv4Builder afi = new Ipv4Builder();
         afi.setIpv4TunnelSenderAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
-        afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
+        afi.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
             (byte) 0x78 }))));
         afi.setIpv4TunnelEndpointAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 })));
         final LspIdentifiers tlv = new LspIdentifiersBuilder().setAddressFamily(new Ipv4CaseBuilder().setIpv4(afi.build()).build()).setLspId(
@@ -149,7 +149,7 @@ public class PCEPTlvParserTest {
         afi.setIpv6TunnelSenderAddress(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
             (byte) 0x9A, (byte) 0xBC, (byte) 0xDE, (byte) 0xF0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9A,
             (byte) 0xBC, (byte) 0xDE, (byte) 0xF0 })));
-        afi.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
+        afi.setIpv6ExtendedTunnelId(new Ipv6ExtendedTunnelId(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56,
             (byte) 0x78, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67,
             (byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67 }))));
         afi.setIpv6TunnelEndpointAddress(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
@@ -167,7 +167,7 @@ public class PCEPTlvParserTest {
     public void testRSVPError4SpecTlv() throws PCEPDeserializerException {
         final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
         final RsvpErrorBuilder builder = new RsvpErrorBuilder();
-        builder.setNode(new IpAddress(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }))));
+        builder.setNode(new IpAddressNoZone(Ipv4Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }))));
         builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true));
         builder.setCode((short) 146);
         builder.setValue(5634);
@@ -182,7 +182,7 @@ public class PCEPTlvParserTest {
     public void testRSVPError6SpecTlv() throws PCEPDeserializerException {
         final Stateful07RSVPErrorSpecTlvParser parser = new Stateful07RSVPErrorSpecTlvParser();
         final RsvpErrorBuilder builder = new RsvpErrorBuilder();
-        builder.setNode(new IpAddress(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
+        builder.setNode(new IpAddressNoZone(Ipv6Util.noZoneAddressForByteBuf(Unpooled.wrappedBuffer(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78,
             (byte) 0x9a, (byte) 0xbc, (byte) 0xde, (byte) 0xf0, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a,
             (byte) 0xbc, (byte) 0xde, (byte) 0xf0 }))));
         builder.setFlags(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ErrorSpec.Flags(false, true));
index e9e5b6887fce012f4f5d8877ca49371ae525cfa2..fdbc118d479e7f02a77b0a21f6541b0a66294e27 100644 (file)
@@ -33,6 +33,7 @@ import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContex
 import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator;
 import org.opendaylight.protocol.util.ByteArray;
 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.Ipv4AddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1;
@@ -272,7 +273,7 @@ public class PCEPValidatorTest {
         builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
         final LspId lspId = new LspId(1L);
         final TunnelId tunnelId = new TunnelId(1);
-        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
+        builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4AddressNoZone("127.0.1.2")));
         builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
         final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
         final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
index 291b1fdd4dd43466483087e37bf1896343102cb5..e703c29988755af48f4c3d8413e10d6a2e07beee 100644 (file)
@@ -105,12 +105,12 @@ module rsvp {
     }
 
     typedef ipv4-extended-tunnel-id {
-        type inet:ipv4-address;
+        type inet:ipv4-address-no-zone;
         reference "https://tools.ietf.org/html/rfc3209#section-4.6.1.1";
     }
 
     typedef ipv6-extended-tunnel-id {
-        type inet:ipv6-address;
+        type inet:ipv6-address-no-zone;
         reference "https://tools.ietf.org/html/rfc3209#section-4.6.1.2";
     }
 
@@ -172,7 +172,7 @@ module rsvp {
         reference "https://tools.ietf.org/html/rfc2205#page-81";
 
         leaf node {
-            type inet:ip-address;
+            type inet:ip-address-no-zone;
             mandatory true;
         }
 
@@ -732,7 +732,7 @@ module rsvp {
                 type uint16;
             }
             leaf ip-address {
-                type inet:ip-address;
+                type inet:ip-address-no-zone;
                 mandatory true;
             }
         }
@@ -782,11 +782,11 @@ module rsvp {
                 uses rsvp-te-object;
                 list plr {
                     leaf plr-id {
-                        type inet:ipv4-address;
+                        type inet:ipv4-address-no-zone;
                         mandatory true;
                     }
                     leaf avoid-node {
-                        type inet:ipv4-address;
+                        type inet:ipv4-address-no-zone;
                         mandatory true;
                     }
                 }
@@ -795,13 +795,13 @@ module rsvp {
                 uses rsvp-te-object;
                 list plr-id {
                     leaf plr-id {
-                        type inet:ipv6-address;
+                        type inet:ipv6-address-no-zone;
                         mandatory true;
                     }
                 }
                 list avoid-node {
                     leaf avoid-node {
-                        type inet:ipv6-address;
+                        type inet:ipv6-address-no-zone;
                         mandatory true;
                     }
                 }
index 44b29d76ccab8f4814076cf8d161faead2145707..5498839295374c22db1a7cc677a24decd5caa161 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
 import org.opendaylight.protocol.rsvp.parser.spi.subobjects.AbstractRSVPObjectParser;
 import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.protocol.util.Ipv6Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AssociationType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObject;
@@ -27,23 +27,23 @@ public abstract class AbstractAssociationParser extends AbstractRSVPObjectParser
     private static final Integer BODY_SIZE_IPV4 = 8;
     private static final Integer BODY_SIZE_IPV6 = 20;
 
-    protected abstract IpAddress parseAssociationIpAddress(ByteBuf byteBuf);
+    protected abstract IpAddressNoZone parseAssociationIpAddress(ByteBuf byteBuf);
 
     @Override
     protected final void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
         Preconditions.checkArgument(teLspObject instanceof AssociationObject, "AssociationObject is mandatory.");
         final AssociationObject assObject = (AssociationObject) teLspObject;
 
-        if (assObject.getIpAddress().getIpv4Address() != null) {
+        if (assObject.getIpAddress().getIpv4AddressNoZone() != null) {
             serializeAttributeHeader(BODY_SIZE_IPV4, CLASS_NUM, CTYPE_IPV4, output);
             output.writeShort(assObject.getAssociationType().getIntValue());
             output.writeShort(assObject.getAssociationId());
-            output.writeBytes(Ipv4Util.byteBufForAddress(assObject.getIpAddress().getIpv4Address()));
+            output.writeBytes(Ipv4Util.byteBufForAddress(assObject.getIpAddress().getIpv4AddressNoZone()));
         } else {
             serializeAttributeHeader(BODY_SIZE_IPV6, CLASS_NUM, CTYPE_IPV6, output);
             output.writeShort(assObject.getAssociationType().getIntValue());
             output.writeShort(assObject.getAssociationId());
-            output.writeBytes(Ipv6Util.byteBufForAddress(assObject.getIpAddress().getIpv6Address()));
+            output.writeBytes(Ipv6Util.byteBufForAddress(assObject.getIpAddress().getIpv6AddressNoZone()));
         }
     }
 
index bd84ec7fc10850b8dbd8cd4e2fb444c96542f042..e8f71738f11dbf1a2f0c478ce37e2e5b099014c9 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.protocol.rsvp.parser.impl.te;
 
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.util.Ipv4Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 
 public final class AssociationObjectParserIPV4 extends AbstractAssociationParser {
     @Override
-    protected IpAddress parseAssociationIpAddress(final ByteBuf byteBuf) {
-        return new IpAddress(Ipv4Util.addressForByteBuf(byteBuf));
+    protected IpAddressNoZone parseAssociationIpAddress(final ByteBuf byteBuf) {
+        return new IpAddressNoZone(Ipv4Util.noZoneAddressForByteBuf(byteBuf));
     }
 }
index bfb479a17951666c4b381493898200d031d984bb..6d66fd3fdf6b5753d4cf0e4261fcab9cc9bac8ce 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.protocol.rsvp.parser.impl.te;
 
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.util.Ipv6Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
 
 public final class AssociationObjectParserIPV6 extends AbstractAssociationParser {
     @Override
-    protected IpAddress parseAssociationIpAddress(final ByteBuf byteBuf) {
-        return new IpAddress(Ipv6Util.addressForByteBuf(byteBuf));
+    protected IpAddressNoZone parseAssociationIpAddress(final ByteBuf byteBuf) {
+        return new IpAddressNoZone(Ipv6Util.noZoneAddressForByteBuf(byteBuf));
     }
 }
index 5bd65a1e137dc10c4827bf8eebfbea5c35aacc0a..02ebd79f97061700923af793b45e9c650877d8cf 100644 (file)
@@ -32,8 +32,8 @@ public final class DetourObjectIpv4Parser extends AbstractRSVPObjectParser {
         final List<Plr> plrList = new ArrayList<>();
         while (byteBuf.isReadable()) {
             final PlrBuilder plr = new PlrBuilder();
-            plr.setPlrId(Ipv4Util.addressForByteBuf(byteBuf));
-            plr.setAvoidNode(Ipv4Util.addressForByteBuf(byteBuf));
+            plr.setPlrId(Ipv4Util.noZoneAddressForByteBuf(byteBuf));
+            plr.setAvoidNode(Ipv4Util.noZoneAddressForByteBuf(byteBuf));
             plrList.add(plr.build());
         }
         return ipv4Case.setPlr(plrList).build();
index 618e96356b3e14fef9d6413217ac4b9765dc47b0..f37f19bafda3626ef17745330d4f82c03765c4fd 100644 (file)
@@ -36,14 +36,14 @@ public final class DetourObjectIpv6Parser extends AbstractRSVPObjectParser {
 
         while (plrId.isReadable()) {
             final PlrIdBuilder plr = new PlrIdBuilder();
-            plr.setPlrId(Ipv6Util.addressForByteBuf(plrId));
+            plr.setPlrId(Ipv6Util.noZoneAddressForByteBuf(plrId));
             plrIdList.add(plr.build());
         }
 
         final List<AvoidNode> avoidNodeList = new ArrayList<>();
         while (byteBuf.isReadable()) {
             final AvoidNodeBuilder plr = new AvoidNodeBuilder();
-            plr.setAvoidNode(Ipv6Util.addressForByteBuf(byteBuf));
+            plr.setAvoidNode(Ipv6Util.noZoneAddressForByteBuf(byteBuf));
             avoidNodeList.add(plr.build());
         }
 
@@ -57,7 +57,7 @@ public final class DetourObjectIpv6Parser extends AbstractRSVPObjectParser {
 
         final List<PlrId> pList = detourObject.getPlrId();
         final List<AvoidNode> aList = detourObject.getAvoidNode();
-        serializeAttributeHeader((pList.size() * Ipv6Util.IPV6_LENGTH) + (aList.size() * Ipv6Util.IPV6_LENGTH),
+        serializeAttributeHeader(pList.size() * Ipv6Util.IPV6_LENGTH + aList.size() * Ipv6Util.IPV6_LENGTH,
             CLASS_NUM,
             CTYPE, byteAggregator);
 
index 97711cc5f6476389f62db2ac89ff6a1739263a51..cced9ba6cb2575f637e692c2556f13ac2da4fe79 100644 (file)
@@ -22,6 +22,7 @@ import java.util.Map;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 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.Ipv4AddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 
@@ -47,6 +48,16 @@ public final class Ipv4Util {
         return IetfInetUtil.INSTANCE.ipv4AddressFor(ByteArray.readBytes(buffer, IP4_LENGTH));
     }
 
+    /**
+     * Reads from ByteBuf buffer and converts bytes to Ipv4Address.
+     *
+     * @param buffer containing Ipv4 address, starting at reader index
+     * @return Ipv4AddressNoZone
+     */
+    public static Ipv4AddressNoZone noZoneAddressForByteBuf(final ByteBuf buffer) {
+        return IetfInetUtil.INSTANCE.ipv4AddressNoZoneFor(ByteArray.readBytes(buffer, IP4_LENGTH));
+    }
+
     /**
      * From string ipAddress creates an InetAddress and puts it into ByteBuf.
      *
@@ -69,7 +80,7 @@ public final class Ipv4Util {
 
     public static int prefixBitsToBytes(final int bits) {
         if (bits % Byte.SIZE != 0) {
-            return (bits / Byte.SIZE) + 1;
+            return bits / Byte.SIZE + 1;
         }
         return bits / Byte.SIZE;
     }
@@ -120,7 +131,7 @@ public final class Ipv4Util {
      */
     public static Ipv4Prefix prefixForByteBuf(final ByteBuf buf) {
         final int prefixLength = UnsignedBytes.toInt(buf.readByte());
-        final int size = prefixLength / Byte.SIZE + ((prefixLength % Byte.SIZE == 0) ? 0 : 1);
+        final int size = prefixLength / Byte.SIZE + (prefixLength % Byte.SIZE == 0 ? 0 : 1);
         final int readable = buf.readableBytes();
         Preconditions.checkArgument(size <= readable, "Illegal length of IP prefix: %s/%s", size, readable);
 
index 69916831699d53abfe0588500e536c1450c587d8..31c94f8692402a56c42b186e2ba12998bf370ff6 100644 (file)
@@ -18,6 +18,7 @@ import java.util.Collections;
 import java.util.List;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 
 /**
@@ -52,6 +53,16 @@ public final class Ipv6Util {
         return IetfInetUtil.INSTANCE.ipv6AddressFor(ByteArray.readBytes(buffer, IPV6_LENGTH));
     }
 
+    /**
+     * Reads from ByteBuf buffer and converts bytes to Ipv6AddressNoZone.
+     *
+     * @param buffer containing Ipv6 address, starting at reader index
+     * @return Ipv6AddressNoZone
+     */
+    public static Ipv6AddressNoZone noZoneAddressForByteBuf(final ByteBuf buffer) {
+        return IetfInetUtil.INSTANCE.ipv6AddressNoZoneFor(ByteArray.readBytes(buffer, IPV6_LENGTH));
+    }
+
     /**
      * From string ipAddress creates an InetAddress and puts it into ByteBuf.
      * @param ipAddress Ipv6 address
@@ -110,7 +121,7 @@ public final class Ipv6Util {
      */
     public static Ipv6Prefix prefixForByteBuf(final ByteBuf buf) {
         final int prefixLength = UnsignedBytes.toInt(buf.readByte());
-        final int size = prefixLength / Byte.SIZE + ((prefixLength % Byte.SIZE == 0) ? 0 : 1);
+        final int size = prefixLength / Byte.SIZE + (prefixLength % Byte.SIZE == 0 ? 0 : 1);
         final int readable = buf.readableBytes();
         Preconditions.checkArgument(size <= readable, "Illegal length of IP prefix: %s/%s", size, readable);