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


Java OFPortState类代码示例

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


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

示例1: generateSwitchPortStatusUpdate

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(DatapathId sw, OFPort port) {
	UpdateOperation operation;

	IOFSwitch iofSwitch = switchService.getSwitch(sw);
	if (iofSwitch == null) return;

	OFPortDesc ofp = iofSwitch.getPort(port);
	if (ofp == null) return;

	Set<OFPortState> srcPortState = ofp.getState();
	boolean portUp = !srcPortState.contains(OFPortState.STP_BLOCK);

	if (portUp) {
		operation = UpdateOperation.PORT_UP;
	} else {
		operation = UpdateOperation.PORT_DOWN;
	}

	updates.add(new LDUpdate(sw, port, operation));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:LinkDiscoveryManager.java

示例2: generateSwitchPortStatusUpdate

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
private void generateSwitchPortStatusUpdate(DatapathId sw, OFPort port) {
	UpdateOperation operation;

	IOFSwitch iofSwitch = switchService.getSwitch(sw);
	if (iofSwitch == null) return;

	OFPortDesc ofp = iofSwitch.getPort(port);
	if (ofp == null) return;

	Set<OFPortState> srcPortState = ofp.getState();
	boolean portUp = !srcPortState.contains(OFPortState.STP_BLOCK);

	if (portUp) {
		operation = UpdateOperation.PORT_UP;
	} else {
		operation = UpdateOperation.PORT_DOWN;
	}
	
	updates.add(new LDUpdate(sw, port, operation));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:21,代码来源:LinkDiscoveryManager.java

示例3: portChanged

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
@Override
public void portChanged(Dpid dpid, OFPortStatus status) {
    LinkDiscovery ld = discoverers.get(dpid);
    if (ld == null) {
        return;
    }
    final OFPortDesc port = status.getDesc();
    final boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) &&
            !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    if (enabled) {
        ld.addPort(port);
    } else {
        /*
         * remove port calls linkVanished
         */
        ld.removePort(port);
    }

}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:20,代码来源:OpenFlowLinkProvider.java

示例4: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public static int toWireValue(Set<OFPortState> set) {
    int wireValue = 0;

    for(OFPortState e: set) {
        switch(e) {
            case LINK_DOWN:
                wireValue |= LINK_DOWN_VAL;
                break;
            case BLOCKED:
                wireValue |= BLOCKED_VAL;
                break;
            case LIVE:
                wireValue |= LIVE_VAL;
                break;
            default:
                throw new IllegalArgumentException("Illegal enum value for type OFPortState in version 1.2: " + e);
        }
    }
    return wireValue;
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:21,代码来源:OFPortStateSerializerVer12.java

示例5: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public static int toWireValue(Set<OFPortState> set) {
    int wireValue = 0;

    for(OFPortState e: set) {
        switch(e) {
            case LINK_DOWN:
                wireValue |= LINK_DOWN_VAL;
                break;
            case BLOCKED:
                wireValue |= BLOCKED_VAL;
                break;
            case LIVE:
                wireValue |= LIVE_VAL;
                break;
            default:
                throw new IllegalArgumentException("Illegal enum value for type OFPortState in version 1.3: " + e);
        }
    }
    return wireValue;
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:21,代码来源:OFPortStateSerializerVer13.java

示例6: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public static int toWireValue(Set<OFPortState> set) {
    int wireValue = 0;

    for(OFPortState e: set) {
        switch(e) {
            case LINK_DOWN:
                wireValue |= LINK_DOWN_VAL;
                break;
            case STP_LISTEN:
                wireValue |= STP_LISTEN_VAL;
                break;
            case STP_LEARN:
                wireValue |= STP_LEARN_VAL;
                break;
            case STP_FORWARD:
                wireValue |= STP_FORWARD_VAL;
                break;
            case STP_BLOCK:
                wireValue |= STP_BLOCK_VAL;
                break;
            default:
                throw new IllegalArgumentException("Illegal enum value for type OFPortState in version 1.0: " + e);
        }
    }
    return wireValue;
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:27,代码来源:OFPortStateSerializerVer10.java

示例7: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public static int toWireValue(Set<OFPortState> set) {
    int wireValue = 0;

    for(OFPortState e: set) {
        switch(e) {
            case LINK_DOWN:
                wireValue |= LINK_DOWN_VAL;
                break;
            case BLOCKED:
                wireValue |= BLOCKED_VAL;
                break;
            case LIVE:
                wireValue |= LIVE_VAL;
                break;
            default:
                throw new IllegalArgumentException("Illegal enum value for type OFPortState in version 1.1: " + e);
        }
    }
    return wireValue;
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:21,代码来源:OFPortStateSerializerVer11.java

示例8: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public static int toWireValue(Set<OFPortState> set) {
    int wireValue = 0;

    for(OFPortState e: set) {
        switch(e) {
            case LINK_DOWN:
                wireValue |= LINK_DOWN_VAL;
                break;
            case BLOCKED:
                wireValue |= BLOCKED_VAL;
                break;
            case LIVE:
                wireValue |= LIVE_VAL;
                break;
            default:
                throw new IllegalArgumentException("Illegal enum value for type OFPortState in version 1.4: " + e);
        }
    }
    return wireValue;
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:21,代码来源:OFPortStateSerializerVer14.java

示例9: createMockPortWithState

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
private OFPortDesc createMockPortWithState(short portNumber,
        Set<OFPortState> state) {
    OFPort ofPort = createMock(OFPort.class);
    expect(ofPort.getShortPortNumber()).andReturn(portNumber).anyTimes();

    OFPortDesc ofPortDesc = createMock(OFPortDesc.class);
    expect(ofPortDesc.getPortNo()).andReturn(ofPort).anyTimes();
    expect(ofPortDesc.getHwAddr()).andReturn(
            MacAddress.of(DEFAULT_MAC_ADDRESS)).anyTimes();
    expect(ofPortDesc.getConfig()).
            andReturn(Collections.<OFPortConfig>emptySet()).anyTimes();
    expect(ofPortDesc.getState()).andReturn(state).anyTimes();

    replay(ofPort);
    replay(ofPortDesc);

    return ofPortDesc;
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:19,代码来源:LinkDiscoveryManagerTest.java

示例10: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
/**
 * Build a portDescription from a given Ethernet port description.
 *
 * @param port the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(OFPortDesc port) {
    if (port.getVersion().wireVersion >= OFVersion.OF_14.getWireVersion()) {
        return buildPortDescription14(port);
    }
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled =
            !port.getState().contains(OFPortState.LINK_DOWN) &&
                    !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
    boolean adminDown = port.getConfig().contains(OFPortConfig.PORT_DOWN);
    SparseAnnotations annotations = makePortAnnotation(port.getName(),
                                                       port.getHwAddr().toString(),
                                                       adminDown).build();
    return new DefaultPortDescription(portNo, enabled, type,
                                      portSpeed(port), annotations);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:OpenFlowDeviceProvider.java

示例11: toWireValue

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public static int toWireValue(Set<OFPortState> set) {
    int wireValue = 0;

    for(OFPortState e: set) {
        switch(e) {
            case LINK_DOWN:
                wireValue |= LINK_DOWN_VAL;
                break;
            case BLOCKED:
                wireValue |= BLOCKED_VAL;
                break;
            case LIVE:
                wireValue |= LIVE_VAL;
                break;
            default:
                throw new IllegalArgumentException("Illegal enum value for type OFPortState in version 1.5: " + e);
        }
    }
    return wireValue;
}
 
开发者ID:floodlight,项目名称:loxigen-artifacts,代码行数:21,代码来源:OFPortStateSerializerVer15.java

示例12: testIsEnabledForFactory

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
public void testIsEnabledForFactory(OFFactory factory) {
    // Default
    OFPortDesc desc = factory.buildPortDesc()
            .build();
    assertThat(desc.isEnabled(), is(true));

    // Partially disabled
    desc = factory.buildPortDesc()
            .setConfig(new HashSet<OFPortConfig>(Arrays.asList(OFPortConfig.PORT_DOWN)))
            .build();
    assertThat(desc.isEnabled(), is(false));

    // Fully disabled
    desc = factory.buildPortDesc()
            .setConfig(new HashSet<OFPortConfig>(Arrays.asList(OFPortConfig.PORT_DOWN)))
            .setState(new HashSet<OFPortState>(Arrays.asList(OFPortState.LINK_DOWN)))
            .build();
    assertThat(desc.isEnabled(), is(false));
}
 
开发者ID:floodlight,项目名称:loxigen-artifacts,代码行数:20,代码来源:OFPortDescTest.java

示例13: buildOduCltPortDescription

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
private PortDescription buildOduCltPortDescription(OFPortDesc port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled = !port.getState().contains(OFPortState.LINK_DOWN) &&
            !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    Long portSpeedInMbps = portSpeed(port);
    CltSignalType sigType = null;

    switch (portSpeedInMbps.toString()) {
        case "1000":
            sigType = CltSignalType.CLT_1GBE;
            break;
        case "10000":
            sigType = CltSignalType.CLT_10GBE;
            break;
        case "40000":
            sigType = CltSignalType.CLT_40GBE;
            break;
        case "100000":
            sigType = CltSignalType.CLT_100GBE;
            break;
        default:
            throw new RuntimeException("Un recognize OduClt speed: " + portSpeedInMbps.toString());
    }

    SparseAnnotations annotations = buildOduCltAnnotation(port);
    return oduCltPortDescription(portNo, enabled, sigType, annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:OpenFlowDeviceProvider.java

示例14: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
/**
 * Build a portDescription from a given Ethernet port description.
 *
 * @param port the port to build from.
 * @return portDescription for the port.
 */
private PortDescription buildPortDescription(OFPortDesc port) {
    PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
    boolean enabled =
            !port.getState().contains(OFPortState.LINK_DOWN) &&
                    !port.getConfig().contains(OFPortConfig.PORT_DOWN);
    Port.Type type = port.getCurr().contains(OFPortFeatures.PF_FIBER) ? FIBER : COPPER;
    SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString());
    return new DefaultPortDescription(portNo, enabled, type,
            portSpeed(port), annotations);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:OpenFlowDeviceProvider.java

示例15: getUpdateOperation

import org.projectfloodlight.openflow.protocol.OFPortState; //导入依赖的package包/类
protected UpdateOperation getUpdateOperation(OFPortState srcPortState, OFPortState dstPortState) {
	boolean added = ((srcPortState != OFPortState.STP_BLOCK) && (dstPortState != OFPortState.STP_BLOCK));

	if (added) {
		return UpdateOperation.LINK_UPDATED;
	} else {
		return UpdateOperation.LINK_REMOVED;
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:10,代码来源:LinkDiscoveryManager.java


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