Java 类org.projectfloodlight.openflow.protocol.OFHelloElem 实例源码

项目:athena    文件:OFChannelHandler.java   
/**
 * Send hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHandshakeHelloMessage() throws IOException {
    // The OF protocol requires us to start things off by sending the highest
    // version of the protocol supported.

    // bitmap represents OF1.0 (ofp_version=0x01) and OF1.3 (ofp_version=0x04)
    // see Sec. 7.5.1 of the OF1.3.4 spec
    U32 bitmap = U32.ofRaw(0x00000012);
    OFHelloElem hem = factory13.buildHelloElemVersionbitmap()
            .setBitmaps(Collections.singletonList(bitmap))
            .build();
    OFMessage.Builder mb = factory13.buildHello()
            .setXid(this.handshakeTransactionIds--)
            .setElements(Collections.singletonList(hem));
    log.info("Sending OF_13 Hello to {}", channel.getRemoteAddress());
    channel.write(Collections.singletonList(mb.build()));
}
项目:fresco_floodlight    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    write(m);
    log.debug("Send hello: {}", m); 
}
项目:fresco_floodlight    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:iTAP-controller    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));

    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:SDN-Multicast    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    write(m);
    log.debug("Send hello: {}", m); 
}
项目:SDN-Multicast    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:arscheduler    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    write(m);
    log.debug("Send hello: {}", m); 
}
项目:arscheduler    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:floodlight1.2-delay    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    write(m);
    log.debug("Send hello: {}", m); 
}
项目:floodlight1.2-delay    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:floodlight-hardware    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    write(m);
    log.debug("Send hello: {}", m);
}
项目:floodlight-hardware    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:ACAMPController    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    write(m);
    log.debug("Send hello: {}", m); 
}
项目:ACAMPController    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:fast-failover-demo    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));

    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:ravikumaran201504    文件:OFChannelHandler.java   
/**
 * Send hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHandshakeHelloMessage() throws IOException {
    // The OF protocol requires us to start things off by sending the highest
    // version of the protocol supported.

    // bitmap represents OF1.0 (ofp_version=0x01) and OF1.3 (ofp_version=0x04)
    // see Sec. 7.5.1 of the OF1.3.4 spec
    U32 bitmap = U32.ofRaw(0x00000012);
    OFHelloElem hem = factory13.buildHelloElemVersionbitmap()
            .setBitmaps(Collections.singletonList(bitmap))
            .build();
    OFMessage.Builder mb = factory13.buildHello()
            .setXid(this.handshakeTransactionIds--)
            .setElements(Collections.singletonList(hem));
    log.info("Sending OF_13 Hello to {}", channel.getRemoteAddress());
    channel.write(Collections.singletonList(mb.build()));
}
项目:floodlightLB    文件:OFChannelHandler.java   
/**
 * Send a hello message to the switch using the handshake transactions ids.
 * @throws IOException
 */
private void sendHelloMessage() throws IOException {
    // Send initial hello message

    OFHello.Builder builder = factory.buildHello();

    /* Our highest-configured OFVersion does support version bitmaps, so include it */
    if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
        List<OFHelloElem> he = new ArrayList<OFHelloElem>();
        he.add(factory.buildHelloElemVersionbitmap()
                .setBitmaps(ofBitmaps)
                .build());
        builder.setElements(he);
    }

    OFHello m = builder.setXid(handshakeTransactionIds--)
            .build();

    channel.write(Collections.singletonList(m));
    log.debug("Send hello: {}", m); 
}
项目:floodlightLB    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));

    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:DSC    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));

    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:floodlight    文件:OFConnectionTest.java   
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));

    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
项目:spring-open    文件:OFChannelHandler.java   
/**
 * Send hello message to the switch using the handshake transactions ids.
 *
 * @throws IOException
 */
private void sendHandshakeHelloMessage() throws IOException {
    // The OF protocol requires us to start things off by sending the
    // highest
    // version of the protocol supported.

    // bitmap represents OF1.0 (ofp_version=0x01) and OF1.3
    // (ofp_version=0x04)
    // see Sec. 7.5.1 of the OF1.3.4 spec
    OFHello hello;
    if (useOnly10) {
        hello = factory10.buildHello().setXid(handshakeTransactionIds--).build();
        log.info("Sending OF_10 Hello to {}", channel.getRemoteAddress());
    } else {
        U32 bitmap = U32.ofRaw(0x00000012);
        OFHelloElem hem = factory13.buildHelloElemVersionbitmap()
                .setBitmaps(Collections.singletonList(bitmap))
                .build();
        OFHello.Builder mb = factory13.buildHello()
                .setXid(this.handshakeTransactionIds--)
                .setElements(Collections.singletonList(hem));
        hello = mb.build();
        log.info("Sending OF_13 Hello to {}", channel.getRemoteAddress());
    }

    channel.write(Collections.singletonList(hello));
}