本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply.getEntries方法的典型用法代码示例。如果您正苦于以下问题:Java OFGroupDescStatsReply.getEntries方法的具体用法?Java OFGroupDescStatsReply.getEntries怎么用?Java OFGroupDescStatsReply.getEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply
的用法示例。
在下文中一共展示了OFGroupDescStatsReply.getEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeGroupDescReply
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply; //导入方法依赖的package包/类
/***
* Serializes Group Desc Reply
* @author Naveen
* @param groupDescReplies
* @param jGen
* @throws IOException
* @throws JsonProcessingException
*/
public static void serializeGroupDescReply(List<OFGroupDescStatsReply> groupDescReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
OFGroupDescStatsReply groupDescReply = groupDescReplies.get(0);
jGen.writeStringField("version", groupDescReply.getVersion().toString()); //return the enum name
jGen.writeFieldName("groupDesc");
jGen.writeStartArray();
for(OFGroupDescStatsEntry entry : groupDescReply.getEntries()) {
jGen.writeStartObject();
jGen.writeStringField("groupType",entry.getGroupType().toString());
jGen.writeStringField("groupNumber",entry.getGroup().toString());
jGen.writeFieldName("buckets");
jGen.writeStartArray();
for(OFBucket buckets : entry.getBuckets()) {
jGen.writeStartObject();
jGen.writeNumberField("weight", buckets.getWeight());
jGen.writeNumberField("watchPortNumber", buckets.getWatchPort().getPortNumber());
jGen.writeStringField("watchGroup", buckets.getWatchGroup().toString());
OFActionListSerializer.serializeActions(jGen, buckets.getActions());
jGen.writeEndObject();
}//End of for loop - buckets
jGen.writeEndArray();//end of buckets
jGen.writeEndObject();//end of group Desc iteration
}//End of for loop - GroupDescStats
jGen.writeEndArray();//end of group Desc
}
示例2: serializeGroupDescReply
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply; //导入方法依赖的package包/类
/***
* Serializes Group Desc Reply
* @author Naveen
* @param groupDescReplies
* @param jGen
* @throws IOException
* @throws JsonProcessingException
*/
public static void serializeGroupDescReply(List<OFGroupDescStatsReply> groupDescReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{
OFGroupDescStatsReply groupDescReply = groupDescReplies.get(0);
jGen.writeStringField("version", groupDescReply.getVersion().toString()); //return the enum name
jGen.writeFieldName("groupDesc");
jGen.writeStartArray();
for(OFGroupDescStatsEntry entry : groupDescReply.getEntries()) {
jGen.writeStartObject();
jGen.writeStringField("groupType",entry.getGroupType().toString());
jGen.writeStringField("groupNumber",entry.getGroup().toString());
jGen.writeFieldName("buckets");
jGen.writeStartArray();
for(OFBucket buckets : entry.getBuckets()) {
jGen.writeStartObject();
jGen.writeNumberField("weight", buckets.getWeight());
jGen.writeNumberField("watchPortNumber", buckets.getWatchPort().getPortNumber());
jGen.writeStringField("watchGroup", buckets.getWatchGroup().toString());
OFActionListSerializer.serializeActions(jGen, buckets.getActions());
jGen.writeEndObject();
}//End of for loop - buckets
jGen.writeEndArray();//end of buckets
jGen.writeEndObject();//end of group Desc iteration
}//End of for loop - GroupDescStats
jGen.writeEndArray();//end of group Desc
}
示例3: processGroupDesc
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply; //导入方法依赖的package包/类
private void processGroupDesc(OFGroupDescStatsReply gdsr) {
log.info("Sw: {} Group Desc {} in driverState {} ", getStringId(), gdsr,
driverState);
if (driverState == DriverState.AUDIT_GROUPS)
{
auditBucketToGroupIds = new ConcurrentHashMap<List<BucketInfo>, List<Integer>>();
for (OFGroupDescStatsEntry entry : gdsr.getEntries()) {
int groupId = entry.getGroup().getGroupNumber();
OFGroupType groupType = entry.getGroupType();
List<OFBucket> buckets = entry.getBuckets();
List<BucketInfo> driverBuckets = new ArrayList<BucketInfo>();
for (OFBucket bucket : buckets) {
driverBuckets.add(getDriverBucketFromOFBucket(bucket));
}
Collections.sort(driverBuckets);
List<Integer> groupIds = auditBucketToGroupIds.get(driverBuckets);
if (groupIds == null)
groupIds = new ArrayList<Integer>();
groupIds.add(groupId);
auditBucketToGroupIds.put(driverBuckets, groupIds);
ecmpGroups.put(groupId, new EcmpInfo(groupId, groupType, driverBuckets));
}
log.debug("processGroupDesc: Groups that are present in "
+ "switch {} are {} ", getStringId(), ecmpGroups);
}
else {
// TODO -- actually do verification
}
try {
nextDriverState();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}