本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFGroupType类的典型用法代码示例。如果您正苦于以下问题:Java OFGroupType类的具体用法?Java OFGroupType怎么用?Java OFGroupType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFGroupType类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFGroupType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGroupType
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
private GroupDescription.Type getGroupType(OFGroupType type) {
switch (type) {
case ALL:
return GroupDescription.Type.ALL;
case INDIRECT:
return GroupDescription.Type.INDIRECT;
case SELECT:
return GroupDescription.Type.SELECT;
case FF:
return GroupDescription.Type.FAILOVER;
default:
log.error("Unsupported OF group type : {}", type);
break;
}
return null;
}
示例2: getOFGroupType
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
private OFGroupType getOFGroupType(GroupDescription.Type groupType) {
switch (groupType) {
case INDIRECT:
return OFGroupType.INDIRECT;
case SELECT:
return OFGroupType.SELECT;
case FAILOVER:
return OFGroupType.FF;
case ALL:
return OFGroupType.ALL;
default:
log.error("Unsupported group type : {}", groupType);
break;
}
return null;
}
示例3: getGroupType
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
private GroupDescription.Type getGroupType(OFGroupType type) {
switch (type) {
case ALL:
return GroupDescription.Type.ALL;
case INDIRECT:
return GroupDescription.Type.INDIRECT;
case SELECT:
return GroupDescription.Type.SELECT;
case FF:
return GroupDescription.Type.FAILOVER;
default:
log.error("Unsupported OF group type : {}", type);
break;
}
return null;
}
示例4: deleteGroup
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
private void deleteGroup(EcmpInfo groupInfo) {
List<OFMessage> msglist = new ArrayList<OFMessage>();
OFGroup group = OFGroup.of(groupInfo.groupId);
OFMessage gm = factory.buildGroupDelete()
.setGroup(group)
// .setGroupType(groupInfo.groupType) /* Due to a bug in CPqD
// switch */
.setGroupType(OFGroupType.SELECT)
.setXid(getNextTransactionId())
.build();
msglist.add(gm);
log.debug("GroupDelete in sw {} groupId {}",
getStringId(), groupInfo.groupId);
try {
write(msglist);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例5: createInnermostLabelGroup
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
private EcmpInfo createInnermostLabelGroup(int innermostGroupId,
List<PortNumber> ports, int mplsLabel, boolean bos,
HashMap<PortNumber, Integer> lastSetOfGroupIds) {
List<BucketInfo> buckets = new ArrayList<BucketInfo>();
for (PortNumber sp : ports) {
Dpid neighborDpid = portToNeighbors.get(sp);
BucketInfo b = new BucketInfo(neighborDpid,
MacAddress.of(srConfig.getRouterMac()),
getNeighborRouterMacAddress(neighborDpid), null,
mplsLabel, bos,
lastSetOfGroupIds.get(sp));
buckets.add(b);
}
EcmpInfo ecmpInfo = new EcmpInfo(innermostGroupId,
OFGroupType.SELECT, buckets);
setEcmpGroup(ecmpInfo);
log.debug(
"createInnermostLabelGroup: Creating select group {} in sw {} "
+ "with: {}", innermostGroupId, getStringId(), ecmpInfo);
return ecmpInfo;
}
示例6: startDriverHandshake
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
@Override
public void startDriverHandshake() {
if (startDriverHandshakeCalled) {
throw new SwitchDriverSubHandshakeAlreadyStarted();
}
startDriverHandshakeCalled = true;
OFFlowMod fm = factory().buildFlowDelete()
.setTableId(TableId.ALL)
.setOutGroup(OFGroup.ANY)
.build();
sendMsg(ImmutableList.of(fm));
OFGroupMod gm = factory().buildGroupDelete()
.setGroup(OFGroup.ALL)
.setGroupType(OFGroupType.ALL)
.build();
sendMsg(ImmutableList.of(gm));
handshakeComplete.set(true);
log.info("Handshake with device {} ended", super.getStringId());
}
示例7: ofGroupDescStatsEntry
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的package包/类
private OFGroupDescStatsEntry ofGroupDescStatsEntry(Group group) {
List<OFBucket> ofBuckets = Lists.newArrayList();
group.buckets().buckets().forEach(groupBucket -> {
ofBuckets.add(FACTORY.buildBucket()
.setWeight(groupBucket.weight())
.setWatchGroup(OFGroup.of(groupBucket.watchGroup().id()))
.setWatchPort(OFPort.of((int) groupBucket.watchPort().toLong()))
.build()
);
});
OFGroup ofGroup = OFGroup.of(group.givenGroupId());
OFGroupType ofGroupType = OFGroupType.valueOf(group.type().name());
OFGroupDescStatsEntry entry = FACTORY.buildGroupDescStatsEntry()
.setGroup(ofGroup)
.setGroupType(ofGroupType)
.setBuckets(ofBuckets)
.build();
return entry;
}
示例8: startDriverHandshake
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
示例9: buildGroupDel
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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;
}
示例10: groupModFailure
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
示例11: switchActivated
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
}
示例12: pushOFCreateGroup
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
示例13: pushOFModifyGroup
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
示例14: pushOFDeleteGroup
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
示例15: switchActivated
import org.projectfloodlight.openflow.protocol.OFGroupType; //导入依赖的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);
}
}