Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit 414eec1

Browse files
Sumanth SathyanarayanaSumanth Sathyanarayana
authored andcommitted
Merged Issue42 branch
2 parents 17b21e0 + 3279556 commit 414eec1

19 files changed

+649
-129
lines changed

AUTHORS

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
Current designer/coder:
2-
Ali Al-Shabibi - [email protected]
3-
2+
Sumanth M Sathyanarayana - [email protected]
43
Flowvisor creator:
54
65

76
Currently maintained by:
8-
Ali Al-Shabibi - [email protected]
7+
Sumanth M Sathyanarayana - [email protected]
8+
9+
FlowVisor Project headed by:
10+
Ali Al-Shabibi <[email protected]>
911

1012
Additional help from:
1113

@@ -24,3 +26,10 @@ FlowVisor 0.8:
2426
Ali Al-Shabibi <[email protected]>
2527
FlowVisor 0.10:
2628
Andrew Ragusa <[email protected]>
29+
FlowVisor 1.0:
30+
Ali Al-Shabibi <[email protected]>
31+
FlowVisor 1.2:
32+
Sumanth M. Sathyanarayana <[email protected]>
33+
FlowVisor 1.4:
34+
Sumanth M. Sathyanarayana <[email protected]>
35+

RELEASE-NOTES

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
FlowVisor 1.1.3-DEV: May 15 2013
1+
FlowVisor 1.4: Aug 30 2013
2+
* FLOWVISOR-229 : Don't destroy derby.log at startup
3+
* FLOWVISOR-215 : Configuration variables aren't documented
4+
* FLOWVISOR-214 : fvctl set-config with no arguments seems to succeed
5+
* FLOWVISOR-213 : fvctl set-config should let you set all configurable variables
6+
* FLOWVISOR-212 : fvctl get-config should show all configurable variables
7+
* FLOWVISOR-243 : datapath description: append FV version info
8+
* FLOWVISOR-249 : NullPointerExceptions in UpdateFlowSpace
9+
* FLOWVISOR-208 : Flowspace rules should support ranges
10+
* FLOWVISOR-23 : slice names longer than 255 will break lldp
11+
* FLOWVISOR-42 : need to virtualize flow_mod priorities
12+
13+
14+
15+
FlowVisor 1.2: May 31 2013
216
* FLOWVISOR-59 : Flowvisor should be able to ask the flow table from the switch
317
* FLOWVISOR-62 : Allow slice perms to be specfied with "rwd" in addition to by number
418
* FLOWVISOR-191: fvctl add-flowspace should check whether a slice exist before returning

scripts/fvctl-json.py

Lines changed: 84 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -303,31 +303,56 @@ def pa_addFlowSpace(args, cmd):
303303
help="Define list of queues permitted on this flowspace.")
304304
parser.add_option("-f", "--forced-queue", default=None, dest="fqueue", type="int",
305305
help="Force a queue id upon output action.")
306-
307306
return parser.parse_args(args)
308307

