use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project openflowplugin by opendaylight.
the class OpenflowpluginGroupTestServiceProvider method register.
public ObjectRegistration<OpenflowpluginGroupTestServiceProvider> register(final ProviderContext ctx) {
RoutedRpcRegistration<SalGroupService> addRoutedRpcImplementation = ctx.<SalGroupService>addRoutedRpcImplementation(SalGroupService.class, this);
setGroupRegistration(addRoutedRpcImplementation);
InstanceIdentifierBuilder<Nodes> builder1 = InstanceIdentifier.<Nodes>builder(Nodes.class);
NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID);
NodeKey nodeKey = new NodeKey(nodeId);
InstanceIdentifierBuilder<Node> nodeIndentifier = builder1.<Node, NodeKey>child(Node.class, nodeKey);
InstanceIdentifier<Node> instance = nodeIndentifier.build();
groupRegistration.registerPath(NodeContext.class, instance);
RoutedRpcRegistration<SalGroupService> groupRegistration1 = this.getGroupRegistration();
return new AbstractObjectRegistration<OpenflowpluginGroupTestServiceProvider>(this) {
@Override
protected void removeRegistration() {
groupRegistration1.close();
}
};
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project openflowplugin by opendaylight.
the class OpenflowpluginMeterTestServiceProvider method register.
public ObjectRegistration<OpenflowpluginMeterTestServiceProvider> register(final ProviderContext ctx) {
RoutedRpcRegistration<SalMeterService> addRoutedRpcImplementation = ctx.<SalMeterService>addRoutedRpcImplementation(SalMeterService.class, this);
setMeterRegistration(addRoutedRpcImplementation);
InstanceIdentifierBuilder<Nodes> builder1 = InstanceIdentifier.<Nodes>builder(Nodes.class);
NodeId nodeId = new NodeId(OpenflowpluginTestActivator.NODE_ID);
NodeKey nodeKey = new NodeKey(nodeId);
InstanceIdentifierBuilder<Node> nodeIndentifier = builder1.<Node, NodeKey>child(Node.class, nodeKey);
InstanceIdentifier<Node> instance = nodeIndentifier.build();
meterRegistration.registerPath(NodeContext.class, instance);
RoutedRpcRegistration<SalMeterService> meterRegistration1 = this.getMeterRegistration();
return new AbstractObjectRegistration<OpenflowpluginMeterTestServiceProvider>(this) {
@Override
protected void removeRegistration() {
meterRegistration1.close();
}
};
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project genius by opendaylight.
the class NodeConnectorStatsImpl method remove.
@Override
protected void remove(InstanceIdentifier<Node> identifier, Node node) {
NodeId nodeId = node.getId();
String nodeVal = nodeId.getValue().split(":")[1];
BigInteger dpId = new BigInteger(nodeVal);
if (nodes.contains(dpId)) {
nodes.remove(dpId);
// remove counters set from node
Set<Counter> nodeMetricCounterSet = metricsCountersPerNodeMap.remove(dpId);
if (nodeMetricCounterSet != null) {
// remove counters
nodeMetricCounterSet.forEach(UncheckedCloseable::close);
}
}
if (nodes.size() > 0) {
delayStatsQuery = ifmConfig.getIfmStatsDefPollInterval() / nodes.size();
} else {
stopPortStatRequestTask();
delayStatsQuery = 0;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Close in project genius by opendaylight.
the class NodeConnectorStatsImpl method getCounter.
/*
* This method returns counter and also creates counter if does not exist.
*
* @param counterName name of the counter
* @param switchId datapath-id value
* @param port port-id value
* @param aliasId alias-id value
* @param tableId table-id value of switch
* @return counter object
*/
private Counter getCounter(String counterName, BigInteger switchId, String port, String aliasId, String tableId) {
/*
* Pattern to be followed for key generation:
*
* genius.interfacemanager.entitycounter{entitytype=port,switchid=value,portid=value,aliasid=value,
* name=counterName}
* genius.interfacemanager.entitycounter{entitytype=flowtable,switchid=value,flowtableid=value,name=counterName}
*/
Counter counter = null;
if (port != null) {
Labeled<Labeled<Labeled<Labeled<Labeled<Counter>>>>> labeledCounter = metricProvider.newCounter(MetricDescriptor.builder().anchor(this).project("genius").module("interfacemanager").id(CounterConstants.CNT_TYPE_ENTITY_CNT_ID).build(), CounterConstants.LBL_KEY_ENTITY_TYPE, CounterConstants.LBL_KEY_SWITCHID, CounterConstants.LBL_KEY_PORTID, CounterConstants.LBL_KEY_ALIASID, CounterConstants.LBL_KEY_COUNTER_NAME);
counter = labeledCounter.label(CounterConstants.LBL_VAL_ENTITY_TYPE_PORT).label(switchId.toString()).label(port).label(aliasId).label(counterName);
}
if (tableId != null) {
Labeled<Labeled<Labeled<Labeled<Counter>>>> labeledCounter = metricProvider.newCounter(MetricDescriptor.builder().anchor(this).project("genius").module("interfacemanager").id(CounterConstants.CNT_TYPE_ENTITY_CNT_ID).build(), CounterConstants.LBL_KEY_ENTITY_TYPE, CounterConstants.LBL_KEY_SWITCHID, CounterConstants.LBL_KEY_FLOWTBLID, CounterConstants.LBL_KEY_COUNTER_NAME);
counter = labeledCounter.label(CounterConstants.LBL_VAL_ENTITY_TYPE_FLOWTBL).label(switchId.toString()).label(tableId).label(counterName);
}
// create counters set for node if absent.
// and then populate counter set with counter object
// which will be needed to close counters when node is removed.
metricsCountersPerNodeMap.computeIfAbsent(switchId, counterSet -> ConcurrentHashMap.newKeySet()).add(counter);
return counter;
}
Aggregations