Skip to content
This repository was archived by the owner on Oct 17, 2022. It is now read-only.

Commit

Permalink
Fixed onos flows
Browse files Browse the repository at this point in the history
  • Loading branch information
rvilalta committed Nov 18, 2019
1 parent ae67c7a commit 6c9cded
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
Binary file removed netconf/confd-basic-7.2.1.linux.x86_64.zip
Binary file not shown.
30 changes: 13 additions & 17 deletions onos_api/onos_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,35 @@ def insertFlow( nodeId, priority, inport, outport ):
flow='{ "priority": '+priority+', "timeout": 0, "isPermanent": true, "deviceId": "'+nodeId+'", "treatment": { "instructions": [ { "type": "OUTPUT", "port": "'+outport+'" } ] }, "selector": { "criteria": [ { "type": "IN_PORT", "port": "'+inport+'" } ] } }'


print "Flow: " + flow
print ("Flow: " + flow)
url = URL + nodeId + '?appId=tuto'
headers = {'content-type': 'application/json'}
print url
print (url)
response = requests.post(url, data=flow,
headers=headers, auth=HTTPBasicAuth(USER,
PASSWORD))
print response
return { 'status':response.status_code, 'content': response.content}
print (response)
return response.status_code

def deleteFlow(nodeId, flow_id):
def deleteFlows():

url = URL + '' + nodeId + '/' + flow_id
url = URL + '' + 'application/'+'tuto'
response = requests.delete(url, auth=HTTPBasicAuth(USER, PASSWORD))
return {'flow_id':flow_id, 'status':response.status_code, 'content': response.content}
print (response)
return response.status_code



if __name__ == "__main__":

print "Setting flow"
print ("Setting flow")

res = insertFlow(nodeId="of:0000000000000001", priority="40001", inport="1", outport="2")
print json.dumps(res, indent=4, sort_keys=True)
print (res)

res = insertFlow(nodeId="of:0000000000000001", priority="40002", inport="2", outport="1")
print json.dumps(res, indent=4, sort_keys=True)

res = insertFlow(nodeId="of:0000000000000002", priority="40001", inport="1", outport="2")
print json.dumps(res, indent=4, sort_keys=True)

res = insertFlow(nodeId="of:0000000000000002", priority="40002", inport="2", outport="1")
print json.dumps(res, indent=4, sort_keys=True)
#deleteFlows()





Expand Down

0 comments on commit 6c9cded

Please sign in to comment.