Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 1 | ''' |
| 2 | More complex (composite) test-cases for the OLT |
| 3 | ''' |
| 4 | |
| 5 | import logging |
| 6 | from oftest.testutils import * |
| 7 | from oltbase import OltBaseTest |
| 8 | |
| 9 | class Thing(object): |
| 10 | """An object we can stash arbitrary attributes for easy reach""" |
| 11 | def __init__(self, **kws): |
| 12 | self.__dict__.update(kws) |
| 13 | |
| 14 | |
| 15 | class ControllerAccess(OltBaseTest): |
| 16 | """Verify openflow access from OLT device""" |
| 17 | |
| 18 | def runTest(self): |
| 19 | logging.info("Running ControllerAccess test") |
| 20 | |
| 21 | # implicitly testing access to the openflow device |
| 22 | # and deleting all residual flows and groups |
| 23 | delete_all_flows(self.controller) |
| 24 | delete_all_groups(self.controller) |
| 25 | |
| 26 | |
| 27 | class TestScenario1SingleOnu(OltBaseTest): |
| 28 | """ |
| 29 | Run a comprehensive test scenrario on the OLT. |
| 30 | |
| 31 | Plan: |
| 32 | |
| 33 | 1. Reset the OLT into a clean state |
| 34 | 2. Setup the OLT to pass authentication (L2/Unicast) traffic for the ONU1 |
| 35 | 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways) |
| 36 | 4. Setup IGMP forwarding toward the controller |
| 37 | 5. Send periodic IGMP queries out toward the ONU and verify its arrival |
| 38 | 6. Send in an IGMP join request for one channel (specific multicast address) and verify that |
| 39 | the controller receives it. |
| 40 | 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s) |
| 41 | 8. Verify that multicast packets can reach the ONU |
| 42 | 9. Verify that bidirectional unicast traffic still works across the PON |
| 43 | 10. Change channel to a new multicast group and verify both multicast receiption as well as |
| 44 | unicast traffic works. This step involves: |
| 45 | - sending a leave message by the ONU to the controller and verify its reception |
| 46 | - sending a join message and verify its reception |
| 47 | - removing the existing multicast flow |
| 48 | - adding a new multicast flow |
| 49 | - verify that original flow no longer flows |
| 50 | - verify new flow |
| 51 | - verify that unicast still works |
| 52 | 11. Add a second channel while keeping the existing one. Verify all what needs to be verified |
| 53 | (similar as above) |
| 54 | 12. Add two more multicast channels, and verify everything |
| 55 | 13. Flip a channel for one of the multicast channels, and verify everything |
| 56 | 14. Tear down the test. |
| 57 | """ |
| 58 | |
| 59 | def runTest(self): |
| 60 | logging.info("Running %s" % self.__class__.__name__) |
| 61 | |
| 62 | # Some constants |
| 63 | c_vlan_id = 111 |
| 64 | mcast_groups = Thing( |
| 65 | ch1="230.10.10.10", |
| 66 | ch2="231.11.11.11", |
| 67 | ch3="232.12.12.12", |
| 68 | ch4="233.13.13.13" |
| 69 | ) |
| 70 | onu1 = Thing( |
| 71 | ip="13.14.14.13", |
| 72 | mac="b6:b8:3e:fb:1a:3f", |
| 73 | s_vlan_id=13 |
| 74 | ) |
| 75 | |
| 76 | # 1. Reset the OLT into a clean state |
| 77 | self.resetOlt() |
| 78 | |
| 79 | # 2. Setup the OLT to pass authentication (L2/Unicast) traffic for the ONU1 |
| 80 | self.installDoubleTaggingRules(onu1.s_vlan_id, c_vlan_id, self.getCookieBlock()) |
| 81 | |
| 82 | # 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways) |
| 83 | self.testPacketFlow(onu1.s_vlan_id, c_vlan_id) # this tests just one packet in each way |
| 84 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 100) |
| 85 | |
| 86 | # 4. Setup IGMP forwarding toward the controller |
| 87 | # 5. Send periodic IGMP queries out toward the ONU and verify its arrival |
| 88 | # 6. Send in an IGMP join request for one channel (specific multicast address) and verify that |
| 89 | # the controller receives it. |
| 90 | # 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s) |
| 91 | # 8. Verify that multicast packets can reach the ONU |
| 92 | # 9. Verify that bidirectional unicast traffic still works across the PON |
| 93 | # 10. Change channel to a new multicast group and verify both multicast receiption as well as |
| 94 | # unicast traffic works. This step involves: |
| 95 | # - sending a leave message by the ONU to the controller and verify its reception |
| 96 | # - sending a join message and verify its reception |
| 97 | # - removing the existing multicast flow |
| 98 | # - adding a new multicast flow |
| 99 | # - verify that original flow no longer flows |
| 100 | # - verify new flow |
| 101 | # - verify that unicast still works |
| 102 | # 11. Add a second channel while keeping the existing one. Verify all what needs to be verified |
| 103 | # (similar as above) |
| 104 | # 12. Add two more multicast channels, and verify everything |
| 105 | # 13. Flip a channel for one of the multicast channels, and verify everything |
| 106 | |
| 107 | # 14. Tear down the test. |
| 108 | self.resetOlt() |