use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project genius by opendaylight.
the class InterfaceConfigListener method update.
@Override
protected void update(InstanceIdentifier<Interface> key, Interface interfaceOld, Interface interfaceNew) {
interfaceManagerCommonUtils.addInterfaceToCache(interfaceNew);
if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
return;
}
LOG.debug("Received Interface Update Event: {}, {}, {}", key, interfaceOld, interfaceNew);
ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class);
if (parentRefs == null || parentRefs.getParentInterface() == null && !InterfaceManagerCommonUtils.isTunnelInterface(interfaceNew)) {
// If parentRefs are missing, try to find a matching parent and
// update - this will trigger another DCN
updateInterfaceParentRefs(interfaceNew);
}
if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) {
LOG.debug("parent refs not specified for {}, or parentRefs {} missing DPN/parentInterface", interfaceNew.getName(), parentRefs);
return;
}
RendererConfigUpdateWorker configWorker = new RendererConfigUpdateWorker(key, interfaceOld, interfaceNew, interfaceNew.getName());
String synchronizationKey = getSynchronizationKey(interfaceNew, parentRefs);
coordinator.enqueueJob(synchronizationKey, configWorker, IfmConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project genius by opendaylight.
the class InterfaceConfigListener method add.
@Override
protected void add(InstanceIdentifier<Interface> key, Interface interfaceNew) {
interfaceManagerCommonUtils.addInterfaceToCache(interfaceNew);
if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
return;
}
LOG.debug("Received Interface Add Event: {}, {}", key, interfaceNew);
ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class);
if (parentRefs == null || parentRefs.getParentInterface() == null) {
// If parentRefs are missing, try to find a matching parent and
// update - this will trigger another DCN
updateInterfaceParentRefs(interfaceNew);
}
if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) {
LOG.debug("parent refs not specified for {}", interfaceNew.getName());
return;
}
RendererConfigAddWorker configWorker = new RendererConfigAddWorker(key, interfaceNew, parentRefs, interfaceNew.getName());
String synchronizationKey = getSynchronizationKey(interfaceNew, parentRefs);
coordinator.enqueueJob(synchronizationKey, configWorker, IfmConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project genius by opendaylight.
the class InterfaceInventoryStateListener method remove.
@Override
protected void remove(InstanceIdentifier<FlowCapableNodeConnector> key, FlowCapableNodeConnector flowCapableNodeConnectorOld) {
if (interfacemgrProvider.isItmDirectTunnelsEnabled() && interfaceManagerCommonUtils.isTunnelInternal(flowCapableNodeConnectorOld.getName())) {
LOG.debug("ITM Direct Tunnels is enabled, ignoring node connector removed for internal tunnel {}", flowCapableNodeConnectorOld.getName());
return;
}
if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
return;
}
LOG.debug("Received NodeConnector Remove Event: {}, {}", key, flowCapableNodeConnectorOld);
NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(key.firstIdentifierOf(NodeConnector.class)).getId();
String portName = InterfaceManagerCommonUtils.getPortNameForInterface(nodeConnectorId, flowCapableNodeConnectorOld.getName());
remove(nodeConnectorId, null, flowCapableNodeConnectorOld, portName, true);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project controller by opendaylight.
the class ClusterAdminRpcService method getShardRole.
@Override
public ListenableFuture<RpcResult<GetShardRoleOutput>> getShardRole(final GetShardRoleInput input) {
final String shardName = input.getShardName();
if (Strings.isNullOrEmpty(shardName)) {
return newFailedRpcResultFuture("A valid shard name must be specified");
}
DataStoreType dataStoreType = input.getDataStoreType();
if (dataStoreType == null) {
return newFailedRpcResultFuture("A valid DataStoreType must be specified");
}
LOG.info("Getting role for shard {}, datastore type {}", shardName, dataStoreType);
final SettableFuture<RpcResult<GetShardRoleOutput>> returnFuture = SettableFuture.create();
ListenableFuture<GetShardRoleReply> future = sendMessageToShardManager(dataStoreType, new GetShardRole(shardName));
Futures.addCallback(future, new FutureCallback<GetShardRoleReply>() {
@Override
public void onSuccess(final GetShardRoleReply reply) {
if (reply == null) {
returnFuture.set(ClusterAdminRpcService.<GetShardRoleOutput>newFailedRpcResultBuilder("No Shard role present. Please retry..").build());
return;
}
LOG.info("Successfully received role:{} for shard {}", reply.getRole(), shardName);
final GetShardRoleOutputBuilder builder = new GetShardRoleOutputBuilder();
if (reply.getRole() != null) {
builder.setRole(reply.getRole());
}
returnFuture.set(newSuccessfulResult(builder.build()));
}
@Override
public void onFailure(final Throwable failure) {
returnFuture.set(ClusterAdminRpcService.<GetShardRoleOutput>newFailedRpcResultBuilder("Failed to get shard role.", failure).build());
}
}, MoreExecutors.directExecutor());
return returnFuture;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project bgpcep by opendaylight.
the class NeighborStateCliUtilsTest method testFullNeighborStateCli.
@Test
public void testFullNeighborStateCli() throws IOException {
final AfiSafi afiSafi = new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder().addAugmentation(new NeighborAfiSafiStateAugmentationBuilder().setActive(Boolean.TRUE).setPrefixes(new PrefixesBuilder().setInstalled(Uint32.ONE).setReceived(Uint32.ONE).setSent(Uint32.TWO).build()).build()).build()).build();
final StateBuilder stateBuilder = new StateBuilder().addAugmentation(new NeighborStateAugmentationBuilder().setSupportedCapabilities(Collections.singletonList(ADDPATHS.class)).setSessionState(BgpNeighborState.SessionState.ACTIVE).build());
final Received received = new ReceivedBuilder().setNOTIFICATION(Uint64.ONE).setUPDATE(Uint64.TEN).build();
final Sent sent = new SentBuilder().setNOTIFICATION(Uint64.TEN).setUPDATE(Uint64.ONE).build();
stateBuilder.addAugmentation(new BgpNeighborStateAugmentationBuilder().setMessages(new MessagesBuilder().setReceived(received).setSent(sent).build()).build());
final Transport transport = new TransportBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.transport.StateBuilder().addAugmentation(new NeighborTransportStateAugmentationBuilder().setRemoteAddress(NEIGHBOR_IP_ADDRESS).setLocalPort(new PortNumber(Uint16.valueOf(1234))).setRemotePort(new PortNumber(Uint16.valueOf(4321))).build()).build()).build();
final Timers timers = new TimersBuilder().setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers.StateBuilder().addAugmentation(new NeighborTimersStateAugmentationBuilder().setNegotiatedHoldTime(BigDecimal.TEN).setUptime(new Timeticks(Uint32.valueOf(600))).build()).build()).build();
final Neighbor neighbor = new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4"))).setState(stateBuilder.build()).setAfiSafis(new AfiSafisBuilder().setAfiSafi(Map.of(afiSafi.key(), afiSafi)).build()).setTransport(transport).setTimers(timers).build();
NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS, neighbor, this.stream);
final String expected = Resources.toString(getClass().getClassLoader().getResource("neighbor.txt"), StandardCharsets.UTF_8);
assertEquals(expected, this.output.toString());
}
Aggregations