use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.
the class FlowCreatorUtil method createWildcardedMatchV10.
/**
* Method creates openflow 1.0 format match, that can match all the flow entries.
*
* @return V10 Match object
*/
public static MatchV10 createWildcardedMatchV10() {
MatchV10Builder builder = new MatchV10Builder();
builder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true, true, true, true, true));
builder.setNwSrcMask((short) 0);
builder.setNwDstMask((short) 0);
builder.setInPort(0);
builder.setDlSrc(new MacAddress("00:00:00:00:00:00"));
builder.setDlDst(new MacAddress("00:00:00:00:00:00"));
builder.setDlVlan(0);
builder.setDlVlanPcp((short) 0);
builder.setDlType(0);
builder.setNwTos((short) 0);
builder.setNwProto((short) 0);
builder.setNwSrc(new Ipv4Address("0.0.0.0"));
builder.setNwDst(new Ipv4Address("0.0.0.0"));
builder.setTpSrc(0);
builder.setTpDst(0);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.
the class ResponseExpectedRpcListenerTest method testDiscard.
/**
* Test object creation.
*/
@Test
public void testDiscard() {
RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
listener.discard();
RpcError rpcError = AbstractRpcListener.buildRpcError("Failed to send message", "check switch connection", new TimeoutException("Request timed out"));
SettableFuture<RpcResult<?>> result = SettableFuture.create();
result.set(RpcResultBuilder.failed().withRpcError(rpcError).build());
try {
Assert.assertEquals("Wrong result", result.get().getErrors().iterator().next().getMessage(), listener.getResult().get().getErrors().iterator().next().getMessage());
Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
} catch (InterruptedException | ExecutionException e) {
fail("Problem accessing result");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.
the class ConfigurationServiceFactoryImplTest method setUp.
@Before
public void setUp() throws Exception {
when(config.isIsStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsFlowStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsTableStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsFlowStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsGroupStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsMeterStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsQueueStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.isIsPortStatisticsPollingOn()).thenReturn(IS_STATISTICS_POLLING_ON);
when(config.getBarrierCountLimit()).thenReturn(new NonZeroUint16Type(BARRIER_COUNT_LIMIT));
when(config.getBarrierIntervalTimeoutLimit()).thenReturn(new NonZeroUint32Type(BARRIER_INTERVAL_TIMEOUT_LIMIT));
when(config.getEchoReplyTimeout()).thenReturn(new NonZeroUint32Type(ECHO_REPLY_TIMEOUT));
when(config.isEnableFlowRemovedNotification()).thenReturn(ENABLE_FLOW_REMOVED_NOTIFICATION);
when(config.isSkipTableFeatures()).thenReturn(SKIP_TABLE_FEATURES);
when(config.getBasicTimerDelay()).thenReturn(new NonZeroUint32Type(BASIC_TIMER_DELAY));
when(config.getMaximumTimerDelay()).thenReturn(new NonZeroUint32Type(MAXIMUM_TIMER_DELAY));
when(config.isSwitchFeaturesMandatory()).thenReturn(SWITCH_FEATURES_MANDATORY);
when(config.isIsStatisticsRpcEnabled()).thenReturn(IS_STATISTICS_RPC_ENABLED);
when(config.isUseSingleLayerSerialization()).thenReturn(USE_SINGLE_LAYER_SERIALIZATION);
when(config.getRpcRequestsQuota()).thenReturn(new NonZeroUint16Type(RPC_REQUESTS_QUOTA));
when(config.getGlobalNotificationQuota()).thenReturn(GLOBAL_NOTIFICATION_QUOTA);
when(config.getThreadPoolMinThreads()).thenReturn(THREAD_POOL_MIN_THREADS);
when(config.getThreadPoolMaxThreads()).thenReturn(new NonZeroUint16Type(THREAD_POOL_MAX_THREADS));
when(config.getThreadPoolTimeout()).thenReturn(THREAD_POOL_TIMEOUT);
final Dictionary<String, Object> properties = new Hashtable<>();
properties.put(ConfigurationProperty.IS_STATISTICS_POLLING_ON.toString(), IS_STATISTICS_POLLING_ON);
when(configuration.getProperties()).thenReturn(properties);
when(configurationAdmin.getConfiguration(OFConstants.CONFIG_FILE_ID)).thenReturn(configuration);
when(bundleContext.getService(serviceReference)).thenReturn(configurationAdmin);
when(bundleContext.getServiceReference(ConfigurationAdmin.class)).thenReturn(serviceReference);
configurationService = new ConfigurationServiceFactoryImpl().newInstance(config, bundleContext);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.
the class FlowsInTableService method buildRequest.
@Override
protected OfHeader buildRequest(final Xid xid, final GetFlowStatisticsFromFlowTableInput input) throws ServiceException {
final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
if (input.getTableId() != null) {
mprFlowRequestBuilder.setTableId(input.getTableId());
} else {
mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
}
if (input.getOutPort() != null) {
mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
} else {
mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
}
if (input.getOutGroup() != null) {
mprFlowRequestBuilder.setOutGroup(input.getOutGroup());
} else {
mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
}
if (input.getCookie() != null) {
mprFlowRequestBuilder.setCookie(input.getCookie().getValue());
} else {
mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
}
if (input.getCookieMask() != null) {
mprFlowRequestBuilder.setCookieMask(input.getCookieMask().getValue());
} else {
mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
}
// convert and inject match
final Optional<Object> conversionMatch = convertorExecutor.convert(input.getMatch(), data);
MatchInjector.inject(conversionMatch, mprFlowRequestBuilder, data.getVersion());
// Set request body to main multipart request
multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
return mprInput.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.
the class AggregatedFlowStatisticsTranslator method translate.
@Override
public AggregatedFlowStatistics translate(final MultipartReply input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
AggregatedFlowStatisticsBuilder aggregatedFlowStatisticsBuilder = new AggregatedFlowStatisticsBuilder();
MultipartReplyAggregateCase caseBody = (MultipartReplyAggregateCase) input.getMultipartReplyBody();
MultipartReplyAggregate replyBody = caseBody.getMultipartReplyAggregate();
aggregatedFlowStatisticsBuilder.setByteCount(new Counter64(replyBody.getByteCount()));
aggregatedFlowStatisticsBuilder.setFlowCount(new Counter32(replyBody.getFlowCount()));
aggregatedFlowStatisticsBuilder.setPacketCount(new Counter64(replyBody.getPacketCount()));
return aggregatedFlowStatisticsBuilder.build();
}
Aggregations