(sdn)在floodlight控制器中统计进入packed-in数量的代码(改)

在floodlight控制器中统计进入packed-in数量的代码:

package edu.wzu.steve.trafficanalyser;

import java.util.ArrayList;

import java.util.Collection;

import java.util.HashMap;

import java.util.Iterator;

import java.util.Map;

import java.util.Map.Entry;

import org.restlet.resource.ResourceException;

import org.restlet.resource.ServerResource;

import net.floodlightcontroller.counter.CounterValue;

import net.floodlightcontroller.counter.ICounter;

import org.restlet.resource.Get;

import net.floodlightcontroller.core.FloodlightContext;

import net.floodlightcontroller.core.IFloodlightProviderService;

import net.floodlightcontroller.core.IOFMessageListener;

import net.floodlightcontroller.core.IOFSwitch;

import net.floodlightcontroller.core.module.FloodlightModuleContext;

import net.floodlightcontroller.core.module.FloodlightModuleException;

import net.floodlightcontroller.core.module.IFloodlightModule;

import net.floodlightcontroller.core.module.IFloodlightService;

import net.floodlightcontroller.counter.ICounterStoreService;

import org.openflow.protocol.OFMessage;

import org.openflow.protocol.OFType;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

public class TrafficAnalyser extends ServerResource implements IOFMessageListener, IFloodlightModule{

protected ICounterStoreService counterStore;

protected IFloodlightProviderService floodlightProvider;

protected static Logger logger;

@Override

public String getName() {

// TODO Auto-generated method stub

return TrafficAnalyser.class.getSimpleName();

}

@Override

public boolean isCallbackOrderingPrereq(OFType type, String name) {

// TODO Auto-generated method stub

return false;

}

@Override

public boolean isCallbackOrderingPostreq(OFType type, String name) {

// TODO Auto-generated method stub

return false;

}

@Override

public Collection<Class<? extends IFloodlightService>> getModuleServices() {

// TODO Auto-generated method stub

return null;

}

@Override

public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {

// TODO Auto-generated method stub

return null;

}

@Override

public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {

// TODO Auto-generated method stub

Collection<Class<? extends IFloodlightService>> l =

new ArrayList<Class<? extends IFloodlightService>>();

l.add(IFloodlightProviderService.class);

return l;

}

@Override

public void init(FloodlightModuleContext context)

throws FloodlightModuleException {

this.floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);

this.counterStore = context.getServiceImpl(ICounterStoreService.class);

logger = LoggerFactory.getLogger(TrafficAnalyser.class);

}

@Override

public void startUp(FloodlightModuleContext context) {

floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);

}

@Get("json")

public Map<String, Object> retrieve(){

String counterTitle =

(String) getRequestAttributes().get("counterTitle");

Map<String, Object> model = new HashMap<String,Object>();

CounterValue v;

if (counterTitle.equalsIgnoreCase("all")) {

Map<String, ICounter> counters = this.counterStore.getAll();

if (counters != null) {

Iterator<Map.Entry<String, ICounter>> it =

counters.entrySet().iterator();

while (it.hasNext()) {

Entry<String, ICounter> entry = it.next();

String counterName = entry.getKey();

v = entry.getValue().getCounterValue();

if (CounterValue.CounterType.LONG == v.getType()) {

model.put(counterName, v.getLong());

} else if (v.getType() == CounterValue.CounterType.DOUBLE) {

model.put(counterName, v.getDouble());

}

}

}

} else {

ICounter counter = this.counterStore.getCounter(counterTitle);

if (counter != null) {

v = counter.getCounterValue();

} else {

v = new CounterValue(CounterValue.CounterType.LONG);

}

if (CounterValue.CounterType.LONG == v.getType()) {

model.put(counterTitle, v.getLong());

} else if (v.getType() == CounterValue.CounterType.DOUBLE) {

model.put(counterTitle, v.getDouble());

}

}

return model;

}

protected void doInit() throws ResourceException {

super.doInit();

counterStore =

(ICounterStoreService)getContext().getAttributes().

get(ICounterStoreService.class.getCanonicalName());

}

@Override

public net.floodlightcontroller.core.IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {

System.out.println(retrieve().toString());

return Command.CONTINUE;

}

}

这代码没有报错,可是,控制器只能连接到ovs,在mininet中用hosts去pingall的时候就会一下连接,一下断开,无法ping通。

于是就简化了一下代码,去掉觉得有bug的代码,抛出的异常是没有实例化;

