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 |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 8 | from oltconstants import * |
| 9 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 10 | |
| 11 | class Thing(object): |
| 12 | """An object we can stash arbitrary attributes for easy reach""" |
| 13 | def __init__(self, **kws): |
| 14 | self.__dict__.update(kws) |
| 15 | |
| 16 | |
| 17 | class ControllerAccess(OltBaseTest): |
| 18 | """Verify openflow access from OLT device""" |
| 19 | |
| 20 | def runTest(self): |
| 21 | logging.info("Running ControllerAccess test") |
| 22 | |
| 23 | # implicitly testing access to the openflow device |
| 24 | # and deleting all residual flows and groups |
| 25 | delete_all_flows(self.controller) |
| 26 | delete_all_groups(self.controller) |
| 27 | |
| 28 | |
| 29 | class TestScenario1SingleOnu(OltBaseTest): |
| 30 | """ |
Zsolt Haraszti | 5b8b39c | 2016-03-02 22:25:51 -0800 | [diff] [blame^] | 31 | Run a comprehensive test scenrario on the OLT, with one ONU. |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 32 | |
| 33 | Plan: |
| 34 | |
Zsolt Haraszti | 5b8b39c | 2016-03-02 22:25:51 -0800 | [diff] [blame^] | 35 | 0. Reset the OLT into a clean state |
| 36 | 1. Setup the OLT to pass authentication (EAPOL) to controller |
| 37 | from any port, and test it. |
| 38 | 2. Setup the OLT to pass unicast traffic for the ONU |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 39 | 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways) |
| 40 | 4. Setup IGMP forwarding toward the controller |
| 41 | 5. Send periodic IGMP queries out toward the ONU and verify its arrival |
| 42 | 6. Send in an IGMP join request for one channel (specific multicast address) and verify that |
| 43 | the controller receives it. |
| 44 | 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s) |
| 45 | 8. Verify that multicast packets can reach the ONU |
| 46 | 9. Verify that bidirectional unicast traffic still works across the PON |
| 47 | 10. Change channel to a new multicast group and verify both multicast receiption as well as |
| 48 | unicast traffic works. This step involves: |
| 49 | - sending a leave message by the ONU to the controller and verify its reception |
| 50 | - sending a join message and verify its reception |
| 51 | - removing the existing multicast flow |
| 52 | - adding a new multicast flow |
| 53 | - verify that original flow no longer flows |
| 54 | - verify new flow |
| 55 | - verify that unicast still works |
| 56 | 11. Add a second channel while keeping the existing one. Verify all what needs to be verified |
| 57 | (similar as above) |
| 58 | 12. Add two more multicast channels, and verify everything |
| 59 | 13. Flip a channel for one of the multicast channels, and verify everything |
| 60 | 14. Tear down the test. |
| 61 | """ |
| 62 | |
| 63 | def runTest(self): |
| 64 | logging.info("Running %s" % self.__class__.__name__) |
| 65 | |
| 66 | # Some constants |
| 67 | c_vlan_id = 111 |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 68 | mcast_vlan_id = 140 |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 69 | mcast_groups = Thing( |
| 70 | ch1="230.10.10.10", |
| 71 | ch2="231.11.11.11", |
| 72 | ch3="232.12.12.12", |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 73 | ch4="233.13.13.13", |
| 74 | ch5="234.14.14.14" |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 75 | ) |
| 76 | onu1 = Thing( |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 77 | port=onu_port, |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 78 | ip="13.14.14.13", |
| 79 | mac="b6:b8:3e:fb:1a:3f", |
| 80 | s_vlan_id=13 |
| 81 | ) |
| 82 | |
Zsolt Haraszti | 5b8b39c | 2016-03-02 22:25:51 -0800 | [diff] [blame^] | 83 | # 0. Reset the OLT into a clean state |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 84 | self.resetOlt() |
| 85 | |
Zsolt Haraszti | 5b8b39c | 2016-03-02 22:25:51 -0800 | [diff] [blame^] | 86 | # 1. Setup the OLT to pass authentication (EAPOL) to controller |
| 87 | # from any port, and test it. |
| 88 | self.installEapolRule() |
| 89 | self.sendEapolIn() |
| 90 | |
| 91 | # 2. Setup the OLT to pass unicast traffic for the ONU1 |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 92 | self.installDoubleTaggingRules(onu1.s_vlan_id, c_vlan_id, self.getCookieBlock()) |
| 93 | |
| 94 | # 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways) |
| 95 | self.testPacketFlow(onu1.s_vlan_id, c_vlan_id) # this tests just one packet in each way |
| 96 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 100) |
| 97 | |
| 98 | # 4. Setup IGMP forwarding toward the controller |
Zsolt Haraszti | 5b8b39c | 2016-03-02 22:25:51 -0800 | [diff] [blame^] | 99 | self.installIgmpRule(self.getCookieBlock()) |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 100 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
| 101 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 102 | # 5. Send periodic IGMP queries out toward the ONU and verify its arrival |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 103 | self.testIgmpQueryOut() |
| 104 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
| 105 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 106 | # 6. Send in an IGMP join request for one channel (specific multicast address) and verify that |
| 107 | # the controller receives it. |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 108 | self.sendIgmpReport(join=[mcast_groups.ch1]) |
| 109 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 110 | # 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s) |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 111 | ch1_cookie = self.getCookieBlock() |
| 112 | ch1_group_id = 1 |
| 113 | self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie) |
| 114 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 115 | # 8. Verify that multicast packets can reach the ONU |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 116 | self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10) |
| 117 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 118 | # 9. Verify that bidirectional unicast traffic still works across the PON |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 119 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
| 120 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 121 | # 10. Change channel to a new multicast group and verify both multicast receiption as well as |
| 122 | # unicast traffic works. This step involves: |
| 123 | # - sending a leave message by the ONU to the controller and verify its reception |
| 124 | # - sending a join message and verify its reception |
| 125 | # - removing the existing multicast flow |
| 126 | # - adding a new multicast flow |
| 127 | # - verify that original flow no longer flows |
| 128 | # - verify new flow |
| 129 | # - verify that unicast still works |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 130 | self.sendIgmpReport(leave=[mcast_groups.ch1], join=[mcast_groups.ch2]) |
| 131 | self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie) |
| 132 | ch2_cookie = self.getCookieBlock() |
| 133 | ch2_group_id = 2 |
| 134 | self.setupMcastChannel(mcast_groups.ch2, mcast_vlan_id, [onu1.port], ch2_group_id, ch2_cookie) |
| 135 | self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True) |
| 136 | self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10) |
| 137 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
| 138 | |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 139 | # 11. Add a second channel while keeping the existing one. Verify all what needs to be verified |
| 140 | # (similar as above) |
Zsolt Haraszti | d057140 | 2016-03-02 18:40:50 -0800 | [diff] [blame] | 141 | self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3]) |
| 142 | ch3_cookie = self.getCookieBlock() |
| 143 | ch3_group_id = 3 |
| 144 | self.setupMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie) |
| 145 | self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True) |
| 146 | self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10) |
| 147 | self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10) |
| 148 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
| 149 | |
| 150 | # 12. Add two more multicast channels, and verify everything again |
| 151 | self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3, mcast_groups.ch4, mcast_groups.ch5]) |
| 152 | ch4_cookie = self.getCookieBlock() |
| 153 | ch4_group_id = 4 |
| 154 | self.setupMcastChannel(mcast_groups.ch4, mcast_vlan_id, [onu1.port], ch4_group_id, ch4_cookie) |
| 155 | ch5_cookie = self.getCookieBlock() |
| 156 | ch5_group_id = 5 |
| 157 | self.setupMcastChannel(mcast_groups.ch5, mcast_vlan_id, [onu1.port], ch5_group_id, ch5_cookie) |
| 158 | self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True) |
| 159 | self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10) |
| 160 | self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10) |
| 161 | self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port], 10) |
| 162 | self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu1.port], 10) |
| 163 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
| 164 | |
| 165 | # 13. Flip a channel for one of the multicast channels, and verify everything (ch3 -> ch1) |
| 166 | self.sendIgmpReport(join=[mcast_groups.ch1, mcast_groups.ch2, mcast_groups.ch4, mcast_groups.ch5], |
| 167 | leave=[mcast_groups.ch3]) |
| 168 | self.removeMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie) |
| 169 | ## reusing the same group id and cookie |
| 170 | self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie) |
| 171 | self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10) |
| 172 | self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10) |
| 173 | self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True) |
| 174 | self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port], 10) |
| 175 | self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu1.port], 10) |
| 176 | self.testSustainedPacketFlow(onu1.s_vlan_id, c_vlan_id, 10) # to check that unicast still flows |
Zsolt Haraszti | f5c6aba | 2016-03-02 11:41:22 -0800 | [diff] [blame] | 177 | |
| 178 | # 14. Tear down the test. |
| 179 | self.resetOlt() |
Zsolt Haraszti | 5b8b39c | 2016-03-02 22:25:51 -0800 | [diff] [blame^] | 180 | |
| 181 | |
| 182 | class TestScenario2TwoOnus(OltBaseTest): |
| 183 | """ |
| 184 | Run a comprehensive test scenario involving the OLT and two ONUs. |
| 185 | |
| 186 | Plan: |
| 187 | |
| 188 | 0. Reset the OLT into a clean state |
| 189 | |
| 190 | 1. Setup the OLT to pass authentication (EAPOL) to controller from ONU1 |
| 191 | and test it. |
| 192 | 2. Setup the OLT to pass unicast traffic for the ONU1 |
| 193 | 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways) |
| 194 | 4. Setup IGMP forwarding toward the controller |
| 195 | 5. Send periodic IGMP queries out toward the ONU1 and verify its arrival |
| 196 | 6. Send in an IGMP join request for one channel (specific multicast address) and verify that |
| 197 | the controller receives it. |
| 198 | 7. Setup flows for forwarding multicast traffic from the OLT port toward ONU1 |
| 199 | 8. Verify that multicast packets can reach ONU1 |
| 200 | 9. Verify that bidirectional unicast traffic still works across the PON |
| 201 | 10. Change channel to a new multicast group and verify both multicast receiption as well as |
| 202 | unicast traffic works. This step involves: |
| 203 | - sending a leave message by the ONU to the controller and verify its reception |
| 204 | - sending a join message and verify its reception |
| 205 | - removing the existing multicast flow |
| 206 | - adding a new multicast flow |
| 207 | - verify that original flow no longer flows |
| 208 | - verify new flow |
| 209 | - verify that unicast still works |
| 210 | 11. Add a second channel while keeping the existing one. Verify all what needs to be verified |
| 211 | (similar as above) - at this point ONU1 is tuned into ch2 and ch3 |
| 212 | |
| 213 | 12. Setup the OLT to pass authentication (EAPOL) to controller from ONU2 |
| 214 | and test it. |
| 215 | 13. Setup the OLT to pass unicast traffic for the ONU2 |
| 216 | 14. Verify that unicast traffic works in both directions (use a few hundred frames in both ways) |
| 217 | |
| 218 | 15. Verify that both ONUs can send/receive unicast and ONU1 can still see its 2 channels |
| 219 | |
| 220 | 16. Setup IGMP forwarding toward the controller |
| 221 | 17. Send periodic IGMP queries out toward the ONU2 and verify its arrival |
| 222 | 18. Send in an IGMP join request for one channel (specific multicast address) and verify that |
| 223 | the controller receives it. |
| 224 | 19. Setup flows for forwarding multicast traffic from the OLT port toward ONU2 |
| 225 | 20. Verify that multicast packets can reach ONU2 |
| 226 | 21. Verify that bidirectional unicast traffic still works across the PON for both ONUs |
| 227 | 22. Change channel to a new multicast group and verify both multicast receiption as well as |
| 228 | unicast traffic works. This step involves: |
| 229 | - sending a leave message by the ONU to the controller and verify its reception |
| 230 | - sending a join message and verify its reception |
| 231 | - removing the existing multicast flow |
| 232 | - adding a new multicast flow |
| 233 | - verify that original flow no longer flows |
| 234 | - verify new flow |
| 235 | - verify that unicast still works |
| 236 | - verify everything for ONU1 too |
| 237 | 23. Add a second channel while keeping the existing one. Verify all what needs to be verified |
| 238 | (similar as above) - at this point ONU1 is tuned into ch2 and ch3 and ONU2 is |
| 239 | tuned to ch2 and ch5 |
| 240 | |
| 241 | 24. Flip a channel for ONU1 and verify everything |
| 242 | 25. Tear down the test. |
| 243 | |
| 244 | """ |
| 245 | |
| 246 | # TODO |