Giter VIP home page Giter VIP logo

Comments (6)

charlesmcchan avatar charlesmcchan commented on August 16, 2024

The error message seems suggesting that we should omit the entire match field instead of using wildcard mask.
Have you tried removing the entire match field on hdr.ethernet.dst?

from ngsdn-tutorial.

makrofag1 avatar makrofag1 commented on August 16, 2024

I have removed hdr.ethernet.dst, so the criterion looks like this:
final PiCriterion unmatchedTrafficCriterion = PiCriterion.builder() .matchTernary( PiMatchFieldId.of(""), MacAddress.valueOf("00:00:00:00:00:00").toBytes(), MacAddress.valueOf("00:00:00:00:00:00").toBytes()) .build();

In the result I have received this exception in onos logs:
Exception in thread "pool-13-thread-3" java.lang.IllegalArgumentException: Name cannot be empty at com.google.common.base.Preconditions.checkArgument(Preconditions.java:134) at org.onosproject.net.pi.model.PiMatchFieldId.of(PiMatchFieldId.java:43) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.insertUnmatchedBridgingFlowRule(L2BridgingComponent.java:274) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.setUpDevice(L2BridgingComponent.java:158) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.lambda$setUpAllDevices$2(L2BridgingComponent.java:496) at com.google.common.collect.Iterables$4.lambda$forEach$0(Iterables.java:584) at java.base/java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4772) at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085) at com.google.common.collect.Iterables$4.forEach(Iterables.java:581) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.setUpAllDevices(L2BridgingComponent.java:493) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

There is no way to omit entire object of PiMatchFieldID.of() because in PiCriterion which is used in L2BridingComponent.java all versions of matchTernary() function require 3 arguments. I really don't understand why it doesn't work despite it is a tutorial.

from ngsdn-tutorial.

charlesmcchan avatar charlesmcchan commented on August 16, 2024

I was suggesting skipping the entire ethernet dst match field. Something like this:

final PiCriterion unmatchedTrafficCriterion = PiCriterion.builder().build();

This should theoretically create a "catch all" match

from ngsdn-tutorial.

makrofag1 avatar makrofag1 commented on August 16, 2024

I checked your suggestion but I get:
Exception in thread "pool-13-thread-3" java.lang.IllegalArgumentException: Cannot build PI criterion with 0 field matches at com.google.common.base.Preconditions.checkArgument(Preconditions.java:134) at org.onosproject.net.flow.criteria.PiCriterion$Builder.build(PiCriterion.java:334) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.insertUnmatchedBridgingFlowRule(L2BridgingComponent.java:272) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.setUpDevice(L2BridgingComponent.java:158) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.lambda$setUpAllDevices$2(L2BridgingComponent.java:491) at com.google.common.collect.Iterables$4.lambda$forEach$0(Iterables.java:584) at java.base/java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4772) at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085) at com.google.common.collect.Iterables$4.forEach(Iterables.java:581) at org.onosproject.ngsdn.tutorial.L2BridgingComponent.setUpAllDevices(L2BridgingComponent.java:488) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

from ngsdn-tutorial.

charlesmcchan avatar charlesmcchan commented on August 16, 2024

Hmm... alright, looks like it doesn't like it either. Will need to take a closer look to figure out why the original PiCriterion get rejected.

from ngsdn-tutorial.

ccascone avatar ccascone commented on August 16, 2024

Hi @makrofag1, you are describing the case where an app wants to modify a table's default action, which is equivalent to a flow rule with all match fields set to "don't care". To create such a flow rule, you simply need to omit adding a selector when invoking the flow rule builder. Unfortunately, in this tutorial we use the utility method buildFlowRule which always adds a selector:

.withSelector(DefaultTrafficSelector.builder()

You could solve this by creating a different utility method that looks like this:

public static FlowRule buildFlowRuleDefaultAction(DeviceId switchId, ApplicationId appId,
                                                  String tableId, PiTableAction piAction) {
        return DefaultFlowRule.builder()
                .forDevice(switchId)
                .forTable(PiTableId.of(tableId))
                .fromApp(appId)
                .withPriority(DEFAULT_FLOW_RULE_PRIORITY)
                .makePermanent(
                .withTreatment(DefaultTrafficTreatment.builder()
                                       .piTableAction(piAction).build())
                .build();
    }

from ngsdn-tutorial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.