use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project netvirt by opendaylight.
the class ElanInterfaceStateChangeListener method remove.
@Override
protected void remove(InstanceIdentifier<Interface> identifier, Interface delIf) {
if (!L2vlan.class.equals(delIf.getType())) {
return;
}
LOG.trace("Received interface {} Down event", delIf);
String interfaceName = delIf.getName();
Optional<ElanInterface> elanInterface = elanInterfaceCache.get(interfaceName);
if (!elanInterface.isPresent()) {
LOG.debug("No Elan Interface is created for the interface:{} ", interfaceName);
return;
}
NodeConnectorId nodeConnectorId = new NodeConnectorId(delIf.getLowerLayerIf().get(0));
BigInteger dpId = BigInteger.valueOf(MDSALUtil.getDpnIdFromPortName(nodeConnectorId));
InterfaceInfo interfaceInfo = new InterfaceInfo(dpId, nodeConnectorId.getValue());
interfaceInfo.setInterfaceName(interfaceName);
interfaceInfo.setInterfaceType(InterfaceInfo.InterfaceType.VLAN_INTERFACE);
interfaceInfo.setInterfaceTag(delIf.getIfIndex());
String elanInstanceName = elanInterface.get().getElanInstanceName();
ElanInstance elanInstance = elanInstanceCache.get(elanInstanceName).orNull();
if (elanInstance == null) {
LOG.debug("No Elan instance is available for the interface:{} ", interfaceName);
return;
}
InterfaceRemoveWorkerOnElan removeWorker = new InterfaceRemoveWorkerOnElan(elanInstanceName, elanInstance, interfaceName, interfaceInfo, elanInterfaceManager);
jobCoordinator.enqueueJob(elanInstanceName, removeWorker, ElanConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project netvirt by opendaylight.
the class CounterRetriever method createNodeConnectorResultMapDirect.
private CounterResultDataStructure createNodeConnectorResultMapDirect(GetNodeConnectorStatisticsOutput nodeConnectorStatsOutput, NodeConnectorId nodeConnectorId) {
List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorUpdates = nodeConnectorStatsOutput.getNodeConnectorStatisticsAndPortNumberMap();
if (nodeConnectorUpdates == null || nodeConnectorUpdates.isEmpty()) {
counters.failedGettingResultMapForNodeConnectorCounters.inc();
LOG.warn("Unable to retrieve statistics info for node connector");
return null;
}
CounterResultDataStructure crds = new CounterResultDataStructure();
for (NodeConnectorStatisticsAndPortNumberMap nodeConnectorUpdate : nodeConnectorUpdates) {
if (nodeConnectorUpdate.getNodeConnectorId() == null) {
continue;
}
String resultId = nodeConnectorId.getValue();
crds.addCounterResult(resultId);
if (nodeConnectorUpdate.getBytes() != null) {
crds.addCounterToGroup(resultId, CountersUtils.BYTES_GROUP_NAME, CountersUtils.BYTES_RECEIVED_COUNTER_NAME, nodeConnectorUpdate.getBytes().getReceived());
crds.addCounterToGroup(resultId, CountersUtils.BYTES_GROUP_NAME, CountersUtils.BYTES_TRANSMITTED_COUNTER_NAME, nodeConnectorUpdate.getBytes().getTransmitted());
}
if (nodeConnectorUpdate.getPackets() != null) {
crds.addCounterToGroup(resultId, CountersUtils.PACKETS_GROUP_NAME, CountersUtils.PACKETS_RECEIVED_COUNTER_NAME, nodeConnectorUpdate.getPackets().getReceived());
crds.addCounterToGroup(resultId, CountersUtils.PACKETS_GROUP_NAME, CountersUtils.PACKETS_TRANSMITTED_COUNTER_NAME, nodeConnectorUpdate.getPackets().getTransmitted());
}
if (nodeConnectorUpdate.getDuration() != null) {
crds.addCounterToGroup(resultId, CountersUtils.DURATION_GROUP_NAME, CountersUtils.DURATION_SECOND_COUNTER_NAME, big(nodeConnectorUpdate.getDuration().getSecond().getValue()));
crds.addCounterToGroup(resultId, CountersUtils.DURATION_GROUP_NAME, CountersUtils.DURATION_NANO_SECOND_COUNTER_NAME, big(nodeConnectorUpdate.getDuration().getNanosecond().getValue()));
}
}
return crds;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project netvirt by opendaylight.
the class CounterRetriever method getNodeConnectorStatisticsInputBuilder.
private GetNodeConnectorStatisticsInput getNodeConnectorStatisticsInputBuilder(NodeId nodeId, NodeConnectorId nodeConnectorId) {
NodeRef nodeRef = new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(nodeId)).toInstance());
GetNodeConnectorStatisticsInputBuilder nodeConnectorBuilder = new GetNodeConnectorStatisticsInputBuilder().setNode(nodeRef).setNodeConnectorId(nodeConnectorId);
GetNodeConnectorStatisticsInput gncsi = nodeConnectorBuilder.build();
return gncsi;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project netvirt by opendaylight.
the class CounterRetriever method getNodeConnectorCountersDirect.
public CounterResultDataStructure getNodeConnectorCountersDirect(NodeId nodeId, NodeConnectorId nodeConnectorId) {
GetNodeConnectorStatisticsInput gncsi = getNodeConnectorStatisticsInputBuilder(nodeId, nodeConnectorId);
Future<RpcResult<GetNodeConnectorStatisticsOutput>> rpcResultFuture = odlDirectStatsService.getNodeConnectorStatistics(gncsi);
RpcResult<GetNodeConnectorStatisticsOutput> rpcResult = null;
try {
rpcResult = rpcResultFuture.get();
} catch (InterruptedException | ExecutionException e) {
counters.failedGettingNodeConnectorCounters.inc();
LOG.warn("Unable to retrieve node connector counters for port {}", nodeConnectorId);
return null;
}
if (rpcResult != null && rpcResult.isSuccessful() && rpcResult.getResult() != null) {
GetNodeConnectorStatisticsOutput nodeConnectorStatsOutput = rpcResult.getResult();
return createNodeConnectorResultMapDirect(nodeConnectorStatsOutput, nodeConnectorId);
} else {
counters.failedGettingRpcResultForNodeConnectorCounters.inc();
LOG.warn("Unable to retrieve node connector counters for port {}", nodeConnectorId);
return null;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project netvirt by opendaylight.
the class NatUtil method getDpIdFromInterface.
public static BigInteger getDpIdFromInterface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState) {
String lowerLayerIf = ifState.getLowerLayerIf().get(0);
NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
return new BigInteger(getDpnFromNodeConnectorId(nodeConnectorId));
}
Aggregations