Merge branch 'master' of github.com:OPENNETWORKINGLAB/ONOS
diff --git a/cluster-mgmt/bin/check_status.py b/cluster-mgmt/bin/check_status.py
index 434bb33..eb5f535 100755
--- a/cluster-mgmt/bin/check_status.py
+++ b/cluster-mgmt/bin/check_status.py
@@ -3,53 +3,74 @@
import os
urls="http://localhost:8080/wm/core/topology/switches/all/json http://localhost:8080/wm/core/topology/links/json http://localhost:8080/wm/registry/controllers/json http://localhost:8080/wm/registry/switches/json"
-RestIP="onosdevz1"
+RestIP=os.environ.get("ONOS_CLUSTER_BASENAME")+"1"
RestPort="8080"
core_switches=["00:00:00:00:ba:5e:ba:11", "00:00:00:00:00:00:ba:12", "00:00:20:4e:7f:51:8a:35", "00:00:00:00:ba:5e:ba:13", "00:00:00:08:a2:08:f9:01", "00:00:00:16:97:08:9a:46"]
correct_nr_switch=[6,50,25,25,25,25,25,25]
correct_intra_link=[16, 98, 48, 48, 48, 48, 48, 48]
+
#nr_links=(switch[1]+switch[2]+switch[3]+switch[4]+switch[5]+switch[6]+switch[7]+len(switch)-1+8)*2
nr_links= (49 + 24 * 6 + 7 + 8) * 2
-def check_switch():
+def get_json(url):
+ print url
try:
- command = "curl -s \'http://%s:%s/wm/core/topology/switches/all/json\'" % (RestIP, RestPort)
- print command
+ command = "curl -s %s" % (url)
result = os.popen(command).read()
+ parsedResult = json.loads(result)
except:
- print "REST IF has issue"
- exit
+ print "REST IF %s has issue" % command
+ parsedResult = ""
- parsedResult = json.loads(result)
+ if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
+ print "REST %s returned code %s" % (command, parsedResult['code'])
+ parsedResult = ""
+
+ return parsedResult
+
+def check_switch():
+ url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ return
+
print "switch: total %d switches" % len(parsedResult)
cnt = []
+ active = []
for r in range(8):
cnt.append(0)
+ active.append(0)
for s in parsedResult:
- nw =int(s['dpid'].split(':')[-2], 16)
- if nw >= 2 and nw <=8:
- cnt[nw-1] = cnt[nw-1] + 1
+ if s['dpid'] in core_switches:
+ nw_index = 0
else:
- cnt[0] = cnt[0] + 1
+ nw_index =int(s['dpid'].split(':')[-2], 16) - 1
+ cnt[nw_index] += 1
+
+ if s['state'] == "ACTIVE":
+ active[nw_index] += 1
+
for r in range(8):
- print "switch: network %d %d switches" % (r+1, cnt[r])
+ print "switch: network %d : %d switches %d active" % (r+1, cnt[r], active[r])
if correct_nr_switch[r] != cnt[r]:
print "switch fail: network %d should have %d switches but has %d" % (r+1, correct_nr_switch[r], cnt[r])
- break
+
+ if correct_nr_switch[r] != active[r]:
+ print "switch fail: network %d should have %d active switches but has %d" % (r+1, correct_nr_switch[r], active[r])
def check_link():
- try:
- command = "curl -s \'http://%s:%s/wm/core/topology/links/json\'" % (RestIP, RestPort)
- print command
- result = os.popen(command).read()
- except:
- print "REST IF has issue"
- exit
- parsedResult = json.loads(result)
+ url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ return
+
print "link: total %d links (correct : %d)" % (len(parsedResult), nr_links)
intra = []
+ interlink=0
for r in range(8):
intra.append(0)
@@ -68,20 +89,23 @@
dst_swid =int(s['dst-switch'].split(':')[-1], 16)
if src_nw == dst_nw:
intra[src_nw - 1] = intra[src_nw - 1] + 1
+ else:
+ interlink += 1
for r in range(8):
if intra[r] != correct_intra_link[r]:
print "link fail: network %d should have %d intra links but has %d" % (r+1, correct_intra_link[r], intra[r])
+ if interlink != 14:
+ print "link fail: There should be %d intra links (uni-directional) but %d" % (14, interlink)
+
def check_mastership():
- try:
- command = "curl -s \'http://%s:%s/wm/registry/switches/json\'" % (RestIP, RestPort)
- print command
- result = os.popen(command).read()
- except:
- print "REST IF has issue"
- exit
- parsedResult = json.loads(result)
+ url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
+
+ if parsedResult == "":
+ return
+
for s in parsedResult:
#print s,len(s),s[0]['controllerId']
ctrl=parsedResult[s][0]['controllerId']
@@ -96,15 +120,12 @@
print "ownership fail: switch %s is owened by %s" % (s, ctrl)
def check_controllers():
- try:
- command = "curl -s \'http://%s:%s/wm/registry/controllers/json\'" % (RestIP, RestPort)
- print command
- result = os.popen(command).read()
- except:
- print "REST IF has issue"
- exit
+ url = "http://%s:%s/wm/registry/controllers/json" % (RestIP, RestPort)
+ parsedResult = get_json(url)
- parsedResult = json.loads(result)
+ if parsedResult == "":
+ return
+
unique=list(set(parsedResult))
if len(unique) != 8:
print "controller fail: there are %d controllers" % (len(parsedResult))
diff --git a/cluster-mgmt/template/onsdemo_core.py b/cluster-mgmt/template/onsdemo_core.py
index b9da603..61d2dcc 100755
--- a/cluster-mgmt/template/onsdemo_core.py
+++ b/cluster-mgmt/template/onsdemo_core.py
@@ -51,12 +51,12 @@
def __init__( self, *args, **kwargs ):
Topo.__init__( self, *args, **kwargs )
- sw1 = self.addSwitch('sw1', dpid='0000001697089a46')
- sw2 = self.addSwitch('sw2', dpid='00000000ba5eba11')
- sw3 = self.addSwitch('sw3', dpid='00000008a208f901')
- sw4 = self.addSwitch('sw4', dpid='000000000000ba12')
- sw5 = self.addSwitch('sw5', dpid='00000000ba5eba13')
- sw6 = self.addSwitch('sw6', dpid='0000204e7f518a35')
+ sw1 = self.addSwitch('sw1', dpid='0000000000000101')
+ sw2 = self.addSwitch('sw2', dpid='0000000000000102')
+ sw3 = self.addSwitch('sw3', dpid='0000000000000103')
+ sw4 = self.addSwitch('sw4', dpid='0000000000000104')
+ sw5 = self.addSwitch('sw5', dpid='0000000000000105')
+ sw6 = self.addSwitch('sw6', dpid='0000000000000106')
host1 = self.addHost( 'host1' )
host2 = self.addHost( 'host2' )
diff --git a/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java b/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
index a516108..7cf1cab 100644
--- a/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
+++ b/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
@@ -77,26 +77,32 @@
@Override
- public boolean installRemoteFlowEntry(FlowEntry entry) {
+ public boolean installRemoteFlowEntry(FlowPath flowPath,
+ FlowEntry entry) {
// TODO Auto-generated method stub
return false;
}
@Override
- public boolean removeRemoteFlowEntry(FlowEntry entry) {
+ public boolean removeRemoteFlowEntry(FlowPath flowPath,
+ FlowEntry entry) {
return false;
// TODO Auto-generated method stub
}
@Override
- public boolean installFlowEntry(IOFSwitch mySwitch, FlowEntry flowEntry) {
+ public boolean installFlowEntry(IOFSwitch mySwitch,
+ FlowPath flowPath,
+ FlowEntry flowEntry) {
// TODO Auto-generated method stub
return false;
}
@Override
- public boolean removeFlowEntry(IOFSwitch mySwitch, FlowEntry flowEntry) {
+ public boolean removeFlowEntry(IOFSwitch mySwitch,
+ FlowPath flowPath,
+ FlowEntry flowEntry) {
// TODO Auto-generated method stub
return false;
}
diff --git a/web/topology_rest.py b/web/topology_rest.py
index 74129e3..e7e1d83 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -809,7 +809,7 @@
flow_nr=int(ret)
flow_nr += 1
- command = "/home/ubuntu/ONOS/web/add_flow.py %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (flow_nr, "dummy", src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC)
+ command = "/home/ubuntu/ONOS/web/add_flow.py -m onos %d %s %s %s %s %s matchSrcMac %s matchDstMac %s" % (flow_nr, "dummy", src_dpid, src_port, dst_dpid, dst_port, srcMAC, dstMAC)
print command
errcode = os.popen(command).read()
return errcode