コード例 #1
0
ファイル: test_odlSwitch.py プロジェクト: NexusIS/nexus-test
 def setUp(self):
     self.defaultFlowStatJson = {u'flowStatistics': [{u'node': {u'type': u'OF', u'id': u'00:00:00:00:00:00:00:01'}, u'flowStatistic': []}]}
     self.switchList = [u'00:00:00:00:00:00:00:01']
     self.typeList = [u'OF']
     self.hostList = u'10.0.0.1'
     self.switch = odlSwitch.odlSwitch(self.testBaseUrl)
     self.switch.removeAllFlows()
     self.switch.removeAllActiveHosts()
     self.switch.removeAllTopoLinks()
     self.flow0 = odlJson.odlJson.odlJsonFlow('flow0')
     self.flow0.setInPort(1)
     self.flow0.addAction("OUTPUT=2")
     self.flow0.setSwitchId(self.switch.getSwitchIds(self.defaultFlowStatJson)[0])
     self.flow0.buildPutFlowJson()
     self.host0 = odlJson.odlJson.odlJsonHost("10.0.0.1")
     self.host0.setSwitchId(self.switch.getSwitchIds(self.defaultFlowStatJson)[0])
     self.host0.setHostId('00:00:00:00:01:01')
     self.host0.setNodeId(1)
     self.host0.buildPutHostJson()
     pass
コード例 #2
0
ファイル: test_odlSwitch.py プロジェクト: NexusIS/nexus-test
 def testGetNodeTypes(self):
     switch = odlSwitch.odlSwitch(self.testBaseUrl)
     self.assertEquals(switch.getNodeTypes(self.defaultFlowStatJson), self.typeList)
コード例 #3
0
ファイル: test_odlSwitch.py プロジェクト: NexusIS/nexus-test
 def testGetSwitchIds(self):
     switch = odlSwitch.odlSwitch(self.testBaseUrl)
     self.assertEquals(switch.getSwitchIds(self.defaultFlowStatJson), self.switchList)
     pass
コード例 #4
0
ファイル: runner.py プロジェクト: NexusIS/nexus-test
import socket
import sys
from pythonOpenDayLight.openDayLight import odlSwitch, odlJson

if len(sys.argv) > 1:
    if (sys.argv[1] == "prod"):
        testBaseUrl = 'http://ec2-54-214-70-92.us-west-2.compute.amazonaws.com:8080/controller/nb/v2/'
    else:
        testBaseUrl = sys.argv[1]
elif socket.gethostname() == 'ip-10-232-26-187':
    testBaseUrl = 'http://ec2-54-245-68-94.us-west-2.compute.amazonaws.com:8080/controller/nb/v2/'
else:
    testBaseUrl = 'http://localhost:8080/controller/nb/v2/'

switch = odlSwitch.odlSwitch(testBaseUrl)
switch.removeAllFlows()
switch.removeAllActiveHosts()
switch.removeAllTopoLinks()
data = switch.getFlowStatJson()
flow1json = odlJson.odlJson.odlJsonFlow('h1toh2s2')
flow2json = odlJson.odlJson.odlJsonFlow('h2toh1s2')
flow3json = odlJson.odlJson.odlJsonFlow('h3tos1')
flow4json = odlJson.odlJson.odlJsonFlow('h4tos3')
flow5json = odlJson.odlJson.odlJsonFlow('h5toh6s2')
flow6json = odlJson.odlJson.odlJsonFlow('h6toh5s2')
flow7json = odlJson.odlJson.odlJsonFlow('s1toh3')
flow8json = odlJson.odlJson.odlJsonFlow('s3toh4')
flow9json = odlJson.odlJson.odlJsonFlow('s2toh1h2')
flow10json = odlJson.odlJson.odlJsonFlow('s2toh5h6')