代码如下:

package edu.wzu.steve.trafficanalyser;

import java.util.ArrayList;

import java.util.Collection;

import java.util.HashMap;

import java.util.Iterator;

import java.util.Map;

import java.util.Map.Entry;

import org.restlet.resource.ResourceException;

import org.restlet.resource.ServerResource;

import net.floodlightcontroller.counter.CounterValue;

import net.floodlightcontroller.counter.ICounter;

import org.restlet.resource.Get;

import net.floodlightcontroller.core.FloodlightContext;

import net.floodlightcontroller.core.IFloodlightProviderService;

import net.floodlightcontroller.core.IOFMessageListener;

import net.floodlightcontroller.core.IOFSwitch;

import net.floodlightcontroller.core.module.FloodlightModuleContext;

import net.floodlightcontroller.core.module.FloodlightModuleException;

import net.floodlightcontroller.core.module.IFloodlightModule;

import net.floodlightcontroller.core.module.IFloodlightService;

import net.floodlightcontroller.counter.ICounterStoreService;

import org.openflow.protocol.OFMessage;

import org.openflow.protocol.OFType;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

public class TrafficAnalyser extends ServerResource implements IOFMessageListener, IFloodlightModule{

protected ICounterStoreService counterStore;

protected IFloodlightProviderService floodlightProvider;

protected static Logger logger;

@Override

public String getName() {

// TODO Auto-generated method stub

return TrafficAnalyser.class.getSimpleName();

}

@Override

public boolean isCallbackOrderingPrereq(OFType type, String name) {

// TODO Auto-generated method stub

return false;

}

@Override

public boolean isCallbackOrderingPostreq(OFType type, String name) {

// TODO Auto-generated method stub

return false;

}

@Override

public Collection<Class<? extends IFloodlightService>> getModuleServices() {

// TODO Auto-generated method stub

return null;

}

@Override

public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() {

// TODO Auto-generated method stub

return null;

}

@Override

public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {

// TODO Auto-generated method stub

Collection<Class<? extends IFloodlightService>> l =

new ArrayList<Class<? extends IFloodlightService>>();

l.add(IFloodlightProviderService.class);

return l;

}

@Override

public void init(FloodlightModuleContext context)

throws FloodlightModuleException {

this.floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);

this.counterStore = context.getServiceImpl(ICounterStoreService.class);

logger = LoggerFactory.getLogger(TrafficAnalyser.class);

}

@Override

public void startUp(FloodlightModuleContext context) {

floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);

}

@Get("json")

public Map<String, Object> retrieve(){

Map<String, Object> model = new HashMap<String,Object>();

CounterValue v;

Map<String, ICounter> counters = this.counterStore.getAll();

if (counters != null) {

Iterator<Map.Entry<String, ICounter>> it =

counters.entrySet().iterator();

while (it.hasNext()) {

Entry<String, ICounter> entry = it.next();

String counterName = entry.getKey();

v = entry.getValue().getCounterValue();

if (CounterValue.CounterType.LONG == v.getType()) {

model.put(counterName, v.getLong());

} else if (v.getType() == CounterValue.CounterType.DOUBLE) {

model.put(counterName, v.getDouble());

}

}

}

return model;

}

protected void doInit() throws ResourceException {

super.doInit();

counterStore =

(ICounterStoreService)getContext().getAttributes().

get(ICounterStoreService.class.getCanonicalName());

}

@Override

public net.floodlightcontroller.core.IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {

System.out.println(retrieve().toString());

return Command.CONTINUE;

}

}

sudo mn --topo single,3 --mac --switch ovsk --controller=remote,ip=10.0.2.15,port=6633

建立hosts去pingall

eclipse中控制台出来的信息截图如上,完整信息如下:

00:58:01.133 INFO [n.f.c.m.FloodlightModuleLoader:main] Loading default modules

00:58:01.846 INFO [n.f.c.i.Controller:main] Controller role set to MASTER

00:58:01.869 INFO [n.f.c.i.Controller:main] Flush switches on reconnect -- Disabled

00:58:02.968 ERROR [o.s.s.i.c.DelegatingCCProvider:main] Failed to initialize provider org.sdnplatform.sync.internal.config.SyncStoreCCProvider

org.sdnplatform.sync.error.PersistException: Could not initialize persistent storage

at org.sdnplatform.sync.internal.store.JavaDBStorageEngine.<init>(JavaDBStorageEngine.java:106) ~[bin/:na]

