use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.Updates in project genius by opendaylight.
the class NodeConnectorStatsImpl method processFlowStatistics.
/**
* This method processes FlowStatistics RPC result.
* It performs:
* - fetches all flows of node
* - stores flows count per table in local map
* - creates/updates Flow table counters using Infrautils metrics API
* - set counter with values fetched from FlowStatistics
*/
private void processFlowStatistics(GetFlowStatisticsOutput flowStatsOutput, BigInteger dpid) {
Map<Short, AtomicInteger> flowTableMap = new HashMap<>();
// Get all flows for node from RPC result
List<FlowAndStatisticsMapList> flowTableAndStatisticsMapList = flowStatsOutput.getFlowAndStatisticsMapList();
for (FlowAndStatisticsMapList flowAndStatisticsMap : flowTableAndStatisticsMapList) {
short tableId = flowAndStatisticsMap.getTableId();
// populate map to maintain flow count per table
flowTableMap.computeIfAbsent(tableId, key -> new AtomicInteger(0)).incrementAndGet();
}
LOG.trace("FlowTableStatistics (tableId:counter): {} for node: {}", flowTableMap.entrySet(), dpid.toString());
for (Map.Entry<Short, AtomicInteger> flowTable : flowTableMap.entrySet()) {
Short tableId = flowTable.getKey();
AtomicInteger flowCount = flowTable.getValue();
Counter counter = getCounter(CounterConstants.IFM_FLOW_TBL_COUNTER_FLOWS_PER_TBL, dpid, null, null, tableId.toString());
// update counter value
updateCounter(counter, flowCount.longValue());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.Updates in project genius by opendaylight.
the class NodeConnectorStatsImpl method processNodeConnectorStatistics.
/**
* This method processes NodeConnectorStatistics RPC result.
* It performs:
* - fetches various OF Port counters values
* - creates/updates new OF Port counters using Infrautils metrics API
* - set counter with values fetched from NodeConnectorStatistics
*/
private void processNodeConnectorStatistics(GetNodeConnectorStatisticsOutput nodeConnectorStatisticsOutput, BigInteger dpid) {
String port = "";
String portUuid = "";
List<NodeConnectorStatisticsAndPortNumberMap> ncStatsAndPortMapList = nodeConnectorStatisticsOutput.getNodeConnectorStatisticsAndPortNumberMap();
// Parse NodeConnectorStatistics and create/update counters for them
for (NodeConnectorStatisticsAndPortNumberMap ncStatsAndPortMap : ncStatsAndPortMapList) {
NodeConnectorId nodeConnector = ncStatsAndPortMap.getNodeConnectorId();
LOG.trace("Create/update metric counter for NodeConnector: {} of node: {}", nodeConnector, dpid.toString());
port = nodeConnector.getValue();
// update port name as per port name maintained in portNameCache
String portNameInCache = "openflow" + ":" + dpid.toString() + ":" + port;
java.util.Optional<String> portName = portNameCache.get(portNameInCache);
if (portName.isPresent()) {
Optional<List<InterfaceChildEntry>> interfaceChildEntries = interfaceChildCache.getInterfaceChildEntries(portName.get());
if (interfaceChildEntries.isPresent()) {
if (!interfaceChildEntries.get().isEmpty()) {
portUuid = interfaceChildEntries.get().get(0).getChildInterface();
LOG.trace("Retrieved portUuid {} for portname {}", portUuid, portName.get());
} else {
LOG.trace("PortUuid is not found for portname {}. Skipping IFM counters publish for this port.", portName.get());
continue;
}
} else {
LOG.trace("PortUuid is not found for portname {}. Skipping IFM counters publish for this port.", portName.get());
continue;
}
}
Counter counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_DURATION, dpid, port, portUuid, null);
long ofPortDuration = ncStatsAndPortMap.getDuration().getSecond().getValue();
updateCounter(counter, ofPortDuration);
counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_PKT_RECVDROP, dpid, port, portUuid, null);
long packetsPerOFPortReceiveDrop = ncStatsAndPortMap.getReceiveDrops().longValue();
updateCounter(counter, packetsPerOFPortReceiveDrop);
counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_PKT_RECVERROR, dpid, port, portUuid, null);
long packetsPerOFPortReceiveError = ncStatsAndPortMap.getReceiveErrors().longValue();
updateCounter(counter, packetsPerOFPortReceiveError);
counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_PKT_SENT, dpid, port, portUuid, null);
long packetsPerOFPortSent = ncStatsAndPortMap.getPackets().getTransmitted().longValue();
updateCounter(counter, packetsPerOFPortSent);
counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_PKT_RECV, dpid, port, portUuid, null);
long packetsPerOFPortReceive = ncStatsAndPortMap.getPackets().getReceived().longValue();
updateCounter(counter, packetsPerOFPortReceive);
counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_BYTE_SENT, dpid, port, portUuid, null);
long bytesPerOFPortSent = ncStatsAndPortMap.getBytes().getTransmitted().longValue();
updateCounter(counter, bytesPerOFPortSent);
counter = getCounter(CounterConstants.IFM_PORT_COUNTER_OFPORT_BYTE_RECV, dpid, port, portUuid, null);
long bytesPerOFPortReceive = ncStatsAndPortMap.getBytes().getReceived().longValue();
updateCounter(counter, bytesPerOFPortReceive);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.Updates in project netvirt by opendaylight.
the class InterVpnLinkUtil method updateInterVpnLinkState.
/**
* Updates inter-VPN link state.
*
* @param vpnLinkName The name of the InterVpnLink
* @param state Sets the state of the InterVpnLink to Active or Error
* @param newFirstEndpointState Updates the lportTag and/or DPNs of the 1st endpoint of the InterVpnLink
* @param newSecondEndpointState Updates the lportTag and/or DPNs of the 2nd endpoint of the InterVpnLink
* @param interVpnLinkCache the InterVpnLinkCache
*/
void updateInterVpnLinkState(String vpnLinkName, InterVpnLinkState.State state, FirstEndpointState newFirstEndpointState, SecondEndpointState newSecondEndpointState, InterVpnLinkCache interVpnLinkCache) {
Optional<InterVpnLinkState> optOldVpnLinkState = getInterVpnLinkState(vpnLinkName);
if (optOldVpnLinkState.isPresent()) {
InterVpnLinkState newVpnLinkState = new InterVpnLinkStateBuilder(optOldVpnLinkState.get()).setState(state).setFirstEndpointState(newFirstEndpointState).setSecondEndpointState(newSecondEndpointState).build();
vpnUtil.syncUpdate(LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkStateIid(vpnLinkName), newVpnLinkState);
interVpnLinkCache.addInterVpnLinkStateToCaches(newVpnLinkState);
} else {
InterVpnLinkState newIVpnLinkState = new InterVpnLinkStateBuilder().withKey(new InterVpnLinkStateKey(vpnLinkName)).setInterVpnLinkName(vpnLinkName).setFirstEndpointState(newFirstEndpointState).setSecondEndpointState(newSecondEndpointState).setState(InterVpnLinkState.State.Active).build();
vpnUtil.syncWrite(LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkStateIid(vpnLinkName), newIVpnLinkState);
interVpnLinkCache.addInterVpnLinkStateToCaches(newIVpnLinkState);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.Updates in project netvirt by opendaylight.
the class QosNeutronPortChangeListener method update.
@Override
public void update(InstanceIdentifier<Port> instanceIdentifier, Port original, Port update) {
qosNeutronUtils.addToPortCache(update);
// check for QoS updates
QosPortExtension updateQos = update.augmentation(QosPortExtension.class);
QosPortExtension originalQos = original.augmentation(QosPortExtension.class);
if (originalQos == null && updateQos != null) {
// qosservice policy add
qosNeutronUtils.addToQosPortsCache(updateQos.getQosPolicyId(), update);
qosNeutronUtils.handleNeutronPortQosAdd(update, updateQos.getQosPolicyId());
} else if (originalQos != null && updateQos != null && !Objects.equals(originalQos.getQosPolicyId(), updateQos.getQosPolicyId())) {
// qosservice policy update
qosNeutronUtils.removeFromQosPortsCache(originalQos.getQosPolicyId(), original);
qosNeutronUtils.addToQosPortsCache(updateQos.getQosPolicyId(), update);
qosNeutronUtils.handleNeutronPortQosUpdate(update, updateQos.getQosPolicyId(), originalQos.getQosPolicyId());
} else if (originalQos != null && updateQos == null) {
// qosservice policy delete
qosNeutronUtils.handleNeutronPortQosRemove(original, originalQos.getQosPolicyId());
qosNeutronUtils.removeFromQosPortsCache(originalQos.getQosPolicyId(), original);
}
if (qosEosHandler.isQosClusterOwner()) {
checkForPortIpAddressUpdate(original, update);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.Updates in project netvirt by opendaylight.
the class NeutronPortChangeListener method createOfPortInterface.
private String createOfPortInterface(Port port, TypedWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
Interface inf = createInterface(port);
String infName = inf.getName();
InstanceIdentifier<Interface> interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(infName);
try {
Optional<Interface> optionalInf = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, interfaceIdentifier);
if (!optionalInf.isPresent()) {
wrtConfigTxn.put(interfaceIdentifier, inf);
} else if (isInterfaceUpdated(inf, optionalInf.get())) {
/*
Case where an update DTCN wasn't received by this class due to node going down
upon cluster reboot or any other unknown reason
In such a case, updates contained in the missed DTCN won't be processed and have to be handled
explicitly
Update of subports (vlanId, splithorizon tag) is handled here
Update of portSecurity (PortSecurityEnabled, SecurityGroups, AllowedAddressPairs) add is handled
Update of portSecurity update/removed is not handled
Update of parentrefs is not handled as parentrefs updation is handled by IFM Oxygen onwards
*/
wrtConfigTxn.put(interfaceIdentifier, inf);
LOG.error("Interface {} is already present and is updated", infName);
} else {
LOG.warn("Interface {} is already present", infName);
}
} catch (ExecutionException | InterruptedException e) {
LOG.error("failed to create interface {}", infName, e);
}
return infName;
}
Aggregations