本文整理汇总了Java中org.projectfloodlight.openflow.types.OFGroup类的典型用法代码示例。如果您正苦于以下问题:Java OFGroup类的具体用法?Java OFGroup怎么用?Java OFGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFGroup类属于org.projectfloodlight.openflow.types包,在下文中一共展示了OFGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendGroupStatistic
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
private void sendGroupStatistic() {
if (log.isTraceEnabled()) {
log.trace("sendGroupStatistics {}:{}", sw.getStringId(), sw.getRole());
}
if (sw.getRole() != RoleState.MASTER) {
return;
}
Long statsXid = OpenFlowGroupProvider.getXidAndAdd(2);
OFGroupStatsRequest statsRequest = sw.factory().buildGroupStatsRequest()
.setGroup(OFGroup.ALL)
.setXid(statsXid)
.build();
sw.sendMsg(statsRequest);
Long descXid = statsXid + 1;
OFGroupDescStatsRequest descStatsRequest =
sw.factory().buildGroupDescStatsRequest()
.setXid(descXid)
.build();
sw.sendMsg(descStatsRequest);
}
示例2: dumpFlowTable
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public OFFlowStatsReply dumpFlowTable(final DatapathId dpid) {
OFFlowStatsReply values = null;
IOFSwitch sw = ofSwitchService.getSwitch(dpid);
if (sw == null) {
throw new IllegalArgumentException(String.format("Switch %s was not found", dpid.toString()));
}
OFFactory ofFactory = sw.getOFFactory();
OFFlowStatsRequest flowRequest = ofFactory.buildFlowStatsRequest()
.setMatch(sw.getOFFactory().matchWildcardAll())
.setTableId(TableId.ALL)
.setOutPort(OFPort.ANY)
.setOutGroup(OFGroup.ANY)
.setCookieMask(U64.ZERO)
.build();
try {
ListenableFuture<OFFlowStatsReply> future = sw.writeRequest(flowRequest);
values = future.get(10, TimeUnit.SECONDS);
} catch (ExecutionException | InterruptedException | TimeoutException e) {
logger.error("Could not get flow stats: {}", e.getMessage());
}
return values;
}
示例3: startDriverHandshake
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
@Override
public void startDriverHandshake() {
if (startDriverHandshakeCalled) {
throw new SwitchDriverSubHandshakeAlreadyStarted();
}
startDriverHandshakeCalled = true;
OFFlowMod fm = factory().buildFlowDelete()
.setTableId(TableId.ALL)
.setOutGroup(OFGroup.ANY)
.build();
sendMsg(Collections.singletonList(fm));
OFGroupMod gm = factory().buildGroupDelete()
.setGroup(OFGroup.ALL)
.setGroupType(OFGroupType.ALL)
.build();
sendMsg(Collections.singletonList(gm));
OFMeterMod mm = factory().buildMeterMod()
.setMeterId(MeterId.ALL.id())
.build();
sendMsg(Collections.singletonList(mm));
barrierXid = getNextTransactionId();
OFBarrierRequest barrier = factory().buildBarrierRequest()
.setXid(barrierXid).build();
sendHandshakeMessage(barrier);
}
示例4: buildGroupAdd
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Builds the GroupAdd OF message.
*
* @return GroupAdd OF message
*/
public OFGroupAdd buildGroupAdd() {
List<OFBucket> ofBuckets = new ArrayList<OFBucket>();
for (GroupBucket bucket: buckets.buckets()) {
List<OFAction> actions = buildActions(bucket.treatment());
OFBucket.Builder bucketBuilder = factory.buildBucket();
bucketBuilder.setActions(actions);
if (type == GroupDescription.Type.SELECT) {
bucketBuilder.setWeight(1);
}
if (type == GroupDescription.Type.FAILOVER && bucket.watchPort() != null) {
bucketBuilder.setWatchPort(OFPort.of((int) bucket.watchPort().toLong()));
} else {
bucketBuilder.setWatchPort(OFPort.ANY);
}
if (type == GroupDescription.Type.FAILOVER && bucket.watchGroup() != null) {
bucketBuilder.setWatchGroup(OFGroup.of(bucket.watchGroup().id()));
} else {
bucketBuilder.setWatchGroup(OFGroup.ANY);
}
OFBucket ofBucket = bucketBuilder.build();
ofBuckets.add(ofBucket);
}
OFGroupAdd groupMsg = factory.buildGroupAdd()
.setGroup(OFGroup.of(groupId.id()))
.setBuckets(ofBuckets)
.setGroupType(getOFGroupType(type))
.setXid(xid)
.build();
return groupMsg;
}
示例5: buildGroupMod
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Builds the GroupMod OF message.
*
* @return GroupMod OF message
*/
public OFGroupMod buildGroupMod() {
List<OFBucket> ofBuckets = new ArrayList<OFBucket>();
for (GroupBucket bucket: buckets.buckets()) {
List<OFAction> actions = buildActions(bucket.treatment());
OFBucket.Builder bucketBuilder = factory.buildBucket();
bucketBuilder.setActions(actions);
if (type == GroupDescription.Type.SELECT) {
bucketBuilder.setWeight(1);
}
if (type == GroupDescription.Type.FAILOVER && bucket.watchPort() != null) {
bucketBuilder.setWatchPort(OFPort.of((int) bucket.watchPort().toLong()));
} else {
bucketBuilder.setWatchPort(OFPort.ANY);
}
if (type == GroupDescription.Type.FAILOVER && bucket.watchGroup() != null) {
bucketBuilder.setWatchGroup(OFGroup.of(bucket.watchGroup().id()));
} else {
bucketBuilder.setWatchGroup(OFGroup.ANY);
}
OFBucket ofBucket = bucketBuilder.build();
ofBuckets.add(ofBucket);
}
OFGroupMod groupMsg = factory.buildGroupModify()
.setGroup(OFGroup.of(groupId.id()))
.setBuckets(ofBuckets)
.setGroupType(getOFGroupType(type))
.setXid(xid)
.build();
return groupMsg;
}
示例6: buildGroupDel
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Builds the GroupDel OF message.
*
* @return GroupDel OF message
*/
public OFGroupDelete buildGroupDel() {
OFGroupDelete groupMsg = factory.buildGroupDelete()
.setGroup(OFGroup.of(groupId.id()))
.setGroupType(OFGroupType.SELECT)
.setXid(xid)
.build();
return groupMsg;
}
示例7: groupModFailure
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
@Test
public void groupModFailure() {
TestOpenFlowGroupProviderService testProviderService =
(TestOpenFlowGroupProviderService) providerService;
GroupId groupId = new DefaultGroupId(1);
List<GroupBucket> bucketList = Lists.newArrayList();
TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
builder.setOutput(PortNumber.portNumber(1));
GroupBucket bucket =
DefaultGroupBucket.createSelectGroupBucket(builder.build());
bucketList.add(bucket);
GroupBuckets buckets = new GroupBuckets(bucketList);
List<GroupOperation> operationList = Lists.newArrayList();
GroupOperation operation = GroupOperation.createAddGroupOperation(groupId,
GroupDescription.Type.SELECT, buckets);
operationList.add(operation);
GroupOperations operations = new GroupOperations(operationList);
provider.performGroupOperation(deviceId, operations);
OFGroupModFailedErrorMsg.Builder errorBuilder =
OFFactories.getFactory(OFVersion.OF_13).errorMsgs().buildGroupModFailedErrorMsg();
OFGroupMod.Builder groupBuilder = OFFactories.getFactory(OFVersion.OF_13).buildGroupModify();
groupBuilder.setGroupType(OFGroupType.ALL);
groupBuilder.setGroup(OFGroup.of(1));
errorBuilder.setCode(OFGroupModFailedCode.GROUP_EXISTS);
errorBuilder.setXid(provider.getXidAndAdd(0) - 1);
controller.processPacket(dpid1, errorBuilder.build());
assertNotNull("Operation failed should not be null",
testProviderService.failedOperation);
}
示例8: switchActivated
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
@Override
public void switchActivated(DatapathId switchId) {
IOFSwitch sw = switchService.getSwitch(switchId);
if (sw == null) {
log.warn("Switch {} was activated but had no switch object in the switch service. Perhaps it quickly disconnected", switchId);
return;
}
if (OFDPAUtils.isOFDPASwitch(sw)) {
sw.write(sw.getOFFactory().buildFlowDelete()
.setTableId(TableId.ALL)
.build()
);
sw.write(sw.getOFFactory().buildGroupDelete()
.setGroup(OFGroup.ANY)
.setGroupType(OFGroupType.ALL)
.build()
);
sw.write(sw.getOFFactory().buildGroupDelete()
.setGroup(OFGroup.ANY)
.setGroupType(OFGroupType.INDIRECT)
.build()
);
sw.write(sw.getOFFactory().buildBarrierRequest().build());
List<OFPortModeTuple> portModes = new ArrayList<OFPortModeTuple>();
for (OFPortDesc p : sw.getPorts()) {
portModes.add(OFPortModeTuple.of(p.getPortNo(), OFPortMode.ACCESS));
}
if (log.isWarnEnabled()) {
log.warn("For OF-DPA switch {}, initializing VLAN {} on ports {}", new Object[] { switchId, VlanVid.ZERO, portModes});
}
OFDPAUtils.addLearningSwitchPrereqs(sw, VlanVid.ZERO, portModes);
}
}
示例9: createL2DCOFloodOverUnicastTunnels
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Only bits 0-9 of index are used. Bits 10-15 are ignored.
* @param index
* @param tunnelId
* @return
*/
public static OFGroup createL2DCOFloodOverUnicastTunnels(U16 index, U16 tunnelId) { //8
return OFGroup.of(0 | (index.getRaw() & 0x03ff)
| (tunnelId.getRaw() << 12)
| (L2OverlaySubType.L2_OVERLAY_FLOOD_OVER_UNICAST_TUNNELS << 10)
| (OFDPAGroupType.L2_DATA_CENTER_OVERLAY << 28));
}
示例10: createL2DCOFloodOverMulticastTunnels
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Only bits 0-9 of index are used. Bits 10-15 are ignored.
* @param index
* @param tunnelId
* @return
*/
public static OFGroup createL2DCOFloodOverMulticastTunnels(U16 index, U16 tunnelId) { //8
return OFGroup.of(0 | (index.getRaw() & 0x03ff)
| (tunnelId.getRaw() << 12)
| (L2OverlaySubType.L2_OVERLAY_FLOOD_OVER_MULTICAST_TUNNELS << 10)
| (OFDPAGroupType.L2_DATA_CENTER_OVERLAY << 28));
}
示例11: createL2DCOMulticastOverUnicastTunnels
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Only bits 0-9 of index are used. Bits 10-15 are ignored.
* @param index
* @param tunnelId
* @return
*/
public static OFGroup createL2DCOMulticastOverUnicastTunnels(U16 index, U16 tunnelId) { //8
return OFGroup.of(0 | (index.getRaw() & 0x03ff)
| (tunnelId.getRaw() << 12)
| (L2OverlaySubType.L2_OVERLAY_MULTICAST_OVER_UNICAST_TUNNELS << 10)
| (OFDPAGroupType.L2_DATA_CENTER_OVERLAY << 28));
}
示例12: createL2DCOMulticastOverMulticastTunnels
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
/**
* Only bits 0-9 of index are used. Bits 10-15 are ignored.
* @param index
* @param tunnelId
* @return
*/
public static OFGroup createL2DCOMulticastOverMulticastTunnels(U16 index, U16 tunnelId) { //8
return OFGroup.of(0 | (index.getRaw() & 0x03ff)
| (tunnelId.getRaw() << 12)
| (L2OverlaySubType.L2_OVERLAY_MULTICAST_OVER_MULTICAST_TUNNELS << 10)
| (OFDPAGroupType.L2_DATA_CENTER_OVERLAY << 28));
}
示例13: pushOFCreateGroup
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
private void pushOFCreateGroup(IOFSwitch sw) {
/* Creates group flow with set queue option */
OFFactory of13Factory = sw.getOFFactory();
OFGroupAdd addGroup = of13Factory.buildGroupAdd()
.setGroup(OFGroup.of(multicastGroup.ofGroupId))
.setGroupType(OFGroupType.ALL)
.setBuckets(multicastGroup.getMemberOFBucketList(sw.getId()))
.build();
sw.write(addGroup);
}
示例14: pushOFModifyGroup
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
private void pushOFModifyGroup(IOFSwitch sw) {
/* Creates group flow with set queue option */
OFFactory of13Factory = sw.getOFFactory();
OFGroupMod modGroup = of13Factory.buildGroupModify()
.setGroup(OFGroup.of(multicastGroup.ofGroupId))
.setGroupType(OFGroupType.ALL)
.setBuckets(multicastGroup.getMemberOFBucketList(sw.getId()))
.build();
sw.write(modGroup);
}
示例15: pushOFDeleteGroup
import org.projectfloodlight.openflow.types.OFGroup; //导入依赖的package包/类
protected void pushOFDeleteGroup(IOFSwitch sw) {
/* Delete the queues attached to all the member ports*/
long queueId = -1;
OFPort ofp = null;
ArrayList<OFBucket> ofBuckets = multicastGroup.getMemberOFBucketList(sw.getId());
OVSDBContext ovsdbContext = mcObject.ovsdbChannelMap.get(sw.getId());
for (OFBucket ofb : ofBuckets) {
queueId = -1;
ofp = null;
for (OFAction ofa: ofb.getActions()){
if (ofa.getType() == OFActionType.SET_QUEUE){
OFActionSetQueue ofas = (OFActionSetQueue) ofa;
queueId = ofas.getQueueId();
/* removes queue using OVSDBContext on the switch */
}
if (ofa.getType() == OFActionType.OUTPUT){
OFActionOutput ofo = (OFActionOutput) ofa;
ofp = ofo.getPort();
/* removes queue using OVSDBContext on the switch */
}
}
if (ofp != null && queueId != -1)
ovsdbContext.deleteQueueOnPort(ofp, (int)queueId);
else
logger.error("pushOFDeleteGroup: unexpected actionset in group bucket");
}
/* Creates group flow with set queue option */
OFFactory of13Factory = sw.getOFFactory();
OFGroupDelete delGroup = of13Factory.buildGroupDelete()
.setGroup(OFGroup.of(multicastGroup.ofGroupId))
.setGroupType(OFGroupType.ALL)
.build();
sw.write(delGroup);
}