309308
def do_addFlowSpace(gopts, opts, args):
310309
if len(args) != 5:
311310
print "add-flowpace : Requires 5 arguments; only %d given" % len(args)
312311
print "add-flowspace: <flowspace-name> <dpid> <priority> <match> <slice-perm>"
312+
print "If range is specified for vlan, the format for add-flowspace is as below:(Currently only vlan ranges are supported)"
313+
print "add-flowspace <flowspace-name> <dpid> <priority> <dl_vlan=1-10> <slice-perm>"
313314
sys.exit()
314315
passwd = getPassword(gopts)
315-
match = makeMatch(args[3])
316-
req = { "name" : args[0], "dpid" : args[1], "priority" : int(args[2]), "match" : match }
317-
if opts.queues is not None:
318-
req['queues'] = opts.queues
319-
if opts.fqueue is not None:
320-
req['force-enqueue'] = opts.fqueue
321-
actions = args[4].split(',')
322-
acts = []
323-
for action in actions:
324-
parts = action.split('=')
325-
act = { 'slice-name' : parts[0], "permission" : parts[1] }
326-
acts.append(act)
327-
req['slice-action'] = acts
328-
ret = connect(gopts, "add-flowspace", passwd, data=[req])
329-
if ret:
330-
print "FlowSpace %s was added with request id %s." % (args[0], ret)
316+
if(args[3].find('-') != -1):
317+
#Get the ranges
318+
ranges = getRange(args[3])
319+
if((int(ranges[0]) < 1) or (int(ranges[0]) > 4095) or (int(ranges[1]) < 1) or (int(ranges[1]) > 4095)):
320+
print "The vlan range should be within 1 and 4095"
321+
sys.exit()
322+
for r in range((int(ranges[0])), (int(ranges[1])+1)):
323+
match = makeMatchWithRanges(args[3],r)
324+
req = { "name" : args[0], "dpid" : args[1], "priority" : int(args[2]), "match" : match }
325+
if opts.queues is not None:
326+
req['queues'] = opts.queues
327+
if opts.fqueue is not None:
328+
req['force-enqueue'] = opts.fqueue
329+
actions = args[4].split(',')
330+
acts = []
331+
for action in actions:
332+
parts = action.split('=')
333+
act = { 'slice-name' : parts[0], "permission" : parts[1] }
334+
acts.append(act)
335+
req['slice-action'] = acts
336+
ret = connect(gopts, "add-flowspace", passwd, data=[req])
337+
if ret:
338+
print "FlowSpace %s was added with request id %s." % (args[0], ret)
339+
else:
340+
match = makeMatch(args[3])
341+
req = { "name" : args[0], "dpid" : args[1], "priority" : int(args[2]), "match" : match }
342+
if opts.queues is not None:
343+
req['queues'] = opts.queues
344+
if opts.fqueue is not None:
345+
req['force-enqueue'] = opts.fqueue
346+
actions = args[4].split(',')
347+
acts = []
348+
for action in actions:
349+
parts = action.split('=')
350+
act = { 'slice-name' : parts[0], "permission" : parts[1] }
351+
acts.append(act)
352+
req['slice-action'] = acts
353+
ret = connect(gopts, "add-flowspace", passwd, data=[req])
354+
if ret:
355+
print "FlowSpace %s was added with request id %s." % (args[0], ret)
331356

332357
def pa_updateFlowSpace(args, cmd):
333358
usage = "%s [options] <flowspace-name>" % USAGE.format(cmd)
@@ -717,7 +742,8 @@ def makeMatch(matchStr):
717742
for item in matchItems:
718743
it = item.split('=')
719744
if len(it) != 2:
720-
print "Match items must be of the form <key>=<val>"
745+
print it
746+
print "Match items must be of the form =, not %s" % it
721747
sys.exit()
722748
try:
723749
(mstr, func) = MATCHSTRS[it[0].lower()]
@@ -726,8 +752,44 @@ def makeMatch(matchStr):
726752
print "Unknown match item %s" % it[0]
727753
sys.exit()
728754
return match
729-
730755

756+
def makeMatchWithRanges(matchStr,rng):
757+
if matchStr == 'any' or matchStr == 'all':
758+
return {}
759+
matchItems = matchStr.split(',')
760+
match = {}
761+
for item in matchItems:
762+
it = item.split('=')
763+
if len(it) != 2:
764+
print it
765+
print "Match items must be of the form <key>=<val>"
766+
sys.exit()
767+
try:
768+
if it[0].lower() != 'dl_vlan':
769+
(mstr, func) = MATCHSTRS[it[0].lower()]
770+
match[mstr] = func(it[1])
771+
else:
772+
match['dl_vlan'] = rng
773+
except KeyError, e:
774+
print "Unknown match item %s" % it[0]
775+
sys.exit()
776+
return match
777+
778+
def getRange(matchStr):
779+
matchItems = matchStr.split(',')
780+
match = {}
781+
ranges = []
782+
for item in matchItems:
783+
it = item.split('=')
784+
if len(it) != 2:
785+
print "Match items must be of the form <key>=<val>"
786+
sys.exit()
787+
if it[0].lower() == 'dl_vlan':
788+
ranges = it[1].split('-')
789+
if len(ranges) !=2:
790+
print "The vlan range should be given in the form <from>-<to>, for eg. dl_vlan=10-100"
791+
return ranges
792+
731793
def connect(opts, cmd, passwd, data=None):
732794
try:
733795
url = getUrl(opts)
@@ -923,6 +985,9 @@ def print_help(option, opt, value, parser):
923985
"replaced with the queue id given in the forced queue option. Note: The forced queue "
924986
"should be defined in the queue option and all these queue ids should be defined with "
925987
"the appropriate port on the switch."
988+
"A range can be specified only for the dl_vlan match field."
989+
"To specify the range for dl_vlan match field, the add-flowspace api has to be used as in the below example:"
990+
"Eg. ./fvctl.py add-flowspace flow1 all 1000 dl_vlan=1-10 slice1=6"
926991
"See the fvctl man page for information "
927992
"on the format of <dpid>, <match>, and <slice-perm>."
928993
)),

