A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 1 | import os |
| 2 | import sys |
| 3 | import unittest |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 4 | import time |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 5 | import json |
| 6 | import requests |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 7 | import threading |
| 8 | from random import randint |
| 9 | from threading import Timer |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 10 | from nose.tools import * |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 11 | from nose.twistedtools import reactor, deferred |
| 12 | from twisted.internet import defer |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 13 | from CordTestConfig import setup_module |
| 14 | from CordTestUtils import log_test |
| 15 | from VolthaCtrl import VolthaCtrl |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 16 | from CordTestUtils import log_test, get_controller |
| 17 | from portmaps import g_subscriber_port_map |
| 18 | from OltConfig import * |
| 19 | from EapTLS import TLSAuthTest |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 20 | from DHCP import DHCPTest |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 21 | from OnosCtrl import OnosCtrl |
| 22 | from CordLogger import CordLogger |
| 23 | from scapy.all import * |
| 24 | from scapy_ssl_tls.ssl_tls import * |
| 25 | from scapy_ssl_tls.ssl_tls_crypto import * |
| 26 | from CordTestServer import cord_test_onos_restart, cord_test_shell, cord_test_radius_restart |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 27 | from CordContainer import Onos |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 28 | |
| 29 | class voltha_exchange(unittest.TestCase): |
| 30 | |
| 31 | OLT_TYPE = 'tibit_olt' |
| 32 | OLT_MAC = '00:0c:e2:31:12:00' |
| 33 | VOLTHA_HOST = 'localhost' |
| 34 | VOLTHA_REST_PORT = 8881 |
| 35 | voltha = None |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 36 | success = True |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 37 | apps = ('org.opencord.aaa', 'org.onosproject.dhcp') |
| 38 | olt_apps = () #'org.opencord.cordmcast') |
| 39 | vtn_app = 'org.opencord.vtn' |
| 40 | table_app = 'org.ciena.cordigmp' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 41 | test_path = os.path.dirname(os.path.realpath(__file__)) |
| 42 | table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar') |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 43 | app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar') |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 44 | olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar') |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 45 | olt_app_name = 'org.onosproject.olt' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 46 | #onos_config_path = os.path.join(test_path, '..', 'setup/onos-config') |
| 47 | olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json')) |
| 48 | onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0))) |
| 49 | VOLTHA_ENABLED = True |
| 50 | INTF_TX_DEFAULT = 'veth2' |
| 51 | INTF_RX_DEFAULT = 'veth0' |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 52 | INTF_2_RX_DEFAULT = 'veth6' |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 53 | TESTCASE_TIMEOUT = 300 |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 54 | # VOLTHA_CONFIG_FAKE = True |
| 55 | VOLTHA_CONFIG_FAKE = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 56 | VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' } |
| 57 | VOLTHA_ONU_UNI_PORT = 'veth0' |
| 58 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 59 | dhcp_server_config = { |
| 60 | "ip": "10.1.11.50", |
| 61 | "mac": "ca:fe:ca:fe:ca:fe", |
| 62 | "subnet": "255.255.252.0", |
| 63 | "broadcast": "10.1.11.255", |
| 64 | "router": "10.1.8.1", |
| 65 | "domain": "8.8.8.8", |
| 66 | "ttl": "63", |
| 67 | "delay": "2", |
| 68 | "startip": "10.1.11.51", |
| 69 | "endip": "10.1.11.100" |
| 70 | } |
| 71 | |
| 72 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 73 | CLIENT_CERT = """-----BEGIN CERTIFICATE----- |
| 74 | MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 75 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 76 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 77 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN |
| 78 | MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 79 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 80 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC |
| 81 | gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe |
| 82 | +9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg |
| 83 | rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD |
| 84 | VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l |
| 85 | eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY |
| 86 | 6tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC |
| 87 | PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC |
| 88 | nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug== |
| 89 | -----END CERTIFICATE-----""" |
| 90 | |
| 91 | CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE----- |
| 92 | MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 93 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 94 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 95 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN |
| 96 | MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 97 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 98 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC |
| 99 | AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ |
| 100 | 5An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK |
| 101 | tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR |
| 102 | OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21 |
| 103 | qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39 |
| 104 | 2Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB |
| 105 | BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l |
| 106 | eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV |
| 107 | MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn |
| 108 | VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP |
| 109 | RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ |
| 110 | dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3 |
| 111 | T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt |
| 112 | yg== |
| 113 | -----END CERTIFICATE-----''' |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 114 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 115 | @classmethod |
| 116 | def update_apps_version(cls): |
| 117 | version = Onos.getVersion() |
| 118 | major = int(version.split('.')[0]) |
| 119 | minor = int(version.split('.')[1]) |
| 120 | cordigmp_app_version = '2.0-SNAPSHOT' |
| 121 | olt_app_version = '1.2-SNAPSHOT' |
| 122 | if major > 1: |
| 123 | cordigmp_app_version = '3.0-SNAPSHOT' |
| 124 | olt_app_version = '2.0-SNAPSHOT' |
| 125 | elif major == 1: |
| 126 | if minor > 10: |
| 127 | cordigmp_app_version = '3.0-SNAPSHOT' |
| 128 | olt_app_version = '2.0-SNAPSHOT' |
| 129 | elif minor <= 8: |
| 130 | olt_app_version = '1.1-SNAPSHOT' |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 131 | cls.app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-{}.oar'.format(cordigmp_app_version)) |
| 132 | cls.table_app_file = os.path.join(cls.test_path, '..', 'apps/ciena-cordigmp-multitable-{}.oar'.format(cordigmp_app_version)) |
| 133 | cls.olt_app_file = os.path.join(cls.test_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version)) |
| 134 | |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 135 | @classmethod |
A.R Karthick | f874d03 | 2017-06-07 18:47:51 -0700 | [diff] [blame] | 136 | def onos_load_config(cls, app, config): |
| 137 | status, code = OnosCtrl.config(config) |
| 138 | if status is False: |
| 139 | log_test.info('JSON config request for app %s returned status %d' %(app, code)) |
| 140 | assert_equal(status, True) |
| 141 | time.sleep(2) |
| 142 | |
| 143 | @classmethod |
| 144 | def onos_aaa_load(cls): |
| 145 | aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password', |
| 146 | 'radiusIp': '172.17.0.2' } } } } |
| 147 | radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2' |
| 148 | aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip |
| 149 | cls.onos_load_config('org.opencord.aaa', aaa_dict) |
| 150 | |
| 151 | @classmethod |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 152 | def onos_dhcp_table_load(self, config = None): |
| 153 | dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } } |
| 154 | dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp'] |
| 155 | if config: |
| 156 | for k in config.keys(): |
| 157 | if dhcp_config.has_key(k): |
| 158 | dhcp_config[k] = config[k] |
| 159 | self.onos_load_config('org.onosproject.dhcp', dhcp_dict) |
| 160 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 161 | def dhcp_sndrcv(self, dhcp, update_seed = False, mac = None, validation = True): |
| 162 | if validation : |
| 163 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 164 | assert_not_equal(cip, None) |
| 165 | assert_not_equal(sip, None) |
| 166 | log_test.info('Got dhcp client IP %s from server %s for mac %s' % |
| 167 | (cip, sip, dhcp.get_mac(cip)[0])) |
| 168 | if validation == False: |
| 169 | cip, sip = dhcp.discover(mac = mac, update_seed = update_seed) |
| 170 | assert_equal(cip, None) |
| 171 | assert_equal(sip, None) |
| 172 | log_test.info('Dhcp client did not get IP from server %s for mac %s' % |
| 173 | (cip, sip, dhcp.get_mac(cip)[0])) |
| 174 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 175 | return cip,sip |
| 176 | |
| 177 | def dhcp_request(self, onu_iface = None, seed_ip = '10.10.10.1', update_seed = False): |
| 178 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.200', |
| 179 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 180 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 181 | self.onos_dhcp_table_load(config) |
| 182 | dhcp = DHCPTest(seed_ip = seed_ip, iface =onu_iface) |
| 183 | cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed) |
| 184 | return cip, sip |
| 185 | |
| 186 | @classmethod |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 187 | def setUpClass(cls): |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 188 | cls.update_apps_version() |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 189 | cls.voltha = VolthaCtrl(cls.VOLTHA_HOST, rest_port = cls.VOLTHA_REST_PORT) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 190 | cls.install_app_table() |
| 191 | cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 192 | cls.port_map, cls.port_list = cls.olt.olt_port_map() |
| 193 | cls.switches = cls.port_map['switches'] |
| 194 | cls.num_ports = cls.port_map['num_ports'] |
| 195 | if cls.num_ports > 1: |
| 196 | cls.num_ports -= 1 ##account for the tx port |
| 197 | cls.activate_apps(cls.apps + cls.olt_apps) |
A.R Karthick | f874d03 | 2017-06-07 18:47:51 -0700 | [diff] [blame] | 198 | cls.onos_aaa_load() |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 199 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 200 | @classmethod |
| 201 | def tearDownClass(cls): |
| 202 | '''Deactivate the olt apps and restart OVS back''' |
| 203 | apps = cls.olt_apps + ( cls.table_app,) |
| 204 | for app in apps: |
| 205 | onos_ctrl = OnosCtrl(app) |
| 206 | onos_ctrl.deactivate() |
| 207 | cls.install_app_igmp() |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 208 | |
A.R Karthick | 3493a57 | 2017-06-07 18:28:10 -0700 | [diff] [blame] | 209 | @classmethod |
| 210 | def install_app_igmp(cls): |
| 211 | ##Uninstall the table app on class exit |
| 212 | OnosCtrl.uninstall_app(cls.table_app) |
| 213 | time.sleep(2) |
| 214 | log_test.info('Installing back the cord igmp app %s for subscriber test on exit' %(cls.app_file)) |
| 215 | OnosCtrl.install_app(cls.app_file) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 216 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 217 | def remove_olt(self, switch_map): |
| 218 | controller = get_controller() |
| 219 | auth = ('karaf', 'karaf') |
| 220 | #remove subscriber for every port on all the voltha devices |
| 221 | for device, device_map in switch_map.iteritems(): |
| 222 | uni_ports = device_map['ports'] |
| 223 | uplink_vlan = device_map['uplink_vlan'] |
| 224 | for port in uni_ports: |
| 225 | rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}'.format(controller, |
| 226 | device, |
| 227 | port) |
| 228 | resp = requests.delete(rest_url, auth = auth) |
| 229 | if resp.status_code not in [204, 202, 200]: |
| 230 | log_test.error('Error deleting subscriber for device %s on port %s' %(device, port)) |
| 231 | else: |
| 232 | log_test.info('Deleted subscriber for device %s on port %s' %(device, port)) |
| 233 | OnosCtrl.uninstall_app(self.olt_app_file) |
| 234 | |
| 235 | def config_olt(self, switch_map): |
| 236 | controller = get_controller() |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 237 | auth = ('karaf', 'karaf') |
| 238 | #configure subscriber for every port on all the voltha devices |
| 239 | for device, device_map in switch_map.iteritems(): |
| 240 | uni_ports = device_map['ports'] |
| 241 | uplink_vlan = device_map['uplink_vlan'] |
| 242 | for port in uni_ports: |
| 243 | vlan = port |
| 244 | rest_url = 'http://{}:8181/onos/olt/oltapp/{}/{}/{}'.format(controller, |
| 245 | device, |
| 246 | port, |
| 247 | vlan) |
| 248 | resp = requests.post(rest_url, auth = auth) |
| 249 | #assert_equal(resp.ok, True) |
| 250 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 251 | def voltha_uni_port_toggle(self, uni_port = None): |
| 252 | ## Admin state of port is down and up |
| 253 | if not uni_port: |
| 254 | uni_port = self.INTF_RX_DEFAULT |
| 255 | cmd = 'ifconfig {} down'.format(uni_port) |
| 256 | os.system(cmd) |
| 257 | log_test.info('Admin state of uni_port is down') |
| 258 | time.sleep(30) |
| 259 | cmd = 'ifconfig {} up'.format(uni_port) |
| 260 | os.system(cmd) |
| 261 | log_test.info('Admin state of uni_port is up now') |
| 262 | time.sleep(30) |
| 263 | return |
| 264 | |
| 265 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 266 | @classmethod |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 267 | def install_app_table(cls): |
| 268 | ##Uninstall the existing app if any |
| 269 | OnosCtrl.uninstall_app(cls.table_app) |
| 270 | time.sleep(2) |
| 271 | log_test.info('Installing the multi table app %s for subscriber test' %(cls.table_app_file)) |
| 272 | OnosCtrl.install_app(cls.table_app_file) |
| 273 | time.sleep(3) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 274 | |
| 275 | @classmethod |
| 276 | def activate_apps(cls, apps): |
| 277 | for app in apps: |
| 278 | onos_ctrl = OnosCtrl(app) |
| 279 | status, _ = onos_ctrl.activate() |
| 280 | assert_equal(status, True) |
| 281 | time.sleep(2) |
| 282 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 283 | @classmethod |
| 284 | def deactivate_apps(cls, apps): |
| 285 | self.success = True |
| 286 | for app in apps: |
| 287 | onos_ctrl = OnosCtrl(app) |
| 288 | status, _ = onos_ctrl.deactivate() |
| 289 | if status is False: |
| 290 | self.success = False |
| 291 | assert_equal(status, True) |
| 292 | time.sleep(2) |
| 293 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 294 | def tls_flow_check(self, olt_uni_port, cert_info = None): |
| 295 | def tls_fail_cb(): |
| 296 | log_test.info('TLS verification failed') |
| 297 | if cert_info is None: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 298 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 299 | log_test.info('Running subscriber %s tls auth test with valid TLS certificate' %olt_uni_port) |
| 300 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 301 | if tls.failTest is True: |
| 302 | self.success = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 303 | assert_equal(tls.failTest, False) |
| 304 | if cert_info == "no_cert": |
| 305 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = '') |
| 306 | log_test.info('Running subscriber %s tls auth test with no TLS certificate' %olt_uni_port) |
| 307 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 308 | if tls.failTest is False: |
| 309 | self.success = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 310 | assert_equal(tls.failTest, True) |
| 311 | if cert_info == "invalid_cert": |
| 312 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID) |
| 313 | log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port) |
| 314 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 315 | if tls.failTest is False: |
| 316 | self.success = False |
| 317 | assert_equal(tls.failTest, True) |
| 318 | if cert_info == "same_cert": |
| 319 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port) |
| 320 | log_test.info('Running subscriber %s tls auth test with invalid TLS certificate' %olt_uni_port) |
| 321 | tls.runTest() |
| 322 | if tls.failTest is False: |
| 323 | self.success = False |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 324 | assert_equal(tls.failTest, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 325 | if cert_info == "app_deactivate" or cert_info == "restart_radius" or cert_info == "disable_olt_device" or \ |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 326 | cert_info == "uni_port_admin_down" or cert_info == "restart_olt_device" or cert_info == "restart_onu_device": |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 327 | tls = TLSAuthTest(fail_cb = tls_fail_cb, intf = olt_uni_port, client_cert = self.CLIENT_CERT_INVALID) |
| 328 | log_test.info('Running subscriber %s tls auth test with %s' %(olt_uni_port,cert_info)) |
| 329 | tls.runTest() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 330 | if tls.failTest is False: |
| 331 | self.success = False |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 332 | assert_equal(tls.failTest, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 333 | self.test_status = True |
| 334 | return self.test_status |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 335 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 336 | def dhcp_flow_check(self, onu_iface =None, negative_test = None): |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 337 | self.success = True |
| 338 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 339 | if negative_test is None: |
| 340 | cip, sip = self.dhcp_request(onu_iface, update_seed = True) |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 341 | if not cip: |
| 342 | self.success = False |
| 343 | log_test.info('Subscriber %s client ip %s from server %s' %(onu_iface, cip, sip)) |
| 344 | self.test_status = True |
| 345 | |
| 346 | if negative_test == "app_deactivation": |
| 347 | cip, sip = self.dhcp_request(onu_iface, update_seed = True) |
| 348 | if cip is not None: |
| 349 | self.success = False |
| 350 | assert_equal(cip,None) |
| 351 | log_test.info('Subscriber %s not got client ip %s from server %s' %(onu_iface, cip, sip)) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 352 | self.test_status = True |
| 353 | |
| 354 | if negative_test == "invalid_src_mac_broadcast": |
| 355 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 356 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 357 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 358 | self.onos_dhcp_table_load(config) |
| 359 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 360 | cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 361 | |
| 362 | if cip is not None: |
| 363 | self.success = False |
| 364 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected self.success = %s '%self.success) |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 365 | assert_equal(cip,None) |
| 366 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 367 | self.test_status = True |
| 368 | if negative_test == "invalid_src_mac_multicast": |
| 369 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 370 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 371 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 372 | self.onos_dhcp_table_load(config) |
| 373 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 374 | cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:91:02:e4') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 375 | if cip is not None: |
| 376 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 377 | assert_equal(cip,None) |
| 378 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 379 | self.test_status = True |
| 380 | |
| 381 | if negative_test == "invalid_src_mac_junk": |
| 382 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 383 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 384 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 385 | self.onos_dhcp_table_load(config) |
| 386 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 387 | cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 388 | if cip is not None: |
| 389 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 390 | assert_equal(cip,None) |
| 391 | log_test.info('ONOS dhcp server rejected client discover with invalid source mac as expected') |
| 392 | self.test_status = True |
| 393 | |
| 394 | if negative_test == "request_release": |
| 395 | config = {'startip':'10.10.100.20', 'endip':'10.10.100.230', |
| 396 | 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe", |
| 397 | 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'} |
| 398 | self.onos_dhcp_table_load(config) |
| 399 | self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = onu_iface) |
| 400 | cip, sip = self.dhcp_sndrcv(self.dhcp) |
| 401 | log_test.info('Releasing ip %s to server %s' %(cip, sip)) |
| 402 | assert_equal(self.dhcp.release(cip), True) |
| 403 | log_test.info('Triggering DHCP discover again after release') |
| 404 | cip2, sip2 = self.dhcp_sndrcv(self.dhcp, update_seed = True) |
| 405 | log_test.info('Verifying released IP was given back on rediscover') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 406 | if cip == cip2: |
| 407 | self.success = False |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 408 | assert_equal(cip, cip2) |
| 409 | log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2)) |
| 410 | assert_equal(self.dhcp.release(cip2), True) |
| 411 | self.test_status = True |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 412 | if negative_test == "starvation_positive": |
| 413 | config = {'startip':'193.170.1.20', 'endip':'193.170.1.69', |
| 414 | 'ip':'193.170.1.2', 'mac': "ca:fe:c2:fe:cc:fe", |
| 415 | 'subnet': '255.255.255.0', 'broadcast':'192.168.1.255', 'router': '192.168.1.1'} |
| 416 | self.onos_dhcp_table_load(config) |
| 417 | self.dhcp = DHCPTest(seed_ip = '192.169.1.1', iface = onu_iface) |
| 418 | ip_map = {} |
| 419 | for i in range(10): |
| 420 | cip, sip = self.dhcp_sndrcv(self.dhcp, update_seed = True) |
| 421 | if ip_map.has_key(cip): |
| 422 | self.success = False |
| 423 | log_test.info('IP %s given out multiple times' %cip) |
| 424 | assert_equal(False, ip_map.has_key(cip)) |
| 425 | ip_map[cip] = sip |
| 426 | self.test_status = True |
| 427 | if negative_test == "starvation_negative": |
| 428 | config = {'startip':'182.17.0.20', 'endip':'182.17.0.69', |
| 429 | 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe", |
| 430 | 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'} |
| 431 | self.onos_dhcp_table_load(config) |
| 432 | self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = onu_iface) |
| 433 | log_test.info('Verifying passitive case') |
| 434 | for x in xrange(50): |
| 435 | mac = RandMAC()._fix() |
| 436 | self.dhcp_sndrcv(self.dhcp,mac = mac) |
| 437 | log_test.info('Verifying negative case') |
| 438 | cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True) |
| 439 | assert_equal(cip, None) |
| 440 | assert_equal(sip, None) |
| 441 | self.test_status = True |
| 442 | self.success = True |
| 443 | if negative_test == "multiple_discover": |
| 444 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 445 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 446 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 447 | self.onos_dhcp_table_load(config) |
| 448 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 449 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 450 | log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' % |
| 451 | (cip, sip, mac) ) |
| 452 | assert_not_equal(cip, None) |
| 453 | log_test.info('Triggering DHCP discover again.') |
| 454 | new_cip, new_sip, new_mac, _ = self.dhcp.only_discover() |
| 455 | assert_equal(new_cip, cip) |
| 456 | log_test.info('client got same IP as expected when sent 2nd discovery') |
| 457 | self.test_status = True |
| 458 | self.success = True |
| 459 | if negative_test == "multiple_requests": |
| 460 | config = {'startip':'10.10.10.20', 'endip':'10.10.10.69', |
| 461 | 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 462 | 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'} |
| 463 | self.onos_dhcp_table_load(config) |
| 464 | self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = onu_iface) |
| 465 | log_test.info('Sending DHCP discover and DHCP request.') |
| 466 | cip, sip = self.dhcp_sndrcv(self.dhcp,update_seed = True) |
| 467 | mac = self.dhcp.get_mac(cip)[0] |
| 468 | log_test.info("Sending DHCP request again.") |
| 469 | new_cip, new_sip = self.dhcp.only_request(cip, mac) |
| 470 | assert_equal(new_cip,cip) |
| 471 | log_test.info('server offered same IP to clain for multiple requests, as expected') |
| 472 | self.test_status = True |
| 473 | self.success = True |
| 474 | if negative_test == "desired_ip_address": |
| 475 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 476 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 477 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 478 | self.onos_dhcp_table_load(config) |
| 479 | self.dhcp = DHCPTest(seed_ip = '20.20.20.50', iface = onu_iface) |
| 480 | cip, sip, mac, _ = self.dhcp.only_discover(desired = True) |
| 481 | assert_not_equal(cip, None) |
| 482 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 483 | (cip, sip, mac)) |
| 484 | assert_equal(cip,self.dhcp.seed_ip) |
| 485 | log_test.info('ONOS dhcp server offered client requested IP %s as expected'%self.dhcp.seed_ip) |
| 486 | self.test_status = True |
| 487 | self.success = True |
| 488 | if negative_test == "desired_out_of_pool_ip_address": |
| 489 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 490 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 491 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 492 | self.onos_dhcp_table_load(config) |
| 493 | self.dhcp = DHCPTest(seed_ip = '20.20.20.75', iface = onu_iface) |
| 494 | cip, sip, mac, _ = self.dhcp.only_discover(desired = True) |
| 495 | assert_not_equal(cip, None) |
| 496 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 497 | (cip, sip, mac) ) |
| 498 | assert_not_equal(cip,self.dhcp.seed_ip) |
| 499 | log_test.info('server offered IP from its pool of IPs when requested out of pool IP, as expected') |
| 500 | self.test_status = True |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 501 | self.success = True |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 502 | if negative_test == "dhcp_renew": |
| 503 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 504 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 505 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 506 | self.onos_dhcp_table_load(config) |
| 507 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface) |
| 508 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 509 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 510 | (cip, sip, mac) ) |
| 511 | assert_not_equal(cip, None) |
| 512 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True) |
| 513 | log_test.info('waiting renew time %d seconds to send next request packet'%lval) |
| 514 | time.sleep(lval) |
| 515 | latest_cip, latest_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True) |
| 516 | assert_equal(latest_cip,cip) |
| 517 | log_test.info('client got same IP after renew time, as expected') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 518 | self.test_status = True |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 519 | self.success = True |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 520 | if negative_test == "dhcp_rebind": |
| 521 | config = {'startip':'20.20.20.30', 'endip':'20.20.20.69', |
| 522 | 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe", |
| 523 | 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'} |
| 524 | self.onos_dhcp_table_load(config) |
| 525 | self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = onu_iface) |
| 526 | cip, sip, mac, _ = self.dhcp.only_discover() |
| 527 | log_test.info('Got dhcp client IP %s from server %s for mac %s .' % |
| 528 | (cip, sip, mac) ) |
| 529 | assert_not_equal(cip, None) |
| 530 | new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True) |
| 531 | log_test.info('waiting rebind time %d seconds to send next request packet'%lval) |
| 532 | time.sleep(lval) |
| 533 | latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac) |
| 534 | assert_equal(latest_cip,cip) |
| 535 | log_test.info('client got same IP after rebind time, as expected') |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 536 | self.test_status = True |
| 537 | self.success = True |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 538 | |
| 539 | |
| 540 | return self.test_status |
| 541 | |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 542 | def test_olt_enable_disable(self): |
A R Karthick | 35495c3 | 2017-05-11 14:58:32 -0700 | [diff] [blame] | 543 | log_test.info('Enabling OLT type %s, MAC %s' %(self.OLT_TYPE, self.OLT_MAC)) |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 544 | device_id, status = self.voltha.enable_device(self.OLT_TYPE, self.OLT_MAC) |
| 545 | assert_not_equal(device_id, None) |
| 546 | try: |
| 547 | assert_equal(status, True) |
| 548 | time.sleep(10) |
| 549 | finally: |
| 550 | self.voltha.disable_device(device_id, delete = True) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 551 | |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 552 | def test_ponsim_enable_disable(self): |
A.R Karthick | 8b9c5f1 | 2017-05-30 17:47:08 -0700 | [diff] [blame] | 553 | log_test.info('Enabling ponsim_olt') |
| 554 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
A.R Karthick | 8a507cf | 2017-06-02 18:44:49 -0700 | [diff] [blame] | 555 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 556 | assert_not_equal(device_id, None) |
| 557 | try: |
| 558 | assert_equal(status, True) |
| 559 | time.sleep(10) |
| 560 | finally: |
| 561 | self.voltha.disable_device(device_id, delete = True) |
A.R Karthick | 8b9c5f1 | 2017-05-30 17:47:08 -0700 | [diff] [blame] | 562 | |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 563 | def test_subscriber_with_voltha_for_eap_tls_authentication(self): |
| 564 | """ |
| 565 | Test Method: |
| 566 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 567 | 1. OLT and ONU is detected and validated. |
| 568 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 569 | 3. Issue auth request packets from CORD TESTER voltha test module acting as a subscriber.. |
| 570 | 4. Validate that eap tls valid auth packets are being exchanged between subscriber, onos and freeradius. |
| 571 | 5. Verify that subscriber is authenticated successfully. |
| 572 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 573 | log_test.info('Enabling ponsim_olt') |
| 574 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 575 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 576 | assert_not_equal(device_id, None) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 577 | if status == False: |
| 578 | self.voltha.disable_device(device_id, delete = True) |
| 579 | assert_equal(status, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 580 | time.sleep(10) |
| 581 | switch_map = None |
| 582 | olt_configured = False |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 583 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 584 | rest_port = self.VOLTHA_REST_PORT, |
| 585 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 586 | try: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 587 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 588 | if not switch_map: |
| 589 | log_test.info('No voltha devices found') |
| 590 | return |
| 591 | log_test.info('Installing OLT app') |
| 592 | OnosCtrl.install_app(self.olt_app_file) |
| 593 | time.sleep(5) |
| 594 | log_test.info('Adding subscribers through OLT app') |
| 595 | self.config_olt(switch_map) |
| 596 | olt_configured = True |
| 597 | time.sleep(5) |
| 598 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 599 | assert_equal(auth_status, True) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 600 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 601 | if switch_map is not None: |
| 602 | if olt_configured is True: |
| 603 | self.remove_olt(switch_map) |
| 604 | self.voltha.disable_device(device_id, delete = True) |
| 605 | time.sleep(10) |
| 606 | OnosCtrl.uninstall_app(self.olt_app_name) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 607 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 608 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 609 | def test_subscriber_with_voltha_for_eap_tls_authentication_failure(self): |
| 610 | """ |
| 611 | Test Method: |
| 612 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 613 | 1. OLT and ONU is detected and validated. |
| 614 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 615 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 616 | 4. Validate that eap tls without cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 617 | 5. Verify that subscriber authentication is unsuccessful.. |
| 618 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 619 | df = defer.Deferred() |
| 620 | def tls_flow_check_with_no_cert_scenario(df): |
| 621 | log_test.info('Enabling ponsim_olt') |
| 622 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 623 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 624 | assert_not_equal(device_id, None) |
| 625 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 626 | rest_port = self.VOLTHA_REST_PORT, |
| 627 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 628 | time.sleep(10) |
| 629 | switch_map = None |
| 630 | olt_configured = False |
| 631 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 632 | log_test.info('Installing OLT app') |
| 633 | OnosCtrl.install_app(self.olt_app_file) |
| 634 | time.sleep(5) |
| 635 | log_test.info('Adding subscribers through OLT app') |
| 636 | self.config_olt(switch_map) |
| 637 | olt_configured = True |
| 638 | time.sleep(5) |
| 639 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert") |
| 640 | try: |
| 641 | assert_equal(auth_status, True) |
| 642 | assert_equal(status, True) |
| 643 | time.sleep(10) |
| 644 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 645 | self.remove_olt(switch_map) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 646 | self.voltha.disable_device(device_id, delete = True) |
| 647 | df.callback(0) |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 648 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 649 | reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df) |
| 650 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 651 | |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 652 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 653 | def test_subscriber_with_voltha_for_eap_tls_authentication_using_invalid_cert(self): |
| 654 | """ |
| 655 | Test Method: |
| 656 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 657 | 1. OLT and ONU is detected and validated. |
| 658 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 659 | 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber.. |
| 660 | 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 661 | 5. Verify that subscriber authentication is unsuccessful.. |
| 662 | """ |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 663 | df = defer.Deferred() |
| 664 | def tls_flow_check_with_invalid_cert_scenario(df): |
| 665 | log_test.info('Enabling ponsim_olt') |
| 666 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 667 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 668 | assert_not_equal(device_id, None) |
| 669 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 670 | rest_port = self.VOLTHA_REST_PORT, |
| 671 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 672 | time.sleep(10) |
| 673 | switch_map = None |
| 674 | olt_configured = False |
| 675 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 676 | log_test.info('Installing OLT app') |
| 677 | OnosCtrl.install_app(self.olt_app_file) |
| 678 | time.sleep(5) |
| 679 | log_test.info('Adding subscribers through OLT app') |
| 680 | self.config_olt(switch_map) |
| 681 | olt_configured = True |
| 682 | time.sleep(5) |
| 683 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 684 | try: |
| 685 | assert_equal(auth_status, True) |
| 686 | assert_equal(status, True) |
| 687 | time.sleep(10) |
| 688 | finally: |
A.R Karthick | b9eab5a | 2017-06-07 16:03:51 -0700 | [diff] [blame] | 689 | self.remove_olt(switch_map) |
Thangavelu K S | 77c8c0c | 2017-06-07 18:04:21 +0000 | [diff] [blame] | 690 | self.voltha.disable_device(device_id, delete = True) |
| 691 | df.callback(0) |
| 692 | reactor.callLater(0, tls_flow_check_with_invalid_cert_scenario, df) |
| 693 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 694 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 695 | @deferred(TESTCASE_TIMEOUT) |
| 696 | def test_subscriber_with_voltha_for_multiple_invalid_authentication_attempts(self): |
| 697 | """ |
| 698 | Test Method: |
| 699 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 700 | 1. OLT and ONU is detected and validated. |
| 701 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 702 | 3. Issue tls auth packets and exchange invalid cert from CORD TESTER voltha test module acting as a subscriber for multiple times. |
| 703 | 4. Validate that eap tls with invalid cert auth packet is being exchanged between subscriber, onos and freeradius. |
| 704 | 5. Verify that subscriber authentication is unsuccessful.. |
| 705 | """ |
| 706 | df = defer.Deferred() |
| 707 | def tls_flow_check_with_no_cert_scenario(df): |
| 708 | log_test.info('Enabling ponsim_olt') |
| 709 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 710 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 711 | assert_not_equal(device_id, None) |
| 712 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 713 | rest_port = self.VOLTHA_REST_PORT, |
| 714 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 715 | time.sleep(10) |
| 716 | switch_map = None |
| 717 | olt_configured = False |
| 718 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 719 | log_test.info('Installing OLT app') |
| 720 | OnosCtrl.install_app(self.olt_app_file) |
| 721 | time.sleep(5) |
| 722 | log_test.info('Adding subscribers through OLT app') |
| 723 | self.config_olt(switch_map) |
| 724 | olt_configured = True |
| 725 | time.sleep(5) |
| 726 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 727 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 728 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "no_cert") |
| 729 | auth_status = self.tls_flow_check(self.INTF_RX_DEFAULT, cert_info = "invalid_cert") |
| 730 | try: |
| 731 | assert_equal(auth_status, True) |
| 732 | assert_equal(status, True) |
| 733 | time.sleep(10) |
| 734 | finally: |
| 735 | self.voltha.disable_device(device_id, delete = True) |
| 736 | df.callback(0) |
| 737 | reactor.callLater(0, tls_flow_check_with_no_cert_scenario, df) |
| 738 | return df |
| 739 | |
| 740 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 741 | def test_subscriber_with_voltha_for_eap_tls_authentication_with_aaa_app_deactivation(self): |
| 742 | """ |
| 743 | Test Method: |
| 744 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 745 | 1. OLT and ONU is detected and validated. |
| 746 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 747 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 748 | 4. Validate that eap tls without sending client hello, it's not being exchanged between client, onos and freeradius. |
| 749 | 5. Verify that subscriber authentication is unsuccessful.. |
| 750 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 751 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 752 | def tls_flow_check_deactivating_app(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 753 | aaa_app = ["org.opencord.aaa"] |
| 754 | log_test.info('Enabling ponsim_olt') |
| 755 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 756 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 757 | assert_not_equal(device_id, None) |
| 758 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 759 | rest_port = self.VOLTHA_REST_PORT, |
| 760 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 761 | time.sleep(10) |
| 762 | switch_map = None |
| 763 | olt_configured = False |
| 764 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 765 | log_test.info('Installing OLT app') |
| 766 | OnosCtrl.install_app(self.olt_app_file) |
| 767 | time.sleep(5) |
| 768 | log_test.info('Adding subscribers through OLT app') |
| 769 | self.config_olt(switch_map) |
| 770 | olt_configured = True |
| 771 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 772 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 773 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"app_deactivate",)) |
| 774 | thread2 = threading.Thread(target = self.deactivate_apps, args = (aaa_app,)) |
| 775 | thread1.start() |
| 776 | time.sleep(randint(1,2)) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 777 | log_test.info('Restart aaa app in onos during tls auth flow check on voltha') |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 778 | thread2.start() |
| 779 | time.sleep(10) |
| 780 | thread1.join() |
| 781 | thread2.join() |
| 782 | try: |
| 783 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 784 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 785 | time.sleep(10) |
| 786 | finally: |
| 787 | self.voltha.disable_device(device_id, delete = True) |
| 788 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 789 | reactor.callLater(0, tls_flow_check_deactivating_app, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 790 | return df |
| 791 | |
| 792 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 793 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_radius_server(self): |
| 794 | """ |
| 795 | Test Method: |
| 796 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 797 | 1. OLT and ONU is detected and validated. |
| 798 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 799 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 800 | 4. Validate that eap tls with restart of radius server and packets are being exchanged between subscriber, onos and freeradius. |
| 801 | 5. Verify that subscriber authentication is unsuccessful.. |
| 802 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 803 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 804 | def tls_flow_check_restarting_radius(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 805 | aaa_app = ["org.opencord.aaa"] |
| 806 | log_test.info('Enabling ponsim_olt') |
| 807 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 808 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 809 | assert_not_equal(device_id, None) |
| 810 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 811 | rest_port = self.VOLTHA_REST_PORT, |
| 812 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 813 | time.sleep(10) |
| 814 | switch_map = None |
| 815 | olt_configured = False |
| 816 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 817 | log_test.info('Installing OLT app') |
| 818 | OnosCtrl.install_app(self.olt_app_file) |
| 819 | time.sleep(5) |
| 820 | log_test.info('Adding subscribers through OLT app') |
| 821 | self.config_olt(switch_map) |
| 822 | olt_configured = True |
| 823 | time.sleep(5) |
| 824 | |
| 825 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,"restart_radius")) |
| 826 | thread2 = threading.Thread(target = cord_test_radius_restart) |
| 827 | thread1.start() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 828 | time.sleep(randint(1,2)) |
| 829 | log_test.info('Restart radius server during tls auth flow check on voltha') |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 830 | thread2.start() |
| 831 | time.sleep(10) |
| 832 | thread1.join() |
| 833 | thread2.join() |
| 834 | try: |
| 835 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 836 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 837 | time.sleep(10) |
| 838 | finally: |
| 839 | self.voltha.disable_device(device_id, delete = True) |
| 840 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 841 | reactor.callLater(0, tls_flow_check_restarting_radius, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 842 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 843 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 844 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 845 | def test_subscriber_with_voltha_for_eap_tls_authentication_with_disabled_olt(self): |
| 846 | """ |
| 847 | Test Method: |
| 848 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 849 | 1. OLT and ONU is detected and validated. |
| 850 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 851 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 852 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 853 | 6. Verify that subscriber authenticated successfully. |
| 854 | 7. Disable olt which is seen in voltha and issue tls auth packets from subscriber. |
| 855 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 856 | 9. Verify that subscriber authentication is unsuccessful.. |
| 857 | """ |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 858 | df = defer.Deferred() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 859 | def tls_flow_check_operating_olt_state(df): |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 860 | aaa_app = ["org.opencord.aaa"] |
| 861 | log_test.info('Enabling ponsim_olt') |
| 862 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 863 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 864 | assert_not_equal(device_id, None) |
| 865 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 866 | rest_port = self.VOLTHA_REST_PORT, |
| 867 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 868 | time.sleep(10) |
| 869 | switch_map = None |
| 870 | olt_configured = False |
| 871 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 872 | log_test.info('Installing OLT app') |
| 873 | OnosCtrl.install_app(self.olt_app_file) |
| 874 | time.sleep(5) |
| 875 | log_test.info('Adding subscribers through OLT app') |
| 876 | self.config_olt(switch_map) |
| 877 | olt_configured = True |
| 878 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 879 | |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 880 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "disable_olt_device",)) |
| 881 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,)) |
| 882 | thread1.start() |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 883 | time.sleep(randint(1,2)) |
| 884 | log_test.info('Disable the ponsim olt device during tls auth flow check on voltha') |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 885 | thread2.start() |
| 886 | time.sleep(10) |
| 887 | thread1.join() |
| 888 | thread2.join() |
| 889 | try: |
| 890 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 891 | assert_equal(self.success, True) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 892 | time.sleep(10) |
| 893 | finally: |
| 894 | self.voltha.disable_device(device_id, delete = True) |
| 895 | df.callback(0) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 896 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
Thangavelu K S | 0d745c8 | 2017-06-09 21:56:08 +0000 | [diff] [blame] | 897 | return df |
| 898 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 899 | @deferred(TESTCASE_TIMEOUT) |
| 900 | def test_subscriber_with_voltha_for_eap_tls_authentication_disabling_uni_port(self): |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 901 | """ |
| 902 | Test Method: |
| 903 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 904 | 1. OLT and ONU is detected and validated. |
| 905 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 906 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 907 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 908 | 6. Verify that subscriber authenticated successfully. |
| 909 | 7. Disable uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 910 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 911 | 9. Verify that subscriber authentication is unsuccessful.. |
| 912 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 913 | df = defer.Deferred() |
| 914 | def tls_flow_check_operating_olt_state(df): |
| 915 | aaa_app = ["org.opencord.aaa"] |
| 916 | log_test.info('Enabling ponsim_olt') |
| 917 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 918 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 919 | assert_not_equal(device_id, None) |
| 920 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 921 | rest_port = self.VOLTHA_REST_PORT, |
| 922 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 923 | time.sleep(10) |
| 924 | switch_map = None |
| 925 | olt_configured = False |
| 926 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 927 | log_test.info('Installing OLT app') |
| 928 | OnosCtrl.install_app(self.olt_app_file) |
| 929 | time.sleep(5) |
| 930 | log_test.info('Adding subscribers through OLT app') |
| 931 | self.config_olt(switch_map) |
| 932 | olt_configured = True |
| 933 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 934 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 935 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "uni_port_admin_down",)) |
| 936 | thread2 = threading.Thread(target = self.voltha_uni_port_toggle) |
| 937 | thread1.start() |
| 938 | time.sleep(randint(1,2)) |
| 939 | log_test.info('Admin state of uni port is down and up after delay of 30 sec during tls auth flow check on voltha') |
| 940 | thread2.start() |
| 941 | time.sleep(10) |
| 942 | thread1.join() |
| 943 | thread2.join() |
| 944 | try: |
| 945 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 946 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 947 | time.sleep(10) |
| 948 | finally: |
| 949 | self.voltha.disable_device(device_id, delete = True) |
| 950 | df.callback(0) |
| 951 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 952 | return df |
| 953 | |
| 954 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 955 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_olt(self): |
| 956 | """ |
| 957 | Test Method: |
| 958 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 959 | 1. OLT and ONU is detected and validated. |
| 960 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 961 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 962 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 963 | 6. Verify that subscriber authenticated successfully. |
| 964 | 7. Restart olt which is seen in voltha and issue tls auth packets from subscriber. |
| 965 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 966 | 9. Verify that subscriber authentication is unsuccessful.. |
| 967 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 968 | df = defer.Deferred() |
| 969 | def tls_flow_check_operating_olt_state(df): |
| 970 | aaa_app = ["org.opencord.aaa"] |
| 971 | log_test.info('Enabling ponsim_olt') |
| 972 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 973 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 974 | assert_not_equal(device_id, None) |
| 975 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 976 | rest_port = self.VOLTHA_REST_PORT, |
| 977 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 978 | time.sleep(10) |
| 979 | switch_map = None |
| 980 | olt_configured = False |
| 981 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 982 | log_test.info('Installing OLT app') |
| 983 | OnosCtrl.install_app(self.olt_app_file) |
| 984 | time.sleep(5) |
| 985 | log_test.info('Adding subscribers through OLT app') |
| 986 | self.config_olt(switch_map) |
| 987 | olt_configured = True |
| 988 | time.sleep(5) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 989 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 990 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_olt_device",)) |
| 991 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 992 | thread1.start() |
| 993 | time.sleep(randint(1,2)) |
| 994 | log_test.info('Restart the ponsim olt device during tls auth flow check on voltha') |
| 995 | thread2.start() |
| 996 | time.sleep(10) |
| 997 | thread1.join() |
| 998 | thread2.join() |
| 999 | try: |
| 1000 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1001 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1002 | time.sleep(10) |
| 1003 | finally: |
| 1004 | self.voltha.disable_device(device_id, delete = True) |
| 1005 | df.callback(0) |
| 1006 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 1007 | return df |
| 1008 | |
| 1009 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1010 | def test_subscriber_with_voltha_for_eap_tls_authentication_restarting_onu(self): |
| 1011 | """ |
| 1012 | Test Method: |
| 1013 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1014 | 1. OLT and ONU is detected and validated. |
| 1015 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1016 | 3. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1017 | 5. Validate that eap tls packets are being exchanged between subscriber, onos and freeradius. |
| 1018 | 6. Verify that subscriber authenticated successfully. |
| 1019 | 7. Restart onu which is seen in voltha and issue tls auth packets from subscriber. |
| 1020 | 8. Validate that eap tls packets are not being exchanged between subscriber, onos and freeradius. |
| 1021 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1022 | """ |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1023 | df = defer.Deferred() |
| 1024 | def tls_flow_check_operating_olt_state(df): |
| 1025 | aaa_app = ["org.opencord.aaa"] |
| 1026 | log_test.info('Enabling ponsim_olt') |
| 1027 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1028 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1029 | devices_list = self.voltha.get_devices() |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1030 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 1031 | |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1032 | onu_device_id = devices_list['items'][1]['id'] |
| 1033 | assert_not_equal(device_id, None) |
| 1034 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1035 | rest_port = self.VOLTHA_REST_PORT, |
| 1036 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1037 | time.sleep(10) |
| 1038 | switch_map = None |
| 1039 | olt_configured = False |
| 1040 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1041 | log_test.info('Installing OLT app') |
| 1042 | OnosCtrl.install_app(self.olt_app_file) |
| 1043 | time.sleep(5) |
| 1044 | log_test.info('Adding subscribers through OLT app') |
| 1045 | self.config_olt(switch_map) |
| 1046 | olt_configured = True |
| 1047 | time.sleep(5) |
| 1048 | devices_list = self.voltha.get_devices() |
| 1049 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT, "restart_onu_device",)) |
| 1050 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (onu_device_id,)) |
| 1051 | thread1.start() |
| 1052 | time.sleep(randint(1,2)) |
| 1053 | log_test.info('Restart the ponsim oon device during tls auth flow check on voltha') |
| 1054 | thread2.start() |
| 1055 | time.sleep(10) |
| 1056 | thread1.join() |
| 1057 | thread2.join() |
| 1058 | try: |
| 1059 | # assert_equal(status, True) |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1060 | assert_equal(self.success, True) |
Thangavelu K S | b6fc1b5 | 2017-06-12 17:46:10 +0000 | [diff] [blame] | 1061 | time.sleep(10) |
| 1062 | finally: |
| 1063 | self.voltha.disable_device(device_id, delete = True) |
| 1064 | df.callback(0) |
| 1065 | reactor.callLater(0, tls_flow_check_operating_olt_state, df) |
| 1066 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1067 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1068 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1069 | def test_two_subscribers_with_voltha_for_eap_tls_authentication(self): |
| 1070 | """ |
| 1071 | Test Method: |
| 1072 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1073 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 1074 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1075 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1076 | 4. Validate that eap tls valid auth packets are being exchanged between two subscriber, onos and freeradius. |
| 1077 | 5. Verify that two subscribers are authenticated successfully. |
| 1078 | """ |
| 1079 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1080 | df = defer.Deferred() |
| 1081 | def tls_flow_check_on_two_subscriber_same_olt_device(df): |
| 1082 | aaa_app = ["org.opencord.aaa"] |
| 1083 | log_test.info('Enabling ponsim_olt') |
| 1084 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1085 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1086 | devices_list = self.voltha.get_devices() |
| 1087 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 1088 | |
| 1089 | onu_device_id = devices_list['items'][1]['id'] |
| 1090 | assert_not_equal(device_id, None) |
| 1091 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1092 | rest_port = self.VOLTHA_REST_PORT, |
| 1093 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1094 | time.sleep(10) |
| 1095 | switch_map = None |
| 1096 | olt_configured = False |
| 1097 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1098 | log_test.info('Installing OLT app') |
| 1099 | OnosCtrl.install_app(self.olt_app_file) |
| 1100 | time.sleep(5) |
| 1101 | log_test.info('Adding subscribers through OLT app') |
| 1102 | self.config_olt(switch_map) |
| 1103 | olt_configured = True |
| 1104 | time.sleep(5) |
| 1105 | devices_list = self.voltha.get_devices() |
| 1106 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 1107 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT,)) |
| 1108 | thread1.start() |
| 1109 | time.sleep(randint(1,2)) |
| 1110 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 1111 | thread2.start() |
| 1112 | time.sleep(10) |
| 1113 | thread1.join() |
| 1114 | thread2.join() |
| 1115 | try: |
| 1116 | # assert_equal(status, True) |
| 1117 | assert_equal(self.success, True) |
| 1118 | time.sleep(10) |
| 1119 | finally: |
| 1120 | self.voltha.disable_device(device_id, delete = True) |
| 1121 | df.callback(0) |
| 1122 | reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df) |
| 1123 | return df |
| 1124 | |
| 1125 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1126 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_using_same_certificates(self): |
| 1127 | """ |
| 1128 | Test Method: |
| 1129 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1130 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 1131 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1132 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1133 | 4. Validate that two valid certificates are being exchanged between two subscriber, onos and freeradius. |
| 1134 | 5. Verify that two subscribers are not authenticated. |
| 1135 | """ |
| 1136 | |
Thangavelu K S | 9648eed | 2017-06-13 20:15:25 +0000 | [diff] [blame] | 1137 | df = defer.Deferred() |
| 1138 | def tls_flow_check_on_two_subscriber_same_olt_device(df): |
| 1139 | aaa_app = ["org.opencord.aaa"] |
| 1140 | log_test.info('Enabling ponsim_olt') |
| 1141 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1142 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1143 | devices_list = self.voltha.get_devices() |
| 1144 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 1145 | |
| 1146 | onu_device_id = devices_list['items'][1]['id'] |
| 1147 | assert_not_equal(device_id, None) |
| 1148 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1149 | rest_port = self.VOLTHA_REST_PORT, |
| 1150 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1151 | time.sleep(10) |
| 1152 | switch_map = None |
| 1153 | olt_configured = False |
| 1154 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1155 | log_test.info('Installing OLT app') |
| 1156 | OnosCtrl.install_app(self.olt_app_file) |
| 1157 | time.sleep(5) |
| 1158 | log_test.info('Adding subscribers through OLT app') |
| 1159 | self.config_olt(switch_map) |
| 1160 | olt_configured = True |
| 1161 | time.sleep(5) |
| 1162 | devices_list = self.voltha.get_devices() |
| 1163 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 1164 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "same_cert",)) |
| 1165 | thread1.start() |
| 1166 | time.sleep(randint(1,2)) |
| 1167 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 1168 | thread2.start() |
| 1169 | time.sleep(10) |
| 1170 | thread1.join() |
| 1171 | thread2.join() |
| 1172 | try: |
| 1173 | # assert_equal(status, True) |
| 1174 | assert_equal(self.success, True) |
| 1175 | time.sleep(10) |
| 1176 | finally: |
| 1177 | self.voltha.disable_device(device_id, delete = True) |
| 1178 | df.callback(0) |
| 1179 | reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df) |
| 1180 | return df |
| 1181 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 1182 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1183 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_tls_packets_for_one_subscriber(self): |
| 1184 | """ |
| 1185 | Test Method: |
| 1186 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1187 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 1188 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1189 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1190 | 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius. |
| 1191 | 5. Validate that eap tls valid auth packets are being exchanged between invalid client, onos and freeradius. |
| 1192 | 6. Verify that valid subscriber authenticated successfully. |
| 1193 | 7. Verify that invalid subscriber are not authenticated successfully. |
| 1194 | """ |
| 1195 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 1196 | df = defer.Deferred() |
| 1197 | def tls_flow_check_on_two_subscriber_same_olt_device(df): |
| 1198 | aaa_app = ["org.opencord.aaa"] |
| 1199 | log_test.info('Enabling ponsim_olt') |
| 1200 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1201 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1202 | devices_list = self.voltha.get_devices() |
| 1203 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 1204 | |
| 1205 | onu_device_id = devices_list['items'][1]['id'] |
| 1206 | assert_not_equal(device_id, None) |
| 1207 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1208 | rest_port = self.VOLTHA_REST_PORT, |
| 1209 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1210 | time.sleep(10) |
| 1211 | switch_map = None |
| 1212 | olt_configured = False |
| 1213 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1214 | log_test.info('Installing OLT app') |
| 1215 | OnosCtrl.install_app(self.olt_app_file) |
| 1216 | time.sleep(5) |
| 1217 | log_test.info('Adding subscribers through OLT app') |
| 1218 | self.config_olt(switch_map) |
| 1219 | olt_configured = True |
| 1220 | time.sleep(5) |
| 1221 | devices_list = self.voltha.get_devices() |
| 1222 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 1223 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "no_cert",)) |
| 1224 | thread1.start() |
| 1225 | time.sleep(randint(1,2)) |
| 1226 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 1227 | thread2.start() |
| 1228 | time.sleep(10) |
| 1229 | thread1.join() |
| 1230 | thread2.join() |
| 1231 | try: |
| 1232 | # assert_equal(status, True) |
| 1233 | assert_equal(self.success, True) |
| 1234 | time.sleep(10) |
| 1235 | finally: |
| 1236 | self.voltha.disable_device(device_id, delete = True) |
| 1237 | df.callback(0) |
| 1238 | reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df) |
| 1239 | return df |
| 1240 | |
| 1241 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1242 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_initiating_invalid_cert_for_one_subscriber(self): |
| 1243 | """ |
| 1244 | Test Method: |
| 1245 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1246 | 1. OLT is detected and ONU ports(nni and 2 uni's) are being seen. |
| 1247 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1248 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1249 | 4. Validate that eap tls valid auth packets are being exchanged between valid subscriber, onos and freeradius. |
| 1250 | 5. Validate that eap tls invalid cert auth packets are being exchanged between invalid subscriber, onos and freeradius. |
| 1251 | 6. Verify that valid subscriber authenticated successfully. |
| 1252 | 7. Verify that invalid subscriber are not authenticated successfully. |
| 1253 | """ |
| 1254 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 1255 | df = defer.Deferred() |
| 1256 | def tls_flow_check_on_two_subscriber_same_olt_device(df): |
| 1257 | aaa_app = ["org.opencord.aaa"] |
| 1258 | log_test.info('Enabling ponsim_olt') |
| 1259 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1260 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1261 | devices_list = self.voltha.get_devices() |
| 1262 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 1263 | |
| 1264 | onu_device_id = devices_list['items'][1]['id'] |
| 1265 | assert_not_equal(device_id, None) |
| 1266 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1267 | rest_port = self.VOLTHA_REST_PORT, |
| 1268 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1269 | time.sleep(10) |
| 1270 | switch_map = None |
| 1271 | olt_configured = False |
| 1272 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1273 | log_test.info('Installing OLT app') |
| 1274 | OnosCtrl.install_app(self.olt_app_file) |
| 1275 | time.sleep(5) |
| 1276 | log_test.info('Adding subscribers through OLT app') |
| 1277 | self.config_olt(switch_map) |
| 1278 | olt_configured = True |
| 1279 | time.sleep(5) |
| 1280 | devices_list = self.voltha.get_devices() |
| 1281 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 1282 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "invalid_cert",)) |
| 1283 | thread1.start() |
| 1284 | time.sleep(randint(1,2)) |
| 1285 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 1286 | thread2.start() |
| 1287 | time.sleep(10) |
| 1288 | thread1.join() |
| 1289 | thread2.join() |
| 1290 | try: |
| 1291 | # assert_equal(status, True) |
| 1292 | assert_equal(self.success, True) |
| 1293 | time.sleep(10) |
| 1294 | finally: |
| 1295 | self.voltha.disable_device(device_id, delete = True) |
| 1296 | df.callback(0) |
| 1297 | reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df) |
| 1298 | return df |
| 1299 | |
| 1300 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1301 | def test_two_subscribers_with_voltha_for_eap_tls_authentication_with_one_uni_port_disabled(self): |
| 1302 | """ |
| 1303 | Test Method: |
| 1304 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1305 | 1. OLT and ONU is detected and validated. |
| 1306 | 2. Bring up freeradius server container using CORD TESTER and make sure that ONOS have connectivity to freeradius server. |
| 1307 | 3. Bring up two Residential subscribers from cord-tester and issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1308 | 5. Validate that eap tls packets are being exchanged between two subscriber, onos and freeradius. |
| 1309 | 6. Verify that subscriber authenticated successfully. |
| 1310 | 7. Disable one of the uni port which is seen in voltha and issue tls auth packets from subscriber. |
| 1311 | 8. Validate that eap tls packets are not being exchanged between one subscriber, onos and freeradius. |
| 1312 | 9. Verify that subscriber authentication is unsuccessful.. |
| 1313 | 10. Verify that other subscriber authenticated successfully. |
| 1314 | """ |
| 1315 | |
Chetan Gaonker | fe1048f | 2017-06-13 20:16:25 +0000 | [diff] [blame] | 1316 | df = defer.Deferred() |
| 1317 | def tls_flow_check_on_two_subscriber_same_olt_device(df): |
| 1318 | aaa_app = ["org.opencord.aaa"] |
| 1319 | log_test.info('Enabling ponsim_olt') |
| 1320 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1321 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1322 | devices_list = self.voltha.get_devices() |
| 1323 | log_test.info('All available devices on voltha = %s'%devices_list['items']) |
| 1324 | |
| 1325 | onu_device_id = devices_list['items'][1]['id'] |
| 1326 | assert_not_equal(device_id, None) |
| 1327 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1328 | rest_port = self.VOLTHA_REST_PORT, |
| 1329 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1330 | time.sleep(10) |
| 1331 | switch_map = None |
| 1332 | olt_configured = False |
| 1333 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1334 | log_test.info('Installing OLT app') |
| 1335 | OnosCtrl.install_app(self.olt_app_file) |
| 1336 | time.sleep(5) |
| 1337 | log_test.info('Adding subscribers through OLT app') |
| 1338 | self.config_olt(switch_map) |
| 1339 | olt_configured = True |
| 1340 | time.sleep(5) |
| 1341 | devices_list = self.voltha.get_devices() |
| 1342 | thread1 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_RX_DEFAULT,)) |
| 1343 | thread2 = threading.Thread(target = self.tls_flow_check, args = (self.INTF_2_RX_DEFAULT, "uni_port_admin_down",)) |
| 1344 | thread1.start() |
| 1345 | time.sleep(randint(1,2)) |
| 1346 | log_test.info('Initiating tls auth packets from one more subscriber on same olt device which is deteced on voltha') |
| 1347 | thread2.start() |
| 1348 | time.sleep(10) |
| 1349 | thread1.join() |
| 1350 | thread2.join() |
| 1351 | try: |
| 1352 | # assert_equal(status, True) |
| 1353 | assert_equal(self.success, True) |
| 1354 | time.sleep(10) |
| 1355 | finally: |
| 1356 | self.voltha.disable_device(device_id, delete = True) |
| 1357 | df.callback(0) |
| 1358 | reactor.callLater(0, tls_flow_check_on_two_subscriber_same_olt_device, df) |
| 1359 | return df |
| 1360 | |
| 1361 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1362 | def test_subscriber_with_voltha_for_dhcp_request(self): |
| 1363 | """ |
| 1364 | Test Method: |
| 1365 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1366 | 1. OLT and ONU is detected and validated. |
| 1367 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1368 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 1369 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1370 | """ |
| 1371 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1372 | df = defer.Deferred() |
| 1373 | def dhcp_flow_check_scenario(df): |
| 1374 | log_test.info('Enabling ponsim_olt') |
| 1375 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1376 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1377 | assert_not_equal(device_id, None) |
| 1378 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1379 | rest_port = self.VOLTHA_REST_PORT, |
| 1380 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1381 | time.sleep(10) |
| 1382 | switch_map = None |
| 1383 | olt_configured = False |
| 1384 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1385 | log_test.info('Installing OLT app') |
| 1386 | OnosCtrl.install_app(self.olt_app_file) |
| 1387 | time.sleep(5) |
| 1388 | log_test.info('Adding subscribers through OLT app') |
| 1389 | self.config_olt(switch_map) |
| 1390 | olt_configured = True |
| 1391 | time.sleep(5) |
| 1392 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 1393 | try: |
| 1394 | assert_equal(dhcp_status, True) |
| 1395 | #assert_equal(status, True) |
| 1396 | time.sleep(10) |
| 1397 | finally: |
| 1398 | self.remove_olt(switch_map) |
| 1399 | self.voltha.disable_device(device_id, delete = True) |
| 1400 | df.callback(0) |
| 1401 | |
| 1402 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1403 | return df |
| 1404 | |
| 1405 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1406 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_broadcast_source_mac(self): |
| 1407 | """ |
| 1408 | Test Method: |
| 1409 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1410 | 1. OLT and ONU is detected and validated. |
| 1411 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1412 | 3. Send dhcp request with invalid source mac broadcast from residential subscrber to dhcp server which is running as onos app. |
| 1413 | 4. Verify that subscriber should not get ip from dhcp server. |
| 1414 | """ |
| 1415 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1416 | df = defer.Deferred() |
| 1417 | def dhcp_flow_check_scenario(df): |
| 1418 | log_test.info('Enabling ponsim_olt') |
| 1419 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1420 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1421 | assert_not_equal(device_id, None) |
| 1422 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1423 | rest_port = self.VOLTHA_REST_PORT, |
| 1424 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1425 | time.sleep(10) |
| 1426 | switch_map = None |
| 1427 | olt_configured = False |
| 1428 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1429 | log_test.info('Installing OLT app') |
| 1430 | OnosCtrl.install_app(self.olt_app_file) |
| 1431 | time.sleep(5) |
| 1432 | log_test.info('Adding subscribers through OLT app') |
| 1433 | self.config_olt(switch_map) |
| 1434 | olt_configured = True |
| 1435 | time.sleep(5) |
| 1436 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_broadcast") |
| 1437 | try: |
| 1438 | assert_equal(dhcp_status, True) |
| 1439 | #assert_equal(status, True) |
| 1440 | time.sleep(10) |
| 1441 | finally: |
| 1442 | self.voltha.disable_device(device_id, delete = True) |
| 1443 | self.remove_olt(switch_map) |
| 1444 | df.callback(0) |
| 1445 | |
| 1446 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1447 | return df |
| 1448 | |
| 1449 | |
| 1450 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1451 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_multicast_source_mac(self): |
| 1452 | """ |
| 1453 | Test Method: |
| 1454 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1455 | 1. OLT and ONU is detected and validated. |
| 1456 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1457 | 3. Send dhcp request with invalid source mac multicast from residential subscrber to dhcp server which is running as onos app. |
| 1458 | 4. Verify that subscriber should not get ip from dhcp server. |
| 1459 | """ |
| 1460 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1461 | df = defer.Deferred() |
| 1462 | def dhcp_flow_check_scenario(df): |
| 1463 | log_test.info('Enabling ponsim_olt') |
| 1464 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1465 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1466 | assert_not_equal(device_id, None) |
| 1467 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1468 | rest_port = self.VOLTHA_REST_PORT, |
| 1469 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1470 | time.sleep(10) |
| 1471 | switch_map = None |
| 1472 | olt_configured = False |
| 1473 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1474 | log_test.info('Installing OLT app') |
| 1475 | OnosCtrl.install_app(self.olt_app_file) |
| 1476 | time.sleep(5) |
| 1477 | log_test.info('Adding subscribers through OLT app') |
| 1478 | self.config_olt(switch_map) |
| 1479 | olt_configured = True |
| 1480 | time.sleep(5) |
| 1481 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_multicast") |
| 1482 | try: |
| 1483 | assert_equal(dhcp_status, True) |
| 1484 | #assert_equal(status, True) |
| 1485 | time.sleep(10) |
| 1486 | finally: |
| 1487 | self.voltha.disable_device(device_id, delete = True) |
| 1488 | self.remove_olt(switch_map) |
| 1489 | df.callback(0) |
| 1490 | |
| 1491 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1492 | return df |
| 1493 | |
| 1494 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1495 | def test_subscriber_with_voltha_for_dhcp_request_with_invalid_source_mac(self): |
| 1496 | """ |
| 1497 | Test Method: |
| 1498 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1499 | 1. OLT and ONU is detected and validated. |
| 1500 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1501 | 3. Send dhcp request with invalid source mac zero from residential subscrber to dhcp server which is running as onos app. |
| 1502 | 4. Verify that subscriber should not get ip from dhcp server. |
| 1503 | """ |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1504 | df = defer.Deferred() |
| 1505 | def dhcp_flow_check_scenario(df): |
| 1506 | log_test.info('Enabling ponsim_olt') |
| 1507 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1508 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1509 | assert_not_equal(device_id, None) |
| 1510 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1511 | rest_port = self.VOLTHA_REST_PORT, |
| 1512 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1513 | time.sleep(10) |
| 1514 | switch_map = None |
| 1515 | olt_configured = False |
| 1516 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1517 | log_test.info('Installing OLT app') |
| 1518 | OnosCtrl.install_app(self.olt_app_file) |
| 1519 | time.sleep(5) |
| 1520 | log_test.info('Adding subscribers through OLT app') |
| 1521 | self.config_olt(switch_map) |
| 1522 | olt_configured = True |
| 1523 | time.sleep(5) |
| 1524 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "invalid_src_mac_junk") |
| 1525 | try: |
| 1526 | assert_equal(dhcp_status, True) |
| 1527 | #assert_equal(status, True) |
| 1528 | time.sleep(10) |
| 1529 | finally: |
| 1530 | self.voltha.disable_device(device_id, delete = True) |
| 1531 | self.remove_olt(switch_map) |
| 1532 | df.callback(0) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1533 | |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1534 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1535 | return df |
| 1536 | |
| 1537 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1538 | def test_subscriber_with_voltha_for_dhcp_request_and_release(self): |
| 1539 | """ |
| 1540 | Test Method: |
| 1541 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1542 | 1. OLT and ONU is detected and validated. |
| 1543 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1544 | 3. Send dhcp request from residential subscrber to dhcp server which is running as onos app. |
| 1545 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1546 | 5. Send dhcp release from residential subscrber to dhcp server which is running as onos app. |
| 1547 | 6 Verify that subscriber should not get ip from dhcp server, ping to gateway. |
| 1548 | """ |
Thangavelu K S | a1c71b4 | 2017-06-14 18:13:21 +0000 | [diff] [blame] | 1549 | df = defer.Deferred() |
| 1550 | def dhcp_flow_check_scenario(df): |
| 1551 | log_test.info('Enabling ponsim_olt') |
| 1552 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1553 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1554 | assert_not_equal(device_id, None) |
| 1555 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1556 | rest_port = self.VOLTHA_REST_PORT, |
| 1557 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1558 | time.sleep(10) |
| 1559 | switch_map = None |
| 1560 | olt_configured = False |
| 1561 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1562 | log_test.info('Installing OLT app') |
| 1563 | OnosCtrl.install_app(self.olt_app_file) |
| 1564 | time.sleep(5) |
| 1565 | log_test.info('Adding subscribers through OLT app') |
| 1566 | self.config_olt(switch_map) |
| 1567 | olt_configured = True |
| 1568 | time.sleep(5) |
| 1569 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "request_release") |
| 1570 | try: |
| 1571 | assert_equal(dhcp_status, True) |
| 1572 | #assert_equal(status, True) |
| 1573 | time.sleep(10) |
| 1574 | finally: |
| 1575 | self.voltha.disable_device(device_id, delete = True) |
| 1576 | self.remove_olt(switch_map) |
| 1577 | df.callback(0) |
| 1578 | |
| 1579 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1580 | return df |
Thangavelu K S | 008f38e | 2017-05-15 19:36:55 +0000 | [diff] [blame] | 1581 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1582 | |
| 1583 | @deferred(TESTCASE_TIMEOUT) |
A.R Karthick | 57fa937 | 2017-05-24 12:47:03 -0700 | [diff] [blame] | 1584 | def test_subscriber_with_voltha_for_dhcp_starvation_positive_scenario(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1585 | """ |
| 1586 | Test Method: |
| 1587 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1588 | 1. OLT and ONU is detected and validated. |
| 1589 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1590 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 1591 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1592 | 5. Repeat step 3 and 4 for 10 times. |
| 1593 | 6 Verify that subscriber should get ip from dhcp server. |
| 1594 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1595 | df = defer.Deferred() |
| 1596 | def dhcp_flow_check_scenario(df): |
| 1597 | log_test.info('Enabling ponsim_olt') |
| 1598 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1599 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1600 | assert_not_equal(device_id, None) |
| 1601 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1602 | rest_port = self.VOLTHA_REST_PORT, |
| 1603 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1604 | time.sleep(10) |
| 1605 | switch_map = None |
| 1606 | olt_configured = False |
| 1607 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1608 | log_test.info('Installing OLT app') |
| 1609 | OnosCtrl.install_app(self.olt_app_file) |
| 1610 | time.sleep(5) |
| 1611 | log_test.info('Adding subscribers through OLT app') |
| 1612 | self.config_olt(switch_map) |
| 1613 | olt_configured = True |
| 1614 | time.sleep(5) |
| 1615 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_positive") |
| 1616 | try: |
| 1617 | assert_equal(dhcp_status, True) |
| 1618 | #assert_equal(status, True) |
| 1619 | time.sleep(10) |
| 1620 | finally: |
| 1621 | self.voltha.disable_device(device_id, delete = True) |
| 1622 | self.remove_olt(switch_map) |
| 1623 | df.callback(0) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1624 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1625 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1626 | return df |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1631 | def test_subscriber_with_voltha_for_dhcp_starvation_negative_scenario(self): |
| 1632 | """ |
| 1633 | Test Method: |
| 1634 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1635 | 1. OLT and ONU is detected and validated. |
| 1636 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1637 | 3. Send dhcp request from residential subscriber without of pool ip to dhcp server which is running as onos app. |
| 1638 | 4. Verify that subscriber should not get ip from dhcp server. |
| 1639 | 5. Repeat steps 3 and 4 for 10 times. |
| 1640 | 6 Verify that subscriber should not get ip from dhcp server. |
| 1641 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1642 | df = defer.Deferred() |
| 1643 | def dhcp_flow_check_scenario(df): |
| 1644 | log_test.info('Enabling ponsim_olt') |
| 1645 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1646 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1647 | assert_not_equal(device_id, None) |
| 1648 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1649 | rest_port = self.VOLTHA_REST_PORT, |
| 1650 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1651 | time.sleep(10) |
| 1652 | switch_map = None |
| 1653 | olt_configured = False |
| 1654 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1655 | log_test.info('Installing OLT app') |
| 1656 | OnosCtrl.install_app(self.olt_app_file) |
| 1657 | time.sleep(5) |
| 1658 | log_test.info('Adding subscribers through OLT app') |
| 1659 | self.config_olt(switch_map) |
| 1660 | olt_configured = True |
| 1661 | time.sleep(5) |
| 1662 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "starvation_negative") |
| 1663 | try: |
| 1664 | assert_equal(dhcp_status, True) |
| 1665 | #assert_equal(status, True) |
| 1666 | time.sleep(10) |
| 1667 | finally: |
| 1668 | self.voltha.disable_device(device_id, delete = True) |
| 1669 | self.remove_olt(switch_map) |
| 1670 | df.callback(0) |
| 1671 | |
| 1672 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1673 | return df |
| 1674 | |
| 1675 | |
| 1676 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1677 | def test_subscriber_with_voltha_for_dhcp_sending_multiple_discover(self): |
| 1678 | """ |
| 1679 | Test Method: |
| 1680 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1681 | 1. OLT and ONU is detected and validated. |
| 1682 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1683 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 1684 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1685 | 5. Repeat step 3 for 50 times. |
| 1686 | 6 Verify that subscriber should get same ip which was received from 1st discover from dhcp server. |
| 1687 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1688 | df = defer.Deferred() |
| 1689 | def dhcp_flow_check_scenario(df): |
| 1690 | log_test.info('Enabling ponsim_olt') |
| 1691 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1692 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1693 | assert_not_equal(device_id, None) |
| 1694 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1695 | rest_port = self.VOLTHA_REST_PORT, |
| 1696 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1697 | time.sleep(10) |
| 1698 | switch_map = None |
| 1699 | olt_configured = False |
| 1700 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1701 | log_test.info('Installing OLT app') |
| 1702 | OnosCtrl.install_app(self.olt_app_file) |
| 1703 | time.sleep(5) |
| 1704 | log_test.info('Adding subscribers through OLT app') |
| 1705 | self.config_olt(switch_map) |
| 1706 | olt_configured = True |
| 1707 | time.sleep(5) |
| 1708 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_discover") |
| 1709 | try: |
| 1710 | assert_equal(dhcp_status, True) |
| 1711 | #assert_equal(status, True) |
| 1712 | time.sleep(10) |
| 1713 | finally: |
| 1714 | self.voltha.disable_device(device_id, delete = True) |
| 1715 | self.remove_olt(switch_map) |
| 1716 | df.callback(0) |
| 1717 | |
| 1718 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1719 | return df |
| 1720 | |
| 1721 | |
| 1722 | |
| 1723 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1724 | def test_subscriber_with_voltha_for_dhcp_sending_multiple_request(self): |
| 1725 | """ |
| 1726 | Test Method: |
| 1727 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1728 | 1. OLT and ONU is detected and validated. |
| 1729 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1730 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 1731 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1732 | 5. Send DHCP request to dhcp server which is running as onos app. |
| 1733 | 6. Repeat step 5 for 50 times. |
| 1734 | 7. Verify that subscriber should get same ip which was received from 1st discover from dhcp server. |
| 1735 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1736 | df = defer.Deferred() |
| 1737 | def dhcp_flow_check_scenario(df): |
| 1738 | log_test.info('Enabling ponsim_olt') |
| 1739 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1740 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1741 | assert_not_equal(device_id, None) |
| 1742 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1743 | rest_port = self.VOLTHA_REST_PORT, |
| 1744 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1745 | time.sleep(10) |
| 1746 | switch_map = None |
| 1747 | olt_configured = False |
| 1748 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1749 | log_test.info('Installing OLT app') |
| 1750 | OnosCtrl.install_app(self.olt_app_file) |
| 1751 | time.sleep(5) |
| 1752 | log_test.info('Adding subscribers through OLT app') |
| 1753 | self.config_olt(switch_map) |
| 1754 | olt_configured = True |
| 1755 | time.sleep(5) |
| 1756 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "multiple_requests") |
| 1757 | try: |
| 1758 | assert_equal(dhcp_status, True) |
| 1759 | #assert_equal(status, True) |
| 1760 | time.sleep(10) |
| 1761 | finally: |
| 1762 | self.voltha.disable_device(device_id, delete = True) |
| 1763 | self.remove_olt(switch_map) |
| 1764 | df.callback(0) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1765 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1766 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1767 | return df |
| 1768 | |
| 1769 | |
| 1770 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1771 | def test_subscriber_with_voltha_for_dhcp_requesting_desired_ip_address(self): |
| 1772 | """ |
| 1773 | Test Method: |
| 1774 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1775 | 1. OLT and ONU is detected and validated. |
| 1776 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1777 | 3. Send dhcp request with desired ip address from residential subscriber to dhcp server which is running as onos app. |
| 1778 | 4. Verify that subscriber get ip which was requested in step 3 from dhcp server successfully. |
| 1779 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1780 | df = defer.Deferred() |
| 1781 | def dhcp_flow_check_scenario(df): |
| 1782 | log_test.info('Enabling ponsim_olt') |
| 1783 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1784 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1785 | assert_not_equal(device_id, None) |
| 1786 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1787 | rest_port = self.VOLTHA_REST_PORT, |
| 1788 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1789 | time.sleep(10) |
| 1790 | switch_map = None |
| 1791 | olt_configured = False |
| 1792 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1793 | log_test.info('Installing OLT app') |
| 1794 | OnosCtrl.install_app(self.olt_app_file) |
| 1795 | time.sleep(5) |
| 1796 | log_test.info('Adding subscribers through OLT app') |
| 1797 | self.config_olt(switch_map) |
| 1798 | olt_configured = True |
| 1799 | time.sleep(5) |
| 1800 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_ip_address") |
| 1801 | try: |
| 1802 | assert_equal(dhcp_status, True) |
| 1803 | #assert_equal(status, True) |
| 1804 | time.sleep(10) |
| 1805 | finally: |
| 1806 | self.voltha.disable_device(device_id, delete = True) |
| 1807 | self.remove_olt(switch_map) |
| 1808 | df.callback(0) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1809 | |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1810 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1811 | return df |
| 1812 | |
| 1813 | @deferred(TESTCASE_TIMEOUT) |
| 1814 | def test_subscriber_with_voltha_for_dhcp_requesting_desired_out_of_pool_ip_address(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1815 | """ |
| 1816 | Test Method: |
| 1817 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1818 | 1. OLT and ONU is detected and validated. |
| 1819 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1820 | 3. Send dhcp request with desired out of pool ip address from residential subscriber to dhcp server which is running as onos app. |
| 1821 | 4. Verify that subscriber should not get ip which was requested in step 3 from dhcp server, and its offered only within dhcp pool of ip. |
| 1822 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1823 | df = defer.Deferred() |
| 1824 | def dhcp_flow_check_scenario(df): |
| 1825 | log_test.info('Enabling ponsim_olt') |
| 1826 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1827 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1828 | assert_not_equal(device_id, None) |
| 1829 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1830 | rest_port = self.VOLTHA_REST_PORT, |
| 1831 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1832 | time.sleep(10) |
| 1833 | switch_map = None |
| 1834 | olt_configured = False |
| 1835 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1836 | log_test.info('Installing OLT app') |
| 1837 | OnosCtrl.install_app(self.olt_app_file) |
| 1838 | time.sleep(5) |
| 1839 | log_test.info('Adding subscribers through OLT app') |
| 1840 | self.config_olt(switch_map) |
| 1841 | olt_configured = True |
| 1842 | time.sleep(5) |
| 1843 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address") |
| 1844 | try: |
| 1845 | assert_equal(dhcp_status, True) |
| 1846 | #assert_equal(status, True) |
| 1847 | time.sleep(10) |
| 1848 | finally: |
| 1849 | self.voltha.disable_device(device_id, delete = True) |
| 1850 | self.remove_olt(switch_map) |
| 1851 | df.callback(0) |
| 1852 | |
| 1853 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1854 | return df |
| 1855 | |
| 1856 | |
| 1857 | @deferred(TESTCASE_TIMEOUT) |
| 1858 | def test_subscriber_with_voltha_deactivating_dhcp_app_in_onos(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1859 | """ |
| 1860 | Test Method: |
| 1861 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1862 | 1. OLT and ONU is detected and validated. |
| 1863 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1864 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 1865 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1866 | 5. Deactivate dhcp server app in onos. |
| 1867 | 6. Repeat step 3. |
| 1868 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 1869 | """ |
Thangavelu K S | 735a666 | 2017-06-15 18:08:23 +0000 | [diff] [blame] | 1870 | df = defer.Deferred() |
| 1871 | dhcp_app = 'org.onosproject.dhcp' |
| 1872 | def dhcp_flow_check_scenario(df): |
| 1873 | log_test.info('Enabling ponsim_olt') |
| 1874 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1875 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1876 | assert_not_equal(device_id, None) |
| 1877 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1878 | rest_port = self.VOLTHA_REST_PORT, |
| 1879 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1880 | time.sleep(10) |
| 1881 | switch_map = None |
| 1882 | olt_configured = False |
| 1883 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1884 | log_test.info('Installing OLT app') |
| 1885 | OnosCtrl.install_app(self.olt_app_file) |
| 1886 | time.sleep(5) |
| 1887 | log_test.info('Adding subscribers through OLT app') |
| 1888 | self.config_olt(switch_map) |
| 1889 | olt_configured = True |
| 1890 | time.sleep(5) |
| 1891 | # dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "desired_out_of_pool_ip_address") |
| 1892 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "app_deactivation",)) |
| 1893 | thread2 = threading.Thread(target = self.deactivate_apps, args = (dhcp_app,)) |
| 1894 | log_test.info('Restart dhcp app in onos during client send discover to voltha') |
| 1895 | thread2.start() |
| 1896 | time.sleep(randint(0,1)) |
| 1897 | thread1.start() |
| 1898 | time.sleep(10) |
| 1899 | thread1.join() |
| 1900 | thread2.join() |
| 1901 | try: |
| 1902 | assert_equal(self.success, True) |
| 1903 | #assert_equal(status, True) |
| 1904 | time.sleep(10) |
| 1905 | finally: |
| 1906 | self.voltha.disable_device(device_id, delete = True) |
| 1907 | self.remove_olt(switch_map) |
| 1908 | df.callback(0) |
| 1909 | |
| 1910 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1911 | return df |
| 1912 | |
| 1913 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1914 | def test_subscriber_with_voltha_for_dhcp_renew_time(self): |
| 1915 | """ |
| 1916 | Test Method: |
| 1917 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1918 | 1. OLT and ONU is detected and validated. |
| 1919 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1920 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 1921 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1922 | 5. Send dhcp renew packet to dhcp server which is running as onos app. |
| 1923 | 6. Repeat step 4. |
| 1924 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1925 | |
| 1926 | df = defer.Deferred() |
| 1927 | def dhcp_flow_check_scenario(df): |
| 1928 | log_test.info('Enabling ponsim_olt') |
| 1929 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1930 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1931 | assert_not_equal(device_id, None) |
| 1932 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1933 | rest_port = self.VOLTHA_REST_PORT, |
| 1934 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1935 | time.sleep(10) |
| 1936 | switch_map = None |
| 1937 | olt_configured = False |
| 1938 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1939 | log_test.info('Installing OLT app') |
| 1940 | OnosCtrl.install_app(self.olt_app_file) |
| 1941 | time.sleep(5) |
| 1942 | log_test.info('Adding subscribers through OLT app') |
| 1943 | self.config_olt(switch_map) |
| 1944 | olt_configured = True |
| 1945 | time.sleep(5) |
| 1946 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_renew") |
| 1947 | try: |
| 1948 | assert_equal(dhcp_status, True) |
| 1949 | #assert_equal(status, True) |
| 1950 | time.sleep(10) |
| 1951 | finally: |
| 1952 | self.voltha.disable_device(device_id, delete = True) |
| 1953 | self.remove_olt(switch_map) |
| 1954 | df.callback(0) |
| 1955 | |
| 1956 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 1957 | return df |
| 1958 | |
| 1959 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 1960 | def test_subscriber_with_voltha_for_dhcp_rebind_time(self): |
| 1961 | """ |
| 1962 | Test Method: |
| 1963 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 1964 | 1. OLT and ONU is detected and validated. |
| 1965 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 1966 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 1967 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 1968 | 5. Send dhcp rebind packet to dhcp server which is running as onos app. |
| 1969 | 6. Repeat step 4. |
| 1970 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 1971 | df = defer.Deferred() |
| 1972 | def dhcp_flow_check_scenario(df): |
| 1973 | log_test.info('Enabling ponsim_olt') |
| 1974 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 1975 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 1976 | assert_not_equal(device_id, None) |
| 1977 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 1978 | rest_port = self.VOLTHA_REST_PORT, |
| 1979 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 1980 | time.sleep(10) |
| 1981 | switch_map = None |
| 1982 | olt_configured = False |
| 1983 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 1984 | log_test.info('Installing OLT app') |
| 1985 | OnosCtrl.install_app(self.olt_app_file) |
| 1986 | time.sleep(5) |
| 1987 | log_test.info('Adding subscribers through OLT app') |
| 1988 | self.config_olt(switch_map) |
| 1989 | olt_configured = True |
| 1990 | time.sleep(5) |
| 1991 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT, "dhcp_rebind") |
| 1992 | try: |
| 1993 | assert_equal(dhcp_status, True) |
| 1994 | #assert_equal(status, True) |
| 1995 | time.sleep(10) |
| 1996 | finally: |
| 1997 | self.voltha.disable_device(device_id, delete = True) |
| 1998 | self.remove_olt(switch_map) |
| 1999 | df.callback(0) |
| 2000 | |
| 2001 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2002 | return df |
| 2003 | |
| 2004 | |
| 2005 | |
| 2006 | |
| 2007 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2008 | def test_subscriber_with_voltha_for_dhcp_disable_olt_in_voltha(self): |
| 2009 | """ |
| 2010 | Test Method: |
| 2011 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2012 | 1. OLT and ONU is detected and validated. |
| 2013 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2014 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2015 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2016 | 5. Disable olt devices which is being detected in voltha CLI. |
| 2017 | 6. Repeat step 3. |
| 2018 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 2019 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2020 | df = defer.Deferred() |
| 2021 | dhcp_app = 'org.onosproject.dhcp' |
| 2022 | def dhcp_flow_check_scenario(df): |
| 2023 | log_test.info('Enabling ponsim_olt') |
| 2024 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2025 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2026 | assert_not_equal(device_id, None) |
| 2027 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 2028 | rest_port = self.VOLTHA_REST_PORT, |
| 2029 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 2030 | time.sleep(10) |
| 2031 | switch_map = None |
| 2032 | olt_configured = False |
| 2033 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2034 | log_test.info('Installing OLT app') |
| 2035 | OnosCtrl.install_app(self.olt_app_file) |
| 2036 | time.sleep(5) |
| 2037 | log_test.info('Adding subscribers through OLT app') |
| 2038 | self.config_olt(switch_map) |
| 2039 | olt_configured = True |
| 2040 | time.sleep(5) |
| 2041 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 2042 | thread2 = threading.Thread(target = self.voltha.disable_device, args = (device_id,False,)) |
| 2043 | log_test.info('Disable the olt device in during client send discover to voltha') |
| 2044 | thread2.start() |
| 2045 | # time.sleep(randint(0,1)) |
| 2046 | thread1.start() |
| 2047 | time.sleep(10) |
| 2048 | thread1.join() |
| 2049 | thread2.join() |
| 2050 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2051 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2052 | #assert_equal(status, True) |
| 2053 | time.sleep(10) |
| 2054 | finally: |
| 2055 | self.voltha.disable_device(device_id, delete = True) |
| 2056 | self.remove_olt(switch_map) |
| 2057 | df.callback(0) |
| 2058 | |
| 2059 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2060 | return df |
| 2061 | |
| 2062 | |
| 2063 | @deferred(TESTCASE_TIMEOUT) |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2064 | def test_subscriber_with_voltha_for_dhcp_toggling_olt_in_voltha(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2065 | """ |
| 2066 | Test Method: |
| 2067 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2068 | 1. OLT and ONU is detected and validated. |
| 2069 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2070 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2071 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2072 | 5. Disable olt devices which is being detected in voltha CLI. |
| 2073 | 6. Repeat step 3. |
| 2074 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 2075 | 8. Enable olt devices which is being detected in voltha CLI. |
| 2076 | 9. Repeat steps 3 and 4. |
| 2077 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2078 | df = defer.Deferred() |
| 2079 | dhcp_app = 'org.onosproject.dhcp' |
| 2080 | def dhcp_flow_check_scenario(df): |
| 2081 | log_test.info('Enabling ponsim_olt') |
| 2082 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2083 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2084 | assert_not_equal(device_id, None) |
| 2085 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 2086 | rest_port = self.VOLTHA_REST_PORT, |
| 2087 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 2088 | time.sleep(10) |
| 2089 | switch_map = None |
| 2090 | olt_configured = False |
| 2091 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2092 | log_test.info('Installing OLT app') |
| 2093 | OnosCtrl.install_app(self.olt_app_file) |
| 2094 | time.sleep(5) |
| 2095 | log_test.info('Adding subscribers through OLT app') |
| 2096 | self.config_olt(switch_map) |
| 2097 | olt_configured = True |
| 2098 | time.sleep(5) |
| 2099 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 2100 | thread2 = threading.Thread(target = self.voltha.restart_device, args = (device_id,)) |
| 2101 | thread2.start() |
| 2102 | thread1.start() |
| 2103 | time.sleep(10) |
| 2104 | thread1.join() |
| 2105 | thread2.join() |
| 2106 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2107 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2108 | #assert_equal(status, True) |
| 2109 | time.sleep(10) |
| 2110 | finally: |
| 2111 | self.voltha.disable_device(device_id, delete = True) |
| 2112 | self.remove_olt(switch_map) |
| 2113 | df.callback(0) |
| 2114 | |
| 2115 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2116 | return df |
| 2117 | |
| 2118 | |
| 2119 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2120 | def test_subscriber_with_voltha_for_dhcp_disable_onu_port_in_voltha(self): |
| 2121 | """ |
| 2122 | Test Method: |
| 2123 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2124 | 1. OLT and ONU is detected and validated. |
| 2125 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2126 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2127 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2128 | 5. Disable onu port which is being detected in voltha CLI. |
| 2129 | 6. Repeat step 3. |
| 2130 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 2131 | """ |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2132 | df = defer.Deferred() |
| 2133 | dhcp_app = 'org.onosproject.dhcp' |
| 2134 | def dhcp_flow_check_scenario(df): |
| 2135 | log_test.info('Enabling ponsim_olt') |
| 2136 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2137 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2138 | assert_not_equal(device_id, None) |
| 2139 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 2140 | rest_port = self.VOLTHA_REST_PORT, |
| 2141 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 2142 | time.sleep(10) |
| 2143 | switch_map = None |
| 2144 | olt_configured = False |
| 2145 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2146 | log_test.info('Installing OLT app') |
| 2147 | OnosCtrl.install_app(self.olt_app_file) |
| 2148 | time.sleep(5) |
| 2149 | log_test.info('Adding subscribers through OLT app') |
| 2150 | self.config_olt(switch_map) |
| 2151 | olt_configured = True |
| 2152 | time.sleep(5) |
| 2153 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 2154 | thread2 = threading.Thread(target = self.voltha_uni_port_down_up) |
| 2155 | thread1.start() |
| 2156 | thread2.start() |
| 2157 | time.sleep(10) |
| 2158 | thread1.join() |
| 2159 | thread2.join() |
| 2160 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2161 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2162 | #assert_equal(status, True) |
| 2163 | time.sleep(10) |
| 2164 | finally: |
| 2165 | self.voltha.disable_device(device_id, delete = True) |
| 2166 | self.remove_olt(switch_map) |
| 2167 | df.callback(0) |
| 2168 | |
| 2169 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2170 | return df |
| 2171 | |
| 2172 | |
| 2173 | @deferred(TESTCASE_TIMEOUT) |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2174 | def test_subscriber_with_voltha_for_dhcp_toggling_onu_port_in_voltha(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2175 | """ |
| 2176 | Test Method: |
| 2177 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2178 | 1. OLT and ONU is detected and validated. |
| 2179 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2180 | 3. Send dhcp request from residential subscriber to dhcp server which is running as onos app. |
| 2181 | 4. Verify that subscriber get ip from dhcp server successfully. |
| 2182 | 5. Disable onu port which is being detected in voltha CLI. |
| 2183 | 6. Repeat step 3. |
| 2184 | 7. Verify that subscriber should not get ip from dhcp server, and ping to gateway. |
| 2185 | 8. Enable onu port which is being detected in voltha CLI. |
| 2186 | 9. Repeat steps 3 and 4. |
| 2187 | """ |
| 2188 | |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2189 | df = defer.Deferred() |
| 2190 | dhcp_app = 'org.onosproject.dhcp' |
| 2191 | def dhcp_flow_check_scenario(df): |
| 2192 | log_test.info('Enabling ponsim_olt') |
| 2193 | ponsim_address = '{}:50060'.format(self.VOLTHA_HOST) |
| 2194 | device_id, status = self.voltha.enable_device('ponsim_olt', address = ponsim_address) |
| 2195 | assert_not_equal(device_id, None) |
| 2196 | voltha = VolthaCtrl(self.VOLTHA_HOST, |
| 2197 | rest_port = self.VOLTHA_REST_PORT, |
| 2198 | uplink_vlan_map = self.VOLTHA_UPLINK_VLAN_MAP) |
| 2199 | time.sleep(10) |
| 2200 | switch_map = None |
| 2201 | olt_configured = False |
| 2202 | switch_map = voltha.config(fake = self.VOLTHA_CONFIG_FAKE) |
| 2203 | log_test.info('Installing OLT app') |
| 2204 | OnosCtrl.install_app(self.olt_app_file) |
| 2205 | time.sleep(5) |
| 2206 | log_test.info('Adding subscribers through OLT app') |
| 2207 | self.config_olt(switch_map) |
| 2208 | olt_configured = True |
| 2209 | time.sleep(5) |
| 2210 | thread1 = threading.Thread(target = self.dhcp_flow_check, args = (self.INTF_RX_DEFAULT, "interrupting_dhcp_flows",)) |
| 2211 | thread2 = threading.Thread(target = self.voltha_uni_port_down_up) |
| 2212 | log_test.info('Restart dhcp app in onos during client send discover to voltha') |
| 2213 | thread2.start() |
| 2214 | time.sleep(randint(0,1)) |
| 2215 | thread1.start() |
| 2216 | time.sleep(10) |
| 2217 | thread1.join() |
| 2218 | thread2.join() |
| 2219 | dhcp_status = self.dhcp_flow_check(self.INTF_RX_DEFAULT) |
| 2220 | assert_equal(dhcp_status, True) |
| 2221 | try: |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2222 | assert_equal(self.success, True) |
Thangavelu K S | 0f2c523 | 2017-06-19 19:11:43 +0000 | [diff] [blame] | 2223 | #assert_equal(status, True) |
| 2224 | time.sleep(10) |
| 2225 | finally: |
| 2226 | self.voltha.disable_device(device_id, delete = True) |
| 2227 | self.remove_olt(switch_map) |
| 2228 | df.callback(0) |
| 2229 | |
| 2230 | reactor.callLater(0, dhcp_flow_check_scenario, df) |
| 2231 | return df |
| 2232 | |
| 2233 | |
| 2234 | @deferred(TESTCASE_TIMEOUT) |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2235 | def test_two_subscriber_with_voltha_for_dhcp_discover(self): |
| 2236 | """ |
| 2237 | Test Method: |
| 2238 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2239 | 1. OLT and ONU is detected and validated. |
| 2240 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2241 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2242 | 4. Verify that subscribers had got different ips from dhcp server successfully. |
| 2243 | """ |
| 2244 | |
| 2245 | def test_two_subscriber_with_voltha_for_dhcp_multiple_discover(self): |
| 2246 | """ |
| 2247 | Test Method: |
| 2248 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2249 | 1. OLT and ONU is detected and validated. |
| 2250 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2251 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2252 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2253 | 5. Repeat step 3 and 4 for 10 times for both subscribers. |
| 2254 | 6 Verify that subscribers should get same ips which are offered the first time from dhcp server. |
| 2255 | """ |
| 2256 | def test_two_subscriber_with_voltha_for_dhcp_multiple_discover_for_one_subscriber(self): |
| 2257 | """ |
| 2258 | Test Method: |
| 2259 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2260 | 1. OLT and ONU is detected and validated. |
| 2261 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2262 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2263 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2264 | 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber. |
| 2265 | 6 Verify that subscriber should get same ip which is offered the first time from dhcp server and other subscriber ping to gateway should not failed |
| 2266 | """ |
| 2267 | def test_two_subscriber_with_voltha_for_dhcp_discover_desired_ip_address_for_one_subscriber(self): |
| 2268 | """ |
| 2269 | Test Method: |
| 2270 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2271 | 1. OLT and ONU is detected and validated. |
| 2272 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2273 | 3. Send dhcp request from one residential subscriber to dhcp server which is running as onos app. |
| 2274 | 3. Send dhcp request with desired ip from other residential subscriber to dhcp server which is running as onos app. |
| 2275 | 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from dhcp server successfully. |
| 2276 | """ |
| 2277 | def test_two_subscriber_with_voltha_for_dhcp_discover_within_and_wothout_dhcp_pool_ip_addresses(self): |
| 2278 | """ |
| 2279 | Test Method: |
| 2280 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2281 | 1. OLT and ONU is detected and validated. |
| 2282 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2283 | 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to dhcp server which is running as onos app. |
| 2284 | 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to dhcp server which is running as onos app. |
| 2285 | 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from dhcp server successfully. |
| 2286 | """ |
| 2287 | def test_two_subscriber_with_voltha_for_dhcp_disable_onu_port_for_one_subscriber(self): |
| 2288 | """ |
| 2289 | Test Method: |
| 2290 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2291 | 1. OLT and ONU is detected and validated. |
| 2292 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2293 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2294 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2295 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 2296 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 2297 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 2298 | """ |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2299 | def test_two_subscriber_with_voltha_for_dhcp_toggling_onu_port_for_one_subscriber(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2300 | """ |
| 2301 | Test Method: |
| 2302 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2303 | 1. OLT and ONU is detected and validated. |
| 2304 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2305 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2306 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2307 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 2308 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 2309 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 2310 | 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber. |
| 2311 | 9. Repeat step 3 and 4 for one subscriber where uni port is up now. |
| 2312 | 10. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 2313 | """ |
| 2314 | def test_two_subscriber_with_voltha_for_dhcp_disable_olt_detected_in_voltha(self): |
| 2315 | """ |
| 2316 | Test Method: |
| 2317 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2318 | 1. OLT and ONU is detected and validated. |
| 2319 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2320 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2321 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2322 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 2323 | 6. Disable the olt device which is detected in voltha. |
| 2324 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed. |
| 2325 | """ |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2326 | def test_two_subscriber_with_voltha_for_dhcp_toggling_olt_detected_in_voltha(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2327 | """ |
| 2328 | Test Method: |
| 2329 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2330 | 1. OLT and ONU is detected and validated. |
| 2331 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2332 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2333 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2334 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 2335 | 6. Disable the olt device which is detected in voltha. |
| 2336 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed. |
| 2337 | 8. Enable the olt device which is detected in voltha. |
| 2338 | 9. Verify that subscriber should get ip from dhcp server and other subscriber ping to gateway should not failed. |
| 2339 | """ |
| 2340 | def test_two_subscriber_with_voltha_for_dhcp_pause_olt_detected_in_voltha(self): |
| 2341 | """ |
| 2342 | Test Method: |
| 2343 | 0. Make sure that voltha is up and running on CORD-POD setup. |
| 2344 | 1. OLT and ONU is detected and validated. |
| 2345 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2346 | 3. Send dhcp request from two residential subscribers to dhcp server which is running as onos app. |
| 2347 | 4. Verify that subscribers had got ip from dhcp server successfully. |
| 2348 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 2349 | 6. Pause the olt device which is detected in voltha. |
| 2350 | 7. Verify that subscriber should not get ip from dhcp server and other subscriber ping to gateway should failed. |
| 2351 | """ |
| 2352 | def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request(self): |
| 2353 | """ |
| 2354 | Test Method: |
| 2355 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2356 | 1. OLT and ONU is detected and validated. |
| 2357 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2358 | 3. Send dhcp request from residential subscrber to external dhcp server. |
| 2359 | 4. Verify that subscriber get ip from external dhcp server successfully. |
| 2360 | """ |
| 2361 | |
| 2362 | def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_broadcast_source_mac(self): |
| 2363 | """ |
| 2364 | Test Method: |
| 2365 | 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup. |
| 2366 | 1. OLT and ONU is detected and validated. |
| 2367 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2368 | 3. Send dhcp request with invalid source mac broadcast from residential subscrber to external dhcp server. |
| 2369 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 2370 | """ |
| 2371 | |
| 2372 | def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_multicast_source_mac(self): |
| 2373 | """ |
| 2374 | Test Method: |
| 2375 | 0. Make sure that voltha and external dhcp server are is up and running on CORD-POD setup. |
| 2376 | 1. OLT and ONU is detected and validated. |
| 2377 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2378 | 3. Send dhcp request with invalid source mac multicast from residential subscrber to external dhcp server. |
| 2379 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 2380 | """ |
| 2381 | |
| 2382 | def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_with_invalid_source_mac(self): |
| 2383 | """ |
| 2384 | Test Method: |
| 2385 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2386 | 1. OLT and ONU is detected and validated. |
| 2387 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2388 | 3. Send dhcp request with invalid source mac zero from residential subscrber to external dhcp server. |
| 2389 | 4. Verify that subscriber should not get ip from external dhcp server. |
| 2390 | """ |
| 2391 | |
| 2392 | def test_subscriber_with_voltha_for_dhcpRelay_dhcp_request_and_release(self): |
| 2393 | """ |
| 2394 | Test Method: |
| 2395 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2396 | 1. OLT and ONU is detected and validated. |
| 2397 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2398 | 3. Send dhcp request from residential subscrber to external dhcp server. |
| 2399 | 4. Verify that subscriber get ip from external dhcp server successfully. |
| 2400 | 5. Send dhcp release from residential subscrber to external dhcp server. |
| 2401 | 6 Verify that subscriber should not get ip from external dhcp server, ping to gateway. |
| 2402 | """ |
| 2403 | |
| 2404 | def test_subscriber_with_voltha_for_dhcpRelay_starvation(self): |
| 2405 | """ |
| 2406 | Test Method: |
| 2407 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2408 | 1. OLT and ONU is detected and validated. |
| 2409 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2410 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2411 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2412 | 5. Repeat step 3 and 4 for 10 times. |
| 2413 | 6 Verify that subscriber should get ip from external dhcp server.. |
| 2414 | """ |
| 2415 | |
| 2416 | def test_subscriber_with_voltha_for_dhcpRelay_starvation_negative_scenario(self): |
| 2417 | """ |
| 2418 | Test Method: |
| 2419 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2420 | 1. OLT and ONU is detected and validated. |
| 2421 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2422 | 3. Send dhcp request from residential subscriber without of pool ip to external dhcp server. |
| 2423 | 4. Verify that subscriber should not get ip from external dhcp server.. |
| 2424 | 5. Repeat steps 3 and 4 for 10 times. |
| 2425 | 6 Verify that subscriber should not get ip from external dhcp server.. |
| 2426 | """ |
| 2427 | def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_discover(self): |
| 2428 | """ |
| 2429 | Test Method: |
| 2430 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2431 | 1. OLT and ONU is detected and validated. |
| 2432 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2433 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2434 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2435 | 5. Repeat step 3 for 50 times. |
| 2436 | 6 Verify that subscriber should get same ip which was received from 1st discover from external dhcp server.. |
| 2437 | """ |
| 2438 | def test_subscriber_with_voltha_for_dhcpRelay_sending_multiple_request(self): |
| 2439 | """ |
| 2440 | Test Method: |
| 2441 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2442 | 1. OLT and ONU is detected and validated. |
| 2443 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2444 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2445 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2446 | 5. Send DHCP request to external dhcp server. |
| 2447 | 6. Repeat step 5 for 50 times. |
| 2448 | 7. Verify that subscriber should get same ip which was received from 1st discover from external dhcp server.. |
| 2449 | """ |
| 2450 | |
| 2451 | def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_ip_address(self): |
| 2452 | """ |
| 2453 | Test Method: |
| 2454 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2455 | 1. OLT and ONU is detected and validated. |
| 2456 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2457 | 3. Send dhcp request with desired ip address from residential subscriber to external dhcp server. |
| 2458 | 4. Verify that subscriber get ip which was requested in step 3 from external dhcp server. successfully. |
| 2459 | """ |
| 2460 | |
| 2461 | def test_subscriber_with_voltha_for_dhcpRelay_requesting_desired_out_of_pool_ip_address(self): |
| 2462 | """ |
| 2463 | Test Method: |
| 2464 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2465 | 1. OLT and ONU is detected and validated. |
| 2466 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2467 | 3. Send dhcp request with desired out of pool ip address from residential subscriber to external dhcp server. |
| 2468 | 4. Verify that subscriber should not get ip which was requested in step 3 from external dhcp server., and its offered only within dhcp pool of ip. |
| 2469 | """ |
| 2470 | |
| 2471 | def test_subscriber_with_voltha_for_dhcpRelay_deactivating_dhcpRelay_app_in_onos(self): |
| 2472 | """ |
| 2473 | Test Method: |
| 2474 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2475 | 1. OLT and ONU is detected and validated. |
| 2476 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2477 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2478 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2479 | 5. Deactivate dhcp server app in onos. |
| 2480 | 6. Repeat step 3. |
| 2481 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 2482 | """ |
| 2483 | |
| 2484 | def test_subscriber_with_voltha_for_dhcpRelay_renew_time(self): |
| 2485 | """ |
| 2486 | Test Method: |
| 2487 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2488 | 1. OLT and ONU is detected and validated. |
| 2489 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2490 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2491 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2492 | 5. Send dhcp renew packet to external dhcp server. |
| 2493 | 6. Repeat step 4. |
| 2494 | """ |
| 2495 | |
| 2496 | def test_subscriber_with_voltha_for_dhcpRelay_rebind_time(self): |
| 2497 | """ |
| 2498 | Test Method: |
| 2499 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2500 | 1. OLT and ONU is detected and validated. |
| 2501 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2502 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2503 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2504 | 5. Send dhcp rebind packet to external dhcp server. |
| 2505 | 6. Repeat step 4. |
| 2506 | """ |
| 2507 | |
| 2508 | def test_subscriber_with_voltha_for_dhcpRelay_disable_olt_in_voltha(self): |
| 2509 | """ |
| 2510 | Test Method: |
| 2511 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2512 | 1. OLT and ONU is detected and validated. |
| 2513 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2514 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2515 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2516 | 5. Disable olt devices which is being detected in voltha CLI. |
| 2517 | 6. Repeat step 3. |
| 2518 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 2519 | """ |
| 2520 | |
| 2521 | def test_subscriber_with_voltha_for_dhcpRelay_toggling_olt_in_voltha(self): |
| 2522 | """ |
| 2523 | Test Method: |
| 2524 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2525 | 1. OLT and ONU is detected and validated. |
| 2526 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2527 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2528 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2529 | 5. Disable olt devices which is being detected in voltha CLI. |
| 2530 | 6. Repeat step 3. |
| 2531 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 2532 | 8. Enable olt devices which is being detected in voltha CLI. |
| 2533 | 9. Repeat steps 3 and 4. |
| 2534 | """ |
| 2535 | |
| 2536 | def test_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_in_voltha(self): |
| 2537 | """ |
| 2538 | Test Method: |
| 2539 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2540 | 1. OLT and ONU is detected and validated. |
| 2541 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2542 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2543 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2544 | 5. Disable onu port which is being detected in voltha CLI. |
| 2545 | 6. Repeat step 3. |
| 2546 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 2547 | """ |
| 2548 | |
Chetan Gaonker | cf37f26 | 2017-06-19 19:11:11 +0000 | [diff] [blame] | 2549 | def test_subscriber_with_voltha_for_dhcpRelay_toggling_onu_port_in_voltha(self): |
Thangavelu K S | 057b7d2 | 2017-05-16 22:03:22 +0000 | [diff] [blame] | 2550 | """ |
| 2551 | Test Method: |
| 2552 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2553 | 1. OLT and ONU is detected and validated. |
| 2554 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2555 | 3. Send dhcp request from residential subscriber to external dhcp server. |
| 2556 | 4. Verify that subscriber get ip from external dhcp server. successfully. |
| 2557 | 5. Disable onu port which is being detected in voltha CLI. |
| 2558 | 6. Repeat step 3. |
| 2559 | 7. Verify that subscriber should not get ip from external dhcp server., and ping to gateway. |
| 2560 | 8. Enable onu port which is being detected in voltha CLI. |
| 2561 | 9. Repeat steps 3 and 4. |
| 2562 | """ |
| 2563 | |
| 2564 | def test_two_subscriber_with_voltha_for_dhcpRelay_discover(self): |
| 2565 | """ |
| 2566 | Test Method: |
| 2567 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2568 | 1. OLT and ONU is detected and validated. |
| 2569 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2570 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2571 | 4. Verify that subscribers had got different ips from external dhcp server. successfully. |
| 2572 | """ |
| 2573 | |
| 2574 | def test_two_subscriber_with_voltha_for_dhcpRelay_multiple_discover(self): |
| 2575 | """ |
| 2576 | Test Method: |
| 2577 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2578 | 1. OLT and ONU is detected and validated. |
| 2579 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2580 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2581 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2582 | 5. Repeat step 3 and 4 for 10 times for both subscribers. |
| 2583 | 6 Verify that subscribers should get same ips which are offered the first time from external dhcp server.. |
| 2584 | """ |
| 2585 | |
| 2586 | def test_two_subscriber_with_voltha_for_dhcpRelay_multiple_discover_for_one_subscriber(self): |
| 2587 | """ |
| 2588 | Test Method: |
| 2589 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2590 | 1. OLT and ONU is detected and validated. |
| 2591 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2592 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2593 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2594 | 5. Repeat step 3 and 4 for 10 times for only one subscriber and ping to gateway from other subscriber. |
| 2595 | 6 Verify that subscriber should get same ip which is offered the first time from external dhcp server. and other subscriber ping to gateway should not failed |
| 2596 | """ |
| 2597 | |
| 2598 | def test_two_subscriber_with_voltha_for_dhcpRelay_discover_desired_ip_address_for_one_subscriber(self): |
| 2599 | """ |
| 2600 | Test Method: |
| 2601 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2602 | 1. OLT and ONU is detected and validated. |
| 2603 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2604 | 3. Send dhcp request from one residential subscriber to external dhcp server. |
| 2605 | 3. Send dhcp request with desired ip from other residential subscriber to external dhcp server. |
| 2606 | 4. Verify that subscribers had got different ips (one subscriber desired ip and other subscriber random ip) from external dhcp server. successfully. |
| 2607 | """ |
| 2608 | |
| 2609 | def test_two_subscriber_with_voltha_for_dhcpRelay_discover_in_range_and_out_of_range_from_dhcp_pool_ip_addresses(self): |
| 2610 | """ |
| 2611 | Test Method: |
| 2612 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2613 | 1. OLT and ONU is detected and validated. |
| 2614 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2615 | 3. Send dhcp request with desired wihtin dhcp pool ip from one residential subscriber to external dhcp server. |
| 2616 | 3. Send dhcp request with desired without in dhcp pool ip from other residential subscriber to external dhcp server. |
| 2617 | 4. Verify that subscribers had got different ips (both subscriber got random ips within dhcp pool) from external dhcp server. successfully. |
| 2618 | """ |
| 2619 | |
| 2620 | def test_two_subscriber_with_voltha_for_dhcpRelay_disable_onu_port_for_one_subscriber(self): |
| 2621 | """ |
| 2622 | Test Method: |
| 2623 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2624 | 1. OLT and ONU is detected and validated. |
| 2625 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2626 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2627 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2628 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 2629 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 2630 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 2631 | """ |
| 2632 | |
| 2633 | def test_two_subscriber_with_voltha_for_dhcpRelay_toggle_onu_port_for_one_subscriber(self): |
| 2634 | """ |
| 2635 | Test Method: |
| 2636 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2637 | 1. OLT and ONU is detected and validated. |
| 2638 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2639 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2640 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2641 | 5. Disable onu port on which access one subscriber and ping to gateway from other subscriber. |
| 2642 | 6. Repeat step 3 and 4 for one subscriber where uni port is down. |
| 2643 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 2644 | 8. Enable onu port on which was disable at step 5 and ping to gateway from other subscriber. |
| 2645 | 9. Repeat step 3 and 4 for one subscriber where uni port is up now. |
| 2646 | 10. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 2647 | """ |
| 2648 | |
| 2649 | def test_two_subscriber_with_voltha_for_dhcpRelay_disable_olt_detected_in_voltha(self): |
| 2650 | """ |
| 2651 | Test Method: |
| 2652 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2653 | 1. OLT and ONU is detected and validated. |
| 2654 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2655 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2656 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2657 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 2658 | 6. Disable the olt device which is detected in voltha. |
| 2659 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 2660 | """ |
| 2661 | |
| 2662 | def test_two_subscriber_with_voltha_for_dhcpRelay_toggle_olt_detected_in_voltha(self): |
| 2663 | """ |
| 2664 | Test Method: |
| 2665 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2666 | 1. OLT and ONU is detected and validated. |
| 2667 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2668 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2669 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2670 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 2671 | 6. Disable the olt device which is detected in voltha. |
| 2672 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 2673 | 8. Enable the olt device which is detected in voltha. |
| 2674 | 9. Verify that subscriber should get ip from external dhcp server. and other subscriber ping to gateway should not failed. |
| 2675 | """ |
| 2676 | |
| 2677 | def test_two_subscriber_with_voltha_for_dhcpRelay_pause_olt_detected_in_voltha(self): |
| 2678 | """ |
| 2679 | Test Method: |
| 2680 | 0. Make sure that voltha and external dhcp server are up and running on CORD-POD setup. |
| 2681 | 1. OLT and ONU is detected and validated. |
| 2682 | 2. Issue tls auth packets from CORD TESTER voltha test module acting as a subscriber.. |
| 2683 | 3. Send dhcp request from two residential subscribers to external dhcp server. |
| 2684 | 4. Verify that subscribers had got ip from external dhcp server. successfully. |
| 2685 | 5. Start pinging continuously from one subscriber and repeat steps 3 and 4 for other subscriber. |
| 2686 | 6. Pause the olt device which is detected in voltha. |
| 2687 | 7. Verify that subscriber should not get ip from external dhcp server. and other subscriber ping to gateway should failed. |
| 2688 | """ |