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


Java OFPortDesc类代码示例

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


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

示例1: discoverOnAllPorts

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
/**
 * Send LLDPs to all switch-ports
 */
protected void discoverOnAllPorts() {
	log.info("Sending LLDP packets out of all the enabled ports");
	// Send standard LLDPs
	for (DatapathId sw : switchService.getAllSwitchDpids()) {
		IOFSwitch iofSwitch = switchService.getSwitch(sw);
		if (iofSwitch == null) continue;
		if (!iofSwitch.isActive()) continue; /* can't do anything if the switch is SLAVE */
		if (iofSwitch.getEnabledPorts() != null) {
			for (OFPortDesc ofp : iofSwitch.getEnabledPorts()) {
				if (isLinkDiscoverySuppressed(sw, ofp.getPortNo())) {
					continue;
				}

				sendDiscoveryMessage(sw, ofp.getPortNo(), true, false);

				// If the switch port is not already in the maintenance
				// queue, add it.
				NodePortTuple npt = new NodePortTuple(sw, ofp.getPortNo());
				addToMaintenanceQueue(npt);
			}
		}
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:27,代码来源:LinkDiscoveryManager.java

示例2: switchPortChanged

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
/**
 * We don't react the port changed notifications here. we listen for
 * OFPortStatus messages directly. Might consider using this notifier
 * instead
 */
@Override
public void switchPortChanged(DatapathId switchId,
		OFPortDesc port,
		PortChangeType type) {

	switch (type) {
	case UP:
		processNewPort(switchId, port.getPortNo());
		break;
	case DELETE: case DOWN:
		handlePortDown(switchId, port.getPortNo());
		break;
	case OTHER_UPDATE: case ADD:
		// This is something other than port add or delete.
		// Topology does not worry about this.
		// If for some reason the port features change, which
		// we may have to react.
		break;
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:26,代码来源:LinkDiscoveryManager.java

示例3: SwitchUpdate

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
public SwitchUpdate(DatapathId swId,
		SwitchUpdateType switchUpdateType,
		OFPortDesc port,
		PortChangeType changeType) {
	if (switchUpdateType == SwitchUpdateType.PORTCHANGED) {
		if (port == null) {
			throw new NullPointerException("Port must not be null " +
					"for PORTCHANGED updates");
		}
		if (changeType == null) {
			throw new NullPointerException("ChangeType must not be " +
					"null for PORTCHANGED updates");
		}
	} else {
		if (port != null || changeType != null) {
			throw new IllegalArgumentException("port and changeType " +
					"must be null for " + switchUpdateType +
					" updates");
		}
	}
	this.swId = swId;
	this.switchUpdateType = switchUpdateType;
	this.port = port;
	this.changeType = changeType;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:26,代码来源:OFSwitchManager.java

示例4: notifyPortChanged

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
@Override
public synchronized void notifyPortChanged(IOFSwitchBackend sw,
		OFPortDesc port,
		PortChangeType changeType) {
	Preconditions.checkNotNull(sw, "switch must not be null");
	Preconditions.checkNotNull(port, "port must not be null");
	Preconditions.checkNotNull(changeType, "changeType must not be null");

	if (role != OFControllerRole.ROLE_MASTER) {
		counters.invalidPortsChanged.increment();
		return;
	}
	if (!this.switches.containsKey(sw.getId())) {
		counters.invalidPortsChanged.increment();
		return;
	}

	if(sw.getStatus().isVisible()) {
		// no need to count here. SwitchUpdate.dispatch will count
		// the portchanged
		SwitchUpdate update = new SwitchUpdate(sw.getId(),
				SwitchUpdateType.PORTCHANGED,
				port, changeType);
		addUpdateToQueue(update);
	}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:OFSwitchManager.java

示例5: setFeaturesReply

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
@Override
public void setFeaturesReply(OFFeaturesReply featuresReply) {
	if (portManager.getPorts().isEmpty() && featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0) {
		/* ports are updated via port status message, so we
		 * only fill in ports on initial connection.
		 */
		List<OFPortDesc> OFPortDescs = featuresReply.getPorts();
		portManager.updatePorts(OFPortDescs);
	}
	this.capabilities = featuresReply.getCapabilities();
	this.buffers = featuresReply.getNBuffers();

	if (featuresReply.getVersion().compareTo(OFVersion.OF_13) < 0 ) {
		// FIXME:LOJI: OF1.3 has per table actions. This needs to be modeled / handled here
		this.actions = featuresReply.getActions();
	}
	this.tables = featuresReply.getNTables();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:19,代码来源:OFSwitch.java

示例6: setUp

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    super.setUp();
    cntx = new FloodlightContext();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
    fmc.addService(IOFSwitchService.class, getMockSwitchService());
    swDescription = factory.buildDescStatsReply().build();
    pvs = new PathVerificationService();
    pvs.initAlgorithm("secret");
    srcIpTarget = new InetSocketAddress("192.168.10.1", 200);
    dstIpTarget = new InetSocketAddress("192.168.10.101", 100);
    sw1HwAddrTarget = "11:22:33:44:55:66";
    sw2HwAddrTarget = "AA:BB:CC:DD:EE:FF";

    OFPortDesc sw1Port1 = EasyMock.createMock(OFPortDesc.class);
    expect(sw1Port1.getHwAddr()).andReturn(MacAddress.of(sw1HwAddrTarget)).anyTimes();
    OFPortDesc sw2Port1 = EasyMock.createMock(OFPortDesc.class);
    expect(sw2Port1.getHwAddr()).andReturn(MacAddress.of(sw2HwAddrTarget)).anyTimes();
    replay(sw1Port1);
    replay(sw2Port1);

    sw1 = buildMockIOFSwitch(1L, sw1Port1, factory, swDescription, srcIpTarget);
    sw2 = buildMockIOFSwitch(2L, sw2Port1, factory, swDescription, dstIpTarget);
    replay(sw1);
    replay(sw2);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:28,代码来源:PathVerificationPacketOutTest.java

示例7: setupSwitchForAddSwitch

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
/** Set the mock expectations for sw when sw is passed to addSwitch
 * The same expectations can be used when a new SwitchSyncRepresentation
 * is created from the given mocked switch */
protected void setupSwitchForAddSwitch(IOFSwitch sw, DatapathId datapathId,
                                       SwitchDescription description,
                                       OFFeaturesReply featuresReply) {
	String dpidString = datapathId.toString();
    if (description == null) {
        description = createSwitchDescription();
    }
    if (featuresReply == null) {
        featuresReply = createOFFeaturesReply(datapathId);
    }
    List<OFPortDesc> ports = featuresReply.getPorts();

    expect(sw.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_10)).anyTimes();
    expect(sw.getId()).andReturn(datapathId).anyTimes();
    expect(sw.getId().toString()).andReturn(dpidString).anyTimes();
    expect(sw.getSwitchDescription()).andReturn(description).atLeastOnce();
    expect(sw.getBuffers())
            .andReturn(featuresReply.getNBuffers()).atLeastOnce();
    expect(sw.getTables())
            .andReturn(featuresReply.getNTables()).atLeastOnce();
    expect(sw.getCapabilities())
            .andReturn(featuresReply.getCapabilities()).atLeastOnce();
    expect(sw.getActions())
            .andReturn(featuresReply.getActions()).atLeastOnce();
    expect(sw.getPorts())
            .andReturn(ports).atLeastOnce();
    expect(sw.attributeEquals(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE, true))
            .andReturn(false).anyTimes();
    expect(sw.getInetAddress()).andReturn(null).anyTimes();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:34,代码来源:ControllerTest.java

示例8: toOFPortDesc

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
public OFPortDesc toOFPortDesc(OFFactory factory) {
	OFPortDesc.Builder builder = factory.buildPortDesc();
    builder.setPortNo(port.getPortNo());
    builder.setHwAddr(port.getHwAddr());
    builder.setName(port.getName());
    builder.setConfig(port.getConfig());
    builder.setState(port.getState());
    builder.setCurr(port.getCurr());
    builder.setAdvertised(port.getAdvertised());
    builder.setSupported(port.getSupported());
    builder.setPeer(port.getPeer());
    return builder.build();
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:14,代码来源:SwitchSyncRepresentation.java

示例9: createOFFeaturesReply

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
private OFFeaturesReply createOFFeaturesReply(DatapathId datapathId) {
    OFFeaturesReply fr = factory.buildFeaturesReply()
            .setXid(0)
            .setDatapathId(datapathId)
            .setPorts(ImmutableList.<OFPortDesc>of())
            .build();
    return fr;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:9,代码来源:OFSwitchManagerTest.java

示例10: getPorts

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
@Override
/**
 * Returns a list of standard (Ethernet) ports.
 *
 * @return List of ports
 */
public List<OFPortDesc> getPorts() {
    return Collections.EMPTY_LIST;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:OplinkRoadmHandshaker.java

示例11: toSyncedPortList

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
private static List<SyncedPort> toSyncedPortList(Collection<OFPortDesc> ports) {
    List<SyncedPort> rv = new ArrayList<SyncedPort>(ports.size());
    for (OFPortDesc p: ports) {
        rv.add(SyncedPort.fromOFPortDesc(p));
    }
    return rv;
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:8,代码来源:SwitchSyncRepresentation.java

示例12: changePortState

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
@Override
public void changePortState(DeviceId deviceId, PortNumber portNumber,
                            boolean enable) {
    final Dpid dpid = dpid(deviceId.uri());
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    if (sw == null || !sw.isConnected()) {
        LOG.error("Failed to change portState on device {}", deviceId);
        return;
    }
    OFPortMod.Builder pmb = sw.factory().buildPortMod();
    OFPort port = OFPort.of((int) portNumber.toLong());
    pmb.setPortNo(port);
    if (enable) {
        pmb.setConfig(0x0); // port_down bit 0
    } else {
        pmb.setConfig(0x1); // port_down bit 1
    }
    pmb.setMask(0x1);
    pmb.setAdvertise(0x0);
    for (OFPortDesc pd : sw.getPorts()) {
        if (pd.getPortNo().equals(port)) {
            pmb.setHwAddr(pd.getHwAddr());
            break;
        }
    }
    sw.sendMsg(Collections.singletonList(pmb.build()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:OpenFlowDeviceProvider.java

示例13: buildOduCltPortDescription

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的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: buildOduCltAnnotation

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的package包/类
private SparseAnnotations buildOduCltAnnotation(OFPortDesc port) {
    SparseAnnotations annotations = null;
    String portName = Strings.emptyToNull(port.getName());
    if (portName != null) {
        annotations = DefaultAnnotations.builder()
                .set(AnnotationKeys.PORT_NAME, portName)
                .set(AnnotationKeys.STATIC_PORT, Boolean.TRUE.toString()).build();
    }
    return annotations;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:OpenFlowDeviceProvider.java

示例15: buildPortDescription

import org.projectfloodlight.openflow.protocol.OFPortDesc; //导入依赖的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


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