import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.Esi;
abstract class AbstractEsiType implements EsiParser, EsiSerializer {
- static final int BODY_LENGTH = 9;
+ private static final int BODY_LENGTH = 9;
static final int ZERO_BYTE = 1;
static final int MAC_ADDRESS_LENGTH = 6;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.Uint24;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.arbitrary._case.Arbitrary;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.arbitrary._case.ArbitraryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.evpn.Evpn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.evpn.EvpnChoice;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
final class EsiModelUtil {
- static final NodeIdentifier LD_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "local-discriminator").intern());
- static final NodeIdentifier ARB_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "arbitrary").intern());
- static final NodeIdentifier AS_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "as").intern());
- static final NodeIdentifier LACP_MAC_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "ce-lacp-mac-address").intern());
- static final NodeIdentifier PK_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "ce-lacp-port-key").intern());
- static final NodeIdentifier BRIDGE_MAC_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "root-bridge-mac-address").intern());
- static final NodeIdentifier RBP_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "root-bridge-priority").intern());
- static final NodeIdentifier SYSTEM_MAC_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "system-mac-address").intern());
- static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(Evpn.QNAME, "router-id").intern());
+ static final NodeIdentifier LD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "local-discriminator").intern());
+ static final NodeIdentifier ARB_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "arbitrary").intern());
+ static final NodeIdentifier AS_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "as").intern());
+ static final NodeIdentifier LACP_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "ce-lacp-mac-address").intern());
+ static final NodeIdentifier PK_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "ce-lacp-port-key").intern());
+ static final NodeIdentifier BRIDGE_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "root-bridge-mac-address").intern());
+ static final NodeIdentifier RBP_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "root-bridge-priority").intern());
+ static final NodeIdentifier SYSTEM_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "system-mac-address").intern());
+ static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "router-id").intern());
private EsiModelUtil() {
throw new UnsupportedOperationException();
}
static MacAddress extractLacpMac(final ContainerNode t1) {
- return (MacAddress) t1.getChild(LACP_MAC_NID).get().getValue();
+ return new MacAddress((String) t1.getChild(LACP_MAC_NID).get().getValue());
}
static MacAddress extractBrigeMac(final ContainerNode lan) {
- return (MacAddress) lan.getChild(BRIDGE_MAC_NID).get().getValue();
+ return new MacAddress((String) lan.getChild(BRIDGE_MAC_NID).get().getValue());
}
static Integer extractBP(final ContainerNode lan) {
}
static Uint24 extractUint24LD(final ContainerNode esiVal) {
- return (Uint24) esiVal.getChild(LD_NID).get().getValue();
+ return new Uint24((Long) esiVal.getChild(LD_NID).get().getValue());
}
static MacAddress extractSystmeMac(final ContainerNode macGEn) {
- return (MacAddress) macGEn.getChild(SYSTEM_MAC_NID).get().getValue();
+ return new MacAddress((String) macGEn.getChild(SYSTEM_MAC_NID).get().getValue());
}
static Ipv4Address extractRD(final ContainerNode t4) {
- return (Ipv4Address) t4.getChild(RD_NID).get().getValue();
+ return new Ipv4Address((String) t4.getChild(RD_NID).get().getValue());
}
}
integer in line format with the most significant octet sent first";
choice esi {
+ mandatory true;
case arbitrary-case {
container arbitrary {
description "Type 0 indicates an arbitrary 9-octet ESI
}
grouping ethernet-a-d-route {
- reference "https://tools.ietf.org/html/rfc7432#section-7.1";
- description "Ethernet Auto-Discovery (A-D) route";
+ container ethernet-a-d-route {
+ reference "https://tools.ietf.org/html/rfc7432#section-7.1";
+ description "Ethernet Auto-Discovery (A-D) route";
- uses route-distinguisher;
- uses esi;
- uses ethernet-tag-id;
- leaf mpls-label {
- type netc:mpls-label;
- mandatory true;
+ uses esi;
+ uses ethernet-tag-id;
+ leaf mpls-label {
+ type netc:mpls-label;
+ mandatory true;
+ }
}
}
grouping mac-ip-adv-route {
- reference "https://tools.ietf.org/html/rfc7432#section-7.2";
- description "MAC/IP Advertisement route";
+ container mac-ip-adv-route {
+ reference "https://tools.ietf.org/html/rfc7432#section-7.2";
+ description "MAC/IP Advertisement route";
- uses route-distinguisher;
- uses esi;
- uses ethernet-tag-id;
- leaf mac-address {
- type yang:mac-address;
- mandatory true;
- }
- leaf ip-address {
- type inet:ip-address;
- }
- leaf mpls-label1 {
- type netc:mpls-label;
- mandatory true;
- }
- leaf mpls-label2 {
- type netc:mpls-label;
+ uses esi;
+ uses ethernet-tag-id;
+ leaf mac-address {
+ type yang:mac-address;
+ mandatory true;
+ }
+ leaf ip-address {
+ type inet:ip-address;
+ }
+ leaf mpls-label1 {
+ type netc:mpls-label;
+ mandatory true;
+ }
+ leaf mpls-label2 {
+ type netc:mpls-label;
+ }
}
}
grouping inc-multi-ethernet-tag-res {
- reference "https://tools.ietf.org/html/rfc7432#section-7.3";
- description "Inclusive Multicast Ethernet Tag route";
+ container inc-multi-ethernet-tag-res {
+ reference "https://tools.ietf.org/html/rfc7432#section-7.3";
+ description "Inclusive Multicast Ethernet Tag route";
- uses route-distinguisher;
- uses ethernet-tag-id;
- leaf orig-route-ip {
- type inet:ip-address;
+ uses ethernet-tag-id;
+ leaf orig-route-ip {
+ type inet:ip-address;
+ }
}
}
grouping es-route {
- reference "https://tools.ietf.org/html/rfc7432#section-7.4";
- description "Ethernet Segment route";
+ container es-route {
+ reference "https://tools.ietf.org/html/rfc7432#section-7.4";
+ description "Ethernet Segment route";
- leaf route-distinguisher {
- type bgp-t:route-distinguisher;
- mandatory true;
- }
- uses esi;
- leaf orig-route-ip {
- type inet:ip-address;
- mandatory true;
+ uses esi;
+ leaf orig-route-ip {
+ type inet:ip-address;
+ mandatory true;
+ }
}
}
Extensions [RFC4760] with an Address Family Identifier (AFI) of 25 (L2VPN)
and a Subsequent Address Family Identifier (SAFI) of 70 (EVPN)";
- choice evpn {
+ choice evpn-choice {
case ethernet-a-d-route-case {
uses ethernet-a-d-route;
}
case es-route-case {
uses es-route;
}
+ mandatory true;
}
+
+ uses route-distinguisher;
}
augment "/bgp-msg:update/bgp-msg:attributes/bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type" {
package org.opendaylight.protocol.bgp.evpn.impl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeSchemaAwareBuilder;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
-public final class ModelTestUtil {
+public final class EvpnTestUtil {
+ public static final int VALUE_SIZE = 9;
+ public static final long LD = 33686018;
+ public static final String MAC_MODEL = "f2:0c:dd:80:9f:f7";
+ public static final MacAddress MAC = new MacAddress(MAC_MODEL);
+ public static final long AS_MODEL = 16843009;
+ public static final AsNumber AS_NUMBER = new AsNumber(AS_MODEL);
+ public static final Integer PORT = 514;
+
public static DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> createContBuilder(final YangInstanceIdentifier
.NodeIdentifier nid) {
return ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(nid);
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createContBuilder;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createValueBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.AS_MODEL;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.AS_NUMBER;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.LD;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.VALUE_SIZE;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createContBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createValueBuilder;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.AS_NID;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.LD_NID;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.Esi;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.ArbitraryCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.AsGeneratedCase;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-public final class ASGenParserTest extends AbstractParserTest {
+public final class ASGenParserTest {
private static final byte[] VALUE = {(byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x00};
private static final byte[] RESULT = {(byte) 0x05, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x00};
- private static final AsNumber AS = new AsNumber(16843009L);
private ASGenParser parser;
@Before
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
- final AsGeneratedCase acb = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder().setAs(AS)
- .setLocalDiscriminator(LD).build()).build();
- this.parser.serializeEsi(acb, buff);
+ final AsGeneratedCase asGen = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder().setAs(AS_NUMBER).setLocalDiscriminator(LD)
+ .build()).build();
+ this.parser.serializeEsi(asGen, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
- assertEquals(acb, acResult);
+ assertEquals(asGen, acResult);
- final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME))
- .addChild(createValueBuilder(16843009L, AS_NID).build())
- .addChild(createValueBuilder(LD, LD_NID).build())
- .build();
+ final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME)).addChild(createValueBuilder(AS_MODEL, AS_NID).build())
+ .addChild(createValueBuilder(LD, LD_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
- assertEquals(acb, acmResult);
+ assertEquals(asGen, acmResult);
}
@Test(expected = IllegalArgumentException.class)
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.evpn.impl.esi.types;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-
-abstract class AbstractParserTest {
- protected static final int VALUE_SIZE = 9;
- protected static final long LD = 33686018;
- protected static final MacAddress MAC = new MacAddress("f2:0c:dd:80:9f:f7");
-}
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createContBuilder;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createValueBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.VALUE_SIZE;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createContBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createValueBuilder;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.ARB_NID;
import io.netty.buffer.ByteBuf;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-public final class ArbitraryParserTest extends AbstractParserTest {
+public final class ArbitraryParserTest {
private static final byte[] ARB_VALUE = {(byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
(byte) 0x08, (byte) 0x09};
private static final byte[] ARB_RESULT = {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06,
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
- final ArbitraryCase acb = new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder().setArbitrary(ARB_VALUE).build()).build();
- this.parser.serializeEsi(acb, buff);
+ final ArbitraryCase arbitrary = new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder().setArbitrary(ARB_VALUE).build()).build();
+ this.parser.serializeEsi(arbitrary, buff);
assertArrayEquals(ARB_RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(ARB_VALUE));
- assertEquals(acb, acResult);
+ assertEquals(arbitrary, acResult);
final ContainerNode cont = createContBuilder(new NodeIdentifier(Arbitrary.QNAME))
.addChild(createValueBuilder(ARB_VALUE, ARB_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
- assertEquals(acb, acmResult);
+ assertEquals(arbitrary, acmResult);
}
@Test(expected = IllegalArgumentException.class)
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createContBuilder;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createValueBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MAC;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MAC_MODEL;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.PORT;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.VALUE_SIZE;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createContBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createValueBuilder;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.LACP_MAC_NID;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.PK_NID;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-public final class LacpParserTest extends AbstractParserTest {
- private static final Integer PORT = 514;
+public final class LacpParserTest {
private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
(byte) 0x02, (byte) 0x00};
private static final byte[] RESULT = {(byte) 0x01, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
- final LacpAutoGeneratedCase acb = new LacpAutoGeneratedCaseBuilder().setLacpAutoGenerated(new LacpAutoGeneratedBuilder()
+ final LacpAutoGeneratedCase lanAuto = new LacpAutoGeneratedCaseBuilder().setLacpAutoGenerated(new LacpAutoGeneratedBuilder()
.setCeLacpMacAddress(MAC).setCeLacpPortKey(PORT).build()).build();
- this.parser.serializeEsi(acb, buff);
+ this.parser.serializeEsi(lanAuto, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
- assertEquals(acb, acResult);
+ assertEquals(lanAuto, acResult);
final ContainerNode cont = createContBuilder( new NodeIdentifier(LacpAutoGenerated.QNAME))
- .addChild(createValueBuilder(MAC, LACP_MAC_NID).build())
+ .addChild(createValueBuilder(MAC_MODEL, LACP_MAC_NID).build())
.addChild(createValueBuilder(PORT, PK_NID).build())
.build();
final Esi acmResult = this.parser.serializeEsi(cont);
- assertEquals(acb, acmResult);
+ assertEquals(lanAuto, acmResult);
}
@Test(expected = IllegalArgumentException.class)
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createContBuilder;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createValueBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MAC;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MAC_MODEL;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.VALUE_SIZE;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createContBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createValueBuilder;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.BRIDGE_MAC_NID;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.RBP_NID;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.Esi;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.ArbitraryCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.LacpAutoGeneratedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.LanAutoGeneratedCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.LanAutoGeneratedCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.esi.esi.lan.auto.generated._case.LanAutoGenerated;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-public class LanParserTest extends AbstractParserTest {
+public class LanParserTest {
private static final Integer PRIORITY = 514;
public static final LanAutoGeneratedCase LAN_AUT_GEN_CASE = new LanAutoGeneratedCaseBuilder().setLanAutoGenerated(new LanAutoGeneratedBuilder()
.setRootBridgeMacAddress(MAC).setRootBridgePriority(PRIORITY).build()).build();
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
assertEquals(LAN_AUT_GEN_CASE, acResult);
-
-
final Esi acmResult = this.parser.serializeEsi(createLanCont());
assertEquals(LAN_AUT_GEN_CASE, acmResult);
}
public static ChoiceNode createLanChoice() {
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
- choice.withNodeIdentifier(new NodeIdentifier(LacpAutoGeneratedCase.QNAME));
+ choice.withNodeIdentifier(NodeIdentifier.create(Esi.QNAME));
return choice.addChild(createLanCont()).build();
}
private static ContainerNode createLanCont() {
- return createContBuilder(new NodeIdentifier(LanAutoGenerated.QNAME))
- .addChild(createValueBuilder(MAC, BRIDGE_MAC_NID).build())
- .addChild(createValueBuilder(PRIORITY, RBP_NID).build())
- .build();
+ return createContBuilder(new NodeIdentifier(LanAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, BRIDGE_MAC_NID).build())
+ .addChild(createValueBuilder(PRIORITY, RBP_NID).build()).build();
}
}
\ No newline at end of file
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createContBuilder;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createValueBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MAC;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MAC_MODEL;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.VALUE_SIZE;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createContBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createValueBuilder;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.LD_NID;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.SYSTEM_MAC_NID;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-public final class MacParserTest extends AbstractParserTest {
+public final class MacParserTest {
private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
(byte) 0x02, (byte) 0x00};
private static final byte[] RESULT = {(byte) 0x03, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
(byte) 0x02, (byte) 0x00};
- private static final Uint24 UINT24_LD = new Uint24(131584L);
+ private static final long UINT24_LD_MODEL = 131584L;
+ private static final Uint24 UINT24_LD = new Uint24(UINT24_LD_MODEL);
private MacParser parser;
@Before
public void parserTest() {
final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
- final MacAutoGeneratedCase acb = new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(new MacAutoGeneratedBuilder()
+ final MacAutoGeneratedCase macAuto = new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(new MacAutoGeneratedBuilder()
.setLocalDiscriminator(UINT24_LD).setSystemMacAddress(MAC).build()).build();
- this.parser.serializeEsi(acb, buff);
+ this.parser.serializeEsi(macAuto, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
- assertEquals(acb, acResult);
+ assertEquals(macAuto, acResult);
- final ContainerNode cont = createContBuilder(new NodeIdentifier(MacAutoGenerated.QNAME))
- .addChild(createValueBuilder(MAC, SYSTEM_MAC_NID).build())
- .addChild(createValueBuilder(UINT24_LD, LD_NID).build())
- .build();
+ final ContainerNode cont = createContBuilder(new NodeIdentifier(MacAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, SYSTEM_MAC_NID).build())
+ .addChild(createValueBuilder(UINT24_LD_MODEL, LD_NID).build()).build();
final Esi acmResult = this.parser.serializeEsi(cont);
- assertEquals(acb, acmResult);
+ assertEquals(macAuto, acmResult);
}
@Test(expected = IllegalArgumentException.class)
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createContBuilder;
-import static org.opendaylight.protocol.bgp.evpn.impl.ModelTestUtil.createValueBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.LD;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.VALUE_SIZE;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createContBuilder;
+import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.createValueBuilder;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.LD_NID;
import static org.opendaylight.protocol.bgp.evpn.impl.esi.types.EsiModelUtil.RD_NID;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-public class RouterIdParserTest extends AbstractParserTest {
+public class RouterIdParserTest {
public static final byte[] RESULT = {(byte) 0x04, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x02, (byte) 0x02, (byte) 0x02,
(byte) 0x02, (byte) 0x00};
private static final byte[] VALUE = {(byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x02, (byte) 0x02, (byte) 0x02,
private static final Ipv4Address ROUTE_ID = new Ipv4Address("42.42.42.42");
public static final RouterIdGeneratedCase ROUTE_ID_CASE = new RouterIdGeneratedCaseBuilder().setRouterIdGenerated(new RouterIdGeneratedBuilder()
.setLocalDiscriminator(LD).setRouterId(ROUTE_ID).build()).build();
+ private static final String ROUTE_ID_MODEL = "42.42.42.42";
private RouterIdParser parser;
@Before
private static ContainerNode createRouteContainer() {
return createContBuilder(new NodeIdentifier(RouterIdGenerated.QNAME))
- .addChild(createValueBuilder(ROUTE_ID, RD_NID).build())
+ .addChild(createValueBuilder(ROUTE_ID_MODEL, RD_NID).build())
.addChild(createValueBuilder(LD, LD_NID).build())
.build();
}