at org.sdnplatform.sync.internal.StoreRegistry.register(StoreRegistry.java:116) ~[bin/:na]

at org.sdnplatform.sync.internal.SyncManager.registerPersistentStore(SyncManager.java:184) [bin/:na]

at org.sdnplatform.sync.internal.config.SyncStoreCCProvider.init(SyncStoreCCProvider.java:85) ~[bin/:na]

at org.sdnplatform.sync.internal.config.DelegatingCCProvider.init(DelegatingCCProvider.java:37) ~[bin/:na]

at org.sdnplatform.sync.internal.SyncManager.init(SyncManager.java:489) [bin/:na]

at net.floodlightcontroller.core.module.FloodlightModuleLoader.initModules(FloodlightModuleLoader.java:436) [bin/:na]

at net.floodlightcontroller.core.module.FloodlightModuleLoader.loadModulesFromList(FloodlightModuleLoader.java:353) [bin/:na]

at net.floodlightcontroller.core.module.FloodlightModuleLoader.loadModulesFromList(FloodlightModuleLoader.java:362) [bin/:na]

at net.floodlightcontroller.core.module.FloodlightModuleLoader.loadModulesFromConfig(FloodlightModuleLoader.java:200) [bin/:na]

at net.floodlightcontroller.core.Main.main(Main.java:55) [bin/:na]

Caused by: java.sql.SQLException: DDL is not permitted for a read-only connection, user or database.

at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.sdnplatform.sync.internal.store.JavaDBStorageEngine.initTable(JavaDBStorageEngine.java:379) ~[bin/:na]

at org.sdnplatform.sync.internal.store.JavaDBStorageEngine.<init>(JavaDBStorageEngine.java:104) ~[bin/:na]

... 10 common frames omitted

Caused by: org.apache.derby.impl.jdbc.EmbedSQLException: DDL is not permitted for a read-only connection, user or database.

at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ~[derby-10.9.1.0.jar:na]

... 21 common frames omitted

Caused by: org.apache.derby.iapi.error.StandardException: DDL is not permitted for a read-only connection, user or database.

