Search in sources :

Example 21 with NodeIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeIdentifier in project genius by opendaylight.

the class HwVTEPConfigListener method remove.

@Override
public void remove(@Nonnull Interface removedInterface) {
    // HwVTEPs support only VXLAN
    IfTunnel ifTunnel = removedInterface.getAugmentation(IfTunnel.class);
    if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
        ParentRefs parentRefs = removedInterface.getAugmentation(ParentRefs.class);
        if (parentRefs != null && parentRefs.getNodeIdentifier() != null) {
            LOG.debug("Received HwVTEP Interface Remove Event: {}", removedInterface.getName());
            LOG.trace("Received HwVTEP Interface Remove Event: {}", removedInterface);
            for (NodeIdentifier nodeIdentifier : parentRefs.getNodeIdentifier()) {
                if (SouthboundUtils.HWVTEP_TOPOLOGY.equals(nodeIdentifier.getTopologyId())) {
                    coordinator.enqueueJob(removedInterface.getName(), () -> HwVTEPConfigRemoveHelper.removeConfiguration(txRunner, removedInterface, createPhysicalSwitchInstanceIdentifier(nodeIdentifier.getNodeId()), createGlobalNodeInstanceIdentifier(nodeIdentifier.getNodeId())), IfmConstants.JOB_MAX_RETRIES);
                }
            }
        }
    }
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) NodeIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.interfaces._interface.NodeIdentifier) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)

Example 22 with NodeIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeIdentifier in project bgpcep by opendaylight.

the class BmpRouterPeerImpl method createStats.

private static ContainerNode createStats(final Stat stat, final Timestamp timestamp) {
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(Stats.QNAME));
    builder.withChild(ImmutableNodes.leafNode(PEER_STATS_TIMESTAMP_QNAME, timestamp.getValue()));
    final Tlvs tlvs = stat.getTlvs();
    if (tlvs != null) {
        statsForTlvs(tlvs, builder);
    }
    return builder.build();
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)

Example 23 with NodeIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeIdentifier in project bgpcep by opendaylight.

the class BmpMonitorImplTest method setUp.

@Before
public void setUp() throws Exception {
    super.setup();
    doAnswer(invocationOnMock -> {
        BmpMonitorImplTest.this.singletonService = (ClusterSingletonService) invocationOnMock.getArguments()[0];
        singletonService.instantiateServiceInstance();
        return BmpMonitorImplTest.this.singletonServiceRegistration;
    }).when(clusterSSProv).registerClusterSingletonService(any(ClusterSingletonService.class));
    doAnswer(invocationOnMock -> BmpMonitorImplTest.this.singletonService.closeServiceInstance()).when(singletonServiceRegistration).close();
    doAnswer(invocationOnMock -> {
        singletonService2 = (ClusterSingletonService) invocationOnMock.getArguments()[0];
        singletonService2.instantiateServiceInstance();
        return BmpMonitorImplTest.this.singletonServiceRegistration2;
    }).when(clusterSSProv2).registerClusterSingletonService(any(ClusterSingletonService.class));
    doAnswer(invocationOnMock -> BmpMonitorImplTest.this.singletonService2.closeServiceInstance()).when(singletonServiceRegistration2).close();
    ribActivator.startRIBExtensionProvider(ribExtension, mappingService.currentSerializer());
    final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
    bgpActivator.start(context);
    final SimpleBmpExtensionProviderContext ctx = new SimpleBmpExtensionProviderContext();
    bmpActivator = new BmpActivator(context);
    bmpActivator.start(ctx);
    msgRegistry = ctx.getBmpMessageRegistry();
    dispatcher = new BmpDispatcherImpl(new NioEventLoopGroup(), new NioEventLoopGroup(), ctx, new DefaultBmpSessionFactory());
    final InetSocketAddress inetAddress = new InetSocketAddress(InetAddresses.forString(MONITOR_LOCAL_ADDRESS), MONITOR_LOCAL_PORT);
    final DOMDataTreeWriteTransaction wTx = getDomBroker().newWriteOnlyTransaction();
    final ContainerNode parentNode = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(BmpMonitor.QNAME)).addChild(ImmutableNodes.mapNodeBuilder(Monitor.QNAME).build()).build();
    wTx.merge(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.of(BmpMonitor.QNAME), parentNode);
    wTx.commit().get();
    bmpApp = new BmpMonitoringStationImpl(getDomBroker(), dispatcher, ribExtension, mappingService.currentSerializer(), clusterSSProv, MONITOR_ID, inetAddress, null);
    readDataOperational(getDataBroker(), BMP_II, monitor -> {
        assertEquals(1, monitor.nonnullMonitor().size());
        final Monitor bmpMonitor = monitor.nonnullMonitor().values().iterator().next();
        assertEquals(MONITOR_ID, bmpMonitor.getMonitorId());
        assertEquals(0, bmpMonitor.nonnullRouter().size());
        assertEquals(MONITOR_ID, bmpMonitor.getMonitorId());
        assertEquals(0, bmpMonitor.nonnullRouter().size());
        return monitor;
    });
}
Also used : SimpleBmpExtensionProviderContext(org.opendaylight.protocol.bmp.spi.registry.SimpleBmpExtensionProviderContext) InetSocketAddress(java.net.InetSocketAddress) DOMDataTreeWriteTransaction(org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction) BmpDispatcherImpl(org.opendaylight.protocol.bmp.impl.BmpDispatcherImpl) SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) BGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext) BmpMonitor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.BmpMonitor) Monitor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor) ClusterSingletonService(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) DefaultBmpSessionFactory(org.opendaylight.protocol.bmp.impl.session.DefaultBmpSessionFactory) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) BmpActivator(org.opendaylight.protocol.bmp.parser.BmpActivator) Before(org.junit.Before)

