本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFGroupMod类的典型用法代码示例。如果您正苦于以下问题:Java OFGroupMod类的具体用法?Java OFGroupMod怎么用?Java OFGroupMod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OFGroupMod类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFGroupMod类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildGroupMod
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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);
}
bucketBuilder.setWatchGroup(OFGroup.ANY);
bucketBuilder.setWatchPort(OFPort.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;
}
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:31,代码来源:GroupModBuilder.java
示例2: startDriverHandshake
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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());
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:HPSwitchHandshaker.java
示例3: startDriverHandshake
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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);
}
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:CorsaSwitchHandshaker.java
示例4: buildGroupMod
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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;
}
开发者ID:shlee89,项目名称:athena,代码行数:40,代码来源:GroupModBuilder.java
示例5: groupModFailure
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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);
}
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:OpenFlowGroupProviderTest.java
示例6: pushOFModifyGroup
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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);
}
开发者ID:hksoni,项目名称:SDN-Multicast,代码行数:14,代码来源:MulticastTree.java
示例7: performGroupOperation
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的package包/类
@Override
public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) {
Map<OFGroupMod, OpenFlowSwitch> mods = Maps.newIdentityHashMap();
final Dpid dpid = Dpid.dpid(deviceId.uri());
OpenFlowSwitch sw = controller.getSwitch(dpid);
for (GroupOperation groupOperation: groupOps.operations()) {
if (sw == null) {
log.error("SW {} is not found", dpid);
return;
}
final Long groupModXid = XID_COUNTER.getAndIncrement();
GroupModBuilder builder =
GroupModBuilder.builder(groupOperation.buckets(),
groupOperation.groupId(),
groupOperation.groupType(),
sw.factory(),
Optional.of(groupModXid));
OFGroupMod groupMod = null;
switch (groupOperation.opType()) {
case ADD:
groupMod = builder.buildGroupAdd();
break;
case MODIFY:
groupMod = builder.buildGroupMod();
break;
case DELETE:
groupMod = builder.buildGroupDel();
break;
default:
log.error("Unsupported Group operation");
}
sw.sendMsg(groupMod);
GroupId groudId = new DefaultGroupId(groupMod.getGroup().getGroupNumber());
pendingGroupOperations.put(groudId, groupOperation);
pendingXidMaps.put(groudId, groupModXid);
}
}
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:38,代码来源:OpenFlowGroupProvider.java
示例8: buildGroupMod
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的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(bucket.weight());
}
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;
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:40,代码来源:GroupModBuilder.java
示例9: groupModFailure
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的package包/类
@Test
public void groupModFailure() {
TestOpenFlowGroupProviderService testProviderService =
(TestOpenFlowGroupProviderService) providerService;
GroupId groupId = new GroupId(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);
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:35,代码来源:OpenFlowGroupProviderTest.java
示例10: processGroupMod
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的package包/类
private void processGroupMod(OFGroupMod groupMod) {
log.debug("processing GROUP_MOD {} message", groupMod.getCommand());
ApplicationId appId = ofSwitchService.appId();
GroupKey appCookie = new DefaultGroupKey(networkId.toString().getBytes());
switch (groupMod.getCommand()) {
case ADD:
// TODO return OFGroupModFailedCode.GROUP_EXISTS if group already exists
int groupId = groupMod.getGroup().getGroupNumber();
OFGroupAdd groupAdd = (OFGroupAdd) groupMod;
GroupBuckets groupAddBuckets = new OFAgentVirtualGroupBucketEntryBuilder(
Dpid.dpid(Dpid.uri(dpid().getLong())),
groupAdd.getBuckets(), groupAdd.getGroupType(), driverService)
.build();
GroupDescription groupDescription = new DefaultGroupDescription(
deviceId, getGroupType(groupAdd.getGroupType()), groupAddBuckets,
appCookie, groupId, appId);
groupService.addGroup(groupDescription);
break;
case MODIFY:
// TODO return OFGroupModFailedCode.INVALID_GROUP if group does not exist
OFGroupModify groupModify = (OFGroupModify) groupMod;
GroupBuckets groupModifyBuckets = new OFAgentVirtualGroupBucketEntryBuilder(
Dpid.dpid(Dpid.uri(dpid().getLong())),
groupModify.getBuckets(), groupModify.getGroupType(), driverService)
.build();
groupService.setBucketsForGroup(deviceId, appCookie, groupModifyBuckets,
appCookie, appId);
break;
case DELETE:
groupService.removeGroup(deviceId, appCookie, appId);
break;
default:
// INSERT_BUCKET, REMOVE_BUCKET are effective OF 1.5. OFAgent supports 1.3.
log.warn("Unsupported GROUP_MOD {} message received for switch {}",
groupMod.getCommand(), this);
}
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:39,代码来源:DefaultOFSwitch.java
示例11: processControllerCommand
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的package包/类
@Override
public void processControllerCommand(Channel channel, OFMessage msg) {
OFControllerRole myRole = role(channel);
if (OFControllerRole.ROLE_SLAVE.equals(myRole)) {
OFBadRequestErrorMsg errorMsg = FACTORY.errorMsgs()
.buildBadRequestErrorMsg()
.setXid(msg.getXid())
.setCode(OFBadRequestCode.IS_SLAVE)
.build();
channel.writeAndFlush(Collections.singletonList(errorMsg));
return;
}
switch (msg.getType()) {
case PORT_MOD:
OFPortMod portMod = (OFPortMod) msg;
processPortMod(portMod);
break;
case FLOW_MOD:
OFFlowMod flowMod = (OFFlowMod) msg;
processFlowMod(flowMod);
break;
case GROUP_MOD:
OFGroupMod groupMod = (OFGroupMod) msg;
processGroupMod(groupMod);
break;
case METER_MOD:
OFMeterMod meterMod = (OFMeterMod) msg;
processMeterMod(meterMod, channel);
break;
case TABLE_MOD:
log.debug("processControllerCommand: {} not yet supported for {}",
msg.getType(), msg);
break;
default:
log.warn("Unexpected message {} received for switch {}",
msg.getType(), this);
}
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:41,代码来源:DefaultOFSwitch.java
示例12: performGroupOperation
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的package包/类
@Override
public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) {
final Dpid dpid = Dpid.dpid(deviceId.uri());
OpenFlowSwitch sw = controller.getSwitch(dpid);
for (GroupOperation groupOperation: groupOps.operations()) {
if (sw == null) {
log.error("SW {} is not found", dpid);
return;
}
final Long groupModXid = XID_COUNTER.getAndIncrement();
GroupModBuilder builder = null;
if (driverService == null) {
builder = GroupModBuilder.builder(groupOperation.buckets(),
groupOperation.groupId(),
groupOperation.groupType(),
sw.factory(),
Optional.of(groupModXid));
} else {
builder = GroupModBuilder.builder(groupOperation.buckets(),
groupOperation.groupId(),
groupOperation.groupType(),
sw.factory(),
Optional.of(groupModXid),
Optional.of(driverService));
}
OFGroupMod groupMod = null;
switch (groupOperation.opType()) {
case ADD:
groupMod = builder.buildGroupAdd();
break;
case MODIFY:
groupMod = builder.buildGroupMod();
break;
case DELETE:
groupMod = builder.buildGroupDel();
break;
default:
log.error("Unsupported Group operation");
return;
}
sw.sendMsg(groupMod);
GroupId groudId = new DefaultGroupId(groupMod.getGroup().getGroupNumber());
pendingGroupOperations.put(groudId, groupOperation);
pendingXidMaps.put(groudId, groupModXid);
}
}
开发者ID:shlee89,项目名称:athena,代码行数:47,代码来源:OpenFlowGroupProvider.java
示例13: performGroupOperation
import org.projectfloodlight.openflow.protocol.OFGroupMod; //导入依赖的package包/类
@Override
public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) {
final Dpid dpid = Dpid.dpid(deviceId.uri());
OpenFlowSwitch sw = controller.getSwitch(dpid);
for (GroupOperation groupOperation: groupOps.operations()) {
if (sw == null) {
log.error("SW {} is not found", dpid);
return;
}
final Long groupModXid = XID_COUNTER.getAndIncrement();
GroupModBuilder builder = null;
if (driverService == null) {
builder = GroupModBuilder.builder(groupOperation.buckets(),
groupOperation.groupId(),
groupOperation.groupType(),
sw.factory(),
Optional.of(groupModXid));
} else {
builder = GroupModBuilder.builder(groupOperation.buckets(),
groupOperation.groupId(),
groupOperation.groupType(),
sw.factory(),
Optional.of(groupModXid),
Optional.of(driverService));
}
OFGroupMod groupMod = null;
switch (groupOperation.opType()) {
case ADD:
groupMod = builder.buildGroupAdd();
break;
case MODIFY:
groupMod = builder.buildGroupMod();
break;
case DELETE:
groupMod = builder.buildGroupDel();
break;
default:
log.error("Unsupported Group operation");
return;
}
sw.sendMsg(groupMod);
GroupId groudId = new GroupId(groupMod.getGroup().getGroupNumber());
pendingGroupOperations.put(groudId, groupOperation);
pendingXidMaps.put(groudId, groupModXid);
}
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:47,代码来源:OpenFlowGroupProvider.java
注:本文中的org.projectfloodlight.openflow.protocol.OFGroupMod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论