blob: 483b6fdc9547cdba2345434047703018b4b57b14 [file] [log] [blame]
Chetan Gaonker52418832017-01-26 23:03:13 +00001#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#
15import unittest
16from nose.tools import *
17from scapy.all import *
18from OnosCtrl import OnosCtrl, get_mac
19from OltConfig import OltConfig
20from socket import socket
21from OnosFlowCtrl import OnosFlowCtrl
22from nose.twistedtools import reactor, deferred
23from twisted.internet import defer
24from onosclidriver import OnosCliDriver
25from CordContainer import Container, Onos, Quagga
26from CordTestServer import cord_test_onos_restart, cord_test_onos_shutdown
27from portmaps import g_subscriber_port_map
28from scapy.all import *
29import time, monotonic
30from OnosLog import OnosLog
31from CordLogger import CordLogger
32from os import environ as env
33import os
34import json
35import random
36import collections
37import paramiko
38from paramiko import SSHClient
39log.setLevel('INFO')
40
41class vsg_exchange(CordLogger):
42 ONOS_INSTANCES = 3
43 V_INF1 = 'veth0'
44 device_id = 'of:' + get_mac()
45 testcaseLoggers = ("")
46 TEST_IP = '8.8.8.8'
47 HOST = "10.1.0.1"
48 USER = "vagrant"
49 PASS = "vagrant"
50
51
52 def setUp(self):
53 if self._testMethodName not in self.testcaseLoggers:
54 super(vsg_exchange, self).setUp()
55
56 def tearDown(self):
57 if self._testMethodName not in self.testcaseLoggers:
58 super(vsg_exchange, self).tearDown()
59
60 def get_controller(self):
61 controller = os.getenv('ONOS_CONTROLLER_IP') or 'localhost'
62 controller = controller.split(',')[0]
63 return controller
64
65 @classmethod
66 def get_controllers(cls):
67 controllers = os.getenv('ONOS_CONTROLLER_IP') or ''
68 return controllers.split(',')
69
70 def cliEnter(self, controller = None):
71 retries = 0
72 while retries < 30:
73 self.cli = OnosCliDriver(controller = controller, connect = True)
74 if self.cli.handle:
75 break
76 else:
77 retries += 1
78 time.sleep(2)
79
80 def cliExit(self):
81 self.cli.disconnect()
82
83 def onos_shutdown(self, controller = None):
84 status = True
85 self.cliEnter(controller = controller)
86 try:
87 self.cli.shutdown(timeout = 10)
88 except:
89 log.info('Graceful shutdown of ONOS failed for controller: %s' %controller)
90 status = False
91
92 self.cliExit()
93 return status
94
95 def log_set(self, level = None, app = 'org.onosproject', controllers = None):
96 CordLogger.logSet(level = level, app = app, controllers = controllers, forced = True)
97
98 def get_nova_credentials_v2():
99 credential = {}
100 credential['version'] = '2'
101 credential['username'] = env['OS_USERNAME']
102 credential['api_key'] = env['OS_PASSWORD']
103 credential['auth_url'] = env['OS_AUTH_URL']
104 credential['project_id'] = env['OS_TENANT_NAME']
105 return credential
106
107 def get_vsg_ip(vm_id):
108 credentials = get_nova_credentials_v2()
109 nova_client = Client(**credentials)
110 result = nova_client.servers.list()
111 for server in result:
112 print server;
113
114 def health_check(self):
115 cmd = "nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2"
116 status, nova_id = commands.getstatusoutput(cmd)
117 cmd = "nova interface-list {{ nova_id }}|grep -o -m 1 '172\.27\.[[:digit:]]*\.[[:digit:]]*'"
118 status, ip = commands.getstatusoutput(cmd)
119 cmd = "ping -c1 {0}".format(ip)
120 status = os.system(cmd)
121 return status
122
123 def ping_ip(remote, ip):
124 results = []
125 cmd = "ping -c1 {0}".format(ip)
126 result = remote.execute(cmd, verbose=False)
127 return results
128
129 def vsg_vm_ssh_check(vsg_ip):
130 cmd = "nc -z -v "+str(vsg_ip)+" 22"
131 status = os.system(cmd)
132 return status
133
134 def get_vcpe(self):
135 cmd = "nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2"
136 status, node_id = commands.getstatusoutput(cmd)
137
138 def connect_ssh(vsg_ip, private_key_file=None, user='ubuntu'):
139 key = ssh.RSAKey.from_private_key_file(private_key_file)
140 client = ssh.SSHClient()
141 client.set_missing_host_key_policy(ssh.WarningPolicy())
142 client.connect(ip, username=user, pkey=key, timeout=5)
143 return client
144
145 def test_vsg_vm(self):
146 status = self.health_check()
147 assert_equal( status, False)
148
149 def test_vsg_for_default_route_to_vsg_vm(self):
150 client = SSHClient()
151 client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
152 client.connect( self.HOST, username = self.USER, password=self.PASS)
153 cmd = "sudo lxc exec testclient -- route | grep default"
154 stdin, stdout, stderr = client.exec_command(cmd)
155 status = stdout.channel.recv_exit_status()
156 assert_equal( status, False)
157
158 def test_vsg_vm_for_vcpe(self):
159 client = SSHClient()
160 client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
161 client.connect( self.HOST, username = self.USER, password=self.PASS)
162 cmd = "nova service-list|grep nova-compute|cut -d '|' -f 3"
163 stdin, stdout, stderr = client.exec_command(cmd)
164 cmd = "nova list --all-tenants | grep mysite_vsg|cut -d '|' -f 7 | cut -d '=' -f 2 | cut -d ';' -f 1"
165 status, ip = commands.getstatusoutput(cmd)
166 #cmd = "ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {0}" ubuntu@{1} "sudo docker ps|grep vcpe"".format(compute_node_name, ip)
167 status = stdout.channel.recv_exit_status()
168 assert_equal( status, False)
169
170 def test_vsg_for_external_connectivity(self):
171 client = SSHClient()
172 client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
173 client.connect( self.HOST, username = self.USER, password=self.PASS)
174 cmd = "lxc exec testclient -- ping -c 3 8.8.8.8"
175 stdin, stdout, stderr = client.exec_command(cmd)
176 status = stdout.channel.recv_exit_status()
177 assert_equal( status, False)
178
179 def test_vsg_cord_subscriber_creation(self):
180 pass
181
182 def test_vsg_for_dhcp_client(self):
183 pass
184
185 def test_vsg_for_snat(self):
186 pass
187
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000188 def test_vsg_for_ping_from_vsg_to_external_network(self):
189 """
190 Algo:
191 1.Create a vSG VM in compute node
192 2.Ensure VM created properly
193 3.Verify login to VM success
194 4.Do ping to external network from vSG VM
195 5.Verify that ping gets success
196 6.Verify ping success flows added in OvS
197 """
198 def test_vsg_for_ping_from_vcpe_to_external_network(self):
199 """
200 Algo:
201 1.Create a vSG VM in compute node
202 2.Create a vCPE container inside VM
203 3.Verify both VM and Container created properly
204 4.Verify login to vCPE container success
205 5.Do ping to external network from vCPE container
206 6.Verify that ping gets success
207 7.Verify ping success flows added in OvS
208 """
209
Chetan Gaonker52418832017-01-26 23:03:13 +0000210 def test_vsg_for_dns_service(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000211 """
212 Algo:
213 1. Create a test client in Prod VM
214 2. Create a vCPE container in vSG VM inside compute Node
215 3. Ensure vSG VM and vCPE container created properly
216 4. Enable dns service in vCPE ( if not by default )
217 5. Send ping request from test client to valid domain address say, 'www.google'com
218 6. Verify that dns should resolve ping should success
219 7. Now send ping request to invalid domain address say 'www.invalidaddress'.com'
220 8. Verify that dns resolve should fail and hence ping
221 """
222 def test_vsg_for_10_subscribers_for_same_service(self):
223 """
224 Algo:
225 1.Create a vSG VM in compute node
226 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
227 3.Ensure vSG VM and vCPE container created properly
228 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
229 5.Verify that ping success for all 10 subscribers
230 """
231 def test_vsg_for_10_subscribers_for_same_service_ping_invalid_ip(self):
232 """
233 Algo:
234 1.Create a vSG VM in compute Node
235 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
236 3.Ensure vSG VM and vCPE container created properly
237 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP
238 5.Verify that ping fails for all 10 subscribers
239 """
240 def test_vsg_for_10_subscribers_for_same_service_ping_valid_and_invalid_ip(self):
241 """
242 Algo:
243 1.Create a vSG VM in VM
244 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
245 3.Ensure vSG VM and vCPE container created properly
246 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP
247 5.Verify that ping success for all 5 subscribers
248 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP
249 7.Verify that ping fails for all 5 subscribers
250 """
251 def test_vsg_for_100_subscribers_for_same_service(self):
252 """
253 Algo:
254 1.Create a vSG VM in compute node
255 2.Create 100 vCPE containers for 100 subscribers, in vSG VM
256 3.Ensure vSG VM and vCPE container created properly
257 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
258 5.Verify that ping success for all 100 subscribers
259 """
260 def test_vsg_for_100_subscribers_for_same_service_ping_invalid_ip(self):
261 """
262 Algo:
263 1.Create a vSG VM in compute Node
264 2.Create 10 vCPE containers for 100 subscribers, in vSG VM
265 3.Ensure vSG VM and vCPE container created properly
266 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP
267 5.Verify that ping fails for all 100 subscribers
268 """
269 def test_vsg_for_100_subscribers_for_same_service_ping_valid_and_invalid_ip(self):
270 """
271 Algo:
272 1.Create a vSG VM in VM
273 2.Create 10 vCPE containers for 100 subscribers, in vSG VM
274 3.Ensure vSG VM and vCPE container created properly
275 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP
276 5.Verify that ping success for all 5 subscribers
277 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP
278 7.Verify that ping fails for all 5 subscribers
279 """
280 def test_vsg_for_packet_received_with_invalid_ip_fields(self):
281 """
282 Algo:
283 1.Create a vSG VM in compute node
284 2.Create a vCPE container in vSG VM
285 3.Ensure vSG VM and vCPE container created properly
286 4.From subscriber, send a ping packet with invalid ip fields
287 5.Verify that vSG drops the packet
288 6.Verify ping fails
289 """
290 def test_vsg_for_packet_received_with_invalid_mac_fields(self):
291 """
292 Algo:
293 1.Create a vSG VM in compute node
294 2.Create a vCPE container in vSG VM
295 3.Ensure vSG VM and vCPE container created properly
296 4.From subscriber, send a ping packet with invalid mac fields
297 5.Verify that vSG drops the packet
298 6.Verify ping fails
299 """
300 def test_vsg_for_vlan_id_mismatch_in_stag(self):
301 """
302 Algo:
303 1.Create a vSG VM in compute Node
304 2.Create a vCPE container in vSG VM
305 3.Ensure vSG VM and vCPE container created properly
306 4.Send a ping request to external valid IP from subscriber, with incorrect vlan id in s-tag and valid c-tag
307 5.Verify that ping fails as the packet drops at VM entry
308 6.Repeat step 4 with correct s-tag
309 7.Verify that ping success
310 """
311 def test_vsg_for_vlan_id_mismatch_in_ctag(self):
312 """
313 Algo:
314 1.Create a vSG VM in compute node
315 2.Create a vCPE container in vSG VM
316 3.Ensure vSG VM and vCPE container created properly
317 4.Send a ping request to external valid IP from subscriber, with valid s-tag and incorrect vlan id in c-tag
318 5.Verify that ping fails as the packet drops at vCPE container entry
319 6.Repeat step 4 with valid s-tag and c-tag
320 7.Verify that ping success
321 """
322 def test_vsg_for_matching_and_mismatching_vlan_id_in_stag(self):
323 """
324 Algo:
325 1.Create two vSG VMs in compute node
326 2.Create a vCPE container in each vSG VM
327 3.Ensure vSG VM and vCPE container created properly
328 4.From subscriber one, send ping request with valid s and c tags
329 5.From subscriber two, send ping request with vlan id mismatch in s-tag and valid c tags
330 6.Verify that ping success for only subscriber one and fails for two.
331 """
332 def test_vsg_for_matching_and_mismatching_vlan_id_in_ctag(self):
333 """
334 Algo:
335 1.Create a vSG VM in compute node
336 2.Create two vCPE containers in vSG VM
337 3.Ensure vSG VM and vCPE container created properly
338 4.From subscriber one, send ping request with valid s and c tags
339 5.From subscriber two, send ping request with valid s-tag and vlan id mismatch in c-tag
340 6.Verify that ping success for only subscriber one and fails for two
341 """
342 def test_vsg_for_out_of_range_vlanid_in_ctag(self):
343 """
344 Algo:
345 1.Create a vSG VM in compute node
346 2.Create a vCPE container in vSG VM
347 3.Ensure vSG VM and vCPE container created properly
348 4.From subscriber, send ping request with valid stag and vlan id in c-tag is an out of range value ( like 0,4097 )
349 4.Verify that ping fails as the ping packets drops at vCPE container entry
350 """
351 def test_vsg_for_out_of_range_vlanid_in_stag(self):
352 """
353 Algo:
354 1.Create a vSG VM in compute node
355 2.Create a vCPE container in vSG VM
356 3.Ensure vSG VM and vCPE container created properly
357 2.From subscriber, send ping request with vlan id in s-tag is an out of range value ( like 0,4097 ), with valid c-tag
358 4.Verify that ping fails as the ping packets drops at vSG VM entry
359 """
360 def test_vsg_without_creating_vcpe_instance(self):
361 """
362 Algo:
363 1.Create a vSG VM in compute Node
364 2.Ensure vSG VM created properly
365 3.Do not create vCPE container inside vSG VM
366 4.From a subscriber, send ping to external valid IP
367 5.Verify that ping fails as the ping packet drops at vSG VM entry itself.
368 """
369 def test_vsg_for_remove_vcpe_instance(self):
370 """
371 Algo:
372 1.Create a vSG VM in compute node
373 2.Create a vCPE container in vSG VM
374 3.Ensure vSG VM and vCPE container created properly
375 4.From subscriber, send ping request with valid s-tag and c-tag
376 5.Verify that ping success
377 6.Verify ping success flows in OvS switch in compute node
378 7.Now remove the vCPE container in vSG VM
379 8.Ensure that the container removed properly
380 9.Repeat step 4
381 10.Verify that now, ping fails
382 """
383 def test_vsg_for_restart_vcpe_instance(self):
384 """
385 Algo:
386 1.Create a vSG VM in compute node
387 2.Create a vCPE container in vSG VM
388 3.Ensure vSG VM and vCPE container created properly
389 4.From subscriber, send ping request with valid s-tag and c-tag
390 5.Verify that ping success
391 6.Verify ping success flows in OvS switch in compute node
392 7.Now restart the vCPE container in vSG VM
393 8.Ensure that the container came up after restart
394 9.Repeat step 4
395 10.Verify that now,ping gets success and flows added in OvS
396 """
397 def test_vsg_for_restart_vsg_vm(self):
398 """
399 Algo:
400 1.Create a vSG VM in compute node
401 2.Create a vCPE container in vSG VM
402 3.Ensure vSG VM and vCPE container created properly
403 4.From subscriber, send ping request with valid s-tag and c-tag
404 5.Verify that ping success
405 6.Verify ping success flows in OvS switch in compute node
406 7.Now restart the vSG VM
407 8.Ensure that the vSG comes up properly after restart
408 9.Verify that vCPE container comes up after vSG restart
409 10.Repeat step 4
410 11.Verify that now,ping gets success and flows added in OvS
411 """
412 def test_vsg_for_pause_vcpe_instance(self):
413 """
414 Algo:
415 1.Create a vSG VM in compute node
416 2.Create a vCPE container in vSG VM
417 3.Ensure vSG VM and vCPE container created properly
418 4.From subscriber, send ping request with valid s-tag and c-tag
419 5.Verify that ping success
420 6.Verify ping success flows in OvS switch in compute node
421 7.Now pause vCPE container in vSG VM for a while
422 8.Ensure that the container state is pause
423 9.Repeat step 4
424 10.Verify that now,ping fails now and verify flows in OvS
425 11.Now resume the container
426 12.Now repeat step 4 again
427 13.Verify that now, ping gets success
428 14.Verify ping success flows in OvS
429 """
430 def test_vsg_for_extract_all_compute_stats_from_all_vcpe_containers(self):
431 """
432 Algo:
433 1.Create a vSG VM in compute node
434 2.Create 10 vCPE containers in VM
435 3.Ensure vSG VM and vCPE containers created properly
436 4.Login to all vCPE containers
437 4.Get all compute stats from all vCPE containers
438 5.Verify the stats # verification method need to add
439 """
440 def test_vsg_for_extract_dns_stats_from_all_vcpe_containers(self):
441 """
442 Algo:
443 1.Create a vSG VM in compute node
444 2.Create 10 vCPE containers in VM
445 3.Ensure vSG VM and vCPE containers created properly
446 4.From 10 subscribers, send ping to valid and invalid dns hosts
447 5.Verify dns resolves and ping success for valid dns hosts
448 6.Verify ping fails for invalid dns hosts
449 7.Verify dns host name resolve flows in OvS
450 8.Login to all 10 vCPE containers
451 9.Extract all dns stats
452 10.Verify dns stats for queries sent, queries received for dns host resolve success and failed scenarios
453 """
454 def test_vsg_for_subscriber_access_two_vsg_services(self):
455 """
456 # Intention is to verify if subscriber can reach internet via two vSG VMs
457 Algo:
458 1.Create two vSG VMs for two services in compute node
459 2.Create one vCPE container in each VM for one subscriber
460 3.Ensure VMs and containers created properly
461 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
462 5.Verify ping gets success
463 6.Verify ping success flows in OvS
464 7.Now repeat step 4 with stag corresponds to vSG-2 VM
465 8.Verify that ping again success
466 9.Verify ping success flows in OvS
467 """
468 def test_vsg_for_subscriber_access_service2_if_service1_goes_down(self):
469 """
470 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
471 Algo:
472 1.Create two vSG VMs for two services in compute node
473 2.Create one vCPE container in each VM for one subscriber
474 3.Ensure VMs and containers created properly
475 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
476 5.Verify ping gets success
477 6.Verify ping success flows in OvS
478 7.Down the vSG-1 VM
479 8.Now repeat step 4
480 9.Verify that ping fails as vSG-1 is down
481 10.Repeat step 4 with stag corresponding to vSG-2
482 9.Verify ping success and flows added in OvS
483 """
484 def test_vsg_for_subscriber_access_service2_if_service1_goes_restart(self):
485 """
486 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
487 Algo:
488 1.Create two vSG VMs for two services in compute node
489 2.Create one vCPE container in each VM for one subscriber
490 3.Ensure VMs and containers created properly
491 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
492 5.Verify ping gets success
493 6.Verify ping success flows added in OvS
494 7.Now restart vSG-1 VM
495 8.Now repeat step 4 while vSG-1 VM restarts
496 9.Verify that ping fails as vSG-1 is restarting
497 10.Repeat step 4 with stag corresponding to vSG-2 while vSG-1 VM restarts
498 11.Verify ping success and flows added in OvS
499 """
500 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_goes_down(self):
501 """
502 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
503 Algo:
504 1.Create a vSG VM in compute node
505 2.Create two vCPE containers corresponds to two subscribers in vSG VM
506 3.Ensure VM and containers created properly
507 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
508 5.Verify ping gets success
509 6.Verify ping success flows added in OvS
510 7.Now stop vCPE-1 container
511 8.Now repeat step 4
512 9.Verify that ping fails as vCPE-1 container is down
513 10.Repeat step 4 with ctag corresponding to vCPE-2 container
514 11.Verify ping success and flows added in OvS
515 """
516 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_restart(self):
517 """
518 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
519 Algo:
520 1.Create a vSG VM in compute node
521 2.Create two vCPE containers corresponds to two subscribers in vSG VM
522 3.Ensure VM and containers created properly
523 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
524 5.Verify ping gets success
525 6.Verify ping success flows added in OvS
526 7.Now restart vCPE-1 container
527 8.Now repeat step 4 while vCPE-1 restarts
528 9.Verify that ping fails as vCPE-1 container is restarts
529 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 restarts
530 11..Verify ping success and flows added in OvS
531 """
532 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_pause(self):
533 """
534 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 paused
535 Algo:
536 1.Create a vSG VM in compute node
537 2.Create two vCPE containers corresponds to two subscribers in vSG VM
538 3.Ensure VM and containers created properly
539 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
540 5.Verify ping gets success
541 6.Verify ping success flows added in OvS
542 7.Now pause vCPE-1 container
543 8.Now repeat step 4 while vCPE-1 in pause state
544 9.Verify that ping fails as vCPE-1 container in pause state
545 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 in pause state
546 11.Verify ping success and flows added in OvS
547 """
548 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_removed(self):
549 """
550 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 removed
551 Algo:
552 1.Create a vSG VM in compute node
553 2.Create two vCPE containers corresponds to two subscribers in vSG VM
554 3.Ensure VM and containers created properly
555 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
556 5.Verify ping gets success
557 6.Verify ping success flows added in OvS
558 7.Now remove vCPE-1 container
559 8.Now repeat step 4
560 9.Verify that ping fails as vCPE-1 container removed
561 10.Repeat step 4 with ctag corresponding to vCPE-2 container
562 11.Verify ping success and flows added in OvS
563 """
564 def test_vsg_for_vcpe_instance_removed_and_added_again(self):
565 """
566 Algo:
567 1.Create a vSG VM in compute node
568 2.Create a vCPE container in vSG VM
569 3.Ensure VM and containers created properly
570 4.From subscriber end, send ping to public IP
571 5.Verify ping gets success
572 6.Verify ping success flows added in OvS
573 7.Now remove vCPE container in vSG VM
574 8.Now repeat step 4
575 9.Verify that ping fails as vCPE container removed
576 10.Create the vCPE container again for the same subscriber
577 11.Ensure that vCPE created now
578 12.Now repeat step 4
579 13.Verify ping success and flows added in OvS
580 """
581 def test_vsg_for_vsg_vm_removed_and_added_again(self):
582 """
583 Algo:
584 1.Create a vSG VM in compute node
585 2.Create a vCPE container in vSG VM
586 3.Ensure VM and containers created properly
587 4.From subscriber end, send ping to public IP
588 5.Verify ping gets success
589 6.Verify ping success flows added in OvS
590 7.Now remove vSG VM
591 8.Now repeat step 4
592 9.Verify that ping fails as vSG VM not exists
593 10.Create the vSG VM and vCPE container in VM again
594 11.Ensure that vSG and vCPE created
595 12.Now repeat step 4
596 13.Verify ping success and flows added in OvS
597 """
598
599 #Test vSG - Subscriber Configuration
600 def test_vsg_for_configuring_new_subscriber_in_vcpe(self):
601 """
602 Algo:
603 1.Create a vSG VM in compute node
604 2.Create a vCPE container in vSG VM
605 3.Ensure VM and containers created properly
606 4.Configure a subscriber in XOS and assign a service id
607 5.Set the admin privileges to the subscriber
608 6.Verify subscriber configuration is success
609 """
610 def test_vsg_for_adding_subscriber_devices_in_vcpe(self):
611 """
612 Algo:
613 1.Create a vSG VM in compute node
614 2.Create a vCPE container in vSG VM
615 3.Ensure VM and containers created properly
616 4.Configure a subscriber in XOS and assign a service id
617 5.Verify subscriber successfully configured in vCPE
618 6.Now add devices( Mac addresses ) under the subscriber admin group
619 7.Verify all devices ( Macs ) added successfully
620 """
621 def test_vsg_for_removing_subscriber_devices_in_vcpe(self):
622 """
623 Algo:
624 1.Create a vSG VM in compute node
625 2.Create a vCPE container in vSG VM
626 3.Ensure VM and containers created properly
627 4.Configure a subscriber in XOS and assign a service id
628 5.Verify subscriber successfully configured
629 6.Now add devices( Mac addresses ) under the subscriber admin group
630 7.Verify all devices ( Macs ) added successfully
631 8.Now remove All the added devices in XOS
632 9.Verify all the devices removed
633 """
634 def test_vsg_for_modify_subscriber_devices_in_vcpe(self):
635 """
636 Algo:
637 1.Create a vSG VM in compute node
638 2.Create a vCPE container in vSG VM
639 3.Ensure VM and containers created properly
640 4.Configure a user in XOS and assign a service id
641 5.Verify subscriber successfully configured in vCPE.
642 6.Now add devices( Mac addresses ) under the subscriber admin group
643 7.Verify all devices ( Macs ) added successfully
644 8.Now remove few devices in XOS
645 9.Verify devices removed successfully
646 10.Now add few additional devices in XOS under the same subscriber admin group
647 11.Verify newly added devices successfully added
648 """
649 def test_vsg_for_vcpe_login_fails_with_incorrect_subscriber_credentials(self):
650 """
651 Algo:
652 1.Create a vSG VM in compute node
653 2.Create a vCPE container in vSG VM
654 3.Ensure VM and containers created properly
655 4.Configure a subscriber in XOS and assign a service id
656 5.Verify subscriber successfully configured
657 6.Now add devices( Mac addresses ) under the subscriber admin group
658 7.Verify all devices ( Macs ) added successfully
659 8.Login vCPE with credentials with which subscriber configured
660 9.Verify subscriber successfully logged in
661 10.Logout and login again with incorrect credentials ( either user name or password )
662 11.Verify login attempt to vCPE fails wtih incorrect credentials
663 """
664 def test_vsg_for_subscriber_configuration_in_vcpe_retain_after_vcpe_restart(self):
665 """
666 Algo:
667 1.Create a vSG VM in compute node
668 2.Create a vCPE container in vSG VM
669 3.Ensure VM and containers created properly
670 4.Configure a subscriber in XOS and assign a service id
671 5.Verify subscriber successfully configured
672 6.Now add devices( Mac addresses ) under the subscriber admin group
673 7.Verify all devices ( Macs ) added successfully
674 8.Restart vCPE ( locate backup config path while restart )
675 9.Verify subscriber details in vCPE after restart should be same as before the restart
676 """
677 def test_vsg_for_create_multiple_vcpe_instances_and_configure_subscriber_in_each_instance(self):
678 """
679 Algo:
680 1.Create a vSG VM in compute node
681 2.Create 2 vCPE containers in vSG VM
682 3.Ensure VM and containers created properly
683 4.Configure a subscriber in XOS for each vCPE instance and assign a service id
684 5.Verify subscribers successfully configured
685 6.Now login vCPE-2 with subscriber-1 credentials
686 7.Verify login fails
687 8.Now login vCPE-1 with subscriber-2 credentials
688 9.Verify login fails
689 10.Now login vCPE-1 with subscriber-1 and vCPE-2 with subscriber-2 credentials
690 11.Verify that both the subscribers able to login to their respective vCPE containers
691 """
692 def test_vsg_for_same_subscriber_can_be_configured_for_multiple_services(self):
693 """
694 Algo:
695 1.Create 2 vSG VMs in compute node
696 2.Create a vCPE container in each vSG VM
697 3.Ensure VMs and containers created properly
698 4.Configure same subscriber in XOS for each vCPE instance and assign a service id
699 5.Verify subscriber successfully configured
700 6.Now login vCPE-1 with subscriber credentials
701 7.Verify login success
702 8.Now login vCPE-2 with the same subscriber credentials
703 9.Verify login success
704 """
705
706 #Test Example Service
707 def test_vsg_for_subcriber_avail_example_service_running_in_apache_server(self):
708 """
709 Algo:
710 1.Create a vSG VM in compute node
711 2.Create a vCPE container in each vSG VM
712 3.Ensure VM and container created properly
713 4.Configure a subscriber in XOS for the vCPE instance and assign a service id
714 5.On-board an example service into cord pod
715 6.Create a VM in compute node and run the example service ( Apache server )
716 7.Configure the example service with service specific and subscriber specific messages
717 8.Verify example service on-boarded successfully
718 9.Verify example service running in VM
719 10.Run a curl command from subscriber to reach example service
720 11.Verify subscriber can successfully reach example service via vSG
721 12.Verify that service specific and subscriber specific messages
722 """
723 def test_vsg_for_subcriber_avail_example_service_running_in_apache_server_after_service_restart(self):
724 """
725 Algo:
726 1.Create a vSG VM in compute node
727 2.Create a vCPE container in each vSG VM
728 3.Ensure VM and container created properly
729 4.Configure a subscriber in XOS for the vCPE instance and assign a service id
730 5.On-board an example service into cord pod
731 6.Create a VM in compute node and run the example service ( Apache server )
732 7.Configure the example service with service specific and subscriber specific messages
733 8.Verify example service on-boarded successfully
734 9.Verify example service running in VM
735 10.Run a curl command from subscriber to reach example service
736 11.Verify subscriber can successfully reach example service via vSG
737 12.Verify that service specific and subscriber specific messages
738 13.Restart example service running in VM
739 14.Repeat step 10
740 15.Verify the same results as mentioned in steps 11, 12
741 """
742
743 #vCPE Firewall Functionality
744 def test_vsg_firewall_for_creating_acl_rule_based_on_source_ip(self):
745 """
746 Algo:
747 1.Create a vSG VM in compute node
748 2.Create vCPE container in the VM
749 3.Ensure vSG VM and vCPE container created properly
750 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
751 5.Bound the acl rule to WAN interface of vCPE
752 6.Verify configuration in vCPE is success
753 8.Verify flows added in OvS
754 """
755 def test_vsg_firewall_for_creating_acl_rule_based_on_destination_ip(self):
756 """
757 Algo:
758 1.Create a vSG VM in compute node
759 2.Create vCPE container in the VM
760 3.Ensure vSG VM and vCPE container created properly
761 4.Configure ac acl rule in vCPE to deny IP traffic to a destination ip
762 5.Bound the acl rule to WAN interface of vCPE
763 6.Verify configuration in vCPE is success
764 8.Verify flows added in OvS
765 """
766 def test_vsg_firewall_for_acl_deny_rule_based_on_source_ip_traffic(self):
767 """
768 Algo:
769 1.Create a vSG VM in compute node
770 2.Create vCPE container in the VM
771 3.Ensure vSG VM and vCPE container created properly
772 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
773 5.Bound the acl rule to WAN interface of vCPE
774 6.From subscriber, send ping to the denied IP address
775 7.Verify that ping fails as vCPE denies ping response
776 8.Verify flows added in OvS
777 """
778 def test_vsg_firewall_for_acl_deny_rule_based_on_destination_ip_traffic(self):
779 """
780 Algo:
781 1.Create a vSG VM in compute node
782 2.Create vCPE container in the VM
783 3.Ensure vSG VM and vCPE container created properly
784 4.Configure ac acl rule in vCPE to deny IP traffic to a destination IP
785 5.Bound the acl rule to WAN interface of vCPE
786 6.From subscriber, send ping to the denied IP address
787 7.Verify that ping fails as vCPE drops the ping request at WAN interface
788 8.Verify flows added in OvS
789 """
Chetan Gaonker52418832017-01-26 23:03:13 +0000790
791 def test_vsg_dnsmasq(self):
792 pass
793
794 def test_vsg_with_external_parental_control_family_shield_for_filter(self):
795 pass
796
797 def test_vsg_with_external_parental_control_with_answerx(self):
798 pass
799
800 def test_vsg_for_subscriber_upstream_bandwidth(self):
801 pass
802
803 def test_vsg_for_subscriber_downstream_bandwidth(self):
804 pass
805
806 def test_vsg_for_diagnostic_run_of_traceroute(self):
807 pass
808
809 def test_vsg_for_diagnostic_run_of_tcpdump(self):
810 pass
811
812 def test_vsg_for_iptable_rules(self):
813 pass
814
815 def test_vsg_for_iptables_with_neutron(self):
816 pass
817