本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry类的典型用法代码示例。如果您正苦于以下问题:Java OFGroupDescStatsEntry类的具体用法?Java OFGroupDescStatsEntry怎么用?Java OFGroupDescStatsEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFGroupDescStatsEntry类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFGroupDescStatsEntry类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeGroupDescReply
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的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.OFGroupDescStatsEntry; //导入依赖的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: ofGroupDescStatsEntry
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的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;
}
示例4: publishGroupDescStats
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的package包/类
private synchronized Collection<OFGroupDescStatsEntry> publishGroupDescStats(Dpid dpid,
OFGroupDescStatsReply reply) {
//TODO: Get rid of synchronized
fullGroupDescStats.putAll(dpid, reply.getEntries());
if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
return fullGroupDescStats.removeAll(dpid);
}
return null;
}
示例5: publishGroupDescStats
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的package包/类
private synchronized Collection<OFGroupDescStatsEntry> publishGroupDescStats(Dpid dpid,
OFGroupDescStatsReply reply) {
//TODO: Get rid of synchronized
fullGroupDescStats.putAll(dpid, reply.getEntries());
if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
return fullGroupDescStats.removeAll(dpid);
}
return null;
}
示例6: processGroupDesc
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的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();
}
}
示例7: OFGroupDescStatsEntryMod
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的package包/类
public OFGroupDescStatsEntryMod(OFGroupDescStatsEntry GroupStatsEntry) {
this.GroupDescStatsEntry = GroupStatsEntry;
}
示例8: getGroupDescStatsEntry
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的package包/类
public OFGroupDescStatsEntry getGroupDescStatsEntry() {
return this.GroupDescStatsEntry;
}
示例9: serialize
import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry; //导入依赖的package包/类
@Override
public void serialize(OFGroupDescStatsEntryMod groupDescStatsModEntry, JsonGenerator jGen,
SerializerProvider sp) throws IOException,
JsonGenerationException {
OFGroupDescStatsEntry groupDescStatsEntryMod = groupDescStatsModEntry.getGroupDescStatsEntry();
List<OFBucket> Buckets = groupDescStatsEntryMod.getBuckets();
jGen.writeStartObject();
jGen.writeNumberField("groupId", groupDescStatsEntryMod.getGroup().getGroupNumber());
jGen.writeStringField("groupType", groupDescStatsEntryMod.getGroupType().name());
jGen.writeArrayFieldStart("bucketsActions");
for (OFBucket bucket : Buckets){
jGen.writeStartObject();
List<OFAction> actions = bucket.getActions();
for (OFAction action : actions ){
if(action.getType().compareTo(OFActionType.SET_FIELD) == 0){
/*
* TODO: 1-Need better if condition.
* TODO: 2-Complete REST response. (Right now we are only sending what
* SegmentRouter CLI needs).
*/
if (((OFActionSetField)action).getField().toString().contains("OFOxmEthSrcVer13")){
jGen.writeStringField("SET_DL_SRC", ((OFActionSetField)action).getField().getValue().toString());
}
else if (((OFActionSetField)action).getField().toString().contains("OFOxmEthDstVer13")){
jGen.writeStringField("SET_DL_DST", ((OFActionSetField)action).getField().getValue().toString());
}
else if (((OFActionSetField)action).getField().toString().contains("OFOxmMplsLabelVer13")){
jGen.writeNumberField("PUSH_MPLS_LABEL",
Integer.decode(((OFActionSetField)action).getField().getValue().toString()));
}
else if (((OFActionSetField)action).getField().toString().contains("OFOxmMplsBosVer13")){
jGen.writeStringField("PUSH_MPLS_BOS",
((OFActionSetField)action).getField().getValue().toString());
}
}
else if(action.getType().compareTo(OFActionType.OUTPUT) == 0){
jGen.writeNumberField("OUTPUT", ((OFActionOutput)action).getPort().getPortNumber());
}
else if(action.getType().compareTo(OFActionType.POP_MPLS) == 0){
jGen.writeStringField("POP_MPLS", "0x"+((OFActionPopMpls)action).getEthertype().toString());
}
else if(action.getType().compareTo(OFActionType.GROUP) == 0){
((OFActionGroup)action).getGroup().getGroupNumber();
jGen.writeNumberField("goToGroup", ((OFActionGroup)action).getGroup().getGroupNumber());
}
else if(action.getType().compareTo(OFActionType.COPY_TTL_IN) == 0
|| action.getType().compareTo(OFActionType.COPY_TTL_OUT) == 0
|| action.getType().compareTo(OFActionType.DEC_MPLS_TTL) == 0
|| action.getType().compareTo(OFActionType.DEC_NW_TTL) == 0
|| action.getType().compareTo(OFActionType.POP_PBB) == 0
|| action.getType().compareTo(OFActionType.POP_VLAN) == 0){
jGen.writeStringField(action.getType().name(), "True");
}
}
jGen.writeEndObject();
}
jGen.writeEndArray();
jGen.writeEndObject();
}