admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame^] | 1 | class DpctlTest: |
| 2 | ''' |
| 3 | Testing of the some basic Dpctl functions included here |
| 4 | ''' |
| 5 | |
| 6 | def __init__(self): |
| 7 | self.default = "" |
| 8 | |
| 9 | def CASE1(self,main): |
| 10 | ''' |
| 11 | Test to add the flow configuration by using dpctl and ping the host |
| 12 | ''' |
| 13 | main.case("DPCTL ping host ") |
| 14 | main.step("adding flow for host2 ") |
| 15 | main.DPCTL1.addFlow(tcpip=main.params['CASE1']['STEP1']['tcpip'], |
| 16 | tcpport=main.params['CASE1']['STEP1']['tcpport'], |
| 17 | inport=main.params['CASE1']['STEP1']['inport'], |
| 18 | timeout=main.params['CASE1']['STEP1']['timeout'], |
| 19 | action=main.params['CASE1']['STEP1']['action']) |
| 20 | main.step("adding another flow for host3") |
| 21 | main.DPCTL1.addFlow(tcpip=main.params['CASE1']['STEP2']['tcpip'], |
| 22 | tcpport=main.params['CASE1']['STEP2']['tcpport'], |
| 23 | inport=main.params['CASE1']['STEP2']['inport'], |
| 24 | timeout=main.params['CASE1']['STEP2']['timeout'], |
| 25 | action=main.params['CASE1']['STEP2']['action']) |
| 26 | main.step("Ping from h2 to h3") |
| 27 | result = main.Mininet1.pingHost(src=main.componentDictionary['DPCTL1']['src'], |
| 28 | target=main.componentDictionary['DPCTL1']['target'], |
| 29 | controller=main.componentDictionary['DPCTL1']['controller']) |
| 30 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Show flow executed",onfail="Show flow execution Failed") |
| 31 | |
| 32 | |
| 33 | def CASE2(self,main): |
| 34 | ''' |
| 35 | Test to add the flow configuration by using dpctl and show the flow using dpctl |
| 36 | ''' |
| 37 | main.case("DPCTL show flow ") |
| 38 | main.step("adding flow for host2") |
| 39 | |
| 40 | main.DPCTL1.addFlow(tcpip=main.params['CASE2']['STEP1']['tcpip'], |
| 41 | tcpport=main.params['CASE2']['STEP1']['tcpport'], |
| 42 | inport=main.params['CASE2']['STEP1']['inport'], |
| 43 | timeout=main.params['CASE2']['STEP1']['timeout'], |
| 44 | action=main.params['CASE2']['STEP1']['action']) |
| 45 | main.step("adding flow for host3") |
| 46 | main.DPCTL1.addFlow(tcpip=main.params['CASE2']['STEP2']['tcpip'], |
| 47 | tcpport=main.params['CASE2']['STEP2']['tcpport'], |
| 48 | inport=main.params['CASE2']['STEP2']['inport'], |
| 49 | timeout=main.params['CASE2']['STEP2']['timeout'], |
| 50 | action=main.params['CASE2']['STEP2']['action']) |
| 51 | main.step("Execute Show flow ") |
| 52 | result = main.DPCTL1.showFlow(tcpip=main.params['CASE2']['tcpip'],tcpport=main.params['CASE2']['tcpport']) |
| 53 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Show flow executed",onfail="Show flow execution Failed") |
| 54 | |
| 55 | |