Example 24 with NodeIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeIdentifier in project bgpcep by opendaylight.

the class LacpParserTest method parserTest.

@Test
public void parserTest() {
    final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
    final LacpAutoGeneratedCase lanAuto = new LacpAutoGeneratedCaseBuilder().setLacpAutoGenerated(new LacpAutoGeneratedBuilder().setCeLacpMacAddress(MAC).setCeLacpPortKey(PORT).build()).build();
    this.parser.serializeEsi(lanAuto, buff);
    assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
    final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
    assertEquals(lanAuto, acResult);
    final ContainerNode cont = createContBuilder(new NodeIdentifier(LacpAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, LACP_MAC_NID).build()).addChild(createValueBuilder(PORT, PK_NID).build()).build();
    final Esi acmResult = this.parser.serializeEsi(cont);
    assertEquals(lanAuto, acmResult);
}
Also used : LacpAutoGeneratedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.lacp.auto.generated._case.LacpAutoGeneratedBuilder) LacpAutoGeneratedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCaseBuilder) LacpAutoGeneratedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.esi.LacpAutoGeneratedCase) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) Esi(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.Esi) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 25 with NodeIdentifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeIdentifier in project bgpcep by opendaylight.

the class LinkstateNlriParserTest method testPrefixNlri.

@Test
public void testPrefixNlri() throws BGPParsingException {
    setUp(this.prefixNlri);
    // test BA form
    assertNull(this.dest.getRouteDistinguisher());
    assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
    assertEquals(Uint64.ONE, this.dest.getIdentifier().getValue());
    final PrefixCase pCase = (PrefixCase) this.dest.getObjectType();
    final AdvertisingNodeDescriptors local = pCase.getAdvertisingNodeDescriptors();
    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());
    final PrefixDescriptors pd = pCase.getPrefixDescriptors();
    assertEquals(OspfRouteType.External1, pd.getOspfRouteType());
    assertEquals(new TopologyIdentifier(Uint16.valueOf(15)), pd.getMultiTopologyId());
    assertEquals(new Ipv4Prefix("255.255.0.0/16"), pd.getIpReachabilityInformation().getIpv4Prefix());
    final ByteBuf buffer = Unpooled.buffer();
    this.registry.serializeNlriType(this.dest, buffer);
    assertArrayEquals(this.prefixNlri, ByteArray.readAllBytes(buffer));
    // test BI form
    final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
    linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
    final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
    protocolId.withNodeIdentifier(LinkstateNlriParser.PROTOCOL_ID_NID);
    protocolId.withValue("isis-level2");
    linkstateBI.addChild(protocolId.build());
    final ImmutableLeafNodeBuilder<Uint64> identifier = new ImmutableLeafNodeBuilder<>();
    identifier.withNodeIdentifier(LinkstateNlriParser.IDENTIFIER_NID);
    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 DataContainerNodeBuilder<NodeIdentifier, ContainerNode> advertisingNodeDescriptors = Builders.containerBuilder();
    advertisingNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.ADVERTISING_NODE_DESCRIPTORS_NID);
    final ImmutableLeafNodeBuilder<Uint32> asNumber = new ImmutableLeafNodeBuilder<>();
    asNumber.withNodeIdentifier(NodeNlriParser.AS_NUMBER_NID);
    asNumber.withValue(Uint32.valueOf(72));
    advertisingNodeDescriptors.addChild(asNumber.build());
    final ImmutableLeafNodeBuilder<Uint32> domainID = new ImmutableLeafNodeBuilder<>();
    domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
    domainID.withValue(Uint32.valueOf(673720360L));
    advertisingNodeDescriptors.addChild(domainID.build());
    final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> crouterId = Builders.choiceBuilder();
    crouterId.withNodeIdentifier(C_ROUTER_ID_NID);
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> isisNode = Builders.containerBuilder();
    isisNode.withNodeIdentifier(NodeNlriParser.ISIS_NODE_NID);
    final ImmutableLeafNodeBuilder<byte[]> isoSystemID = new ImmutableLeafNodeBuilder<>();
    isoSystemID.withNodeIdentifier(NodeNlriParser.ISO_SYSTEM_NID);
    isoSystemID.withValue(new byte[] { 0, 0, 0, 0, 0, (byte) 0x42 });
    isisNode.addChild(isoSystemID.build());
    crouterId.addChild(isisNode.build());
    advertisingNodeDescriptors.addChild(crouterId.build());
    // prefix descriptors
    final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> prefixDescriptors = Builders.containerBuilder();
    prefixDescriptors.withNodeIdentifier(LinkstateNlriParser.PREFIX_DESCRIPTORS_NID);
    prefixDescriptors.addChild(asNumber.build());
    prefixDescriptors.addChild(domainID.build());
    final ImmutableLeafNodeBuilder<Uint16> multiTopologyId = new ImmutableLeafNodeBuilder<>();
    multiTopologyId.withNodeIdentifier(TlvUtil.MULTI_TOPOLOGY_NID);
    multiTopologyId.withValue(Uint16.valueOf(15));
    prefixDescriptors.addChild(multiTopologyId.build());
    final ImmutableLeafNodeBuilder<String> ipReachabilityInformation = new ImmutableLeafNodeBuilder<>();
    ipReachabilityInformation.withNodeIdentifier(IP_REACH_NID);
    ipReachabilityInformation.withValue("255.255.0.0/16");
    prefixDescriptors.addChild(ipReachabilityInformation.build());
    final ImmutableLeafNodeBuilder<String> ospfRouteType = new ImmutableLeafNodeBuilder<>();
    ospfRouteType.withNodeIdentifier(OSPF_ROUTE_NID);
    ospfRouteType.withValue("external1");
    prefixDescriptors.addChild(ospfRouteType.build());
    objectType.addChild(advertisingNodeDescriptors.build());
    objectType.addChild(prefixDescriptors.build());
    linkstateBI.addChild(objectType.build());
    assertEquals(this.dest, LinkstateNlriParser.extractLinkstateDestination(linkstateBI.build()));
}
Also used : PrefixDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.prefix._case.PrefixDescriptors) UnkeyedListEntryNode(org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode) ByteBuf(io.netty.buffer.ByteBuf) IsisNodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.IsisNodeCaseBuilder) AdvertisingNodeDescriptors(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.prefix._case.AdvertisingNodeDescriptors) Uint16(org.opendaylight.yangtools.yang.common.Uint16) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Uint32(org.opendaylight.yangtools.yang.common.Uint32) DomainIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier) TopologyIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.TopologyIdentifier) PrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.PrefixCase) IsoSystemIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.IsoSystemIdentifier) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) IsisNodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.c.router.identifier.isis.node._case.IsisNodeBuilder) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ImmutableLeafNodeBuilder(org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder) Uint64(org.opendaylight.yangtools.yang.common.Uint64) Test(org.junit.Test)

Aggregations

NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)18 Test (org.junit.Test)13 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)10 UnkeyedListEntryNode (org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode)8 ByteBuf (io.netty.buffer.ByteBuf)7 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)6 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)5 ArrayList (java.util.ArrayList)4 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)4 ChoiceNode (org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode)4 ImmutableLeafNodeBuilder (org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder)4 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)3 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)3 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)3 NodeIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.interfaces._interface.NodeIdentifier)3 Esi (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.esi.Esi)3 DomainIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier)3 CRouterIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.identifier.CRouterIdentifier)3 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)3 Before (org.junit.Before)2