src/org/flowvisor/FlowVisor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public class FlowVisor {
4040
public final static int FLOWVISOR_VENDOR_EXTENSION = 0x80000001;
4141

4242
// VERSION
43-
public final static String FLOWVISOR_VERSION = "flowvisor-1.3.0";
43+
public final static String FLOWVISOR_VERSION = "flowvisor-1.4.0";
44+
4445

4546
public final static int FLOWVISOR_DB_VERSION = 2;
4647

src/org/flowvisor/api/handlers/ApiHandler.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,17 @@ public interface ApiHandler<T> {
3131
final static String QUEUE = "queues";
3232
final static String SHOW = "show-disabled";
3333
final static String FSID = "fs-id";
34-
34+
//Additions to get config
35+
public static String APIPORT = "api_webserver_port";
36+
public static String CONFIG = "config_name";
37+
public static String JETTYPORT = "api_jetty_webserver_port";
38+
public static String LOGFACILITY = "log_facility";
39+
public static String LOGGING = "logging";
40+
public static String CHECKPOINT = "checkpointing";
41+
public static String LOGIDENT = "log_ident";
42+
public static String VERSION = "version";
43+
public static String HOST = "host";
44+
public static String DB_VERSION = "db_version";
3545

3646
final static String MSG = "msg";
3747
final static String CURRRATE = "current-rate";

src/org/flowvisor/api/handlers/configuration/GetConfig.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ public JSONRPC2Response process(Map<String, Object> params) {
3737
configs.put(STATSDESC, FlowvisorImpl.getProxy().getstats_desc_hack());
3838
configs.put(TOPOCTRL, FlowvisorImpl.getProxy().getTopologyServer());
3939
configs.put(FSCACHE, FlowvisorImpl.getProxy().getFlowStatsCache());
40+
configs.put(APIPORT, FlowvisorImpl.getProxy().getAPIWSPort());
41+
configs.put(CONFIG, FlowvisorImpl.getProxy().getConfigName());
42+
configs.put(JETTYPORT, FlowvisorImpl.getProxy().getJettyPort());
43+
configs.put(LOGFACILITY, FlowvisorImpl.getProxy().getLogFacility());
44+
configs.put(LOGGING, FlowvisorImpl.getProxy().getLogging());
45+
configs.put(CHECKPOINT, FlowvisorImpl.getProxy().getCheckPoint());
46+
configs.put(LOGIDENT, FlowvisorImpl.getProxy().getLogIdent());
47+
configs.put(VERSION, FlowvisorImpl.getProxy().getVersion());
48+
configs.put(HOST, FlowvisorImpl.getProxy().getHost());
49+
configs.put(DB_VERSION, FlowvisorImpl.getProxy().getDBVersion());
50+
4051
addFloodPerms(dpidStr, configs);
4152
addFlowmodLimits(sliceName, dpidStr, configs);
4253

src/org/flowvisor/api/handlers/configuration/SetConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.flowvisor.config.SliceImpl;
1313
import org.flowvisor.config.SwitchImpl;
1414
import org.flowvisor.exceptions.MissingRequiredField;
15-
import org.flowvisor.exceptions.NoParam;
15+
import org.flowvisor.exceptions.NoParamException;
1616
import org.flowvisor.exceptions.PermissionDeniedException;
1717
import org.flowvisor.flows.FlowEntry;
1818
import org.flowvisor.flows.FlowSpaceUtil;
@@ -73,7 +73,7 @@ public JSONRPC2Response process(Map<String, Object> params){
7373
} catch (PermissionDeniedException e) {
7474
resp = new JSONRPC2Response(new JSONRPC2Error(JSONRPC2Error.INVALID_PARAMS.getCode(),
7575
cmdName() + ": " + e.getMessage()), 0);
76-
} catch (NoParam e) {
76+
} catch (NoParamException e) {
7777
resp = new JSONRPC2Response(new JSONRPC2Error(JSONRPC2Error.INVALID_PARAMS.getCode(),
7878
cmdName() + e.getMessage()), 0);
7979
}
@@ -83,10 +83,10 @@ public JSONRPC2Response process(Map<String, Object> params){
8383

8484

8585
private void checkForNoParams(Map<String, Object> params)
86-
throws NoParam{
86+
throws NoParamException{
8787
if(params.isEmpty()){
8888
FVLog.log(LogLevel.DEBUG, null, "No parameters are specified. Please input the parameters and the value you want them to be set");
89-
throw new NoParam(" No parameters are specified. Please input the parameters and the value you want them to be set! ");
89+
throw new NoParamException(" No parameters are specified. Please input the parameters and the value you want them to be set.");
9090
}
9191
}
9292

src/org/flowvisor/api/handlers/configuration/UpdateFlowSpace.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private int processFlows(List<Map<String, Object>> params)
6464
throws ClassCastException, MissingRequiredField, ConfigError, FlowEntryNotFound, UnknownMatchField {
6565
String name = null;
6666
Long dpid = null;
67-
Integer priority = null;
67+
Number priority = null;
6868
FlowEntry update = null;
6969
//LinkedList<FlowEntry> list = new LinkedList<FlowEntry>();
7070
FlowMap flowSpace = FlowSpaceImpl.getProxy().getFlowMap();
@@ -82,9 +82,9 @@ private int processFlows(List<Map<String, Object>> params)
8282

8383
}
8484

85-
priority = HandlerUtils.<Number>fetchField(FlowSpace.PRIO, fe, false, null).intValue();
85+
priority = HandlerUtils.<Number>fetchField(FlowSpace.PRIO, fe, false, null);
8686
if (priority != null) {
87-
update.setPriority(priority);
87+
update.setPriority(priority.intValue());
8888

8989
}
9090

src/org/flowvisor/config/Flowvisor.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ public interface Flowvisor extends FVAppConfig {
5454
public Boolean getTopologyServer(int id) throws ConfigError;
5555
public Boolean getTopologyServer() throws ConfigError;
5656
public Integer getFlowStatsCache() throws ConfigError;
57-
57+
public String getConfigName(Integer id) throws ConfigError;
58+
public String getConfigName() throws ConfigError;
59+
public String getVersion(Integer id) throws ConfigError;
60+
public String getVersion() throws ConfigError;
61+
public String getHost(Integer id) throws ConfigError;
62+
public String getHost() throws ConfigError;
63+
public String getDBVersion(Integer id) throws ConfigError;
64+
public String getDBVersion() throws ConfigError;
5865

5966
public void settrack_flows(Integer id, Boolean track_flows);
6067
public void settrack_flows(Boolean track_flows);
@@ -77,8 +84,14 @@ public interface Flowvisor extends FVAppConfig {
7784
public void setJettyPort(Integer id, Integer port) throws ConfigError;
7885
public void setJettyPort(Integer port) throws ConfigError;
7986
public void setFlowStatsCache(Integer timer) throws ConfigError;
80-
81-
87+
public void setConfigName(Integer id, String config) throws ConfigError;
88+
public void setConfigName(String config) throws ConfigError;
89+
public void setVersion(Integer id, String version) throws ConfigError;
90+
public void setVersion(String version) throws ConfigError;
91+
public void setDBVersion(Integer id, Integer version) throws ConfigError;
92+
public void setDBVersion(Integer version) throws ConfigError;
93+
public void setHost(Integer id, String version) throws ConfigError;
94+
public void setHost(String version) throws ConfigError;
8295

8396
public int fetchDBVersion();
8497

0 commit comments

Comments
 (0)