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);
}
}
}
}
}
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();
}
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;
});
}
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);
}
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()));
}
Aggregations