Search in sources :

Example 56 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.Result in project bgpcep by opendaylight.

the class EvpnRibSupportTest method testChangedRoutes.

@Test
public void testChangedRoutes() {
    final Routes emptyCase = new EvpnRoutesCaseBuilder().build();
    DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
    Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
    final Routes emptyRoutes = new EvpnRoutesCaseBuilder().setEvpnRoutes(new EvpnRoutesBuilder().build()).build();
    tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
    Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
    final Routes routes = new EvpnRoutesCaseBuilder().setEvpnRoutes(EVPN_ROUTES).build();
    tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
    final Collection<DataTreeCandidateNode> result = RIB_SUPPORT.changedRoutes(tree);
    Assert.assertFalse(result.isEmpty());
}
Also used : DataTreeCandidateNode(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode) EvpnRoutesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.bgp.rib.rib.loc.rib.tables.routes.EvpnRoutesCaseBuilder) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes) EvpnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.EvpnRoutes) EvpnRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.EvpnRoutesBuilder) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 57 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.Result in project bgpcep by opendaylight.

the class ASGenParserTest method parserTest.

@Test
public void parserTest() {
    final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
    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(asGen, acResult);
    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(asGen, acmResult);
}
Also used : AsGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCase) AsGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.as.generated._case.AsGeneratedBuilder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) AsGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.AsGeneratedCaseBuilder) Esi(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.Esi) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 58 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.Result in project bgpcep by opendaylight.

the class MacParserTest method parserTest.

@Test
public void parserTest() {
    final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
    final MacAutoGeneratedCase macAuto = new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(new MacAutoGeneratedBuilder().setLocalDiscriminator(UINT24_LD).setSystemMacAddress(MAC).build()).build();
    this.parser.serializeEsi(macAuto, buff);
    assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
    final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
    assertEquals(macAuto, acResult);
    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(macAuto, acmResult);
}
Also used : MacAutoGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCaseBuilder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) Esi(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.Esi) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) ByteBuf(io.netty.buffer.ByteBuf) MacAutoGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.MacAutoGeneratedCase) MacAutoGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.esi.mac.auto.generated._case.MacAutoGeneratedBuilder) Test(org.junit.Test)

Example 59 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.Result in project bgpcep by opendaylight.

the class ESImpRouteTargetExtComTest method parserTest.

@Test
public void parserTest() throws BGPParsingException, BGPDocumentedException {
    final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
    final EsImportRouteExtendedCommunityCase expected = new EsImportRouteExtendedCommunityCaseBuilder().setEsImportRouteExtendedCommunity(new EsImportRouteExtendedCommunityBuilder().setEsImport(MAC).build()).build();
    this.parser.serializeExtendedCommunity(expected, buff);
    assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
    final ExtendedCommunity result = this.parser.parseExtendedCommunity(Unpooled.wrappedBuffer(RESULT));
    assertEquals(expected, result);
}
Also used : EsImportRouteExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.es._import.route.extended.community.EsImportRouteExtendedCommunityBuilder) EsImportRouteExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.attributes.extended.communities.extended.community.EsImportRouteExtendedCommunityCaseBuilder) ExtendedCommunity(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.ExtendedCommunity) ByteBuf(io.netty.buffer.ByteBuf) EsImportRouteExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.attributes.extended.communities.extended.community.EsImportRouteExtendedCommunityCase) Test(org.junit.Test)

Example 60 with Result

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.Result in project bgpcep by opendaylight.

the class Layer2AttributesExtComTest method evpnVpwsTest.

@Test
public void evpnVpwsTest() throws BGPParsingException, BGPDocumentedException {
    final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
    final Layer2AttributesExtendedCommunityCase expected = new Layer2AttributesExtendedCommunityCaseBuilder().setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true).setControlWord(true).setPrimaryPe(true).setL2Mtu(257).setModeOfOperation(OperationalMode.VlanAwareFxc).setOperatingPer(NormalizationType.SingleVid).build()).build();
    this.parser.serializeExtendedCommunity(expected, buff);
    final byte[] resultByte = ByteArray.getAllBytes(buff);
    assertArrayEquals(EVPN_VPWS, resultByte);
    final ExtendedCommunity result = this.parser.parseExtendedCommunity(Unpooled.wrappedBuffer(EVPN_VPWS));
    assertEquals(expected, result);
    final ByteBuf buff2 = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
    final Layer2AttributesExtendedCommunityCase expected2 = new Layer2AttributesExtendedCommunityCaseBuilder().setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true).setControlWord(true).setPrimaryPe(true).setL2Mtu(257).setModeOfOperation(OperationalMode.VlanUnawareFxc).setOperatingPer(NormalizationType.DoubleVid).build()).build();
    this.parser.serializeExtendedCommunity(expected2, buff2);
    final byte[] resultByte2 = ByteArray.getAllBytes(buff2);
    assertArrayEquals(EVPN_VPWS_2, resultByte2);
    final ExtendedCommunity result2 = this.parser.parseExtendedCommunity(Unpooled.wrappedBuffer(EVPN_VPWS_2));
    assertEquals(expected2, result2);
}
Also used : Layer2AttributesExtendedCommunityCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.attributes.extended.communities.extended.community.Layer2AttributesExtendedCommunityCase) ExtendedCommunity(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.ExtendedCommunity) Layer2AttributesExtendedCommunityCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.evpn.route.attributes.extended.communities.extended.community.Layer2AttributesExtendedCommunityCaseBuilder) ByteBuf(io.netty.buffer.ByteBuf) Layer2AttributesExtendedCommunityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.layer._2.attributes.extended.community.Layer2AttributesExtendedCommunityBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)348 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)174 ByteBuf (io.netty.buffer.ByteBuf)97 ArrayList (java.util.ArrayList)94 ExecutionException (java.util.concurrent.ExecutionException)92 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)46 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)40 RouteAttributeContainer (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer)33 Statement (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement)33 List (java.util.List)31 BigInteger (java.math.BigInteger)29 Collections (java.util.Collections)26 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)24 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)24 Nonnull (javax.annotation.Nonnull)23 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)23 AllocateIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput)22 AllocateIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder)22 RpcError (org.opendaylight.yangtools.yang.common.RpcError)22