at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.sql.conn.GenericAuthorizer.authorize(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.sql.execute.GenericResultSetFactory.getDDLResultSet(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.sql.execute.ConstantActionActivation.execute(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.sql.GenericActivationHolder.execute(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source) ~[derby-10.9.1.0.jar:na]

at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) ~[derby-10.9.1.0.jar:na]

... 15 common frames omitted

00:58:03.244 INFO [n.f.l.i.LinkDiscoveryManager:main] Setting autoportfast feature to OFF

00:58:03.431 INFO [o.s.s.i.c.FallbackCCProvider:main] Cluster not yet configured; using fallback local configuration

00:58:03.436 INFO [o.s.s.i.SyncManager:main] [32767] Updating sync configuration ClusterConfig [allNodes={32767=Node [hostname=localhost, port=6642, nodeId=32767, domainId=32767]}, authScheme=CHALLENGE_RESPONSE, keyStorePath=/etc/floodlight/auth_credentials.jceks, keyStorePassword is unset]

00:58:03.660 INFO [o.s.s.i.r.RPCService:main] Listening for internal floodlight RPC on localhost/127.0.0.1:6642

00:58:04.128 INFO [n.f.c.i.Controller:main] Listening for switch connections on 0.0.0.0/0.0.0.0:6633

00:58:09.232 INFO [n.f.c.i.OFChannelHandler:New I/O server worker #2-1] New switch connection from /10.0.2.15:59701

00:58:09.495 INFO [n.f.c.i.OFChannelHandler:New I/O server worker #2-1] Switch OFSwitchBase [/10.0.2.15:59701 DPID[00:00:00:00:00:00:00:01]] bound to class class net.floodlightcontroller.core.internal.OFSwitchImpl, writeThrottle=false, description Switch Desc - Vendor: Nicira, Inc.  Model: Open vSwitch  Make: None  Version: 2.1.0  S/N: None

00:58:09.509 INFO [n.f.c.OFSwitchBase:New I/O server worker #2-1] Clearing all flows on switch OFSwitchBase [/10.0.2.15:59701 DPID[00:00:00:00:00:00:00:01]]

00:58:09.519 WARN [n.f.c.i.C.s.notification:main] Switch 00:00:00:00:00:00:00:01 connected.

{StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=0, controller__OFPacketIn=0, 00:00:00:00:00:00:00:01__OFPacketIn=0, controller__OFPacketIn__L3_ARP=0, StorageQuery__controller_forwardingconfig=1, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=0, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=0}

{controller__OFPacketIn=1, 00:00:00:00:00:00:00:01__OFPacketIn=1, controller__OFPacketIn__L3_ARP=1, controller__OFPacketOut=0, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=0, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=1, StorageQuery=6, StorageQuery__controller_topologyconfig=1, StorageQuery__controller_firewallrules=1, 00:00:00:00:00:00:00:01__OFFlowMod=0, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=1, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=0, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=1}

{controller__OFPacketIn__L4_ICMP=0, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=0, controller__OFPacketIn=2, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=0, 00:00:00:00:00:00:00:01__OFPacketIn=2, controller__OFPacketIn__unicast=0, controller__OFPacketIn__L3_ARP=2, controller__OFPacketOut=1, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=1, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=2, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=1, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=2, controller__OFPacketIn__L3_IPv4=0, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=1, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=0, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=2}

{controller__OFPacketIn__L4_ICMP=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=1, controller__OFPacketIn=3, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=1, 00:00:00:00:00:00:00:01__OFPacketIn=3, controller__OFPacketIn__unicast=1, controller__OFPacketIn__L3_ARP=2, controller__OFPacketOut=2, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=2, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=2, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=2, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=2, controller__OFPacketIn__L3_IPv4=1, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=2, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=2}

{controller__OFPacketIn__L4_ICMP=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=1, controller__OFPacketIn=4, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=1, 00:00:00:00:00:00:00:01__OFPacketIn=4, controller__OFPacketIn__unicast=1, controller__OFPacketIn__L3_ARP=3, controller__OFPacketOut=2, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=2, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=3, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=2, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=3, controller__OFPacketIn__L3_IPv4=1, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=2, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=3}

{controller__OFPacketIn__L4_ICMP=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=1, controller__OFPacketIn=5, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=1, 00:00:00:00:00:00:00:01__OFPacketIn=5, controller__OFPacketIn__unicast=1, controller__OFPacketIn__L3_ARP=4, controller__OFPacketOut=3, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=3, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=4, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=3, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=4, controller__OFPacketIn__L3_IPv4=1, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=3, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=1, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=4}

{controller__OFPacketIn__L4_ICMP=2, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=2, controller__OFPacketIn=6, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=2, 00:00:00:00:00:00:00:01__OFPacketIn=6, controller__OFPacketIn__unicast=2, controller__OFPacketIn__L3_ARP=4, controller__OFPacketOut=4, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=4, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=4, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=4, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=4, controller__OFPacketIn__L3_IPv4=2, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=4, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=2, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=4}

{controller__OFPacketIn__L4_ICMP=2, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=2, controller__OFPacketIn=7, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=2, 00:00:00:00:00:00:00:01__OFPacketIn=7, controller__OFPacketIn__unicast=2, controller__OFPacketIn__L3_ARP=5, controller__OFPacketOut=4, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=4, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=5, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=4, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=5, controller__OFPacketIn__L3_IPv4=2, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=4, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=2, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=5}

{controller__OFPacketIn__L4_ICMP=2, 00:00:00:00:00:00:00:01__OFPacketIn__L3_IPv4=2, controller__OFPacketIn=8, 00:00:00:00:00:00:00:01__OFPacketIn__unicast=2, 00:00:00:00:00:00:00:01__OFPacketIn=8, controller__OFPacketIn__unicast=2, controller__OFPacketIn__L3_ARP=6, controller__OFPacketOut=5, StorageQuery__controller_forwardingconfig=1, 00:00:00:00:00:00:00:01__OFPacketOut=5, 00:00:00:00:00:00:00:01__OFPacketIn__broadcast=6, StorageQuery=6, StorageQuery__controller_firewallrules=1, StorageQuery__controller_topologyconfig=1, 00:00:00:00:00:00:00:01__OFFlowMod=5, StorageQuery__controller_staticflowtableentry=1, controller__OFPacketIn__broadcast=6, controller__OFPacketIn__L3_IPv4=2, StorageQuery__controller_switchconfig=1, StorageQuery__controller_link=1, controller__OFFlowMod=5, 00:00:00:00:00:00:00:01__OFPacketIn__L4_ICMP=2, 00:00:00:00:00:00:00:01__OFPacketIn__L3_ARP=6}

00:58:11.966 INFO [n.f.j.JythonServer:debugserver-main] Starting DebugServer on :6655

把流量数目统计完了接下去就是流量种类分析了。

时间: 2024-08-01 02:22:50

(sdn)在floodlight控制器中统计进入packed-in数量的代码(改)的相关文章

在floodlight控制器中统计进入packed-in数量的代码(sdn)

<p class="NewStyle15"><span style="font-family: 'Times New Roman'; letter-spacing: 0pt; font-size: 10.5pt;"><o:p></o:p></span></p><p class="NewStyle15" style="text-indent:24.0000pt;

ASP.NET MVC 表单提交多层子级实体集合数据到控制器中

于遇到了项目中实体类嵌套多层子级实体集合,并且子级实体集合的数据需要提交保存到数据库中的问题.针对此情况需要进行一些特殊的处理才可以将整个 实体类及子级实体集合数据提交表单到控制器中,解决的方法是根据MVC视图中表单的命名规则来设置正确的子级实体集合所属的表单控件name属性,从而来 获取提交的集合数据. 在说明如何将表单中实体的子级实体集合数据提交到控制器中的问题前,我们需要了解MVC的对于数组和列表集合的表单提交方式(点击此链接进行查看). 定义多层嵌套实体和假设场景 首先我们根据情况进行分

SDN 实践之floodlight控制器统计流量种类

SDN 实践之floodlight控制器统计流量种类 @温州大学12网工蒋暕青.郑明社 在floodlight控制器统计流量的基础上接着把packed-in流量的种类也区分一下.counter这个类琢磨了一个月终于有些会用了. 下面贴代码: 分两个.java 1. package edu.wzu.steve.trafficanalyser; import java.util.ArrayList; import java.util.Collection; import java.util.Hash

SDN开发之基于floodlight控制器做QoS策略

---温州大学 12网络工程 在floodlight中写主要策略.通过python脚本与ubuntu console界面交互 利用floodlight提供的restAPI开发webUI界面 JAVA部分代码: package net.floodlightcontroller.qos; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import ja

ASP.NET MVC 中将数据从View传递到控制器中的三种方法(表单数据绑定)

转自:http://www.cnblogs.com/zyqgold/archive/2010/11/22/1884779.html 在ASP.NET MVC框架中,将视图中的数据传递到控制器中,主要通过发送表单实现的.具体使用中,主要使用以下三种方法. 1.通过Request.Form读取表单数据        2.通过FormCollection读取表单数据        3.直接读取表单数据对象 下边是我学习这些东西时的一点总结 1.通过Request.Form读取表单数据      首先定

10.16输入一个字符串,内有数字和非数字字符,如: a123x456 17960? 302tab5876 将其中连续的数字作为一个整数,依次存放到一数组num中。例如123放在num[0]中,456放在num[1]中……统计共有多少个整数,并输出这些数。

10.16输入一个字符串,内有数字和非数字字符,如: a123x456 17960? 302tab5876 将其中连续的数字作为一个整数,依次存放到一数组num中.例如123放在num[0]中,456放在num[1]中--统计共有多少个整数,并输出这些数. #include <stdio.h> int main(){ void search(char * parr, int * pnum); char arr[100],* parr; int num[30],* pnum; parr=arr;

java学习,从一个字符串中统计同一类型出现的次数

1.从字符串“AS345asdzf*())sddsWE”中统计大写字母.小写字母.其他类型的出现的次数 String s="AS345asdzf*())sddsWE"; int l = 0,b=0,o=0; for(int i=0;i<s.length();i++){ char t= s.charAt(i);//charAt返回索引值 if(t>='a'&&t<='z'){//判断是否为小写字母 l++; }else if(t>='A'&

在ASP.NET MVC控制器中获取链接中的路由数据

在ASP.NET MVC中,在链接中附加路由数据有2种方式.一种是把路由数据放在匿名对象中传递: <a href="@Url.Action("GetRouteData","Home",new { ReturnUrl = Request.Url.PathAndQuery, x = 10})">走你</a> 一种是放在RouteValueDictionary对象中传递: <a href="@Url.Action

控制器中获取Field值

在ASP.NET MVC程序中,我们需要POST Data到制器中,是有很多方法.但是我们想在控制器中,获取Feild值呢?怎样获取?你可以留意到有一个类FormCollection.它能帮助到我们解决这个问题. 举个简单的例子.在ASP.NET MVC应用程序中,在Controllers目录下,创建一个叫SepController控制器,现在是九月,在九月份做的练习,全在这个控制器下进行. 然后在Views目录下,对应的控制器创建PostDataToControl.cshtml视图,在视图中: