Search in sources :

Example 21 with Object

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();
}
Also used : FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 22 with Object

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");
    }
}
Also used : OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) RpcError(org.opendaylight.yangtools.yang.common.RpcError) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) BarrierOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput) TimeoutException(java.util.concurrent.TimeoutException) Test(org.junit.Test)

Example 23 with Object

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);
}
Also used : NonZeroUint16Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type) Hashtable(java.util.Hashtable) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) Before(org.junit.Before)

Example 24 with Object

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();
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder)

Example 25 with Object

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();
}
Also used : Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) MultipartReplyAggregateCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase) Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) MultipartReplyAggregate(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate) AggregatedFlowStatisticsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder)

Aggregations

ArrayList (java.util.ArrayList)94 ByteBuf (io.netty.buffer.ByteBuf)82 Test (org.junit.Test)62 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)34 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)33 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)33 ExecutionException (java.util.concurrent.ExecutionException)30 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)29 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)25 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)25 List (java.util.List)21 HashMap (java.util.HashMap)19 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)18 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)17 Nullable (org.eclipse.jdt.annotation.Nullable)16 UnknownObject (org.opendaylight.protocol.pcep.spi.UnknownObject)16 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)15 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)15 FutureCallback (com.google.common.util.concurrent.FutureCallback)14 BigInteger (java.math.BigInteger)14