Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 1 | #copyright 2016-present Ciena Corporation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | import time |
| 16 | import os |
| 17 | import sys |
| 18 | import json |
| 19 | import requests |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 20 | import random |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 21 | from nose.tools import * |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 22 | from scapy.all import * |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 23 | from twisted.internet import defer |
| 24 | from nose.twistedtools import reactor, deferred |
| 25 | from CordTestUtils import * |
| 26 | from OltConfig import OltConfig |
| 27 | from onosclidriver import OnosCliDriver |
| 28 | from SSHTestAgent import SSHTestAgent |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 29 | from Channels import Channels, IgmpChannel |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 30 | from IGMP import * |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 31 | from CordLogger import CordLogger |
| 32 | from VSGAccess import VSGAccess |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 33 | from OnosFlowCtrl import OnosFlowCtrl |
| 34 | #imports for cord-subscriber module |
| 35 | from subscriberDb import SubscriberDB |
| 36 | from Stats import Stats |
| 37 | from threadPool import ThreadPool |
| 38 | import threading |
| 39 | from EapTLS import TLSAuthTest |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 40 | from CordTestUtils import log_test as log |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 41 | from CordTestConfig import setup_module, running_on_ciab |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 42 | from OnosCtrl import OnosCtrl |
| 43 | from CordContainer import Onos |
A R Karthick | ed3a2ca | 2017-07-06 15:50:03 -0700 | [diff] [blame] | 44 | from CordSubscriberUtils import CordSubscriberUtils, XosUtils |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 45 | from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart, cord_test_shell, cord_test_radius_restart |
| 46 | from Scale import scale |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 47 | log.setLevel('INFO') |
| 48 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 49 | |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 50 | class scale_exchange(CordLogger): |
| 51 | HOST = "10.1.0.1" |
| 52 | USER = "vagrant" |
| 53 | PASS = "vagrant" |
| 54 | head_node = os.getenv('HEAD_NODE', 'prod') |
| 55 | HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node |
| 56 | test_path = os.path.dirname(os.path.realpath(__file__)) |
| 57 | olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json')) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 58 | restApiXos = None |
| 59 | cord_subscriber = None |
A R Karthick | ed3a2ca | 2017-07-06 15:50:03 -0700 | [diff] [blame] | 60 | SUBSCRIBER_ACCOUNT_NUM = 100 |
| 61 | SUBSCRIBER_S_TAG = 500 |
| 62 | SUBSCRIBER_C_TAG = 500 |
| 63 | SUBSCRIBERS_PER_S_TAG = 8 |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 64 | subscriber_info = [] |
| 65 | volt_subscriber_info = [] |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 66 | restore_methods = [] |
| 67 | TIMEOUT=120 |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 68 | NUM_SUBSCRIBERS = 16 |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 69 | wan_intf_ip = '10.6.1.129' |
| 70 | V_INF1 = 'veth0' |
| 71 | V_INF2 = 'veth1' |
| 72 | MGROUP1 = '239.1.2.3' |
| 73 | MGROUP2 = '239.2.2.3' |
| 74 | MINVALIDGROUP1 = '255.255.255.255' |
| 75 | MINVALIDGROUP2 = '239.255.255.255' |
| 76 | MMACGROUP1 = "01:00:5e:01:02:03" |
| 77 | MMACGROUP2 = "01:00:5e:02:02:03" |
| 78 | IGMP_DST_MAC = "01:00:5e:00:00:16" |
| 79 | IGMP_SRC_MAC = "5a:e1:ac:ec:4d:a1" |
| 80 | IP_SRC = '1.2.3.4' |
| 81 | IP_DST = '224.0.0.22' |
| 82 | igmp_eth = Ether(dst = IGMP_DST_MAC, type = ETH_P_IP) |
| 83 | igmp_ip = IP(dst = IP_DST) |
| 84 | PORT_TX_DEFAULT = 2 |
| 85 | PORT_RX_DEFAULT = 1 |
| 86 | igmp_app = 'org.opencord.igmp' |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 87 | acl_app = 'org.onosproject.acl' |
| 88 | aaa_app = 'org.opencord.aaa' |
| 89 | app = 'org.onosproject.cli' |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 90 | APP_NAME = 'org.ciena.xconnect' |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 91 | INTF_TX_DEFAULT = 'veth2' |
| 92 | INTF_RX_DEFAULT = 'veth0' |
| 93 | default_port_map = { |
| 94 | PORT_TX_DEFAULT : INTF_TX_DEFAULT, |
| 95 | PORT_RX_DEFAULT : INTF_RX_DEFAULT, |
| 96 | INTF_TX_DEFAULT : PORT_TX_DEFAULT, |
| 97 | INTF_RX_DEFAULT : PORT_RX_DEFAULT |
| 98 | } |
| 99 | vrouter_apps = ('org.onosproject.proxyarp', 'org.onosproject.hostprovider', 'org.onosproject.vrouter', 'org.onosproject.fwd') |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 100 | MAX_PORTS = 100 |
| 101 | subscriber_apps = ('org.opencord.aaa', 'org.onosproject.dhcp') |
| 102 | olt_apps = () #'org.opencord.cordmcast') |
| 103 | vtn_app = 'org.opencord.vtn' |
| 104 | table_app = 'org.ciena.cordigmp' |
| 105 | aaa_loaded = False |
| 106 | table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar') |
| 107 | app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar') |
| 108 | olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar') |
| 109 | olt_app_name = 'org.onosproject.olt' |
| 110 | onos_config_path = os.path.join(test_path, '..', 'setup/onos-config') |
| 111 | cpqd_path = os.path.join(test_path, '..', 'setup') |
| 112 | ovs_path = cpqd_path |
| 113 | test_services = ('IGMP', 'TRAFFIC') |
| 114 | num_joins = 0 |
| 115 | num_subscribers = 0 |
| 116 | leave_flag = True |
| 117 | num_channels = 0 |
| 118 | recv_timeout = False |
| 119 | onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0))) |
| 120 | SUBSCRIBER_TIMEOUT = 300 |
| 121 | device_id = 'of:' + get_mac() |
| 122 | |
| 123 | CLIENT_CERT = """-----BEGIN CERTIFICATE----- |
| 124 | MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 125 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 126 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 127 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN |
| 128 | MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 129 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 130 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC |
| 131 | gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe |
| 132 | +9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg |
| 133 | rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD |
| 134 | VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l |
| 135 | eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY |
| 136 | 6tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC |
| 137 | PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC |
| 138 | nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug== |
| 139 | -----END CERTIFICATE-----""" |
| 140 | |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 141 | CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE----- |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 142 | MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx |
| 143 | CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h |
| 144 | IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd |
| 145 | RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN |
| 146 | MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV |
| 147 | BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI |
| 148 | hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC |
| 149 | AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ |
| 150 | 5An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK |
| 151 | tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR |
| 152 | OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21 |
| 153 | qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39 |
| 154 | 2Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB |
| 155 | BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l |
| 156 | eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV |
| 157 | MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn |
| 158 | VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP |
| 159 | RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ |
| 160 | dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3 |
| 161 | T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt |
| 162 | yg== |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 163 | -----END CERTIFICATE-----''' |
| 164 | |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 165 | @classmethod |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 166 | def setUpCordApi(cls): |
A R Karthick | 037cb98 | 2017-07-07 17:35:30 -0700 | [diff] [blame] | 167 | num_subscribers = max(cls.NUM_SUBSCRIBERS, 10) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 168 | cls.cord_subscriber = CordSubscriberUtils(num_subscribers, |
| 169 | account_num = cls.SUBSCRIBER_ACCOUNT_NUM, |
| 170 | s_tag = cls.SUBSCRIBER_S_TAG, |
| 171 | c_tag = cls.SUBSCRIBER_C_TAG, |
| 172 | subscribers_per_s_tag = cls.SUBSCRIBERS_PER_S_TAG) |
| 173 | cls.restApiXos = XosUtils.getRestApi() |
| 174 | |
| 175 | @classmethod |
| 176 | def setUpClass(cls): |
| 177 | log.info('in setUp class 00000000000000') |
| 178 | cls.controllers = get_controllers() |
| 179 | cls.controller = cls.controllers[0] |
| 180 | cls.cli = None |
| 181 | cls.on_pod = running_on_pod() |
| 182 | cls.on_ciab = running_on_ciab() |
| 183 | cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 184 | cls.vcpes = cls.olt.get_vcpes() |
| 185 | cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp') |
| 186 | cls.vcpes_reserved = cls.olt.get_vcpes_by_type('reserved') |
| 187 | cls.dhcp_vcpes_reserved = [ 'vcpe{}.{}.{}'.format(i, cls.vcpes_reserved[i]['s_tag'], cls.vcpes_reserved[i]['c_tag']) |
| 188 | for i in xrange(len(cls.vcpes_reserved)) ] |
| 189 | cls.untagged_dhcp_vcpes_reserved = [ 'vcpe{}'.format(i) for i in xrange(len(cls.vcpes_reserved)) ] |
| 190 | cls.container_vcpes_reserved = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_reserved ] |
| 191 | vcpe_dhcp_reserved = None |
| 192 | vcpe_container_reserved = None |
| 193 | if cls.vcpes_reserved: |
| 194 | vcpe_dhcp_reserved = cls.dhcp_vcpes_reserved[0] |
| 195 | if cls.on_pod is False: |
| 196 | vcpe_dhcp_reserved = cls.untagged_dhcp_vcpes_reserved[0] |
| 197 | vcpe_container_reserved = cls.container_vcpes_reserved[0] |
| 198 | |
| 199 | cls.vcpe_dhcp_reserved = vcpe_dhcp_reserved |
| 200 | cls.vcpe_container_reserved = vcpe_container_reserved |
| 201 | dhcp_vcpe_offset = len(cls.vcpes_reserved) |
| 202 | cls.dhcp_vcpes = [ 'vcpe{}.{}.{}'.format(i+dhcp_vcpe_offset, cls.vcpes_dhcp[i]['s_tag'], cls.vcpes_dhcp[i]['c_tag']) |
| 203 | for i in xrange(len(cls.vcpes_dhcp)) ] |
| 204 | cls.untagged_dhcp_vcpes = [ 'vcpe{}'.format(i+dhcp_vcpe_offset) for i in xrange(len(cls.vcpes_dhcp)) ] |
| 205 | cls.container_vcpes = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_dhcp ] |
| 206 | vcpe_dhcp = None |
| 207 | vcpe_container = None |
| 208 | #cache the first dhcp vcpe in the class for quick testing |
| 209 | if cls.vcpes_dhcp: |
| 210 | vcpe_container = cls.container_vcpes[0] |
| 211 | vcpe_dhcp = cls.dhcp_vcpes[0] |
| 212 | if cls.on_pod is False: |
| 213 | vcpe_dhcp = cls.untagged_dhcp_vcpes[0] |
| 214 | cls.vcpe_container = vcpe_container_reserved or vcpe_container |
| 215 | cls.vcpe_dhcp = vcpe_dhcp_reserved or vcpe_dhcp |
| 216 | VSGAccess.setUp() |
| 217 | cls.setUpCordApi() |
| 218 | if cls.on_pod is True: |
| 219 | cls.openVCPEAccess(cls.cord_subscriber.volt_subscriber_info) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 220 | |
| 221 | @classmethod |
| 222 | def tearDownClass(cls): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 223 | VSGAccess.tearDown() |
| 224 | if cls.on_pod is True: |
| 225 | cls.closeVCPEAccess(cls.cord_subscriber.volt_subscriber_info) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 226 | |
| 227 | def log_set(self, level = None, app = 'org.onosproject'): |
| 228 | CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 229 | ######################## vsg - vcpe utility functions ######################### |
| 230 | @classmethod |
| 231 | def closeVCPEAccess(cls, volt_subscriber_info): |
| 232 | OnosCtrl.uninstall_app(cls.APP_NAME, onos_ip = cls.HEAD_NODE) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 233 | |
| 234 | @classmethod |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 235 | def openVCPEAccess(cls, volt_subscriber_info): |
| 236 | """ |
| 237 | This code is used to configure leaf switch for head node access to compute node over fabric. |
| 238 | Care is to be taken to avoid overwriting existing/default vcpe flows. |
| 239 | The access is opened for generated subscriber info which should not overlap. |
| 240 | We target the fabric onos instance on head node. |
| 241 | """ |
| 242 | version = Onos.getVersion(onos_ip = cls.HEAD_NODE) |
| 243 | app_version = '1.0-SNAPSHOT' |
| 244 | major = int(version.split('.')[0]) |
| 245 | minor = int(version.split('.')[1]) |
| 246 | if major > 1: |
| 247 | app_version = '2.0-SNAPSHOT' |
| 248 | elif major == 1 and minor > 10: |
| 249 | app_version = '2.0-SNAPSHOT' |
| 250 | cls.APP_FILE = os.path.join(cls.test_path, '..', 'apps/xconnect-{}.oar'.format(app_version)) |
| 251 | OnosCtrl.install_app(cls.APP_FILE, onos_ip = cls.HEAD_NODE) |
| 252 | time.sleep(2) |
| 253 | s_tags = map(lambda tenant: int(tenant['voltTenant']['s_tag']), volt_subscriber_info) |
| 254 | #only get unique vlan tags |
| 255 | s_tags = list(set(s_tags)) |
| 256 | devices = OnosCtrl.get_device_ids(controller = cls.HEAD_NODE) |
| 257 | if devices: |
| 258 | device_config = {} |
| 259 | for device in devices: |
| 260 | device_config[device] = [] |
| 261 | for s_tag in s_tags: |
| 262 | xconnect_config = {'vlan': s_tag, 'ports' : [ cls.FABRIC_PORT_HEAD_NODE, cls.FABRIC_PORT_COMPUTE_NODE ] } |
| 263 | device_config[device].append(xconnect_config) |
| 264 | |
| 265 | cfg = { 'apps' : { 'org.ciena.xconnect' : { 'xconnectTestConfig' : device_config } } } |
| 266 | OnosCtrl.config(cfg, controller = cls.HEAD_NODE) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 267 | |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 268 | def get_system_cpu_usage(self): |
| 269 | """ Getting compute node CPU usage """ |
| 270 | ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS) |
| 271 | cmd = "top -b -n1 | grep 'Cpu(s)' | awk '{print $2 + $4}'" |
| 272 | status, output = ssh_agent.run_cmd(cmd) |
| 273 | assert_equal(status, True) |
| 274 | return float(output) |
| 275 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 276 | def vsg_for_external_connectivity(self, subscriber_index, reserved = False): |
| 277 | if reserved is True: |
| 278 | if self.on_pod is True: |
| 279 | vcpe = self.dhcp_vcpes_reserved[subscriber_index] |
| 280 | else: |
| 281 | vcpe = self.untagged_dhcp_vcpes_reserved[subscriber_index] |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 282 | else: |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 283 | if self.on_pod is True: |
| 284 | vcpe = self.dhcp_vcpes[subscriber_index] |
| 285 | else: |
| 286 | vcpe = self.untagged_dhcp_vcpes[subscriber_index] |
| 287 | mgmt = 'eth0' |
| 288 | host = '8.8.8.8' |
| 289 | self.success = False |
| 290 | assert_not_equal(vcpe, None) |
| 291 | vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt) |
| 292 | assert_not_equal(vcpe_ip, None) |
| 293 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe)) |
| 294 | log.info('Sending icmp echo requests to external network 8.8.8.8') |
| 295 | st, _ = getstatusoutput('ping -c 3 8.8.8.8') |
| 296 | VSGAccess.restore_interface_config(mgmt, vcpe = vcpe) |
| 297 | assert_equal(st, 0) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 298 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 299 | def vsg_xos_subscriber_create(self, index, subscriber_info = None, volt_subscriber_info = None): |
| 300 | if self.on_pod is False: |
| 301 | return '' |
| 302 | if subscriber_info is None: |
| 303 | subscriber_info = self.cord_subscriber.subscriber_info[index] |
| 304 | if volt_subscriber_info is None: |
| 305 | volt_subscriber_info = self.cord_subscriber.volt_subscriber_info[index] |
| 306 | s_tag = int(volt_subscriber_info['voltTenant']['s_tag']) |
| 307 | c_tag = int(volt_subscriber_info['voltTenant']['c_tag']) |
| 308 | vcpe = 'vcpe-{}-{}'.format(s_tag, c_tag) |
| 309 | subId = self.cord_subscriber.subscriberCreate(index, subscriber_info, volt_subscriber_info) |
| 310 | if subId: |
| 311 | #if the vsg instance was already instantiated, then reduce delay |
| 312 | if c_tag % self.SUBSCRIBERS_PER_S_TAG == 0: |
| 313 | delay = 350 |
| 314 | else: |
| 315 | delay = 90 |
| 316 | log.info('Delaying %d seconds for the VCPE to be provisioned' %(delay)) |
| 317 | time.sleep(delay) |
| 318 | #log.info('Testing for external connectivity to VCPE %s' %(vcpe)) |
| 319 | #self.vsg_for_external_connectivity(index) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 320 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 321 | return subId |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 322 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 323 | def vsg_delete(self, num_subscribers): |
| 324 | if self.on_pod is False: |
| 325 | return |
| 326 | num_subscribers = min(num_subscribers, len(self.cord_subscriber.subscriber_info)) |
| 327 | for index in xrange(num_subscribers): |
| 328 | subId = self.vsg_xos_subscriber_id(index) |
| 329 | if subId and subId != '0': |
| 330 | self.vsg_xos_subscriber_delete(index, subId = subId) |
| 331 | |
| 332 | def vsg_xos_subscriber_delete(self, index, subId = '', voltId = '', subscriber_info = None, volt_subscriber_info = None): |
| 333 | if self.on_pod is False: |
| 334 | return |
| 335 | self.cord_subscriber.subscriberDelete(index, subId = subId, voltId = voltId, |
| 336 | subscriber_info = subscriber_info, |
| 337 | volt_subscriber_info = volt_subscriber_info) |
| 338 | |
| 339 | def vsg_xos_subscriber_id(self, index): |
| 340 | if self.on_pod is False: |
| 341 | return '' |
| 342 | return self.cord_subscriber.subscriberId(index) |
| 343 | |
| 344 | def vsg_xos_subscriber_create_reserved(self): |
| 345 | if self.on_pod is False: |
| 346 | return |
| 347 | tags_reserved = [ (int(vcpe['s_tag']), int(vcpe['c_tag'])) for vcpe in self.vcpes_reserved ] |
| 348 | volt_tenants = self.restApiXos.ApiGet('TENANT_VOLT') |
| 349 | subscribers = self.restApiXos.ApiGet('TENANT_SUBSCRIBER') |
| 350 | reserved_tenants = filter(lambda tenant: (int(tenant['s_tag']), int(tenant['c_tag'])) in tags_reserved, volt_tenants) |
| 351 | reserved_config = [] |
| 352 | for tenant in reserved_tenants: |
| 353 | for subscriber in subscribers: |
| 354 | if int(subscriber['id']) == int(tenant['subscriber']): |
| 355 | volt_subscriber_info = {} |
| 356 | volt_subscriber_info['voltTenant'] = dict(s_tag = tenant['s_tag'], |
| 357 | c_tag = tenant['c_tag'], |
| 358 | subscriber = tenant['subscriber']) |
| 359 | volt_subscriber_info['volt_id'] = tenant['id'] |
| 360 | volt_subscriber_info['account_num'] = subscriber['identity']['account_num'] |
| 361 | reserved_config.append( (subscriber, volt_subscriber_info) ) |
| 362 | break |
| 363 | else: |
| 364 | log.info('Subscriber not found for tenant %s, s_tag: %s, c_tag: %s' %(str(tenant['subscriber']), |
| 365 | str(tenant['s_tag']), |
| 366 | str(tenant['c_tag']))) |
| 367 | |
| 368 | for subscriber_info, volt_subscriber_info in reserved_config: |
| 369 | self.vsg_xos_subscriber_delete(0, |
| 370 | subId = str(subscriber_info['id']), |
| 371 | voltId = str(volt_subscriber_info['volt_id']), |
| 372 | subscriber_info = subscriber_info, |
| 373 | volt_subscriber_info = volt_subscriber_info) |
| 374 | subId = self.vsg_xos_subscriber_create(0, |
| 375 | subscriber_info = subscriber_info, |
| 376 | volt_subscriber_info = volt_subscriber_info) |
| 377 | log.info('Created reserved subscriber %s' %(subId)) |
| 378 | |
| 379 | @deferred(1800) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 380 | def test_scale_for_vsg_vm_creations(self): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 381 | try: |
| 382 | df = defer.Deferred() |
| 383 | def scale_vsg_vms(df): |
| 384 | for index in xrange(len(self.cord_subscriber.subscriber_info)): |
| 385 | #check if the index exists |
| 386 | subId = self.vsg_xos_subscriber_id(index) |
| 387 | log.info('test_vsg_xos_subscriber_creation - subId is %s'%subId) |
| 388 | if subId and subId != '0': |
| 389 | self.vsg_xos_subscriber_delete(index, subId = subId) |
| 390 | subId = self.vsg_xos_subscriber_create(index) |
| 391 | log.info('Created Subscriber %s' %(subId)) |
| 392 | df.callback(0) |
| 393 | reactor.callLater(0, scale_vsg_vms, df) |
| 394 | return df |
| 395 | finally: |
| 396 | pass |
| 397 | #self.vsg_delete(len(self.cord_subscriber.subscriber_info)) |
| 398 | self.vsg_xos_subscriber_create_reserved |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 399 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 400 | @deferred(1800) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 401 | def test_scale_for_vcpe_creations(self): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 402 | try: |
| 403 | df = defer.Deferred() |
| 404 | def scale_vcpe_instances(df): |
| 405 | for index in xrange(len(self.cord_subscriber.subscriber_info)): |
| 406 | #check if the index exists |
| 407 | subId = self.vsg_xos_subscriber_id(index) |
| 408 | log.info('test_vsg_xos_subscriber_creation') |
| 409 | if subId and subId != '0': |
| 410 | self.vsg_xos_subscriber_delete(index, subId = subId) |
| 411 | subId = self.vsg_xos_subscriber_create(index) |
| 412 | log.info('Created Subscriber %s' %(subId)) |
| 413 | df.callback(0) |
| 414 | reactor.callLater(0, scale_vcpe_instances, df) |
| 415 | return df |
| 416 | except: |
| 417 | self.vsg_delete(len(self.cord_subscriber.subscriber_info)) |
| 418 | self.vsg_xos_subscriber_create_reserved |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 419 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 420 | @deferred(1800) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 421 | def test_scale_of_subcriber_vcpe_creations_in_single_vsg_vm(self): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 422 | try: |
| 423 | df = defer.Deferred() |
| 424 | def scale_vcpe_instances(df): |
| 425 | subId = self.vsg_xos_subscriber_create(100) |
| 426 | if subId and subId != '0': |
| 427 | self.vsg_xos_subscriber_delete(100, subId) |
| 428 | df.callback(0) |
| 429 | reactor.callLater(0, scale_vsg_vms, df) |
| 430 | return df |
| 431 | except: |
| 432 | self.vsg_delete(len(self.cord_subscriber.subscriber_info)) |
| 433 | self.vsg_xos_subscriber_create_reserved |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 434 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 435 | @deferred(1800) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 436 | def test_scale_of_subcriber_vcpe_creations_in_multiple_vsg_vm(self): |
A R Karthick | 037cb98 | 2017-07-07 17:35:30 -0700 | [diff] [blame] | 437 | try: |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 438 | df = defer.Deferred() |
| 439 | def scale_vcpe_instances(df): |
| 440 | subId = self.vsg_xos_subscriber_create(100) |
| 441 | if subId and subId != '0': |
| 442 | self.vsg_xos_subscriber_delete(100, subId) |
| 443 | df.callback(0) |
| 444 | reactor.callLater(0, scale_vsg_vms, df) |
| 445 | return df |
| 446 | except: |
| 447 | self.vsg_delete(len(self.cord_subscriber.subscriber_info)) |
| 448 | self.vsg_xos_subscriber_create_reserved |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 449 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 450 | @deferred(1800) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 451 | def test_scale_of_subcriber_vcpe_creations_with_one_vcpe_in_one_vsg_vm(self): |
A R Karthick | 037cb98 | 2017-07-07 17:35:30 -0700 | [diff] [blame] | 452 | try: |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 453 | df = defer.Deferred() |
| 454 | def scale_vcpe_instances(df): |
| 455 | subId = self.vsg_xos_subscriber_create(100) |
| 456 | if subId and subId != '0': |
| 457 | self.vsg_xos_subscriber_delete(100, subId) |
| 458 | df.callback(0) |
| 459 | reactor.callLater(0, scale_vsg_vms, df) |
| 460 | return df |
| 461 | except: |
| 462 | self.vsg_delete(len(self.cord_subscriber.subscriber_info)) |
| 463 | self.vsg_xos_subscriber_create_reserved |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 464 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 465 | @deferred(1800) |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 466 | def test_scale_for_cord_subscriber_creation_and_deletion(self): |
A R Karthick | 037cb98 | 2017-07-07 17:35:30 -0700 | [diff] [blame] | 467 | try: |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 468 | df = defer.Deferred() |
| 469 | def scale_vcpe_instances(df): |
| 470 | subId = self.vsg_xos_subscriber_create(100) |
| 471 | if subId and subId != '0': |
| 472 | self.vsg_xos_subscriber_delete(100, subId) |
| 473 | df.callback(0) |
| 474 | reactor.callLater(0, scale_vsg_vms, df) |
| 475 | return df |
| 476 | except: |
| 477 | self.vsg_delete(len(self.cord_subscriber.subscriber_info)) |
| 478 | self.vsg_xos_subscriber_create_reserved |
Chetan Gaonker | 357f489 | 2017-06-19 19:38:27 +0000 | [diff] [blame] | 479 | |
| 480 | def test_cord_for_scale_of_subscriber_containers_per_compute_node(self): |
| 481 | pass |
| 482 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 483 | @deferred(10) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 484 | def test_latency_of_cord_for_control_packets_using_icmp_packet(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 485 | """ |
| 486 | Test-Method: |
| 487 | 1. Ping from cord-tester to wan interface IP of CiaB setup |
| 488 | 2. Grep latency of ping packets |
| 489 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 490 | df = defer.Deferred() |
| 491 | def scale_vcpe_instances(df): |
| 492 | cmd = "ping -c 4 {0} | tail -1| awk '{{print $4}}'".format(self.wan_intf_ip) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 493 | st, out = getstatusoutput(cmd) |
| 494 | if out != '': |
| 495 | out = out.split('/') |
| 496 | avg_rtt = out[1] |
| 497 | latency = float(avg_rtt)/float(2) |
| 498 | else: |
| 499 | latency = None |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 500 | log.info('CORD setup latency calculated from icmp packet is = %s ms'%latency) |
| 501 | assert_not_equal(latency,None) |
| 502 | df.callback(0) |
| 503 | reactor.callLater(0, scale_vsg_vms, df) |
| 504 | return df |
| 505 | |
| 506 | @deferred(20) |
| 507 | def test_latency_of_cord_for_control_packets_using_increasing_sizes_of_icmp_packet(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 508 | """ |
| 509 | Test-Method: |
| 510 | 1. Ping from cord-tester to wan interface IP of CiaB setup |
| 511 | 2. Grep the latency of ping packet |
| 512 | 3. Repeat the process for varying sizes of ping packets |
| 513 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 514 | df = defer.Deferred() |
| 515 | def scale_vcpe_instances(df): |
| 516 | pckt_sizes = [100,500,1000,1500] |
| 517 | for size in pckt_sizes: |
| 518 | cmd = "ping -c 4 -s {} {} | tail -1| awk '{{print $4}}'".format(size,self.wan_intf_ip) |
| 519 | st, out = getstatusoutput(cmd) |
| 520 | if out != '': |
| 521 | out = out.split('/') |
| 522 | avg_rtt = out[1] |
| 523 | latency = float(avg_rtt)/float(2) |
| 524 | else: |
| 525 | latency = None |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 526 | log.info('CORD setup latency calculated from icmp packet with size %s bytes is = %s ms'%(size,latency)) |
| 527 | assert_not_equal(latency,None) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 528 | df.callback(0) |
| 529 | reactor.callLater(0, scale_vsg_vms, df) |
| 530 | return df |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 531 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 532 | @deferred(10) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 533 | def test_latency_of_cord_with_traceroute(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 534 | """ |
| 535 | Test-Method: |
| 536 | 1. Traceroute from cord-tester to wan interface IP of CiaB setup |
| 537 | 2. Grep the latency of ping packet |
| 538 | 3. Repeat the process for varying sizes of ping packets |
| 539 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 540 | df = defer.Deferred() |
| 541 | def scale_vcpe_instances(df): |
| 542 | cmd = "traceroute -q1 {} | tail -1| awk '{{print $4}}'".format(self.wan_intf_ip) |
| 543 | avg_rtt = float(0) |
| 544 | latency = None |
| 545 | for index in [1,2,3]: |
| 546 | st, out = getstatusoutput(cmd) |
| 547 | if out != '': |
| 548 | avg_rtt += float(out) |
| 549 | latency = float(avg_rtt)/float(6) |
| 550 | log.info('CORD setup latency calculated from traceroute is = %s ms'%latency) |
| 551 | assert_not_equal(latency,0.0) |
| 552 | assert_not_equal(latency,None) |
| 553 | df.callback(0) |
| 554 | reactor.callLater(0, scale_vsg_vms, df) |
| 555 | return df |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 556 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 557 | #tested with 50 igmp joins on CiaB setup |
| 558 | @deferred(1000) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 559 | def test_scale_with_igmp_joins_for_500_multicast_groups_and_check_cpu_usage(self, group_count=500): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 560 | """ |
| 561 | Test-Method: |
| 562 | 1. Register 500 igmp groups in onos |
| 563 | 2. Send igmp joins for registered groups |
| 564 | 3. Send multicast traffic to all registered groups |
| 565 | 4. Verify traffic forwards properly |
| 566 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 567 | df = defer.Deferred() |
| 568 | def scale_igmp_joins(df): |
| 569 | OnosCtrl(self.igmp_app).activate() |
| 570 | groups = scale().generate_random_multicast_ip_addresses(count = group_count) |
| 571 | sources = scale().generate_random_unicast_ip_addresses(count = group_count) |
| 572 | scale().onos_ssm_table_load(groups,src_list=sources,flag=True) |
| 573 | try: |
| 574 | for index in range(group_count): |
| 575 | scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE, |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 576 | iface = self.V_INF1) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 577 | status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 578 | assert_equal(status, True) |
| 579 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
| 580 | except Exception as error: |
| 581 | log.info('Got unexpected error %s'%error) |
| 582 | raise |
| 583 | df.callback(0) |
| 584 | reactor.callLater(0, scale_igmp_joins, df) |
| 585 | return df |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 586 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 587 | #tested with 50 igmp joins on CiaB setup |
| 588 | @deferred(1000) |
| 589 | def test_scale_with_igmp_joins_for_1000_multicast_groups_and_igmp_app_toggle(self, group_count=1000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 590 | """ |
| 591 | Test-Method: |
| 592 | 1. Register 1000 igmp groups in onos |
| 593 | 2. Send igmp joins for registered groups |
| 594 | 3. Send multicast traffic to all registered groups |
| 595 | 4. Verify traffic forwards properly |
| 596 | 5. deactivate and activate igmp app in onos |
| 597 | 6. Verify multicast traffic do not forward after igmp app deactivated |
| 598 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 599 | df = defer.Deferred() |
| 600 | def scale_igmp_joins(df): |
| 601 | OnosCtrl(self.igmp_app).activate() |
| 602 | groups = scale().generate_random_multicast_ip_addresses(count = group_count) |
| 603 | sources = scale().generate_random_unicast_ip_addresses(count = group_count) |
| 604 | scale().onos_ssm_table_load(groups,src_list=sources,flag=True) |
| 605 | try: |
| 606 | for index in range(group_count): |
| 607 | scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE, |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 608 | iface = self.V_INF1) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 609 | status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 610 | assert_equal(status, True) |
| 611 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
| 612 | log_test.info('Deactivating igmp app in onos') |
| 613 | OnosCtrl(self.igmp_app).deactivate() |
| 614 | time.sleep(2) |
| 615 | for index in range(group_count): |
| 616 | status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 617 | assert_equal(status, False) |
| 618 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 619 | OnosCtrl(self.igmp_app).activate() |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 620 | except Exception as error: |
| 621 | log.info('Got unexpected error %s'%error) |
| 622 | OnosCtrl(self.igmp_app).activate() |
| 623 | raise |
| 624 | df.callback(0) |
| 625 | reactor.callLater(0, scale_igmp_joins, df) |
| 626 | return df |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 627 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 628 | #tested with 50 igmp joins on CiaB setup |
| 629 | @deferred(1800) |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 630 | def test_scale_with_igmp_joins_for_2000_multicast_groups_and_check_cpu_usage(self, group_count=2000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 631 | """ |
| 632 | Test-Method: |
| 633 | 1. Register 500 igmp groups in onos |
| 634 | 2. Send igmp joins for registered groups |
| 635 | 3. Send multicast traffic to all registered groups |
| 636 | 4. Verify traffic forwards properly |
| 637 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 638 | df = defer.Deferred() |
| 639 | def scale_igmp_joins(df): |
| 640 | OnosCtrl(self.igmp_app).activate() |
| 641 | groups = scale().generate_random_multicast_ip_addresses(count = group_count) |
| 642 | sources = scale().generate_random_unicast_ip_addresses(count = group_count) |
| 643 | scale().onos_ssm_table_load(groups,src_list=sources,flag=True) |
| 644 | try: |
| 645 | for index in range(group_count): |
| 646 | scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE, |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 647 | iface = self.V_INF1) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 648 | status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 649 | assert_equal(status, True) |
| 650 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
| 651 | if index % 50 == 0: |
| 652 | cpu_usage = scale().get_system_cpu_usage() |
| 653 | log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1)) |
| 654 | except Exception as error: |
| 655 | log.info('Got unexpected error %s'%error) |
| 656 | raise |
| 657 | df.callback(0) |
| 658 | reactor.callLater(0, scale_igmp_joins, df) |
| 659 | return df |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 660 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 661 | #tested with 50 igmp joins on CiaB setup |
| 662 | @deferred(1000) |
| 663 | def test_scale_of_igmp_joins_for_2000_multicast_groups_and_check_cpu_usage_after_app_deactivation_and_activation(self,group_count=2000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 664 | """ |
| 665 | Test-Method: |
| 666 | 1. Register 2000 igmp groups in onos |
| 667 | 2. Send igmp joins for registered groups |
| 668 | 3. Send multicast traffic to all registered groups |
| 669 | 4. Verify traffic forwards properly |
| 670 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 671 | df = defer.Deferred() |
| 672 | def scale_igmp_joins(df): |
| 673 | cpu_usage1 = scale().get_system_cpu_usage() |
| 674 | OnosCtrl(self.igmp_app).activate() |
| 675 | groups = scale().generate_random_multicast_ip_addresses(count = group_count) |
| 676 | sources = scale().generate_random_unicast_ip_addresses(count = group_count) |
| 677 | scale().onos_ssm_table_load(groups,src_list=sources,flag=True) |
| 678 | try: |
| 679 | for index in range(group_count): |
| 680 | scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE, |
Anil Kumar Sanka | 12a5ec5 | 2017-06-29 18:41:51 +0000 | [diff] [blame] | 681 | iface = self.V_INF1) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 682 | status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 683 | assert_equal(status, True) |
| 684 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
| 685 | if index % 50 == 0: |
| 686 | cpu_usage = self.get_system_cpu_usage() |
| 687 | log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1)) |
| 688 | cpu_usage2 = scale().get_system_cpu_usage() |
| 689 | OnosCtrl(self.igmp_app).deactivate() |
| 690 | time.sleep(2) |
| 691 | cpu_usage3 = scale().get_system_cpu_usage() |
| 692 | log.info('CPU usage before test start = %f after %d igmp entries registered in onos = %f and after the app deactivated = %f are'%(cpu_usage1,cpu_usage2,cpu_usage3)) |
| 693 | except Exception as error: |
| 694 | log.info('Got unexpected error %s'%error) |
| 695 | raise |
| 696 | df.callback(0) |
| 697 | reactor.callLater(0, scale_igmp_joins, df) |
| 698 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 699 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 700 | #tested with 100 flow entries on CiaB setup |
| 701 | @deferred(1000) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 702 | def test_scale_adding_1k_flow_entries_in_onos_with_dynamic_tcp_ports(self,count=1000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 703 | """ |
| 704 | Test-Method: |
| 705 | 1. Add 1000 flow entries with varying tcp port number in onos |
| 706 | 2. Send data traffic for added tcp port numbers |
| 707 | 3. Verify onos forwards data traffic propoerly |
| 708 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 709 | scale().flows_setup() |
| 710 | df = defer.Deferred() |
| 711 | def scale_flow_entries(df): |
| 712 | egress = 1 |
| 713 | ingress = 2 |
| 714 | egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1', 'tcp_port': random.randint(1024,65535) } |
| 715 | ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1', 'tcp_port': random.randint(1024,65535) } |
| 716 | try: |
| 717 | for index in range(0,count): |
| 718 | ingress_map['tcp_port'] = random.randint(1024,65535) |
| 719 | egress_map['tcp_port'] = random.randint(1024,65535) |
| 720 | src_port = ingress_map['tcp_port'] |
| 721 | egr_port = egress_map['tcp_port'] |
| 722 | #log.info('ingress port is %d and egress port is %d'%(src_port,egr_port)) |
| 723 | flow = OnosFlowCtrl(deviceId = self.device_id, |
| 724 | egressPort = egress + scale().port_offset, |
| 725 | ingressPort = ingress + scale().port_offset, |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 726 | tcpSrc = ingress_map['tcp_port'], |
| 727 | tcpDst = egress_map['tcp_port'] |
| 728 | ) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 729 | result = flow.addFlow() |
| 730 | assert_equal(result, True) |
| 731 | log_test.info("flow number = %d is added",index+1) |
| 732 | def mac_recv_task(): |
| 733 | def recv_cb(pkt): |
| 734 | log_test.info('Pkt seen with ingress TCP port %s, egress TCP port %s' %(pkt[TCP].sport, pkt[TCP].dport)) |
| 735 | result = True |
| 736 | sniff(count=2, timeout=5, |
| 737 | lfilter = lambda p: TCP in p and p[TCP].dport == egr_port and p[TCP].sport == src_port ,prn = recv_cb, iface = scale().port_map[egress]) |
| 738 | t = threading.Thread(target = mac_recv_task) |
| 739 | t.start() |
| 740 | L2 = Ether(src = ingress_map['ether'], dst = egress_map['ether']) |
| 741 | L3 = IP(src = ingress_map['ip'], dst = egress_map['ip']) |
| 742 | L4 = TCP(sport = src_port, dport = egr_port) |
| 743 | pkt = L2/L3/L4 |
| 744 | log_test.info('Sending packets to verify if flows are correct') |
| 745 | sendp(pkt, count=50, iface = scale().port_map[ingress]) |
| 746 | t.join() |
| 747 | except Exception as error: |
| 748 | log.info('Got unexpected error %s'%error) |
| 749 | raise |
| 750 | df.callback(0) |
| 751 | reactor.callLater(0,scale_flow_entries, df) |
| 752 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 753 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 754 | #tested with 100 flow entries on CiaB setup |
| 755 | @deferred(1000) |
| 756 | def test_scale_adding_5k_ip_flow_entries_in_onos_and_checking_cpu_usage(self,count=5000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 757 | """ |
| 758 | Test-Method: |
| 759 | 1. Add 5000 flow entries with varying source and destination IP |
| 760 | 2. Send data traffic matching flow entries |
| 761 | 3. Verify onos forwards data traffic propoerly |
| 762 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 763 | scale().flows_setup() |
| 764 | df = defer.Deferred() |
| 765 | def scale_flow_entries(df): |
| 766 | cpu_usage1 = scale().get_system_cpu_usage() |
| 767 | egress = 1 |
| 768 | ingress = 2 |
| 769 | egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '182.0.0.0' } |
| 770 | ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.0.0.0' } |
| 771 | try: |
| 772 | for index in range(0,count): |
| 773 | ingress_map['ip'] = scale().generate_random_unicast_ip_addresses()[0] #next_ip(ingress_map['ip']) |
| 774 | assert_not_equal(ingress_map['ip'], None) |
| 775 | egress_map['ip'] = scale().generate_random_unicast_ip_addresses()[0] #to_egress_ip(ingress_map['ip']) |
| 776 | flow = OnosFlowCtrl(deviceId = self.device_id, |
| 777 | egressPort = egress + scale().port_offset, |
| 778 | ingressPort = ingress + scale().port_offset, |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 779 | ethType = '0x0800', |
| 780 | ipSrc = ('IPV4_SRC', ingress_map['ip']+'/8'), |
| 781 | ipDst = ('IPV4_DST', egress_map['ip']+'/8') |
| 782 | ) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 783 | if index % 50 == 0: |
| 784 | cpu_usage = scale().get_system_cpu_usage() |
| 785 | log.info('CPU usage is %s for flow number %d added'%(cpu_usage,index+1)) |
| 786 | time.sleep(1) |
| 787 | def mac_recv_task(): |
| 788 | def recv_cb(pkt): |
| 789 | log_test.info('Pkt seen with ingress source IP %s, destination IP %s' %(pkt[IP].src, pkt[IP].dst)) |
| 790 | result = True |
| 791 | sniff(count=2, timeout=5, |
| 792 | lfilter = lambda p: IP in p and p[IP].dst == egress_map['ip'] and p[IP].src == ingress_map['ip'] ,prn = recv_cb, iface = scale().port_map[egress]) |
| 793 | t = threading.Thread(target = mac_recv_task) |
| 794 | t.start() |
| 795 | L2 = Ether(src = ingress_map['ether'], dst = egress_map['ether']) |
| 796 | L3 = IP(src = ingress_map['ip'], dst = egress_map['ip']) |
| 797 | pkt = L2/L3 |
| 798 | log_test.info('Sending packets to verify if flows are correct') |
| 799 | sendp(pkt, count=50, iface = scale().port_map[ingress]) |
| 800 | t.join() |
| 801 | cpu_usage2 = scale().get_system_cpu_usage() |
| 802 | log.info('system cpu usage before flows added = %f and after %d flows added = %f'%(cpu_usage1,count,cpu_usage2)) |
| 803 | except Exception as error: |
| 804 | log.info('Got unexpected error %s'%error) |
| 805 | raise |
| 806 | df.callback(0) |
| 807 | reactor.callLater(0, scale_flow_entries, df) |
| 808 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 809 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 810 | #tested with 100 flow entries on CiaB setup |
| 811 | @deferred(1000) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 812 | def test_scale_adding_10k_flow_entries_in_onos_with_dynamic_udp_ports(self,count=10000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 813 | """ |
| 814 | Test-Method: |
| 815 | 1. Add 10000 flow entries with varying udp port number in onos |
| 816 | 2. Send data traffic matching flow entries |
| 817 | 3. Verify onos forwards data traffic propoerly |
| 818 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 819 | scale().flows_setup() |
| 820 | df = defer.Deferred() |
| 821 | def scale_flow_entries(df): |
| 822 | egress = 1 |
| 823 | ingress = 2 |
| 824 | egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1', 'udp_port': random.randint(1024,65535) } |
| 825 | ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1', 'udp_port': random.randint(1024,65535) } |
| 826 | try: |
| 827 | for index in range(0,count): |
| 828 | ingress_map['udp_port'] = random.randint(1024,65535) |
| 829 | egress_map['udp_port'] = random.randint(1024,65535) |
| 830 | src_port = ingress_map['udp_port'] |
| 831 | egr_port = egress_map['udp_port'] |
| 832 | #log.info('ingress port is %d and egress port is %d'%(src_port,egr_port)) |
| 833 | flow = OnosFlowCtrl(deviceId = self.device_id, |
| 834 | egressPort = egress + scale().port_offset, |
| 835 | ingressPort = ingress + scale().port_offset, |
| 836 | udpSrc = ingress_map['udp_port'], |
| 837 | udpDst = egress_map['udp_port'] |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 838 | ) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 839 | result = flow.addFlow() |
| 840 | assert_equal(result, True) |
| 841 | log_test.info("flow number = %d is added",index+1) |
| 842 | def mac_recv_task(): |
| 843 | def recv_cb(pkt): |
| 844 | log_test.info('Pkt seen with ingress UDP port %s, egress UDP port %s' %(pkt[UDP].sport, pkt[UDP].dport)) |
| 845 | result = True |
| 846 | sniff(count=2, timeout=5, |
| 847 | lfilter = lambda p: UDP in p and p[UDP].dport == egr_port and p[UDP].sport == src_port ,prn = recv_cb, iface = scale().port_map[egress]) |
| 848 | t = threading.Thread(target = mac_recv_task) |
| 849 | t.start() |
| 850 | L2 = Ether(src = ingress_map['ether'], dst = egress_map['ether']) |
| 851 | L3 = IP(src = ingress_map['ip'], dst = egress_map['ip']) |
| 852 | L4 = UDP(sport = src_port, dport = egr_port) |
| 853 | pkt = L2/L3/L4 |
| 854 | log_test.info('Sending packets to verify if flows are correct') |
| 855 | sendp(pkt, count=50, iface = scale().port_map[ingress]) |
| 856 | t.join() |
| 857 | except Exception as error: |
| 858 | log.info('Got unexpected error %s'%error) |
| 859 | raise |
| 860 | df.callback(0) |
| 861 | reactor.callLater(0,scale_flow_entries, df) |
| 862 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 863 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 864 | #tested with 100 flow entries on CiaB setup |
| 865 | @deferred(1000) |
| 866 | def test_scale_adding_10k_constant_destination_mac_flow_entries_in_onos_and_check_cpu_usage(self,count=100): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 867 | """ |
| 868 | Test-Method: |
| 869 | 1. Add 10000 flow entries with varying source mac |
| 870 | 2. Send data traffic matching flow entries |
| 871 | 3. Verify onos forwards data traffic propoerly |
| 872 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 873 | scale().flows_setup() |
| 874 | df = defer.Deferred() |
| 875 | def scale_flow_entries(df): |
| 876 | cpu_usage1 = self.get_system_cpu_usage() |
| 877 | egress = 1 |
| 878 | ingress = 2 |
| 879 | egress_mac = '02:00:00:00:0:0' |
| 880 | ingress_mac = '03:00:00:00:00:00' |
| 881 | try: |
| 882 | for index in range(0,count): |
| 883 | result = False |
| 884 | ingress_mac = scale().next_mac(ingress_mac) |
| 885 | flow = OnosFlowCtrl(deviceId = self.device_id, |
| 886 | egressPort = egress + scale().port_offset, |
| 887 | ingressPort = ingress + scale().port_offset, |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 888 | ethSrc = ingress_mac, |
| 889 | ethDst = egress_mac) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 890 | result = flow.addFlow() |
| 891 | assert_equal(result, True) |
| 892 | log.info("flow number = %d is added",index+1) |
| 893 | if index % 100 == 0: |
| 894 | cpu_usage = scale().get_system_cpu_usage() |
| 895 | log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1)) |
| 896 | time.sleep(1) |
| 897 | def mac_recv_task(): |
| 898 | def recv_cb(pkt): |
| 899 | log_test.info('Pkt seen with ingress mac %s, egress mac %s' %(pkt.src , pkt.dst)) |
| 900 | result = True |
| 901 | sniff(count=2, timeout=5, |
| 902 | lfilter = lambda p: p.src == ingress_mac and p.dst == egress_mac ,prn = recv_cb, iface = scale().port_map[egress]) |
| 903 | t = threading.Thread(target = mac_recv_task) |
| 904 | t.start() |
| 905 | L2 = Ether(src = ingress_mac, dst = egress_mac) |
| 906 | pkt = L2/IP() |
| 907 | log_test.info('Sending packets to verify if flows are correct') |
| 908 | sendp(pkt, count=50, iface = scale().port_map[ingress]) |
| 909 | t.join() |
| 910 | assert_equal(result, True) |
| 911 | cpu_usage2 = self.get_system_cpu_usage() |
| 912 | log.info('system cpu usage before flows added = %f and after %d flows added = %f'%(cpu_usage1,count,cpu_usage2)) |
| 913 | except Exception as error: |
| 914 | log.info('Got unexpected error %s'%error) |
| 915 | raise |
| 916 | df.callback(0) |
| 917 | reactor.callLater(0,scale_flow_entries, df) |
| 918 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 919 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 920 | |
| 921 | @deferred(1000) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 922 | def test_scale_adding_10k_acl_rules_to_deny_matching_destination_tcp_port_traffic(self,count=10000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 923 | """ |
| 924 | Test-Method: |
| 925 | 1. Add 10000 acl deny rules with varying tcp port number |
| 926 | 2. Send data traffic matching flow entries |
| 927 | 3. Verify onos drops data traffic propoerly |
| 928 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 929 | df = defer.Deferred() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 930 | def scale_acl_rules(df): |
| 931 | acl_rule = ACLTest() |
| 932 | ingress = self.ingress_iface |
| 933 | egress = self.CURRENT_PORT_NUM |
| 934 | status, code, host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 935 | self.CURRENT_PORT_NUM += 1 |
| 936 | time.sleep(5) |
| 937 | assert_equal(status, True) |
| 938 | srcMac = '00:00:00:00:00:11' |
| 939 | dstMac = host_ip_mac[0][1] |
| 940 | scale().acl_hosts_add(dstHostIpMac = host_ip_mac, egress_iface_count = 1, egress_iface_num = egress ) |
| 941 | try: |
| 942 | for index in range(0,count): |
| 943 | status,code,host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 944 | self.CURRENT_PORT_NUM += 1 |
| 945 | src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 946 | dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 947 | dst_port = random.randint(1024,65535) |
| 948 | log.info('adding acl rule = %d with src ip = %s, dst ip = %s and dst tcp port = %d'%(index+1, src_ip,dst_ip,dst_port)) |
| 949 | status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip, ipProto ='TCP', dstTpPort =dst_port, action = 'deny') |
| 950 | assert_equal(status, True) |
| 951 | self.acl_rule_traffic_send_recv(srcMac = srcMac, dstMac = dstMac ,srcIp = src_ip, dstIp = dst_ip,ingress =ingress, egress = egress, ip_proto = 'TCP',positive_test = False) |
| 952 | scale().acl_hosts_remove(egress_iface_count = 1, egress_iface_num = egress) |
| 953 | except Exception as error: |
| 954 | log.info('Got unexpected error %s'%error) |
| 955 | self.acl_hosts_remove(egress_iface_count = 1, egress_iface_num = egress) |
| 956 | raise |
| 957 | df.callback(0) |
| 958 | reactor.callLater(0, scale_vsg_vms, df) |
| 959 | return df |
| 960 | |
| 961 | @deferred(1000) |
| 962 | def test_scale_adding_10k_acl_rules_to_allow_src_and_dst_ip_matching_traffic_check_cpu_usage(self,count=10000): |
| 963 | """ |
| 964 | Test-Method: |
| 965 | 1. Grep system usage before starting test case |
| 966 | 2. Configure 10000 acl rules in onos |
| 967 | 3. Verify traffic test for all 10000 acl rules configured |
| 968 | 4. Grep system usage again now |
| 969 | """ |
| 970 | df = defer.Deferred() |
| 971 | def scale_acl_rules(df): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 972 | cpu_usage1 = self.get_system_cpu_usage() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 973 | ingress = self.ingress_iface |
| 974 | egress = self.CURRENT_PORT_NUM |
| 975 | status, code, host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 976 | self.CURRENT_PORT_NUM += 1 |
| 977 | time.sleep(5) |
| 978 | assert_equal(status, True) |
| 979 | srcMac = '00:00:00:00:00:11' |
| 980 | dstMac = host_ip_mac[0][1] |
| 981 | self.acl_hosts_add(dstHostIpMac = host_ip_mac, egress_iface_count = 1, egress_iface_num = egress ) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 982 | acl_rule = ACLTest() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 983 | try: |
| 984 | for index in range(0,count): |
| 985 | status,code,host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 986 | self.CURRENT_PORT_NUM += 1 |
| 987 | src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 988 | dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 989 | dst_port = random.randint(1024,65535) |
| 990 | log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip)) |
| 991 | status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'allow') |
| 992 | assert_equal(status, True) |
| 993 | self.acl_rule_traffic_send_recv(srcMac = srcMac, dstMac = dstMac ,srcIp =self.ACL_SRC_IP, dstIp = self.ACL_DST_IP,ingress =ingress, egress = egress, ip_proto = 'UDP', dstPortNum = 456) |
| 994 | if index % 100 == 0: |
| 995 | cpu_usage = self.get_system_cpu_usage() |
| 996 | log.info('CPU usage is %s for acl rule number %s'%(cpu_usage,index+1)) |
| 997 | time.sleep(1) |
| 998 | self.acl_hosts_remove(egress_iface_count = 1, egress_iface_num = egress) |
| 999 | except Exception as error: |
| 1000 | log.info('Got unexpected error %s'%error) |
| 1001 | self.acl_hosts_remove(egress_iface_count = 1, egress_iface_num = egress) |
| 1002 | raise |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1003 | cpu_usage2 = self.get_system_cpu_usage() |
| 1004 | log.info('system cpu usage before flows added = %f and after %d flows added = %f'%(cpu_usage1,count,cpu_usage2)) |
| 1005 | df.callback(0) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1006 | reactor.callLater(0, scale_acl_rules, df) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1007 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1008 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1009 | @deferred(1000) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1010 | def test_scale_adding_and_deleting_10k_acl_rules_to_allow_src_and_dst_ip_matching_traffic(self,count=10000): |
| 1011 | """ |
| 1012 | Test-Method: |
| 1013 | 1. Add 10000 acl rules to allow source and destinaiton IP matching traffic |
| 1014 | 2. Send acl rules matching traffic |
| 1015 | 3. Delete all the added acl rules |
| 1016 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1017 | df = defer.Deferred() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1018 | def scale_acl_rules(df): |
| 1019 | ingress = self.ingress_iface |
| 1020 | egress = self.CURRENT_PORT_NUM |
| 1021 | status, code, host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 1022 | self.CURRENT_PORT_NUM += 1 |
| 1023 | time.sleep(5) |
| 1024 | assert_equal(status, True) |
| 1025 | srcMac = '00:00:00:00:00:11' |
| 1026 | dstMac = host_ip_mac[0][1] |
| 1027 | self.acl_hosts_add(dstHostIpMac = host_ip_mac, egress_iface_count = 1, egress_iface_num = egress ) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1028 | acl_rule = ACLTest() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1029 | try: |
| 1030 | for index in range(0,count): |
| 1031 | status,code,host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 1032 | self.CURRENT_PORT_NUM += 1 |
| 1033 | src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1034 | dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1035 | dst_port = random.randint(1024,65535) |
| 1036 | log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip)) |
| 1037 | status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'allow') |
| 1038 | assert_equal(status, True) |
| 1039 | self.acl_rule_traffic_send_recv(srcMac = srcMac, dstMac = dstMac ,srcIp =self.ACL_SRC_IP, dstIp = self.ACL_DST_IP,ingress =ingress, egress = egress, ip_proto = 'UDP', dstPortNum = 456) |
| 1040 | result = acl_rule.get_acl_rules() |
| 1041 | result = result.json()['aclRules'] |
| 1042 | for acl in result: |
| 1043 | acl_rule.remove_acl_rule(acl['id']) |
| 1044 | log.info('removed acl with Id --> %s'%acl['id']) |
| 1045 | self.acl_hosts_remove(egress_iface_count = 1, egress_iface_num = egress) |
| 1046 | except Exception as error: |
| 1047 | log.info('Got unexpected error %s'%error) |
| 1048 | self.acl_hosts_remove(egress_iface_count = 1, egress_iface_num = egress) |
| 1049 | raise |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1050 | df.callback(0) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1051 | reactor.callLater(0, scale_acl_rules, df) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1052 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1053 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1054 | @deferred(1000) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1055 | def test_scale_adding_20k_acl_rules_to_deny_src_and_dst_ip_matching_traffic_with_acl_app_toggle(self,count=20000): |
| 1056 | """ |
| 1057 | Test-Method: |
| 1058 | 1. Add 20000 acl rules to allow source and destinaiton IP matching traffic |
| 1059 | 2. Send acl rules matching traffic |
| 1060 | 3. Verify onos drops the traffic as the rule is deny type |
| 1061 | 4. Deactivate the acl app in onos |
| 1062 | 4. Verify now onos forwards the traffic |
| 1063 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1064 | df = defer.Deferred() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1065 | def scale_acl_rules(df): |
| 1066 | ingress = self.ingress_iface |
| 1067 | egress = self.CURRENT_PORT_NUM |
| 1068 | status, code, host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 1069 | self.CURRENT_PORT_NUM += 1 |
| 1070 | time.sleep(5) |
| 1071 | assert_equal(status, True) |
| 1072 | srcMac = '00:00:00:00:00:11' |
| 1073 | dstMac = host_ip_mac[0][1] |
| 1074 | self.acl_hosts_add(dstHostIpMac = host_ip_mac, egress_iface_count = 1, egress_iface_num = egress ) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1075 | acl_rule = ACLTest() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1076 | try: |
| 1077 | for index in range(0,count): |
| 1078 | status,code,host_ip_mac = acl_rule.generate_onos_interface_config(iface_num= self.CURRENT_PORT_NUM, iface_name = 'b1',iface_count = 1, iface_ip = self.HOST_DST_IP) |
| 1079 | self.CURRENT_PORT_NUM += 1 |
| 1080 | src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1081 | dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1082 | dst_port = random.randint(1024,65535) |
| 1083 | log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip)) |
| 1084 | status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'deny') |
| 1085 | assert_equal(status, True) |
| 1086 | self.acl_rule_traffic_send_recv(srcMac = srcMac, dstMac = dstMac ,srcIp =self.ACL_SRC_IP, dstIp = self.ACL_DST_IP,ingress =ingress, egress = egress, ip_proto = 'UDP', dstPortNum = 456) |
| 1087 | OnosCtrl(cls.acl_app).deactivate() |
| 1088 | time.sleep(3) |
| 1089 | except Exception as error: |
| 1090 | log.info('Got unexpected error %s'%error) |
| 1091 | raise |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1092 | df.callback(0) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1093 | reactor.callLater(0, scale_acl_rules, df) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1094 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1095 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1096 | @deferred(1000) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1097 | def test_scale_adding_igmp_and_acl_with_flow_entries_and_check_cpu_usage(self,igmp_groups=1300, flows_count=10000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1098 | """ |
| 1099 | Test-Method: |
| 1100 | 1. Add igmp and flow entries in onos |
| 1101 | 2. Send igmp joins for corresponding igmp entries |
| 1102 | 3. Send multicast data traffic to registered igmp groups |
| 1103 | 3. Verify onos forwards the traffic |
| 1104 | 4. Send traffic matching the flow entries |
| 1105 | 4. Verify onos forwards the traffic |
| 1106 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1107 | df = defer.Deferred() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1108 | def scale_igmp_acl_flows(df): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1109 | cpu_usage1 = self.get_system_cpu_usage() |
| 1110 | egress = 1 |
| 1111 | ingress = 2 |
| 1112 | egress_mac = '00:00:00:00:01:01' |
| 1113 | ingress_mac = '02:00:00:00:00:00' |
| 1114 | acl_rule = ACLTest() |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1115 | OnosCtrl(self.igmp_app).activate() |
| 1116 | groups = self.generate_random_multicast_ip_addresses(count = igmp_groups) |
| 1117 | sources = self.generate_random_unicast_ip_addresses(count = igmp_groups) |
| 1118 | self.onos_ssm_table_load(groups,src_list=sources,flag=True) |
| 1119 | for index in range(igmp_groups): |
| 1120 | self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE, |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1121 | iface = self.V_INF1) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1122 | status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 1123 | assert_equal(status, True) |
| 1124 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1125 | for index in range(flows_count): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1126 | src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1127 | dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1128 | log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip)) |
| 1129 | status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'allow') |
| 1130 | assert_equal(status, True) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1131 | ingress_mac = self.next_mac(ingress_mac) |
| 1132 | flow = OnosFlowCtrl(deviceId = self.device_id, |
| 1133 | egressPort = egress + self.port_offset, |
| 1134 | ingressPort = ingress + self.port_offset, |
| 1135 | ethSrc = ingress_mac, |
| 1136 | ethDst = egress_mac) |
| 1137 | result = flow.addFlow() |
| 1138 | assert_equal(result, True) |
| 1139 | log.info("flow number = %d is added",index+1) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1140 | if index % 200 == 0: |
| 1141 | cpu_usage = self.get_system_cpu_usage() |
| 1142 | log.info('CPU usage is %s for acl rule number %s'%(cpu_usage,index+1)) |
| 1143 | time.sleep(1) |
| 1144 | cpu_usage2 = self.get_system_cpu_usage() |
| 1145 | log.info('system cpu usage before flows added = %f, after %d flows added = %f'%(cpu_usage1,count,cpu_usage2)) |
| 1146 | df.callback(0) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1147 | reactor.callLater(0, scale_igmp_acl_flows, df) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1148 | return df |
| 1149 | |
| 1150 | @deferred(1000) |
| 1151 | def test_scale_adding_igmp_acl_and_flow_entries_and_simultaneously_toggling_app_activation(self,igmp_groups=1300, flows_count=10000): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1152 | """ |
| 1153 | Test-Method: |
| 1154 | 1. Add igmp, acl and flow entries in onos |
| 1155 | 2. Send igmp joins for corresponding igmp entries |
| 1156 | 3. Send multicast data traffic to registered igmp groups |
| 1157 | 3. Verify onos forwards the traffic |
| 1158 | 4. Send traffic matching the flow entries |
| 1159 | 4. Verify onos forwards the traffic |
| 1160 | 5. Send traffic matching acl rules |
| 1161 | 6. Verify onos forwards the traffic |
| 1162 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1163 | df = defer.Deferred() |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1164 | def scale_igmp_acl_flows(df): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1165 | cpu_usage1 = self.get_system_cpu_usage() |
| 1166 | def adding_igmp_entries(): |
| 1167 | OnosCtrl(self.igmp_app).activate() |
| 1168 | groups = self.generate_random_multicast_ip_addresses(count = igmp_groups) |
| 1169 | sources = self.generate_random_unicast_ip_addresses(count = igmp_groups) |
| 1170 | self.onos_ssm_table_load(groups,src_list=sources,flag=True) |
| 1171 | for index in range(igmp_groups): |
| 1172 | self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE, |
| 1173 | iface = self.V_INF1) |
| 1174 | status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index]) |
| 1175 | assert_equal(status, True) |
| 1176 | log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index)) |
| 1177 | def adding_flow_entries(): |
| 1178 | egress = 1 |
| 1179 | ingress = 2 |
| 1180 | egress_mac = '00:00:00:00:01:01' |
| 1181 | ingress_mac = '02:00:00:00:00:00' |
| 1182 | for index in range(flows_count): |
| 1183 | ingress_mac = self.next_mac(ingress_mac) |
| 1184 | flow = OnosFlowCtrl(deviceId = self.device_id, |
| 1185 | egressPort = egress + self.port_offset, |
| 1186 | ingressPort = ingress + self.port_offset, |
| 1187 | ethSrc = ingress_mac, |
| 1188 | ethDst = egress_mac) |
| 1189 | result = flow.addFlow() |
| 1190 | assert_equal(result, True) |
| 1191 | log.info("flow number = %d is added",index+1) |
| 1192 | def adding_acl_entries(): |
| 1193 | OnosCtrl(self.acl_app).activate() |
| 1194 | for index in range(flows_count): |
| 1195 | src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1196 | dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32' |
| 1197 | dst_port = random.randint(1024,65535) |
| 1198 | log.info('adding acl rule = %d with src ip = %s, dst ip = %s and dst tcp port = %d'%(index+1, src_ip,dst_ip,dst_port)) |
| 1199 | status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip, ipProto ='TCP', dstTpPort =dst_port, action = 'deny') |
| 1200 | assert_equal(status, True) |
| 1201 | igmp_thread = threading.Thread(target = adding_igmp_entries) |
| 1202 | flows_thread = threading.Thread(target = adding_flow_entries) |
| 1203 | acl_thread = threading.Thread(target = adding_acl_entries) |
| 1204 | igmp_thread.start() |
| 1205 | flows_thread.start() |
| 1206 | acl_thread.start() |
| 1207 | time.sleep(1) |
| 1208 | igmp_thread.join() |
| 1209 | flows_thread.join() |
| 1210 | acl_thread.join() |
| 1211 | cpu_usage2 = self.get_system_cpu_usage() |
| 1212 | OnosCtrl(self.igmp_app).deactivate() |
| 1213 | OnosCtrl(self.acl_app).deactivate() |
| 1214 | cpu_usage3 = self.get_system_cpu_usage() |
| 1215 | log.info('cpu usage before test start = %f, after igmp,flow and acl entries loaded = %f and after the apps deactivated = %f'%(cpu_usage1,cpu_usage2,cpu_usage3)) |
| 1216 | OnosCtrl(self.igmp_app).activate() |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1217 | OnosCtrl(self.acl_app).activate() |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1218 | df.callback(0) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1219 | reactor.callLater(0, scale_igmp_acl_flows, df) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1220 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1221 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1222 | @deferred(1000) |
| 1223 | def test_scale_for_vrouter_with_10_routes_with_10_peers(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1224 | """ |
| 1225 | Test-Method: |
| 1226 | 1. Add 10 routes with 10 pairs in quagga |
| 1227 | 2. Verify routes pushed to onos from quagga |
| 1228 | 3. Send traffic destined the routes added |
| 1229 | 3. Verify onos forwards the traffic |
| 1230 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1231 | scale().vrouter_setup() |
| 1232 | df = defer.Deferred() |
| 1233 | def scale_vrouter_routes(df): |
| 1234 | try: |
| 1235 | res = scale().vrouter_network_verify(100, peers = 10) |
| 1236 | assert_equal(res, True) |
| 1237 | except Exception as error: |
| 1238 | log.info('Got Unexpected error %s'%error) |
| 1239 | raise |
| 1240 | df.callback(0) |
| 1241 | reactor.callLater(0, scale_vrouter_routes, df) |
| 1242 | return df |
A R Karthick | 8f93029 | 2017-07-07 12:36:22 -0700 | [diff] [blame] | 1243 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1244 | #tested with 100 routes on CiaB |
| 1245 | @deferred(1000) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1246 | def test_scale_for_vrouter_with_10000_routes_with_100_peers(self): |
| 1247 | """ |
| 1248 | Test-Method: |
| 1249 | 1. Add 100000 routes with 100 pairs in quagga |
| 1250 | 2. Verify routes pushed to onos from quagga |
| 1251 | 3. Send traffic destined the routes added |
| 1252 | 3. Verify onos forwards the traffic |
| 1253 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1254 | scale().vrouter_setup() |
| 1255 | df = defer.Deferred() |
| 1256 | def scale_vrouter_routes(df): |
| 1257 | try: |
| 1258 | res = scale().vrouter_network_verify(10000, peers = 100) |
| 1259 | assert_equal(res, True) |
| 1260 | except Exception as error: |
| 1261 | log.info('Got Unexpected error %s'%error) |
| 1262 | raise |
| 1263 | df.callback(0) |
| 1264 | reactor.callLater(0, scale_vrouter_routes, df) |
| 1265 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1266 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1267 | #tested with 100 routes on CiaB |
| 1268 | @deferred(1500) |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1269 | def test_scale_for_vrouter_with_20000_routes_with_200_peers(self): |
| 1270 | """ |
| 1271 | Test-Method: |
| 1272 | 1. Add 20000 routes with 200 pairs in quagga |
| 1273 | 2. Verify routes pushed to onos from quagga |
| 1274 | 3. Send traffic destined the routes added |
| 1275 | 3. Verify onos forwards the traffic |
| 1276 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1277 | scale().vrouter_setup() |
| 1278 | df = defer.Deferred() |
| 1279 | def scale_vrouter_routes(df): |
| 1280 | try: |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1281 | res = scale().vrouter_network_verify(20000, peers = 200) |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1282 | assert_equal(res, True) |
| 1283 | except Exception as error: |
| 1284 | log.info('Got Unexpected error %s'%error) |
| 1285 | raise |
| 1286 | df.callback(0) |
| 1287 | reactor.callLater(0, scale_vrouter_routes, df) |
| 1288 | return df |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1289 | |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1290 | #tested with 100 subscribers on CiaB |
| 1291 | @deferred(1800) |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1292 | def test_scale_of_eap_tls_with_5k_sessions_using_diff_mac(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1293 | """ |
| 1294 | Test-Method: |
| 1295 | 1. Simulate eap authentication requests for 5000 users |
| 1296 | 2. Verify authentication is succes for all 5000 users |
| 1297 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1298 | OnosCtrl('org.opencord.aaa').activate() |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1299 | df = defer.Deferred() |
| 1300 | def eap_tls_5k_with_diff_mac(df): |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1301 | try: |
| 1302 | for i in xrange(5000): |
| 1303 | tls = TLSAuthTest(src_mac = 'random') |
| 1304 | tls.runTest() |
| 1305 | log_test.info('Authentication successfull for user %d'%i) |
| 1306 | except Exception as error: |
| 1307 | log.info('Got Unexpected error %s'%error) |
| 1308 | raise |
Anil Kumar Sanka | 8942c88 | 2017-07-07 17:05:11 +0000 | [diff] [blame] | 1309 | df.callback(0) |
| 1310 | reactor.callLater(0, eap_tls_5k_with_diff_mac, df) |
| 1311 | return df |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1312 | |
| 1313 | #tested with 100 subscribers on CiaB |
| 1314 | @deferred(1800) |
| 1315 | def test_scale_of_eap_tls_with_5k_sessions_using_diff_mac_with_aaa_deactivate_and_activated(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1316 | """ |
| 1317 | Test-Method: |
| 1318 | 1. Simulate eap authentication requests for 5000 users |
| 1319 | 2. Verify authentication is succes for all 5000 users |
| 1320 | 3. Deactivate and activate the aaa app in onos |
| 1321 | 4. Simulate eap authentication requests for 5000 users |
| 1322 | 5. Verify authentication is succes for all 5000 users |
| 1323 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1324 | OnosCtrl('org.opencord.aaa').activate() |
| 1325 | df = defer.Deferred() |
| 1326 | def eap_tls_5k_with_diff_mac(df): |
| 1327 | try: |
| 1328 | for i in xrange(5000): |
| 1329 | tls = TLSAuthTest(src_mac = 'random') |
| 1330 | tls.runTest() |
| 1331 | log_test.info('Authentication successfull for user %d'%i) |
| 1332 | OnosCtrl('org.opencord.aaa').deactivate() |
| 1333 | time.sleep(2) |
| 1334 | OnosCtrl('org.opencord.aaa').activate() |
| 1335 | for i in xrange(100): |
| 1336 | tls = TLSAuthTest(src_mac = 'random') |
| 1337 | tls.runTest() |
| 1338 | log_test.info('Authentication successfull for user %d'%i) |
| 1339 | OnosCtrl('org.opencord.aaa').activate() |
| 1340 | except Exception as error: |
| 1341 | log.info('Got Unexpected error %s'%error) |
| 1342 | OnosCtrl('org.opencord.aaa').activate() |
| 1343 | raise |
| 1344 | df.callback(0) |
| 1345 | reactor.callLater(0, eap_tls_5k_with_diff_mac, df) |
| 1346 | return df |
| 1347 | |
| 1348 | #tested with 10 subscribers on CiaB |
| 1349 | @deferred(1800) |
| 1350 | def test_scale_5k_cord_subscribers_authentication_with_valid_and_invalid_certificates_and_channel_surfing(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1351 | """ |
| 1352 | Test-Method: |
| 1353 | 1. Simulate 5000 subscribers to get authentication access |
| 1354 | 2. Send igmp joins from all the subcribers |
| 1355 | 3. Verify multicast traffic received to all 5000 subscribers |
| 1356 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1357 | scale().subscriber_setup() |
| 1358 | df = defer.Deferred() |
| 1359 | def cordsub_auth_invalid_cert(df): |
| 1360 | num_subscribers = 2 |
| 1361 | num_channels = 1 |
| 1362 | try: |
| 1363 | test_status = scale().subscriber_join_verify(num_subscribers = num_subscribers, |
| 1364 | num_channels = num_channels, |
| 1365 | cbs = (scale().tls_invalid_cert, scale().dhcp_verify, scale().igmp_verify), |
| 1366 | port_list = scale().generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'half') |
| 1367 | assert_equal(test_status, True) |
| 1368 | except Exception as error: |
| 1369 | log.info('Got Unexpected error %s'%error) |
| 1370 | raise |
| 1371 | finally: |
| 1372 | scale().subscriber_teardown() |
| 1373 | df.callback(0) |
| 1374 | reactor.callLater(0, cordsub_auth_invalid_cert, df) |
| 1375 | return df |
| 1376 | |
| 1377 | #tested with 10 subscribers on CiaB |
| 1378 | @deferred(1800) |
| 1379 | def test_scale_5k_cord_subscribers_igmp_join_jump_1500channel(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1380 | """ |
| 1381 | Test-Method: |
| 1382 | 1. Simulate 5000 subscribers |
| 1383 | 2. Send igmp joins from all the subcribers |
| 1384 | 3. Verify multicast traffic received to all 5000 subscribers |
| 1385 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1386 | scale().subscriber_setup() |
| 1387 | df = defer.Deferred() |
| 1388 | def cordsub_igmp_join_jump(df): |
| 1389 | num_subscribers = 5000 |
| 1390 | num_channels = 1500 |
| 1391 | try: |
| 1392 | test_status = scale().subscriber_join_verify(num_subscribers = num_subscribers, |
| 1393 | num_channels = num_channels, |
| 1394 | cbs = (scale().tls_verify, scale().dhcp_jump_verify, scale().igmp_jump_verify), |
| 1395 | port_list = scale().generate_port_list(num_subscribers, num_channels), |
| 1396 | negative_subscriber_auth = 'all') |
| 1397 | assert_equal(test_status, True) |
| 1398 | except Exception as error: |
| 1399 | log.info('Got Unexpected error %s'%error) |
| 1400 | raise |
| 1401 | finally: |
| 1402 | scale().subscriber_teardown() |
| 1403 | df.callback(0) |
| 1404 | reactor.callLater(0, cordsub_igmp_join_jump, df) |
| 1405 | return df |
| 1406 | |
| 1407 | #tested with 10 subscribers on CiaB |
| 1408 | @deferred(1800) |
| 1409 | def test_scale_10k_cord_subscribers_authentication_with_valid_and_non_ca_authorized_certificates_and_channel_surfing(self): |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1410 | """ |
| 1411 | Test-Method: |
| 1412 | 1. Simulate 10000 subscribers to get authentication access |
| 1413 | 2. Send igmp joins from all the subcribers |
| 1414 | 3. Verify multicast traffic received to all 10000 subscribers |
| 1415 | """ |
Anil Kumar Sanka | fcb9a0f | 2017-07-22 00:24:35 +0000 | [diff] [blame] | 1416 | scale().subscriber_setup() |
| 1417 | df = defer.Deferred() |
| 1418 | def cordsub_auth_valid_cert(df): |
| 1419 | num_subscribers = 10000 |
| 1420 | num_channels = 1 |
| 1421 | try: |
| 1422 | test_status = scale().subscriber_join_verify(num_subscribers = num_subscribers, |
| 1423 | num_channels = num_channels, |
| 1424 | cbs = (scale().tls_non_ca_authrized_cert, scale().dhcp_verify, scale().igmp_verify), |
| 1425 | port_list = scale().generate_port_list(num_subscribers, num_channels), |
| 1426 | negative_subscriber_auth = 'onethird') |
| 1427 | assert_equal(test_status, True) |
| 1428 | except Exception as error: |
| 1429 | log.info('Got Unexpected error %s'%error) |
| 1430 | raise |
| 1431 | finally: |
| 1432 | scale().subscriber_teardown() |
| 1433 | df.callback(0) |
| 1434 | reactor.callLater(0, cordsub_auth_valid_cert, df) |
| 1435 | return df |
Anil Kumar Sanka | 35fc445 | 2017-07-27 00:39:10 +0000 | [diff] [blame] | 1436 | |