Skip to content
Andreas Wundsam edited this page Nov 18, 2013 · 17 revisions

Overview

OpenFlowJ-Loxi is the Java artifact of Loxigen. It exposes the OpenFlow protocol through a version-agnostic, fluent Java API.

Architecture

  • OpenFlow Messages and other concepts (Matches, Actions, Instructions etc.) are exposed as version-agnostic Interfaces (the API exposes the union of the functionality available in OF1.0-OF1.3).
    • version specific implementations are hidden from the user, and exposed/created through OFFactory.
  • Value Types (static concepts) like IP address, Mac Address, Ports etc. are exposed as instance-controlled immutable objects (pattern: OFPort.of(123) ).
  • Both messages and Value types are immutable - Builders are available to gradually build those objects.
Message Interfaces and Value Type Classes
Message Interfaces and Implementations

API Example

        OFFlowAdd.Builder builder = factory.buildFlowAdd();
        builder.setXid(0x12345678)
                .setCookie(U64.parseHex("FEDCBA9876543210"))
                .setCookieMask(U64.parseHex("FF00FF00FF00FF00"))
                .setTableId(TableId.of(3))
                .setIdleTimeout(5)
                .setHardTimeout(10)
                .setPriority(6000)
                .setBufferId(OFBufferId.of(50))
                .setOutPort(OFPort.of(6))
                .setOutGroup(8)
                .setFlags(ImmutableSet.<OFFlowModFlags> of())
                .setMatch(
                        factory.buildMatch()
                                .setMasked(MatchField.IN_PORT, OFPort.of(4), OFPort.of(5))
                                .setExact(MatchField.ETH_TYPE, EthType.IPv6)
                                .setExact(MatchField.IP_PROTO, IpProtocol.TCP)
                                .setMasked(MatchField.IPV6_SRC,
                                        IPv6Address.of(0x1CCAFE1CB1101C00l, 0x0028000000000000l),
                                        IPv6Address.of(0xFFFFFFFFFFF0FFFFl, 0x1C2C3C0000000000l))
                                .build())
                .setInstructions(
                        ImmutableList.<OFInstruction> of(
                                factory.instructions().gotoTable(TableId.of(4)), factory
                                        .instructions().gotoTable(TableId.of(7))));
        ;
        OFFlowAdd flowAdd = builder.build();
Clone this wiki locally