use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter in project lispflowmapping by opendaylight.
the class LispAuthenticationTest method validate__NoAuthentication.
@Test
public void validate__NoAuthentication() throws Exception {
// LISP(Type = 3 Map-Register, P=1, M=1
// Record Counter: 1
// Nonce: (something)
// Key ID: 0x0000
// AuthDataLength: 0:
// EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
// No-Action
// Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
// Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
//
final ByteBuffer byteBuffer = hexToByteBuffer("38 00 01 01 FF BB " + "00 00 00 00 00 00 00 00 00 00 " + "00 00 " + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " + "ff 00 00 05 00 01 c0 a8 88 0a");
MapRegister mapRegister = MapRegisterSerializer.getInstance().deserialize(byteBuffer, null);
assertTrue(validate(mapRegister, byteBuffer, EID, 0, PASSWORD));
assertTrue(validate(mapRegister, byteBuffer, EID, 0, WRONG_PASSWORD));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter in project genius by opendaylight.
the class FlowNodeConnectorInventoryTranslatorImpl method remove.
@Override
public void remove(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector del, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
Counter counter;
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
String nodeConnectorIdentifier = getNodeConnectorId(String.valueOf(nodeConnIdent.firstKeyOf(NodeConnector.class).getId()));
long dataPathId = getDpIdFromPortName(nodeConnectorIdentifier);
if (dpnToPortMultiMap.containsKey(dataPathId)) {
LOG.debug("Node Connector {} removed", nodeConnectorIdentifier);
dpnToPortMultiMap.remove(dataPathId, nodeConnectorIdentifier);
counter = packetInCounter.label("OFSwitch").label(String.valueOf(dataPathId)).label("portsperswitch");
counter.decrement();
PortNameMapping.updatePortMap("openflow:" + dataPathId + ":" + del.getName(), nodeConnectorIdentifier, "DELETE");
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter in project genius by opendaylight.
the class FlowNodeConnectorInventoryTranslatorImpl method add.
@Override
public void add(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector add, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
Counter counter;
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
String nodeConnectorIdentifier = getNodeConnectorId(String.valueOf(nodeConnIdent.firstKeyOf(NodeConnector.class).getId()));
long dataPathId = getDpIdFromPortName(nodeConnectorIdentifier);
if (entityOwnershipUtils.isEntityOwner(FcapsConstants.SERVICE_ENTITY_TYPE, getNodeId(dataPathId))) {
if (!dpnToPortMultiMap.containsEntry(dataPathId, nodeConnectorIdentifier)) {
LOG.debug("Node Connector {} added", nodeConnectorIdentifier);
dpnToPortMultiMap.put(dataPathId, nodeConnectorIdentifier);
counter = packetInCounter.label("OFSwitch").label(String.valueOf(dataPathId)).label("portsperswitch");
counter.increment();
PortNameMapping.updatePortMap("openflow:" + dataPathId + ":" + add.getName(), nodeConnectorIdentifier, "ADD");
} else {
LOG.error("Duplicate Event.Node Connector already added");
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter in project controller by opendaylight.
the class OpendaylightToaster method restockToaster.
/**
* RestConf RPC call implemented from the ToasterService interface.
* Restocks the bread for the toaster, resets the toastsMade counter to 0, and sends a
* ToasterRestocked notification.
*/
@Override
public ListenableFuture<RpcResult<RestockToasterOutput>> restockToaster(final RestockToasterInput input) {
LOG.info("restockToaster: {}", input);
amountOfBreadInStock.set(input.getAmountOfBreadToStock().toJava());
if (amountOfBreadInStock.get() > 0) {
ToasterRestocked reStockedNotification = new ToasterRestockedBuilder().setAmountOfBread(input.getAmountOfBreadToStock()).build();
notificationProvider.offerNotification(reStockedNotification);
}
return Futures.immediateFuture(RpcResultBuilder.success(EMPTY_RESTOCK_OUTPUT).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter in project netvirt by opendaylight.
the class StatisticsImpl method releaseElementCountersRequestHandler.
@Override
public Future<RpcResult<ReleaseElementCountersRequestHandlerOutput>> releaseElementCountersRequestHandler(ReleaseElementCountersRequestHandlerInput input) {
InstanceIdentifier<CounterRequests> ingressPath = InstanceIdentifier.builder(IngressElementCountersRequestConfig.class).child(CounterRequests.class, new CounterRequestsKey(input.getHandler())).build();
InstanceIdentifier<CounterRequests> egressPath = InstanceIdentifier.builder(EgressElementCountersRequestConfig.class).child(CounterRequests.class, new CounterRequestsKey(input.getHandler())).build();
ReadWriteTransaction tx = db.newReadWriteTransaction();
CheckedFuture<Optional<CounterRequests>, ReadFailedException> ingressRequestData = tx.read(LogicalDatastoreType.CONFIGURATION, ingressPath);
CheckedFuture<Optional<CounterRequests>, ReadFailedException> egressRequestData = tx.read(LogicalDatastoreType.CONFIGURATION, egressPath);
CheckedFuture<Optional<IngressElementCountersRequestConfig>, ReadFailedException> iecrc = tx.read(LogicalDatastoreType.CONFIGURATION, CountersServiceUtils.IECRC_IDENTIFIER);
CheckedFuture<Optional<EgressElementCountersRequestConfig>, ReadFailedException> eecrc = tx.read(LogicalDatastoreType.CONFIGURATION, CountersServiceUtils.EECRC_IDENTIFIER);
try {
Optional<IngressElementCountersRequestConfig> iecrcOpt = iecrc.get();
Optional<EgressElementCountersRequestConfig> eecrcOpt = eecrc.get();
if (!iecrcOpt.isPresent() || !eecrcOpt.isPresent()) {
LOG.warn("Couldn't read element counters config data from DB");
StatisticsPluginImplCounters.failed_reading_counter_data_from_config.inc();
return RpcResultBuilder.<ReleaseElementCountersRequestHandlerOutput>failed().withError(ErrorType.APPLICATION, "Couldn't read element counters config data from DB").buildFuture();
}
if (!ingressRequestData.get().isPresent() && !egressRequestData.get().isPresent()) {
LOG.warn("Handler does not exists");
StatisticsPluginImplCounters.unknown_request_handler.inc();
return RpcResultBuilder.<ReleaseElementCountersRequestHandlerOutput>failed().withError(ErrorType.APPLICATION, "Handler does not exists").buildFuture();
}
String generatedKey = null;
if (ingressRequestData.get().isPresent()) {
handleReleaseTransaction(input, ingressPath, ingressRequestData, iecrcOpt.get().getCounterRequests());
generatedKey = ingressRequestData.get().get().getGeneratedUniqueId();
}
if (egressRequestData.get().isPresent()) {
handleReleaseTransaction(input, egressPath, egressRequestData, eecrcOpt.get().getCounterRequests());
generatedKey = egressRequestData.get().get().getGeneratedUniqueId();
}
releaseId(generatedKey);
} catch (InterruptedException | ExecutionException e) {
LOG.warn("failed to get counter request data from DB");
return RpcResultBuilder.<ReleaseElementCountersRequestHandlerOutput>failed().withError(ErrorType.APPLICATION, "failed to get counter request data from DB").buildFuture();
}
return RpcResultBuilder.<ReleaseElementCountersRequestHandlerOutput>success().buildFuture();
}
Aggregations