diff options
Diffstat (limited to 'ioam')
7 files changed, 57 insertions, 57 deletions
diff --git a/ioam/api/src/main/yang/sfc-ioam-sb-pot.yang b/ioam/api/src/main/yang/sfc-ioam-sb-pot.yang index ff39b2511..dc4ecedf2 100644 --- a/ioam/api/src/main/yang/sfc-ioam-sb-pot.yang +++ b/ioam/api/src/main/yang/sfc-ioam-sb-pot.yang @@ -15,23 +15,24 @@ module sfc-ioam-sb-pot { "This module contains a collection of YANG definitions for managing in-band OAM based proof of transit configuration parameters. (https://github.com/ciscodevnet/ioam). + The model is meant for proof of transit and is targetted for south-bound deployment nodes."; - revision 2016-06-15 { + revision 2017-01-12 { description - "Initial revision."; + "Changes to field names and parameter ranges."; reference ""; } typedef profile-index-range { type int32 { - range "0 .. 1"; + range "-1 .. 1"; } description "Range used for the profile index. Currently restricted to - 0 or 1 to identify the two profiles."; + -1 to 1 to identify profiles."; } identity path-identifier-identity { @@ -108,9 +109,9 @@ module sfc-ioam-sb-pot { "Secret key for validating the path, constant of poly 1"; } - leaf bitmask { - type uint64; - default 4294967295; + leaf number-of-bits { + type uint8; + default 32; description "Number of bits as mask used in random value generation. 32-bits of mask is default."; @@ -165,4 +166,4 @@ module sfc-ioam-sb-pot { /*** Container: end ***/ } /*** module: end ***/ -}
\ No newline at end of file +} diff --git a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizer.java b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizer.java index c5868decf..7df956e68 100644 --- a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizer.java +++ b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizer.java @@ -26,12 +26,11 @@ import io.fd.vpp.jvpp.ioampot.dto.PotProfileAddReply; import io.fd.vpp.jvpp.ioampot.dto.PotProfileDel; import io.fd.vpp.jvpp.ioampot.dto.PotProfileDelReply; import io.fd.vpp.jvpp.ioampot.future.FutureJVppIoampot; -import java.math.BigInteger; import java.nio.charset.StandardCharsets; import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileList; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSet; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetKey; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSet; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -128,8 +127,8 @@ public class IoamPotWriterCustomizer extends FutureJVppIoampotCustomizer impleme request.validator = (byte) (potProfileList.isValidator() ? 1 : 0); request.secretShare = potProfileList.getSecretShare().longValue(); request.prime = potProfileList.getPrimeNumber().longValue(); - request.secretKey = potProfileList.getValidatorKey().longValue(); - request.maxBits = getMaxBitsfromBitmask(potProfileList.getBitmask()); + request.secretKey = potProfileList.isValidator() ? potProfileList.getValidatorKey().longValue() : 0; + request.maxBits = potProfileList.getNumberOfBits().byteValue(); request.lpc = potProfileList.getLpc().longValue(); request.polynomialPublic = potProfileList.getPublicPolynomial().longValue(); request.listNameLen = (byte) name.getBytes(StandardCharsets.UTF_8).length; @@ -146,13 +145,4 @@ public class IoamPotWriterCustomizer extends FutureJVppIoampotCustomizer impleme return getReplyForWrite(getFutureJVppIoampot().potProfileDel(request).toCompletableFuture(),id); } - - static byte getMaxBitsfromBitmask(BigInteger bitmask){ - byte numOfBits = 0; - while ((bitmask.and(BigInteger.ONE)).equals(BigInteger.ONE)){ - bitmask=bitmask.shiftRight(1); - numOfBits++; - } - return numOfBits; - } } diff --git a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/VppIoamWriterFactory.java b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/VppIoamWriterFactory.java index 9d812467f..15d312ff7 100755 --- a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/VppIoamWriterFactory.java +++ b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/config/VppIoamWriterFactory.java @@ -27,9 +27,9 @@ import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfig; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.trace.config.NodeInterfaces; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.PotProfiles; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileList; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSet; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.PotProfiles; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSet; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class VppIoamWriterFactory implements WriterFactory { diff --git a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizer.java b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizer.java index 43a589c35..860fc07df 100644 --- a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizer.java +++ b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizer.java @@ -30,11 +30,11 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.ProfileIndexRange; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileList; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileListBuilder; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileListKey; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.ProfileIndexRange; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileListBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileListKey; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetBuilder; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -108,8 +108,17 @@ public class PotProfileReaderCustomizer extends FutureJVppIoampotCustomizer impl builder.setPublicPolynomial(BigInteger.valueOf(details.polynomialPublic)); builder.setIndex(new ProfileIndexRange((int)details.id)); builder.setLpc(BigInteger.valueOf(details.lpc)); - builder.setBitmask(BigInteger.valueOf(details.bitMask)); + builder.setNumberOfBits(getMaxBitsfromBitmask(BigInteger.valueOf(details.bitMask))); LOG.info("Item {} successfully read: {}",instanceIdentifier,builder.build()); } + + private static short getMaxBitsfromBitmask (BigInteger bitmask){ + short numOfBits = 0; + while ((bitmask.and(BigInteger.ONE)).equals(BigInteger.ONE)){ + bitmask=bitmask.shiftRight(1); + numOfBits++; + } + return numOfBits; + } } diff --git a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java index 26c1a8a99..9efd2e11f 100644 --- a/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java +++ b/ioam/impl/src/main/java/io/fd/hc2vpp/vppioam/impl/oper/VppIoamReaderFactory.java @@ -25,11 +25,11 @@ import javax.inject.Inject; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfig; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.IoamTraceConfigBuilder; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.ioam.sb.trace.rev160512.ioam.trace.config.TraceConfig; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.PotProfiles; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.PotProfilesBuilder; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileList; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSet; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.PotProfiles; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.PotProfilesBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSet; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class VppIoamReaderFactory implements ReaderFactory { diff --git a/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizerTest.java b/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizerTest.java index c32101698..65727a573 100644 --- a/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizerTest.java +++ b/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/config/IoamPotWriterCustomizerTest.java @@ -33,14 +33,14 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import org.junit.Test; import org.mockito.Mock; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.PotProfiles; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.ProfileIndexRange; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileList; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileListBuilder; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileListKey; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSet; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetBuilder; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetKey; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.PotProfiles; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.ProfileIndexRange; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileListBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileListKey; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSet; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -61,7 +61,7 @@ public class IoamPotWriterCustomizerTest extends WriterCustomizerTest { private static PotProfileList generatePotProfileList() { final PotProfileListBuilder builder= new PotProfileListBuilder(); builder.setIndex(new ProfileIndexRange(1)); - builder.setBitmask(new BigInteger("64")); + builder.setNumberOfBits((short)56); builder.setKey(new PotProfileListKey(new ProfileIndexRange(1))); builder.setLpc(new BigInteger("1233")); builder.setPrimeNumber(new BigInteger("1001")); @@ -115,7 +115,7 @@ public class IoamPotWriterCustomizerTest extends WriterCustomizerTest { request.secretKey = 1; request.secretShare = 1234; request.prime = 1001; - request.maxBits = IoamPotWriterCustomizer.getMaxBitsfromBitmask(BigInteger.valueOf(64)); + request.maxBits = (short) 56; request.lpc = 1233; request.polynomialPublic = 1234; request.listNameLen = (byte)POT_TEST_NAME.getBytes(StandardCharsets.UTF_8).length; diff --git a/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizerTest.java b/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizerTest.java index f0c3f83d1..779ec19fe 100644 --- a/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizerTest.java +++ b/ioam/impl/src/test/java/io/fd/hc2vpp/vppioam/impl/oper/PotProfileReaderCustomizerTest.java @@ -31,14 +31,14 @@ import io.fd.vpp.jvpp.ioampot.dto.PotProfileShowConfigDump; import io.fd.vpp.jvpp.ioampot.future.FutureJVppIoampot; import org.junit.Test; import org.mockito.Mock; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.PotProfiles; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.ProfileIndexRange; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileList; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileListBuilder; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profile.PotProfileListKey; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSet; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetBuilder; -import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev160615.pot.profiles.PotProfileSetKey; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.PotProfiles; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.ProfileIndexRange; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileList; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileListBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profile.PotProfileListKey; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSet; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetBuilder; +import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.ioam.sb.pot.rev170112.pot.profiles.PotProfileSetKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class PotProfileReaderCustomizerTest extends ListReaderCustomizerTest<PotProfileList,PotProfileListKey, @@ -60,7 +60,7 @@ public class PotProfileReaderCustomizerTest extends ListReaderCustomizerTest<Pot public void setUp(){ final PotProfileShowConfigDetailsReplyDump replyDump = new PotProfileShowConfigDetailsReplyDump(); final PotProfileShowConfigDetails replyDetails = new PotProfileShowConfigDetails(); - replyDetails.bitMask = (long)0xFFFFFF; + replyDetails.bitMask = (long)0xF; replyDetails.id=0; replyDetails.lpc=1234; replyDetails.polynomialPublic=1234; @@ -82,7 +82,7 @@ public class PotProfileReaderCustomizerTest extends ListReaderCustomizerTest<Pot public void testReadCurrentAttributes() throws ReadFailedException { PotProfileListBuilder builder = new PotProfileListBuilder(); getCustomizer().readCurrentAttributes(getPotProfileListId(0),builder,ctx); - assertEquals(0xFFFFFF,builder.getBitmask().longValue()); + assertEquals(0x4,builder.getNumberOfBits().longValue()); assertEquals(0,builder.getIndex().getValue().intValue()); assertEquals(1234,builder.getLpc().longValue()); assertEquals(1234,builder.getPublicPolynomial().longValue()); |