当前位置: 首页>>代码示例>>Java>>正文


Java OFPortReason类代码示例

本文整理汇总了Java中org.openflow.protocol.OFPortStatus.OFPortReason的典型用法代码示例。如果您正苦于以下问题:Java OFPortReason类的具体用法?Java OFPortReason怎么用?Java OFPortReason使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OFPortReason类属于org.openflow.protocol.OFPortStatus包,在下文中一共展示了OFPortReason类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWriteRead

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
public void testWriteRead() throws Exception {
    OFPortStatus msg = (OFPortStatus) messageFactory
            .getMessage(OFType.PORT_STATUS);
    msg.setDesc(new OFPhysicalPort());
    msg.getDesc().setHardwareAddress(new byte[6]);
    msg.getDesc().setName("eth0");
    msg.setReason((byte) OFPortReason.OFPPR_ADD.ordinal());
    ChannelBuffer bb = ChannelBuffers.dynamicBuffer();
    bb.clear();
    msg.writeTo(bb);
    msg.readFrom(bb);
    TestCase.assertEquals(OFType.PORT_STATUS, msg.getType());
    TestCase.assertEquals((byte) OFPortReason.OFPPR_ADD.ordinal(), msg
            .getReason());
    TestCase.assertNotNull(msg.getDesc());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:17,代码来源:OFPortStatusTest.java

示例2: applyPortStatus

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
/**
 * Changes the attribute of this port according to a MODIFY PortStatus.
 *
 * @param portstat
 *            the port status
 */
public void applyPortStatus(OVXPortStatus portstat) {
    if (!portstat.isReason(OFPortReason.OFPPR_MODIFY)) {
        return;
    }
    OFPhysicalPort psport = portstat.getDesc();
    this.portNumber = psport.getPortNumber();
    this.hardwareAddress = psport.getHardwareAddress();
    this.name = psport.getName();
    this.config = psport.getConfig();
    this.state = psport.getState();
    this.currentFeatures = psport.getCurrentFeatures();
    this.advertisedFeatures = psport.getAdvertisedFeatures();
    this.supportedFeatures = psport.getSupportedFeatures();
    this.peerFeatures = psport.getPeerFeatures();
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:22,代码来源:PhysicalPort.java

示例3: tearDown

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
public void tearDown() {
    if (!this.isActive) {
        return;
    }
    this.isActive = false;
    this.state = OFPortState.OFPPS_LINK_DOWN.getValue();
    this.parentSwitch.generateFeaturesReply();
    if (this.parentSwitch.isActive()) {
        sendStatusMsg(OFPortReason.OFPPR_MODIFY);
    }
    if (this.isLink()) {
        this.getLink().getOutLink().getDstPort().tearDown();
    }

    cleanUpFlowMods();
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:17,代码来源:OVXPort.java

示例4: handleLinkDisable

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
/**
 * Disables a link for LINK_DOWN or DELETE PortStats. Mapping s for the
 * OVXLink are removed only if the provided PortStat is of reason DELETE.
 *
 * @param stat the port status
 * @throws NetworkMappingException
 */
public void handleLinkDisable(OVXPortStatus stat)
        throws NetworkMappingException {
    OVXNetwork virtualNetwork = this.parentSwitch.getMap()
            .getVirtualNetwork(this.tenantId);
    if (virtualNetwork.getHost(this) == null && this.portLink != null &&
            this.portLink.exists()) {
        OVXPort dst = this.portLink.egressLink.getDstPort();
        /* unmap vLinks and this port if DELETE */
        if (stat.isReason(OFPortReason.OFPPR_DELETE)) {
            this.portLink.egressLink.unregister();
            this.portLink.ingressLink.unregister();
        }
        /*
         * set this and destPort as edge, and send up Modify PortStat for
         * dest port
         */
        dst.tearDown();
    }

}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:28,代码来源:OVXPort.java

示例5: handleRouteDisable

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
/**
 * Removes SwitchRoutes from a BVS's routing table if the end points of the
 * route are deleted.
 *
 * @param stat
 */
public void handleRouteDisable(OVXPortStatus stat) {
    if ((this.parentSwitch instanceof OVXBigSwitch)
            && (stat.isReason(OFPortReason.OFPPR_DELETE))) {
        Map<OVXPort, SwitchRoute> routes = ((OVXBigSwitch) this.parentSwitch)
                .getRouteMap().get(this);
        if (routes != null) {
            Set<SwitchRoute> rtset = Collections
                    .unmodifiableSet((Set<SwitchRoute>) routes.values());
            for (SwitchRoute route : rtset) {
                ((OVXBigSwitch) this.parentSwitch).unregisterRoute(route
                        .getRouteId());
            }
        }
        // TODO send flowRemoved's
    }
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:23,代码来源:OVXPort.java

示例6: handlePortStatusMessage

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
protected void handlePortStatusMessage(IOFSwitch sw, OFPortStatus m) {
    short portNumber = m.getDesc().getPortNumber();
    OFPhysicalPort port = m.getDesc();
    if (m.getReason() == (byte)OFPortReason.OFPPR_MODIFY.ordinal()) {
        sw.setPort(port);
        log.debug("Port #{} modified for {}", portNumber, sw);
    } else if (m.getReason() == (byte)OFPortReason.OFPPR_ADD.ordinal()) {
        sw.setPort(port);
        log.debug("Port #{} added for {}", portNumber, sw);
    } else if (m.getReason() ==
               (byte)OFPortReason.OFPPR_DELETE.ordinal()) {
        sw.deletePort(portNumber);
        log.debug("Port #{} deleted for {}", portNumber, sw);
    }
    SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.PORTCHANGED);
    try {
        this.updates.put(update);
    } catch (InterruptedException e) {
        log.error("Failure adding update to queue", e);
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:22,代码来源:Controller.java

示例7: handlePortStatusMessage

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m) {
    Node node = NodeCreator.createOFNode(sw.getId());
    NodeConnector nodeConnector = PortConverter.toNodeConnector(
        m.getDesc().getPortNumber(), node);
    // get node connector properties
    Set<Property> props = InventoryServiceHelper.OFPortToProps(m.getDesc());

    UpdateType type = null;
    if (m.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) {
        type = UpdateType.ADDED;
        nodeConnectorProps.put(nodeConnector, props);
    } else if (m.getReason() == (byte) OFPortReason.OFPPR_DELETE.ordinal()) {
        type = UpdateType.REMOVED;
        nodeConnectorProps.remove(nodeConnector);
    } else if (m.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) {
        type = UpdateType.CHANGED;
        nodeConnectorProps.put(nodeConnector, props);
    }

    logger.trace("handlePortStatusMessage {} type {}", nodeConnector, type);

    if (type != null) {
        notifyInventoryShimListener(nodeConnector, type, props);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:26,代码来源:InventoryServiceShim.java

示例8: testWriteRead

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
public void testWriteRead() throws Exception {
    OFPortStatus msg = (OFPortStatus) messageFactory
            .getMessage(OFType.PORT_STATUS);
    msg.setDesc(new OFPhysicalPort());
    msg.getDesc().setHardwareAddress(new byte[6]);
    msg.getDesc().setName("eth0");
    msg.setReason((byte) OFPortReason.OFPPR_ADD.ordinal());
    ByteBuffer bb = ByteBuffer.allocate(1024);
    bb.clear();
    msg.writeTo(bb);
    bb.flip();
    msg.readFrom(bb);
    TestCase.assertEquals(OFType.PORT_STATUS, msg.getType());
    TestCase.assertEquals((byte) OFPortReason.OFPPR_ADD.ordinal(), msg
            .getReason());
    TestCase.assertNotNull(msg.getDesc());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:18,代码来源:OFPortStatusTest.java

示例9: handlePortStatusMessage

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
protected void handlePortStatusMessage(IOFSwitch sw,
                                       OFPortStatus m,
                                       boolean updateStorage) {
    short portNumber = m.getDesc().getPortNumber();
    OFPhysicalPort port = m.getDesc();
    if (m.getReason() == (byte)OFPortReason.OFPPR_MODIFY.ordinal()) {
        sw.setPort(port);
        if (updateStorage)
            updatePortInfo(sw, port);
        log.debug("Port #{} modified for {}", portNumber, sw);
    } else if (m.getReason() == (byte)OFPortReason.OFPPR_ADD.ordinal()) {
        sw.setPort(port);
        if (updateStorage)
            updatePortInfo(sw, port);
        log.debug("Port #{} added for {}", portNumber, sw);
    } else if (m.getReason() == 
               (byte)OFPortReason.OFPPR_DELETE.ordinal()) {
        sw.deletePort(portNumber);
        if (updateStorage)
            removePortInfo(sw, portNumber);
        log.debug("Port #{} deleted for {}", portNumber, sw);
    }
    SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.PORTCHANGED);
    try {
        this.updates.put(update);
    } catch (InterruptedException e) {
        log.error("Failure adding update to queue", e);
    }
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:30,代码来源:Controller.java

示例10: testHandlePortStatus

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
@Test 
public void testHandlePortStatus() throws Exception {
    IOFSwitch sw = createMock(IOFSwitch.class);
    OFPhysicalPort port = new OFPhysicalPort();
    port.setName("myPortName1");
    port.setPortNumber((short)42);
    
    OFPortStatus ofps = new OFPortStatus();
    ofps.setDesc(port);
    
    ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps, false);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
    
    ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps, false);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
    
    ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
    sw.deletePort(port.getPortNumber());
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps, false);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:38,代码来源:ControllerTest.java

示例11: register

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
/**
 * Registers a port in the virtual parent switch and in the physical port.
 */
public void register() {
    this.parentSwitch.addPort(this);
    this.physicalPort.setOVXPort(this);
    if (this.parentSwitch.isActive()) {
        sendStatusMsg(OFPortReason.OFPPR_ADD);
        this.parentSwitch.generateFeaturesReply();
    }
    DBManager.getInstance().save(this);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:13,代码来源:OVXPort.java

示例12: applyPortStatus

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
/**
 * Changes the attribute of this port according to a MODIFY PortStatus.
 *
 * @param portstat the virtual port status
 */
public void applyPortStatus(OVXPortStatus portstat) {
    if (portstat.getReason() != OFPortReason.OFPPR_MODIFY.getReasonCode()) {
        return;
    }
    OFPhysicalPort psport = portstat.getDesc();
    this.config = psport.getConfig();
    this.state = psport.getState();
    this.peerFeatures = psport.getPeerFeatures();
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:15,代码来源:OVXPort.java

示例13: boot

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
public void boot() {
    if (this.isActive) {
        return;
    }
    this.isActive = true;
    this.state = OFPortState.OFPPS_STP_FORWARD.getValue();
    this.parentSwitch.generateFeaturesReply();
    if (this.parentSwitch.isActive()) {
        sendStatusMsg(OFPortReason.OFPPR_MODIFY);
    }
    if (this.isLink()) {
        this.getLink().getOutLink().getDstPort().boot();
    }
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:15,代码来源:OVXPort.java

示例14: unregister

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
public void unregister() {
    DBManager.getInstance().remove(this);
    OVXNetwork virtualNetwork = null;
    try {
        virtualNetwork = this.parentSwitch.getMap().getVirtualNetwork(
                this.tenantId);
    } catch (NetworkMappingException e) {
        log.error(
                "Error retrieving the network with id {}. Unregister for OVXPort {}/{} not fully done!",
                this.getTenantId(), this.getParentSwitch().getSwitchName(),
                this.getPortNumber());
        return;
    }
    if (this.parentSwitch.isActive()) {
        sendStatusMsg(OFPortReason.OFPPR_DELETE);
    }
    if (this.isEdge && this.isActive) {
        Host host = virtualNetwork.getHost(this);
        host.unregister();
    } else if (!this.isEdge) {
        this.getLink().egressLink.unregister();
        this.getLink().ingressLink.unregister();
    }
    this.unMap();
    this.parentSwitch.generateFeaturesReply();
    cleanUpFlowMods();
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:28,代码来源:OVXPort.java

示例15: testHandlePortStatus

import org.openflow.protocol.OFPortStatus.OFPortReason; //导入依赖的package包/类
@Test
public void testHandlePortStatus() throws Exception {
    IOFSwitch sw = createMock(IOFSwitch.class);
    OFPhysicalPort port = new OFPhysicalPort();
    port.setName("myPortName1");
    port.setPortNumber((short)42);

    OFPortStatus ofps = new OFPortStatus();
    ofps.setDesc(port);

    ofps.setReason((byte)OFPortReason.OFPPR_ADD.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);

    ofps.setReason((byte)OFPortReason.OFPPR_MODIFY.ordinal());
    sw.setPort(port);
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);

    ofps.setReason((byte)OFPortReason.OFPPR_DELETE.ordinal());
    sw.deletePort(port.getPortNumber());
    expectLastCall().once();
    replay(sw);
    controller.handlePortStatusMessage(sw, ofps);
    verify(sw);
    verifyPortChangedUpdateInQueue(sw);
    reset(sw);
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:38,代码来源:ControllerTest.java


注:本文中的org.openflow.protocol.OFPortStatus.OFPortReason类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。