blob: 9e8ec994931bb5a78b39dcfa7d2ec6f56cdbdccd [file] [log] [blame]
Andrew809df1c2014-06-27 14:28:53 -07001#! /usr/bin/python
2
3import json
4import requests
5
6
7url = 'http://127.0.0.1:8080/wm/onos/datagrid/add/intents/json'
8headers = {'Content-type': 'application/json', 'Accept': 'application/json'}
9
10
11for i in range(6,16):
12 srcMac = '00:00:00:00:00:'+ str(hex(i)[2:]).zfill(2)
13 dstMac = '00:00:00:00:00:'+ str(hex(i+10)[2:])
14 srcSwitch = '00:00:00:00:00:00:10:'+ str(i).zfill(2)
15 dstSwitch = '00:00:00:00:00:00:20:'+ str(i+25)
16 srcPort = 1
17 dstPort = 1
18
19 intent = [{'intent_id': '%d' %(i),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':srcSwitch,'srcPort':srcPort,'srcMac':srcMac,'dstSwitch':dstSwitch,'dstPort':dstPort,'dstMac':dstMac}]
20 r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
21 #print json.dumps(intent, sort_keys = True)
22
23 intent = [{'intent_id': '%d' %(i+10),'intent_type':'shortest_intent_type','intent_op':'add','srcSwitch':dstSwitch,'srcPort':dstPort,'srcMac':dstMac,'dstSwitch':srcSwitch,'dstPort':srcPort,'dstMac':srcMac}]
24 #print json.dumps(intent, sort_keys = True)
25 r = requests.post(url, data=json.dumps(intent, sort_keys=True), headers = headers)
26