How to use continue_ method in Playwright Python

Best Python code snippet using playwright-python

vlan_verify_api.py

Source:vlan_verify_api.py Github

copy

Full Screen

1# system imports2from os import chdir3from time import sleep4from datetime import datetime5import logging6import yaml7import sys8from pyats import aetest9from pyats.log.utils import banner10from genie import testbed11#from pyats.topology import loader12from multiprocessing import Process13log = logging.getLogger(__name__)14log.setLevel(logging.DEBUG)15#importing custom modules16from Config.config import *17from Fetch.fetch import *18from Misc.misc import misc19#Fetching input values from input.yaml20global lis21lis=[]22global lis123lis1=[]24class common_setup(aetest.CommonSetup): 25 @aetest.subsection26 def initial_configs(self,steps, testbed, **param):27 28 ref_pp = self.parent.parameters29 ref_pp['ctrl'] = testbed.devices[param['ctrl_alias']]30 ref_pp['dn'] = testbed.devices[param['dn_alias']]31 ref_pp['server'] = testbed.devices[param['server_alias']]32 ref_pp['client'] = testbed.devices[param['client_alias']]33 ref_pp['client2'] = testbed.devices[param['client2_alias']]34 ref_pp['client3'] = testbed.devices[param['client3_alias']]35 ref_pp['ctrl_ip'] = ref_pp['ctrl'].connections.cli.ip36 ref_pp['link_name'] = ref_pp['ctrl'].custom['link_name']37 ref_pp['pop_name'] = ref_pp['ctrl'].custom['name']38 ref_pp['pop_mac'] = ref_pp['ctrl'].custom['mac']39 ref_pp['pop_iface'] = ref_pp['ctrl'].custom['iface']40 ref_pp['pop_iface'] = ref_pp['ctrl'].custom['iface']41 ref_pp['pop_mcvlan'] = ref_pp['ctrl'].custom['mcvlan']42 ref_pp['pop_msvlan'] = ref_pp['ctrl'].custom['msvlan']43 ref_pp['pop_management_ip']=ref_pp['ctrl'].custom['management_ip']44 ref_pp['path']=ref_pp['ctrl'].custom['location']45 46 ref_pp['dn1_name']=ref_pp['dn'].custom['name']47 ref_pp['dn1_site']=ref_pp['dn'].custom['site']48 ref_pp['dn1_lat'] = ref_pp['dn'].custom['lat']49 ref_pp['dn1_lon'] = ref_pp['dn'].custom['lon']50 ref_pp['dn1_alt'] = ref_pp['dn'].custom['alt']51 ref_pp['dn1_acc'] = ref_pp['dn'].custom['acc']52 ref_pp['dn1_inf'] = ref_pp['dn'].custom['inf']53 ref_pp['dn1_inf1'] = ref_pp['dn'].custom['inf1'] 54 ref_pp['dn1_mac'] = ref_pp['dn'].custom['mac']55 ref_pp['dn1_management_ip']=ref_pp['dn'].custom['management_ip']56 ref_pp['dn1_cvlan'] = ref_pp['dn'].custom['cvlan']57 ref_pp['dn1_svlan'] = ref_pp['dn'].custom['svlan']58 ref_pp['dn1_mcvlan'] = ref_pp['dn'].custom['mcvlan']59 ref_pp['dn1_msvlan'] = ref_pp['dn'].custom['msvlan']60 ref_pp['server_inf']=ref_pp['server'].custom['inf']61 ref_pp['server_data_ipv6']=ref_pp['server'].custom['ipv6']62 ref_pp['server_data_ipv4']=ref_pp['server'].custom['ipv4']63 ref_pp['server_mgmt_ipv4']=ref_pp['server'].custom['mgmt_ipv4']64 ref_pp['server_file']=ref_pp['server'].custom['capture_file']65 ref_pp['client_inf']=ref_pp['client'].custom['inf']66 ref_pp['client_data_ipv4']=ref_pp['client'].custom['ipv4']67 ref_pp['client2_inf']=ref_pp['client2'].custom['inf']68 ref_pp['client2_data_ipv4']=ref_pp['client2'].custom['ipv4']69 ref_pp['client3_inf']=ref_pp['client3'].custom['inf']70 ref_pp['client3_data_ipv4']=ref_pp['client3'].custom['ipv4']71 72 vlan=int(ref_pp['dn1_cvlan'])73 #global lis74 #lis=[]75 for i in range(0,5):76 lis.append(vlan+i)77 78 svlan=int(ref_pp['dn1_svlan'])79 #global lis180 #lis1=[]81 for i in range(0,5):82 lis1.append(svlan+i) 83 84 85 ref_pp['server'].connect()86 ref_pp['client'].connect()87 88 '''@aetest.subsection89 def create_site(self,steps,ctrl,server,client,**param):90 misc.execute_command(server,'sudo ifconfig {} mtu 1492'.format(param['server_inf']))91 misc.execute_command(client,'sudo ifconfig {} mtu 1492'.format(param['client_inf']))92 log.info('Creating Site')93 assert api.add_site(param['ctrl_ip'],param['dn1_site'],param['dn1_lat'],param['dn1_lon'],param['dn1_alt'],param['dn1_acc'])94 log.info('Successful in adding site')95 96 @aetest.subsection97 def Adding_node(self,steps,ctrl,server,client,**param):98 #Adding dn99 log.info('Adding dn1')100 assert api.add_dn(param['ctrl_ip'],param['dn1_name'],param['dn1_site'],param['dn1_mac']) 101 log.info('Successful in adding dn1')102 103 @aetest.subsection104 def Adding_link(self,steps,ctrl,server,client,**param):105 #Adding link POP to dn1 link106 log.info('Adding link from controller')107 assert api.add_link(param['ctrl_ip'],param['pop_name'],param['dn1_name'],param['pop_mac'],param['dn1_mac'],init_radio='radio1',resp_radio='radio1')108 log.info('Successful in Adding link') 109 log.info('Verify link status')'''110 @aetest.subsection111 def configuring_mgmt_ip(self,steps,ctrl,server,client,**param):112 with steps.start('Configuring Management ip on POP',continue_=True) as step:113 assert api.config_management_ip(param['ctrl_ip'],param['pop_name'],param['pop_management_ip'])114 log.info('Successful in configuring Mgmt ip on POP')115 with steps.start('Configuring Management ip on DN',continue_=True) as step:116 assert api.config_management_ip(param['ctrl_ip'],param['dn1_name'],param['dn1_management_ip'])117 log.info('Successful in configuring Mgmt ip on DN1')118 119 @aetest.subsection120 def start_iperf_server(self,steps,ctrl,server,client,**param):121 misc.config_iperf_server(server)122 @aetest.subsection123 def verify_links(self,steps,ctrl,server,client,**param): 124 log.info('Verify link status')125 for i in range(0,5):126 127 sleep(5)128 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])129 logger.info(data)130 if data["is_alive"] == True: 131 logger.info('Link is Up') 132 break133 elif i == 4:134 if data["is_alive"] == True:135 logger.info('Link is Up')136 else:137 assert False138 139 140 log.info('Successful in bringing up')141 142 @aetest.subsection143 def configure_l2_bridge(self,steps,ctrl,server,client,**param):144 #configuring l2bridge145 log.info('configuring l2bridge')146 147 assert api.config_l2_bridge(param['ctrl_ip'],status='true')148 log.info('Successful in configuring l2bridge')149 150 #sleep(150)151 152 @aetest.subsection153 def verify_links(self,steps,ctrl,server,client,**param):154 log.info('Verify link status')155 for i in range(0,5):156 157 sleep(5)158 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])159 logger.info(data)160 if data["is_alive"] == True: 161 logger.info('Link is Up') 162 break163 elif i == 4:164 if data["is_alive"] == True:165 logger.info('Link is Up')166 else:167 assert False168 log.info('Successful in bringing up') 169 170 171 172class Q_Vlan(aetest.Testcase):173 def Capturing_Server_interface(self,server,server_inf,server_file):174 assert misc.capture_interface(server,server_inf,server_file)175 176 def Verify_traffic(self,client,server_data_ipv4):177 log.info('Starting iperf client')178 up,down=misc.config_iperf_client(client,server_data_ipv4)179 assert ((up != 0.0) and (down != 0.0))180 #log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))181 182 @aetest.setup183 def Setup(self, steps,ctrl,server,client,**param):184 with steps.start('Verifying links',continue_=True) as step: 185 log.info('Verify link status')186 for i in range(0,5):187 188 sleep(5)189 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])190 logger.info(data)191 if data["is_alive"] == True: 192 logger.info('Link is Up') 193 break194 elif i == 4:195 if data["is_alive"] == True:196 logger.info('Link is Up')197 else:198 assert False199 200 with steps.start('Configure Q VLAN in dn',continue_=True) as step:201 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 202 log.info('sucessful in Enabling Single VLAN on dn')203 204 sleep(60)205 with steps.start('Verifying links',continue_=True) as step: 206 log.info('Verify link status')207 for i in range(0,5):208 209 sleep(5)210 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])211 logger.info(data)212 if data["is_alive"] == True: 213 logger.info('Link is Up') 214 break215 elif i == 4:216 if data["is_alive"] == True:217 logger.info('Link is Up')218 else:219 assert False220 221 with steps.start('Configure Q VLAN in Server',continue_=True) as step:222 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])223 log.info('Successful in configuring vlan in Server')224 225 #Configure IP on client PC226 with steps.start('Configure IP in client',continue_=True) as step: 227 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])228 log.info('Successful in configuring IP in Client')229 230 231 232 with steps.start('Capturing and verifying traffic',continue_=True) as step:233 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))234 p1.start()235 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))236 p2.start()237 p1.join()238 p2.join()239 with steps.start('Analyse Capture',continue_=True) as step:240 ip = param['client_data_ipv4'].rsplit('/', 1)[0]241 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])242 res=misc.analyse_capture(server,filter,param['server_file'])243 if res > 0:244 log.info('Successful in VLAN tagging')245 else:246 assert False247 @aetest.cleanup248 def Disabling_Q_VLAN(self,steps,ctrl,server,client,**param):249 250 log.info('Disabling Single VLAN in dn')251 with steps.start('Configure Q VLAN in Server',continue_=True) as step:252 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')253 log.info('Successful in configuring vlan in Server')254 with steps.start('Removing vlan configs from server',continue_=True) as step:255 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],status='disable') 256 log.info('sucessful in Enabling Single VLAN on dn')257 with steps.start('Configure IP in client',continue_=True) as step:258 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')259 log.info('Successful in configuring IP in Client')260 sleep(60)261 with steps.start('Verifying links',continue_=True) as step: 262 log.info('Verify link status')263 for i in range(0,5):264 265 sleep(5)266 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])267 logger.info(data)268 if data["is_alive"] == True: 269 logger.info('Link is Up') 270 break271 elif i == 4:272 if data["is_alive"] == True:273 logger.info('Link is Up')274 else:275 assert False276 277@aetest.loop(etype = ['0x8100', '0x88A8'])278class QinQ_Vlan(aetest.Testcase):279 def Capturing_Server_interface(self,server,server_inf,server_file):280 assert misc.capture_interface(server,server_inf,server_file)281 def Verify_traffic(self,client,server_data_ipv4):282 log.info('Starting iperf client')283 up,down=misc.config_iperf_client(client,server_data_ipv4)284 assert ((up != 0.0) and (down != 0.0))285 #log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))286 287 @aetest.setup288 def Configure_QinQ_Vlan(self, etype, steps,ctrl,server,client,**param):289 with steps.start('Verifying links',continue_=True) as step: 290 log.info('Verify link status')291 for i in range(0,5):292 293 sleep(5)294 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])295 logger.info(data)296 if data["is_alive"] == True: 297 logger.info('Link is Up') 298 break299 elif i == 4:300 if data["is_alive"] == True:301 logger.info('Link is Up')302 else:303 assert False304 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:305 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 306 log.info('sucessful in Enabling Double VLAN on dn')307 sleep(60)308 with steps.start('Verifying links',continue_=True) as step: 309 log.info('Verify link status')310 for i in range(0,5):311 312 sleep(5)313 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])314 logger.info(data)315 if data["is_alive"] == True: 316 logger.info('Link is Up') 317 break318 elif i == 4:319 if data["is_alive"] == True:320 logger.info('Link is Up')321 else:322 assert False323 324 325 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:326 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)327 log.info('Successful in configuring vlan in Server')328 329 #Configure IP on client PC330 with steps.start('Configure IP in client',continue_=True) as step: 331 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])332 log.info('Successful in configuring IP in Client')333 334 335 with steps.start('Capturing and verifying traffic',continue_=True) as step:336 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))337 p1.start()338 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))339 p2.start()340 p1.join()341 p2.join()342 with steps.start('Analyse Capture',continue_=True) as step:343 if etype =='0x8100':344 ip = param['client_data_ipv4'].rsplit('/', 1)[0]345 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id == {}&&vlan.priority==5&&vlan.priority==3'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])346 else:347 ip = param['client_data_ipv4'].rsplit('/', 1)[0]348 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==5&&vlan.priority==3'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])349 res=misc.analyse_capture(server,filter,param['server_file'])350 if res > 0:351 log.info('Successful in QinQ VLAN tagging')352 else:353 assert False354 355 356 357 @aetest.cleanup358 def Disabling_QinQ_VLAN(self,etype,steps,ctrl,server,client,**param):359 360 log.info('Disabling Double VLAN in dn')361 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:362 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')363 log.info('Successful in Removing vlan in Server')364 with steps.start('Removing vlan configs from DN',continue_=True) as step:365 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,status='disable') 366 log.info('sucessful in Removing QinQ VLAN on dn')367 368 sleep(60)369 with steps.start('Verifying links',continue_=True) as step: 370 log.info('Verify link status')371 for i in range(0,5):372 373 sleep(5)374 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])375 logger.info(data)376 if data["is_alive"] == True: 377 logger.info('Link is Up') 378 break379 elif i == 4:380 if data["is_alive"] == True:381 logger.info('Link is Up')382 else:383 assert False384 with steps.start('Configure IP in client',continue_=True) as step:385 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')386 log.info('Successful in configuring IP in Client')387class Allowed_Q_Vlan(aetest.Testcase):388 389 @aetest.setup390 def Configure_Q_Vlan_allowed_list(self, steps,ctrl,server,client,**param):391 vlans='{},{}-{}'.format(lis[0],lis[1],lis[3])392 with steps.start('Verifying links',continue_=True) as step: 393 log.info('Verify link status')394 for i in range(0,5):395 396 sleep(5)397 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])398 logger.info(data)399 if data["is_alive"] == True: 400 logger.info('Link is Up') 401 break402 elif i == 4:403 if data["is_alive"] == True:404 logger.info('Link is Up')405 else:406 assert False407 408 with steps.start('Configure Q VLAN in dn',continue_=True) as step:409 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=str(int(param['dn1_cvlan'])-1),status='enable') 410 log.info('sucessful in Enabling Single VLAN on dn')411 412 with steps.start('Configure Allowed Q VLAN in dn',continue_=True) as step:413 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=vlans,status='enable') 414 log.info('sucessful in configuring allowed q VLAN on dn')415 sleep(60)416 with steps.start('Verifying links',continue_=True) as step: 417 log.info('Verify link status')418 for i in range(0,5):419 420 sleep(5)421 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])422 logger.info(data)423 if data["is_alive"] == True: 424 logger.info('Link is Up') 425 break426 elif i == 4:427 if data["is_alive"] == True:428 logger.info('Link is Up')429 else:430 assert False431 432 433 def test_untagged_packets(self,steps,ctrl,server,client,**param):434 with steps.start('Configure Q VLAN in Server',continue_=True) as step:435 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'])436 log.info('Successful in configuring vlan in Server')437 with steps.start('Configure IP in client',continue_=True) as step:438 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])439 log.info('Successful in configuring IP in Client')440 log.info('Starting iperf client')441 #sleep(20)442 with steps.start('Verifying Traffic',continue_=True) as step:443 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])444 assert ((up != 0.0) and (down != 0.0))445 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))446 with steps.start('Removing Q VLAN in Server',continue_=True) as step:447 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'],status='disable')448 log.info('Removing Q vlan in Server')449 with steps.start('Removing IP in client',continue_=True) as step:450 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')451 log.info('Successful in Removing IP in Client')452 @ aetest.test.loop(c_vlan=lis)453 def test_single_tagged_packets(self,c_vlan,steps,ctrl,server,client,**param):454 455 with steps.start('Configure Q VLAN in Server',continue_=True) as step:456 assert misc.config_Q(server,param['server_inf'],c_vlan,param['server_data_ipv4'])457 log.info('Successful in configuring vlan in Server')458 459 with steps.start('Configure Q VLAN in client',continue_=True) as step:460 assert misc.config_Q(client,param['client_inf'],c_vlan,param['client_data_ipv4'])461 log.info('Successful in configuring vlan in client')462 463 log.info('Starting iperf client')464 sleep(20) 465 with steps.start('Verifying Traffic',continue_=True) as step:466 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])467 result=((up != 0.0) and (down != 0.0))468 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))469 if c_vlan==int(param['dn1_cvlan'])+4:470 if result == False:471 log.info('No traffic due to unallowed vlan')472 else:473 assert False474 else:475 assert result476 477 with steps.start('Removing Q VLAN in Server',continue_=True) as step:478 assert misc.config_Q(server,param['server_inf'],c_vlan,param['server_data_ipv4'],status='disable')479 log.info('Removing Q vlan in Server')480 481 with steps.start('Removing Q VLAN in client',continue_=True) as step:482 assert misc.config_Q(client,param['client_inf'],c_vlan,param['client_data_ipv4'],status='disable')483 log.info('Removing Q vlan in client')484 485 486 487 488 489 490 @aetest.cleanup491 def VLAN_config_cleanup(self,steps,ctrl,server,client,**param):492 vlans='{},{}-{}'.format(lis[0],lis[1],lis[3])493 494 with steps.start('Remove Q VLAN in dn',continue_=True) as step:495 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id='1',status='disable') 496 log.info('sucessful in Removing Single VLAN on dn')497 498 with steps.start('Removing Allowed Q VLAN in dn',continue_=True) as step:499 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=vlans,status='disable') 500 log.info('sucessful in Removing allowed q VLAN on dn')501 sleep(60)502 with steps.start('Verifying links',continue_=True) as step: 503 log.info('Verify link status')504 for i in range(0,5):505 506 sleep(5)507 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])508 logger.info(data)509 if data["is_alive"] == True: 510 logger.info('Link is Up') 511 break512 elif i == 4:513 if data["is_alive"] == True:514 logger.info('Link is Up')515 else:516 assert False517class Q_Vlan_Remarking(aetest.Testcase):518 519 @aetest.setup520 def Configure_Q_Vlan_allowed_list(self, steps,ctrl,server,client,**param):521 remark=int(param['dn1_cvlan'])+1522 with steps.start('Verifying links',continue_=True) as step: 523 log.info('Verify link status')524 for i in range(0,5):525 526 sleep(5)527 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])528 logger.info(data)529 if data["is_alive"] == True: 530 logger.info('Link is Up') 531 break532 elif i == 4:533 if data["is_alive"] == True:534 logger.info('Link is Up')535 else:536 assert False537 538 with steps.start('Configure Q VLAN in dn',continue_=True) as step:539 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=str(int(param['dn1_cvlan'])-1),status='enable') 540 log.info('sucessful in Enabling Single VLAN on dn')541 with steps.start('Configure Allowed Q VLAN in dn',continue_=True) as step:542 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_cvlan'],status='enable') 543 log.info('sucessful in configuring allowed q VLAN on dn')544 545 with steps.start('Configuring Remark VLAN',continue_=True) as step:546 assert api.config_vlan_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_cvlan'],remark)547 log.info('sucessful in Configuring Single VLAN Remarking on dn')548 sleep(60)549 with steps.start('Verifying links',continue_=True) as step: 550 log.info('Verify link status')551 for i in range(0,5):552 553 sleep(5)554 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])555 logger.info(data)556 if data["is_alive"] == True: 557 logger.info('Link is Up') 558 break559 elif i == 4:560 if data["is_alive"] == True:561 logger.info('Link is Up')562 else:563 assert False564 @ aetest.test565 def test_untagged_packets(self,steps,ctrl,server,client,**param):566 with steps.start('Configure Q VLAN in Server',continue_=True) as step:567 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'])568 log.info('Successful in configuring vlan in Server')569 with steps.start('Configure IP in client',continue_=True) as step:570 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])571 log.info('Successful in configuring IP in Client') 572 with steps.start('Starting client iperf',continue_=True) as step:573 sleep(20) 574 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])575 assert ((up != 0) and (down != 0))576 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))577 578 579 with steps.start('Removing Q VLAN in Server',continue_=True) as step:580 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'],status='disable')581 log.info('Removing Q vlan in Server')582 with steps.start('Removing IP in client',continue_=True) as step:583 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')584 log.info('Successful in Removing IP in Client')585 @ aetest.test586 def test_single_tagged_packets(self,steps,ctrl,server,client,**param):587 remark=int(param['dn1_cvlan'])+1588 with steps.start('Configure Q VLAN in Server',continue_=True) as step:589 assert misc.config_Q(server,param['server_inf'],remark,param['server_data_ipv4'])590 log.info('Successful in configuring vlan in Server')591 with steps.start('Configure Q VLAN in client',continue_=True) as step:592 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'])593 log.info('Successful in configuring vlan in client')594 with steps.start('Starting client iperf',continue_=True) as step:595 sleep(20) 596 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])597 assert ((up != 0) and (down != 0))598 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))599 with steps.start('Removing Q VLAN in Server',continue_=True) as step:600 assert misc.config_Q(server,param['server_inf'],remark,param['server_data_ipv4'],status='disable')601 log.info('Removing Q vlan in Server')602 with steps.start('Removing Q VLAN in client',continue_=True) as step:603 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'],status='disable')604 log.info('Removing Q vlan in client') 605 @aetest.cleanup606 def Removing_configs_from_node_and_PCs(self,steps,ctrl,server,client,**param):607 remark=int(param['dn1_cvlan'])+1608 with steps.start('Removing Q VLAN in dn',continue_=True) as step:609 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id='1',status='disable') 610 log.info('sucessful in Removing Single VLAN on dn')611 with steps.start('Removing Allowed Q VLAN in dn',continue_=True) as step:612 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_cvlan'],status='disable') 613 log.info('sucessful in Removing allowed q VLAN on dn')614 615 with steps.start('Removing Remark VLAN',continue_=True) as step:616 assert api.config_vlan_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_cvlan'],remark,status='disable')617 log.info('sucessful in Removing Single VLAN Remarking on dn')618 sleep(60)619 with steps.start('Verifying links',continue_=True) as step: 620 log.info('Verify link status')621 for i in range(0,5):622 623 sleep(5)624 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])625 logger.info(data)626 if data["is_alive"] == True: 627 logger.info('Link is Up') 628 break629 elif i == 4:630 if data["is_alive"] == True:631 logger.info('Link is Up')632 else:633 assert False634class Q_Vlan_Drop_Untag(aetest.Testcase):635 636 @aetest.setup637 def Configure_Q_Vlan(self, steps,ctrl,server,client,**param):638 with steps.start('Verifying links',continue_=True) as step: 639 log.info('Verify link status')640 for i in range(0,5):641 642 sleep(5)643 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])644 logger.info(data)645 if data["is_alive"] == True: 646 logger.info('Link is Up') 647 break648 elif i == 4:649 if data["is_alive"] == True:650 logger.info('Link is Up')651 else:652 assert False653 with steps.start('Configure Q VLAN in dn',continue_=True) as step:654 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=str(int(param['dn1_cvlan'])-1),status='enable') 655 log.info('sucessful in Enabling Single VLAN on dn')656 657 with steps.start('Configure drop untag packets in Q VLAN',continue_=True) as step:658 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='enable') 659 log.info('sucessful in configuring Drop untag VLAN')660 661 with steps.start('Configure Allowed Q VLAN in dn',continue_=True) as step:662 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_cvlan'],status='enable') 663 log.info('sucessful in configuring allowed q VLAN on dn') 664 sleep(60)665 with steps.start('Verifying links',continue_=True) as step: 666 log.info('Verify link status')667 for i in range(0,5):668 669 sleep(5)670 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])671 logger.info(data)672 if data["is_alive"] == True: 673 logger.info('Link is Up') 674 break675 elif i == 4:676 if data["is_alive"] == True:677 logger.info('Link is Up')678 else:679 assert False680 @ aetest.test681 def test_untagged_packets(self,steps,ctrl,server,client,**param):682 with steps.start('Configure Q VLAN in Server',continue_=True) as step:683 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'])684 log.info('Successful in configuring vlan in Server')685 686 #Configure IP on client PC687 with steps.start('Configure IP in client',continue_=True) as step: 688 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])689 log.info('Successful in configuring IP in Client')690 691 692 with steps.start('Starting iperf in client',continue_=True) as step:693 sleep(20) 694 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])695 result=((up != 0.0) and (down != 0.0))696 if result == False:697 log.info('Traffic Failed due to drop untag')698 else:699 log.info('Failed to drop untagged packets')700 assert False701 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 702 703 704 with steps.start('Configure Q VLAN in Server',continue_=True) as step:705 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'],status='disable')706 log.info('Successful in configuring vlan in Server')707 with steps.start('Removing IP in client',continue_=True) as step:708 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')709 log.info('Successful in Removing IP in Client')710 711 @ aetest.test712 def test_single_tagged_packets(self,steps,ctrl,server,client,**param):713 with steps.start('Configure Q VLAN in Server',continue_=True) as step:714 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])715 log.info('Successful in configuring vlan in Server')716 717 with steps.start('Configure Q VLAN in client',continue_=True) as step:718 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'])719 log.info('Successful in configuring vlan in client')720 721 with steps.start('Starting iperf in client',continue_=True) as step:722 sleep(20) 723 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])724 assert ((up != 0.0) and (down != 0.0))725 log.info('througput numbers up={} down={}'.format(up,down)) 726 with steps.start('Removing Q VLAN in Server',continue_=True) as step:727 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')728 log.info('Successful in Removing vlan in Server')729 730 with steps.start('Removing Q VLAN in client',continue_=True) as step:731 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'],status='disable')732 log.info('Removing Q vlan in client')733 @aetest.cleanup734 def Disabling_Q_VLAN_configs(self,steps,ctrl,server,client,**param):735 736 log.info('Disabling Single VLAN in dn')737 with steps.start('Removing drop untag packets in Q VLAN',continue_=True) as step:738 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 739 log.info('sucessful in Removing Drop untag VLAN')740 with steps.start('Removing vlan configs from dn',continue_=True) as step:741 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],status='disable') 742 log.info('sucessful in Enabling Single VLAN on dn')743 with steps.start('Removing Allowed Q VLAN in dn',continue_=True) as step:744 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_cvlan'],status='disable') 745 log.info('sucessful in Removing allowed q VLAN on dn')746 sleep(60)747 with steps.start('Verifying links',continue_=True) as step: 748 log.info('Verify link status')749 for i in range(0,5):750 751 sleep(5)752 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])753 logger.info(data)754 if data["is_alive"] == True: 755 logger.info('Link is Up') 756 break757 elif i == 4:758 if data["is_alive"] == True:759 logger.info('Link is Up')760 else:761 assert False762 763class Q_Vlan_Priority_Remarking(aetest.Testcase):764 765 def Capturing_Server_interface(self,server,server_inf,server_file):766 assert misc.capture_interface(server,server_inf,server_file)767 def Verify_traffic(self,client,server_data_ipv4):768 log.info('Starting iperf client')769 up,down=misc.config_iperf_client(client,server_data_ipv4)770 assert ((up != 0.0) and (down != 0.0))771 #log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))772 773 @aetest.setup774 def Configure_Q_Vlan(self, steps,ctrl,server,client,**param):775 776 with steps.start('Verifying links',continue_=True) as step: 777 log.info('Verify link status')778 for i in range(0,5):779 780 sleep(5)781 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])782 logger.info(data)783 if data["is_alive"] == True: 784 logger.info('Link is Up') 785 break786 elif i == 4:787 if data["is_alive"] == True:788 logger.info('Link is Up')789 else:790 assert False791 792 with steps.start('Configure Q VLAN in dn',continue_=True) as step:793 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=str(int(param['dn1_cvlan'])-1),status='enable') 794 log.info('sucessful in Enabling Single VLAN on dn')795 with steps.start('Configure Allowed Q VLAN in dn',continue_=True) as step:796 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_cvlan'],status='enable') 797 log.info('sucessful in configuring allowed q VLAN on dn')798 799 with steps.start('Configuring Remark VLAN priority',continue_=True) as step:800 assert api.config_vlan_prio_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_cvlan'],'7')801 log.info('sucessful in Configuring Single VLAN priority Remarking on dn')802 sleep(60)803 with steps.start('Verifying links',continue_=True) as step: 804 log.info('Verify link status')805 for i in range(0,5):806 807 sleep(5)808 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])809 logger.info(data)810 if data["is_alive"] == True: 811 logger.info('Link is Up') 812 break813 elif i == 4:814 if data["is_alive"] == True:815 logger.info('Link is Up')816 else:817 assert False818 @ aetest.test819 def test_untagged_packets(self,steps,ctrl,server,client,**param):820 with steps.start('Configure Q VLAN in Server',continue_=True) as step:821 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'])822 log.info('Successful in configuring vlan in Server')823 824 with steps.start('Configure IP in client',continue_=True) as step:825 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])826 log.info('Successful in configuring IP in Client')827 with steps.start('Capturing and verifying traffic',continue_=True) as step:828 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))829 p1.start()830 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))831 p2.start()832 p1.join()833 p2.join()834 835 with steps.start('Analyse Capture',continue_=True) as step:836 ip = param['client_data_ipv4'].rsplit('/', 1)[0]837 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==0'.format(ip,str(int(param['dn1_cvlan'])-1)) 838 res=misc.analyse_capture(server,filter,param['server_file'])839 if res > 0:840 log.info('Successful in priority remarking')841 else:842 assert False843 844 with steps.start('Removing Q VLAN in Server',continue_=True) as step:845 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),param['server_data_ipv4'],status='disable')846 log.info('Removing Q vlan in Server')847 with steps.start('Removing IP in client',continue_=True) as step:848 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')849 log.info('Successful in Removing IP in Client') 850 851 @ aetest.test852 def test_single_tagged_packets(self,steps,ctrl,server,client,**param):853 854 with steps.start('Configure Q VLAN in Server',continue_=True) as step:855 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])856 log.info('Successful in configuring vlan in Server')857 with steps.start('Configure Q VLAN in client',continue_=True) as step:858 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'])859 log.info('Successful in configuring vlan in client')860 sleep(20)861 862 with steps.start('Capturing and verifying traffic',continue_=True) as step:863 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))864 p1.start()865 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))866 p2.start()867 p1.join()868 p2.join()869 with steps.start('Analyse Capture',continue_=True) as step:870 ip = param['client_data_ipv4'].rsplit('/', 1)[0]871 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])872 res=misc.analyse_capture(server,filter,param['server_file'])873 if res > 0:874 log.info('Successful in priority remarking')875 else:876 assert False877 with steps.start('Removing Q VLAN in Server',continue_=True) as step:878 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')879 log.info('Removing Q vlan in Server')880 881 with steps.start('Removing Q VLAN in client',continue_=True) as step:882 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'],status='disable')883 log.info('Removing Q vlan in client')884 @aetest.cleanup885 def Removing_configs_from_node_and_PCs(self,steps,ctrl,server,client,**param):886 with steps.start('Removing Q VLAN in dn',continue_=True) as step:887 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id='1',status='disable') 888 log.info('sucessful in Removing Single VLAN on dn')889 with steps.start('Removing Allowed Q VLAN in dn',continue_=True) as step:890 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_cvlan'],status='enable') 891 log.info('sucessful in Removing allowed q VLAN on dn')892 893 with steps.start('Removing Remark VLAN prio',continue_=True) as step:894 assert api.config_vlan_prio_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_cvlan'],'7',status='disable')895 log.info('sucessful in Removing Single VLAN priority Remarking on dn')896 sleep(60)897 with steps.start('Verifying links',continue_=True) as step: 898 log.info('Verify link status')899 for i in range(0,5):900 901 sleep(5)902 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])903 logger.info(data)904 if data["is_alive"] == True: 905 logger.info('Link is Up') 906 break907 elif i == 4:908 if data["is_alive"] == True:909 logger.info('Link is Up')910 else:911 assert False912@aetest.loop(etype = ['0x8100', '0x88A8'])913class Q_port_Behaviour_When_QinQ_Ingress(aetest.Testcase):914 @aetest.setup915 def Configure_Q_Vlan(self, steps,ctrl,server,client,etype,**param):916 with steps.start('Verifying links',continue_=True) as step: 917 log.info('Verify link status')918 for i in range(0,5):919 920 sleep(5)921 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])922 logger.info(data)923 if data["is_alive"] == True: 924 logger.info('Link is Up') 925 break926 elif i == 4:927 if data["is_alive"] == True:928 logger.info('Link is Up')929 else:930 assert False931 with steps.start('Configure Q VLAN in dn',continue_=True) as step:932 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id='1',status='enable')933 log.info('sucessful in Enabling Single VLAN on dn')934 with steps.start('Configure Allowed Q VLAN in dn',continue_=True) as step:935 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')936 log.info('sucessful in configuring allowed q VLAN on dn')937 sleep(60)938 with steps.start('Verifying links',continue_=True) as step: 939 log.info('Verify link status')940 for i in range(0,5):941 942 sleep(5)943 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])944 logger.info(data)945 if data["is_alive"] == True: 946 logger.info('Link is Up') 947 break948 elif i == 4:949 if data["is_alive"] == True:950 logger.info('Link is Up')951 else:952 assert False953 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:954 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)955 log.info('Successful in configuring vlan in Server')956 with steps.start('Configure QinQ VLAN in client',continue_=True) as step:957 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)958 log.info('Successful in configuring vlan in Server')959 @ aetest.test960 def Verify_traffic(self,steps,ctrl,server,client,**param):961 log.info('Starting iperf client')962 sleep(20)963 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])964 result=((up != 0.0) and (down != 0.0))965 if result == False:966 log.info('Traffic dropped due to double tagged packets')967 else:968 log.info('Failed to drop double tagged packets')969 assert False970 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))971 @aetest.cleanup972 def Removing_Vlan_configs(self, steps,ctrl,server,client,etype,**param):973 with steps.start('Removing Q VLAN in dn',continue_=True) as step:974 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id='1',status='disable')975 log.info('sucessful in Removing Single VLAN on dn')976 with steps.start('Removing Allowed Q VLAN in dn',continue_=True) as step:977 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')978 log.info('sucessful in Removing allowed q VLAN on dn')979 sleep(60)980 with steps.start('Verifying links',continue_=True) as step: 981 log.info('Verify link status')982 for i in range(0,5):983 984 sleep(5)985 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])986 logger.info(data)987 if data["is_alive"] == True: 988 logger.info('Link is Up') 989 break990 elif i == 4:991 if data["is_alive"] == True:992 logger.info('Link is Up')993 else:994 assert False995 with steps.start('Remonving QinQ VLAN in Server',continue_=True) as step:996 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')997 log.info('Successful in Removing vlan in Server')998 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:999 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')1000 log.info('Successful in Removing vlan in Server')1001@aetest.loop(etype = ['0x8100', '0x88A8'])1002class Allowed_QinQ_Vlan(aetest.Testcase):1003 @aetest.setup1004 def Configure_QinQ_Vlan_allowed_list(self, steps,ctrl,server,client,etype,**param):1005 vlans='{},{}-{}'.format(lis1[0],lis1[1],lis1[3])1006 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1007 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')1008 log.info('sucessful in Enabling Single VLAN on dn')1009 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1010 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=vlans,status='enable')1011 log.info('sucessful in configuring allowed QinQ VLAN on dn')1012 sleep(60)1013 with steps.start('Verifying links',continue_=True) as step: 1014 log.info('Verify link status')1015 for i in range(0,5):1016 1017 sleep(5)1018 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1019 logger.info(data)1020 if data["is_alive"] == True: 1021 logger.info('Link is Up') 1022 break1023 elif i == 4:1024 if data["is_alive"] == True:1025 logger.info('Link is Up')1026 else:1027 assert False1028 @ aetest.test1029 def test_untagged_packets(self,steps,ctrl,server,client,etype,**parm):1030 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1031 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1032 log.info('Successful in configuring vlan in Server')1033 with steps.start('Configure IP in client',continue_=True) as step:1034 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1035 log.info('Successful in configuring IP in Client')1036 with steps.start('Starting iperf in client',continue_=True) as step:1037 sleep(20)1038 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1039 assert ((up != 0.0) and (down != 0.0))1040 with steps.start('Removing Q VLAN in Server',continue_=True) as step:1041 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1042 log.info('Successful in Removing vlan in Server')1043 with steps.start('Removing IP in client',continue_=True) as step:1044 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1045 log.info('Successful in Removing IP in Client') 1046 @ aetest.test.loop(s_vlan=lis1)1047 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,s_vlan,**param):1048 1049 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1050 assert misc.config_QinQ(server,param['server_inf'],s_vlan,str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1051 log.info('Successful in configuring vlan in Server')1052 with steps.start('Configure Q VLAN in client',continue_=True) as step:1053 assert misc.config_Q(client,param['client_inf'],s_vlan,param['client_data_ipv4'])1054 log.info('Successful in configuring vlan in client')1055 with steps.start('Verifying Traffic',continue_=True) as step:1056 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1057 result=((up != 0.0) and (down != 0.0))1058 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1059 if s_vlan==int(param['dn1_svlan'])+4:1060 if result == False:1061 log.info('No traffic due to unallowed vlan')1062 else:1063 assert False1064 else:1065 assert result1066 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1067 assert misc.config_QinQ(server,param['server_inf'],s_vlan,str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1068 log.info('Successful in Removing vlan in Server')1069 with steps.start('Removing Q VLAN in client',continue_=True) as step:1070 assert misc.config_Q(client,param['client_inf'],s_vlan,param['client_data_ipv4'],status='disable')1071 log.info('Removing Q vlan in client')1072 @ aetest.test.loop(s_vlan=lis1)1073 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,s_vlan,**param):1074 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1075 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],s_vlan,param['server_data_ipv4'],ethertype=etype)1076 log.info('Successful in configuring QinQ vlan in Server')1077 with steps.start('Configure Q VLAN in client',continue_=True) as step:1078 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],s_vlan,param['client_data_ipv4'],ethertype=etype)1079 log.info('Successful in configuring QinQ vlan in client')1080 log.info('Starting iperf client')1081 sleep(20)1082 with steps.start('Verifying Traffic',continue_=True) as step:1083 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1084 result=((up != 0.0) and (down != 0.0))1085 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1086 if s_vlan==int(param['dn1_svlan'])+4:1087 if result == False:1088 log.info('No traffic due to unallowed vlan')1089 else:1090 assert False1091 else:1092 assert result1093 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1094 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],s_vlan,param['server_data_ipv4'],status='disable')1095 log.info('Removing QinQ vlan in Server')1096 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1097 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],s_vlan,param['client_data_ipv4'],status='disable')1098 log.info('Removing QiNQ vlan in client')1099 @aetest.cleanup1100 def VLAN_config_cleanup(self,steps,ctrl,server,client,etype,**param):1101 vlans='{},{}-{}'.format(lis1[0],lis1[1],lis1[3])1102 with steps.start('Remove QinQ VLAN in dn',continue_=True) as step:1103 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan='1',cvlan='1',ethertype=etype,status='disable')1104 log.info('sucessful in Removing Double VLAN on dn')1105 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:1106 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=vlans,status='disable')1107 log.info('sucessful in Removing allowed QinQ VLAN on dn')1108 sleep(60)1109 with steps.start('Verifying links',continue_=True) as step: 1110 log.info('Verify link status')1111 for i in range(0,5):1112 1113 sleep(5)1114 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1115 logger.info(data)1116 if data["is_alive"] == True: 1117 logger.info('Link is Up') 1118 break1119 elif i == 4:1120 if data["is_alive"] == True:1121 logger.info('Link is Up')1122 else:1123 assert False1124@aetest.loop(etype = ['0x8100', '0x88A8'])1125class Allowed_QinQ_Vlan(aetest.Testcase):1126 @aetest.setup1127 def Configure_QinQ_Vlan_allowed_list(self, steps,ctrl,server,client,etype,**param):1128 vlans='{},{}-{}'.format(lis1[0],lis1[1],lis1[3])1129 with steps.start('Verifying links',continue_=True) as step: 1130 log.info('Verify link status')1131 for i in range(0,5):1132 1133 sleep(5)1134 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1135 logger.info(data)1136 if data["is_alive"] == True: 1137 logger.info('Link is Up') 1138 break1139 elif i == 4:1140 if data["is_alive"] == True:1141 logger.info('Link is Up')1142 else:1143 assert False1144 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1145 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')1146 log.info('sucessful in Enabling Single VLAN on dn')1147 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1148 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=vlans,status='enable')1149 log.info('sucessful in configuring allowed QinQ VLAN on dn')1150 sleep(60)1151 with steps.start('Verifying links',continue_=True) as step: 1152 log.info('Verify link status')1153 for i in range(0,5):1154 1155 sleep(5)1156 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1157 logger.info(data)1158 if data["is_alive"] == True: 1159 logger.info('Link is Up') 1160 break1161 elif i == 4:1162 if data["is_alive"] == True:1163 logger.info('Link is Up')1164 else:1165 assert False1166 @ aetest.test1167 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):1168 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1169 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1170 log.info('Successful in configuring vlan in Server')1171 with steps.start('Configure IP in client',continue_=True) as step:1172 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1173 log.info('Successful in configuring IP in Client')1174 with steps.start('Starting iperf in client',continue_=True) as step:1175 sleep(20)1176 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1177 assert ((up != 0.0) and (down != 0.0))1178 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1179 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1180 log.info('Successful in Removing vlan in Server')1181 with steps.start('Removing IP in client',continue_=True) as step:1182 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1183 log.info('Successful in Removing IP in Client') 1184 @ aetest.test.loop(s_vlan=lis1)1185 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,s_vlan,**param):1186 1187 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1188 assert misc.config_QinQ(server,param['server_inf'],s_vlan,str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1189 log.info('Successful in configuring vlan in Server')1190 with steps.start('Configure Q VLAN in client',continue_=True) as step:1191 assert misc.config_Q(client,param['client_inf'],s_vlan,param['client_data_ipv4'])1192 log.info('Successful in configuring vlan in client')1193 with steps.start('Verifying Traffic',continue_=True) as step:1194 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1195 result=((up != 0.0) and (down != 0.0))1196 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1197 if s_vlan==int(param['dn1_svlan'])+4:1198 if result == False:1199 log.info('No traffic due to unallowed vlan')1200 else:1201 assert False1202 else:1203 assert result1204 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1205 assert misc.config_QinQ(server,param['server_inf'],s_vlan,str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1206 log.info('Successful in Removing vlan in Server')1207 with steps.start('Removing Q VLAN in client',continue_=True) as step:1208 assert misc.config_Q(client,param['client_inf'],s_vlan,param['client_data_ipv4'],status='disable')1209 log.info('Removing Q vlan in client')1210 @ aetest.test.loop(s_vlan=lis1)1211 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,s_vlan,**param):1212 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1213 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],s_vlan,param['server_data_ipv4'],ethertype=etype)1214 log.info('Successful in configuring QinQ vlan in Server')1215 with steps.start('Configure QinQ VLAN in client',continue_=True) as step:1216 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],s_vlan,param['client_data_ipv4'],ethertype=etype)1217 log.info('Successful in configuring QinQ vlan in client')1218 log.info('Starting iperf client')1219 sleep(20)1220 with steps.start('Verifying Traffic',continue_=True) as step:1221 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1222 result=((up != 0.0) and (down != 0.0))1223 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1224 if s_vlan==int(param['dn1_svlan'])+4:1225 if result == False:1226 log.info('No traffic due to unallowed vlan')1227 else:1228 assert False1229 else:1230 assert result1231 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1232 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],s_vlan,param['server_data_ipv4'],status='disable')1233 log.info('Removing QinQ vlan in Server')1234 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1235 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],s_vlan,param['client_data_ipv4'],status='disable')1236 log.info('Removing QiNQ vlan in client')1237 @aetest.cleanup1238 def VLAN_config_cleanup(self,steps,ctrl,server,client,etype,**param):1239 vlans='{},{}-{}'.format(lis1[0],lis1[1],lis1[3])1240 with steps.start('Remove QinQ VLAN in dn',continue_=True) as step:1241 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan='1',cvlan='1',ethertype=etype,status='disable')1242 log.info('sucessful in Removing Double VLAN on dn')1243 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:1244 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=vlans,status='disable')1245 log.info('sucessful in Removing allowed QinQ VLAN on dn')1246 sleep(60)1247 with steps.start('Verifying links',continue_=True) as step: 1248 log.info('Verify link status')1249 for i in range(0,5):1250 1251 sleep(5)1252 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1253 logger.info(data)1254 if data["is_alive"] == True: 1255 logger.info('Link is Up') 1256 break1257 elif i == 4:1258 if data["is_alive"] == True:1259 logger.info('Link is Up')1260 else:1261 assert False1262@aetest.loop(etype = ['0x8100', '0x88A8'])1263class QinQ_Vlan_Remarking(aetest.Testcase):1264 1265 @aetest.setup1266 def Configure_Q_Vlan_allowed_list(self,etype, steps,ctrl,server,client,**param):1267 remark=int(param['dn1_svlan'])+11268 with steps.start('Verifying links',continue_=True) as step: 1269 log.info('Verify link status')1270 for i in range(0,5):1271 1272 sleep(5)1273 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1274 logger.info(data)1275 if data["is_alive"] == True: 1276 logger.info('Link is Up') 1277 break1278 elif i == 4:1279 if data["is_alive"] == True:1280 logger.info('Link is Up')1281 else:1282 assert False1283 1284 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1285 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=param['dn1_svlan'],cvlan=param['dn1_cvlan'],ethertype=etype,status='enable')1286 log.info('sucessful in Enabling Single VLAN on dn')1287 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1288 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')1289 log.info('sucessful in configuring allowed QinQ VLAN on dn')1290 1291 with steps.start('Configuring Remark VLAN',continue_=True) as step:1292 assert api.config_vlan_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_svlan'],remark)1293 log.info('sucessful in Configuring Single VLAN Remarking on dn')1294 sleep(60)1295 with steps.start('Verifying links',continue_=True) as step: 1296 log.info('Verify link status')1297 for i in range(0,5):1298 1299 sleep(5)1300 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1301 logger.info(data)1302 if data["is_alive"] == True: 1303 logger.info('Link is Up') 1304 break1305 elif i == 4:1306 if data["is_alive"] == True:1307 logger.info('Link is Up')1308 else:1309 assert False1310 @ aetest.test1311 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):1312 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1313 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)1314 log.info('Successful in configuring vlan in Server')1315 with steps.start('Configure IP in client',continue_=True) as step:1316 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1317 log.info('Successful in configuring IP in Client')1318 with steps.start('Starting iperf in client',continue_=True) as step:1319 sleep(20)1320 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1321 assert ((up != 0.0) and (down != 0.0))1322 with steps.start('Removing Q VLAN in Server',continue_=True) as step:1323 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')1324 log.info('Successful in Removing vlan in Server')1325 with steps.start('Removing IP in client',continue_=True) as step:1326 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1327 log.info('Successful in Removing IP in Client') 1328 @ aetest.test1329 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,**param):1330 remark=int(param['dn1_svlan'])+11331 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1332 assert misc.config_QinQ(server,param['server_inf'],remark,param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)1333 log.info('Successful in configuring vlan in Server')1334 with steps.start('Configure Q VLAN in client',continue_=True) as step:1335 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'])1336 log.info('Successful in configuring vlan in client')1337 with steps.start('Verifying Traffic',continue_=True) as step:1338 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1339 assert ((up != 0.0) and (down != 0.0))1340 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1341 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1342 assert misc.config_QinQ(server,param['server_inf'],remark,param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')1343 log.info('Successful in Removing vlan in Server')1344 with steps.start('Removing Q VLAN in client',continue_=True) as step:1345 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1346 log.info('Removing Q vlan in client')1347 @ aetest.test1348 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,**param):1349 remark=int(param['dn1_svlan'])+11350 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1351 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],remark,param['server_data_ipv4'],ethertype=etype)1352 log.info('Successful in configuring QinQ vlan in Server')1353 with steps.start('Configure Q VLAN in client',continue_=True) as step:1354 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)1355 log.info('Successful in configuring QinQ vlan in client')1356 log.info('Starting iperf client')1357 sleep(20)1358 with steps.start('Verifying Traffic',continue_=True) as step:1359 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1360 assert ((up != 0.0) and (down != 0.0))1361 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1362 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1363 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],remark,param['server_data_ipv4'],status='disable')1364 log.info('Removing QinQ vlan in Server')1365 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1366 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1367 log.info('Removing QiNQ vlan in client')1368 1369 @aetest.cleanup1370 def Removing_configs_from_node_and_PCs(self,steps,ctrl,server,client,etype,**param):1371 remark=int(param['dn1_svlan'])+11372 1373 with steps.start('Removing QinQ VLAN in dn',continue_=True) as step:1374 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='disable')1375 log.info('sucessful in Removing QinQ VLAN on dn')1376 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:1377 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')1378 log.info('sucessful in Removing allowed QinQ VLAN on dn')1379 1380 with steps.start('Removing Remark VLAN',continue_=True) as step:1381 assert api.config_vlan_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_svlan'],remark,status='disable')1382 log.info('sucessful in Removing Single VLAN Remarking on dn')1383 sleep(60)1384 with steps.start('Verifying links',continue_=True) as step: 1385 log.info('Verify link status')1386 for i in range(0,5):1387 1388 sleep(5)1389 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1390 logger.info(data)1391 if data["is_alive"] == True: 1392 logger.info('Link is Up') 1393 break1394 elif i == 4:1395 if data["is_alive"] == True:1396 logger.info('Link is Up')1397 else:1398 assert False1399@aetest.loop(etype = ['0x8100', '0x88A8'])1400class QinQ_Vlan_Prio_Remarking(aetest.Testcase):1401 1402 def Capturing_Server_interface(self,server,server_inf,server_file):1403 assert misc.capture_interface(server,server_inf,server_file)1404 def Verify_traffic(self,client,server_data_ipv4):1405 log.info('Starting iperf client')1406 up,down=misc.config_iperf_client(client,server_data_ipv4)1407 assert ((up != 0.0) and (down != 0.0))1408 #log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1409 1410 @aetest.setup1411 def Configure_QinQ_Vlan_allowed_list(self,etype, steps,ctrl,server,client,**param):1412 1413 with steps.start('Verifying links',continue_=True) as step: 1414 log.info('Verify link status')1415 for i in range(0,5):1416 1417 sleep(5)1418 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1419 logger.info(data)1420 if data["is_alive"] == True: 1421 logger.info('Link is Up') 1422 break1423 elif i == 4:1424 if data["is_alive"] == True:1425 logger.info('Link is Up')1426 else:1427 assert False1428 1429 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1430 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')1431 log.info('sucessful in Enabling Single VLAN on dn')1432 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1433 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')1434 log.info('sucessful in configuring allowed QinQ VLAN on dn')1435 1436 with steps.start('Configuring Remark VLAN Priority',continue_=True) as step:1437 assert api.config_vlan_prio_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_svlan'],'7')1438 log.info('sucessful in Configuring Single VLAN prirotiy Remarking on dn')1439 sleep(60)1440 with steps.start('Verifying links',continue_=True) as step: 1441 log.info('Verify link status')1442 for i in range(0,5):1443 1444 sleep(5)1445 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1446 logger.info(data)1447 if data["is_alive"] == True: 1448 logger.info('Link is Up') 1449 break1450 elif i == 4:1451 if data["is_alive"] == True:1452 logger.info('Link is Up')1453 else:1454 assert False1455 @ aetest.test1456 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):1457 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1458 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1459 log.info('Successful in configuring vlan in Server')1460 with steps.start('Configure IP in client',continue_=True) as step:1461 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1462 log.info('Successful in configuring IP in Client')1463 sleep(20)1464 with steps.start('Capturing and verifying traffic',continue_=True) as step:1465 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))1466 p1.start()1467 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))1468 p2.start()1469 p1.join()1470 p2.join()1471 with steps.start('Analyse Capture',continue_=True) as step:1472 ip = param['client_data_ipv4'].rsplit('/', 1)[0]1473 if etype == '0x8100':1474 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id== {}&&vlan.priority==0'.format(ip,str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1))1475 1476 else:1477 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==0&&vlan.priority==0'.format(ip,str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1))1478 1479 res=misc.analyse_capture(server,filter,param['server_file'])1480 if res > 0:1481 log.info('Successful in VLAN tagging')1482 else:1483 assert False1484 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1485 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1486 log.info('Successful in Removing vlan in Server')1487 with steps.start('Removing IP in client',continue_=True) as step:1488 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1489 log.info('Successful in Removing IP in Client') 1490 @ aetest.test1491 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,**param):1492 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1493 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1494 log.info('Successful in configuring vlan in Server')1495 with steps.start('Configure Q VLAN in client',continue_=True) as step:1496 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'])1497 log.info('Successful in configuring vlan in client')1498 1499 with steps.start('Capturing and verifying traffic',continue_=True) as step:1500 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))1501 p1.start()1502 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))1503 p2.start()1504 p1.join()1505 p2.join()1506 with steps.start('Analyse Capture',continue_=True) as step:1507 if etype == '0x8100':1508 ip = param['client_data_ipv4'].rsplit('/', 1)[0]1509 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id== {}&&vlan.priority==0'.format(ip,str(int(param['dn1_svlan'])-1),param['dn1_svlan'])1510 1511 else:1512 ip = param['client_data_ipv4'].rsplit('/', 1)[0]1513 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==0&&vlan.priority==7'.format(ip,param['dn1_svlan'],int(param['dn1_svlan'])-1)1514 1515 res=misc.analyse_capture(server,filter,param['server_file'])1516 if res > 0:1517 log.info('Successful in VLAN tagging')1518 else:1519 assert False1520 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1521 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1522 log.info('Successful in Removing vlan in Server')1523 with steps.start('Removing Q VLAN in client',continue_=True) as step:1524 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1525 log.info('Removing Q vlan in client')1526 @ aetest.test1527 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,**param):1528 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1529 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)1530 log.info('Successful in configuring QinQ vlan in Server')1531 with steps.start('Configure Q VLAN in client',continue_=True) as step:1532 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)1533 log.info('Successful in configuring QinQ vlan in client')1534 with steps.start('Capturing and verifying traffic',continue_=True) as step:1535 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))1536 p1.start()1537 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))1538 p2.start()1539 p1.join()1540 p2.join()1541 with steps.start('Analyse Capture',continue_=True) as step:1542 ip = param['client_data_ipv4'].rsplit('/', 1)[0]1543 if etype == '0x8100': 1544 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id== {}&&vlan.priority==7&&vlan.priority==0'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])1545 else:1546 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==7&&vlan.priority==0'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])1547 res=misc.analyse_capture(server,filter,param['server_file'])1548 if res > 0:1549 log.info('Successful in VLAN tagging')1550 else:1551 assert False1552 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1553 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')1554 log.info('Removing QinQ vlan in Server')1555 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1556 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype,status='disable')1557 log.info('Removing QiNQ vlan in client')1558 @aetest.cleanup1559 def Removing_configs_from_node(self,steps,ctrl,server,client,etype,**param):1560 1561 1562 with steps.start('Removing QinQ VLAN in dn',continue_=True) as step:1563 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='disable')1564 log.info('sucessful in Removing Single VLAN on dn')1565 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:1566 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')1567 log.info('sucessful in Removing allowed QinQ VLAN on dn')1568 1569 with steps.start('Removing Remark VLAN Priority',continue_=True) as step:1570 assert api.config_vlan_prio_remarking(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],param['dn1_svlan'],'7',status='disable')1571 log.info('sucessful in Removing Single VLAN prirotiy Remarking on dn')1572 sleep(60)1573 with steps.start('Verifying links',continue_=True) as step: 1574 log.info('Verify link status')1575 for i in range(0,5):1576 1577 sleep(5)1578 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1579 logger.info(data)1580 if data["is_alive"] == True: 1581 logger.info('Link is Up') 1582 break1583 elif i == 4:1584 if data["is_alive"] == True:1585 logger.info('Link is Up')1586 else:1587 assert False1588@aetest.loop(etype = ['0x8100', '0x88A8'])1589class QinQ_Allow_untag_Allow_Singe_Tag(aetest.Testcase):1590 1591 @aetest.setup1592 def Configure_QinQ_Vlan_allowed_list(self,etype, steps,ctrl,server,client,**param):1593 1594 with steps.start('Verifying links',continue_=True) as step: 1595 log.info('Verify link status')1596 for i in range(0,5):1597 1598 sleep(5)1599 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1600 logger.info(data)1601 if data["is_alive"] == True: 1602 logger.info('Link is Up') 1603 break1604 elif i == 4:1605 if data["is_alive"] == True:1606 logger.info('Link is Up')1607 else:1608 assert False1609 client.disconnect()1610 client.connect()1611 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1612 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')1613 log.info('sucessful in Enabling Single VLAN on dn')1614 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1615 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')1616 log.info('sucessful in configuring allowed QinQ VLAN on dn')1617 1618 with steps.start('Configure drop untag packets in QinQ VLAN',continue_=True) as step:1619 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 1620 log.info('sucessful in configuring Drop untag VLAN')1621 1622 sleep(60)1623 with steps.start('Verifying links',continue_=True) as step: 1624 log.info('Verify link status')1625 for i in range(0,5):1626 1627 sleep(5)1628 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1629 logger.info(data)1630 if data["is_alive"] == True: 1631 logger.info('Link is Up') 1632 break1633 elif i == 4:1634 if data["is_alive"] == True:1635 logger.info('Link is Up')1636 else:1637 assert False1638 1639 1640 @ aetest.test1641 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):1642 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1643 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1644 log.info('Successful in configuring vlan in Server')1645 with steps.start('Configure IP in client',continue_=True) as step:1646 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1647 log.info('Successful in configuring IP in Client')1648 1649 with steps.start('Starting client iperf',continue_=True) as step:1650 sleep(20) 1651 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1652 assert ((up != 0) and (down != 0))1653 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1654 1655 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1656 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1657 log.info('Successful in Removing vlan in Server')1658 with steps.start('Removing IP in client',continue_=True) as step:1659 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1660 log.info('Successful in Removing IP in Client') 1661 @ aetest.test1662 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,**param):1663 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1664 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1665 log.info('Successful in configuring vlan in Server')1666 with steps.start('Configure Q VLAN in client',continue_=True) as step:1667 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'])1668 log.info('Successful in configuring vlan in client')1669 1670 with steps.start('Starting client iperf',continue_=True) as step:1671 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1672 assert ((up != 0) and (down != 0))1673 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1674 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1675 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1676 log.info('Successful in Removing vlan in Server')1677 with steps.start('Removing Q VLAN in client',continue_=True) as step:1678 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1679 log.info('Removing Q vlan in client')1680 @ aetest.test1681 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,**param):1682 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1683 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)1684 log.info('Successful in configuring QinQ vlan in Server')1685 with steps.start('Configure Q VLAN in client',continue_=True) as step:1686 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)1687 log.info('Successful in configuring QinQ vlan in client')1688 with steps.start('Starting client iperf',continue_=True) as step:1689 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1690 assert ((up != 0) and (down != 0))1691 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1692 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1693 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')1694 log.info('Removing QinQ vlan in Server')1695 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1696 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype,status='disable')1697 log.info('Removing QiNQ vlan in client')1698 1699 @aetest.cleanup1700 def Removing_configs_from_node(self,steps,ctrl,server,client,etype,**param):1701 1702 1703 with steps.start('Removing QinQ VLAN in dn',continue_=True) as step:1704 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='disable')1705 log.info('sucessful in Removing Single VLAN on dn')1706 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:1707 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')1708 log.info('sucessful in Removing allowed QinQ VLAN on dn')1709 sleep(60)1710 with steps.start('Verifying links',continue_=True) as step: 1711 log.info('Verify link status')1712 for i in range(0,5):1713 1714 sleep(5)1715 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1716 logger.info(data)1717 if data["is_alive"] == True: 1718 logger.info('Link is Up') 1719 break1720 elif i == 4:1721 if data["is_alive"] == True:1722 logger.info('Link is Up')1723 else:1724 assert False1725 1726 client.disconnect()1727 client.connect()1728@aetest.loop(etype = ['0x8100', '0x88A8'])1729class QinQ_Drop_untag_Allow_Singe_Tag(aetest.Testcase):1730 1731 @aetest.setup1732 def Configure_QinQ_Vlan_allowed_list(self,etype, steps,ctrl,server,client,**param):1733 1734 with steps.start('Verifying links',continue_=True) as step: 1735 log.info('Verify link status')1736 for i in range(0,5):1737 1738 sleep(5)1739 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1740 logger.info(data)1741 if data["is_alive"] == True: 1742 logger.info('Link is Up') 1743 break1744 elif i == 4:1745 if data["is_alive"] == True:1746 logger.info('Link is Up')1747 else:1748 assert False1749 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1750 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')1751 log.info('sucessful in Enabling Single VLAN on dn')1752 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1753 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')1754 log.info('sucessful in configuring allowed QinQ VLAN on dn')1755 1756 with steps.start('Configure drop untag packets in QinQ VLAN',continue_=True) as step:1757 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='enable') 1758 log.info('sucessful in configuring Drop untag VLAN')1759 1760 sleep(60)1761 with steps.start('Verifying links',continue_=True) as step: 1762 log.info('Verify link status')1763 for i in range(0,5):1764 1765 sleep(5)1766 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1767 logger.info(data)1768 if data["is_alive"] == True: 1769 logger.info('Link is Up') 1770 break1771 elif i == 4:1772 if data["is_alive"] == True:1773 logger.info('Link is Up')1774 else:1775 assert False1776 1777 @ aetest.test1778 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):1779 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1780 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1781 log.info('Successful in configuring vlan in Server')1782 1783 #Configure IP on client PC1784 with steps.start('Configure IP in client',continue_=True) as step: 1785 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1786 log.info('Successful in configuring IP in Client')1787 1788 with steps.start('Starting iperf in client',continue_=True) as step:1789 sleep(20) 1790 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1791 result=((up != 0.0) and (down != 0.0))1792 log.info(result)1793 if result == False:1794 log.info('Traffic Failed due to drop untag')1795 else:1796 log.info('Failed to drop untagged packets')1797 assert False1798 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1799 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1800 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1801 log.info('Successful in Removing vlan in Server')1802 with steps.start('Removing IP in client',continue_=True) as step:1803 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1804 log.info('Successful in Removing IP in Client') 1805 @ aetest.test1806 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,**param):1807 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1808 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1809 log.info('Successful in configuring vlan in Server')1810 with steps.start('Configure Q VLAN in client',continue_=True) as step:1811 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'])1812 log.info('Successful in configuring vlan in client')1813 1814 with steps.start('Starting client iperf',continue_=True) as step:1815 sleep(20)1816 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1817 assert ((up != 0) and (down != 0))1818 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1819 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1820 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1821 log.info('Successful in Removing vlan in Server')1822 with steps.start('Removing Q VLAN in client',continue_=True) as step:1823 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1824 log.info('Removing Q vlan in client')1825 @ aetest.test1826 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,**param):1827 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1828 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)1829 log.info('Successful in configuring QinQ vlan in Server')1830 with steps.start('Configure Q VLAN in client',continue_=True) as step:1831 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)1832 log.info('Successful in configuring QinQ vlan in client')1833 with steps.start('Starting client iperf',continue_=True) as step:1834 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1835 assert ((up != 0) and (down != 0))1836 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1837 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1838 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],status='disable')1839 log.info('Removing QinQ vlan in Server')1840 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1841 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1842 log.info('Removing QiNQ vlan in client')1843 1844 @aetest.cleanup1845 def Removing_configs_from_node(self,steps,ctrl,server,client,etype,**param):1846 1847 1848 with steps.start('Removing QinQ VLAN in dn',continue_=True) as step:1849 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='disable')1850 log.info('sucessful in Removing Single VLAN on dn')1851 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:1852 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')1853 log.info('sucessful in Removing allowed QinQ VLAN on dn')1854 1855 with steps.start('Removing drop untag packets in QinQ VLAN',continue_=True) as step:1856 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 1857 log.info('sucessful in Removing Drop untag VLAN')1858 sleep(60)1859 with steps.start('Verifying links',continue_=True) as step: 1860 log.info('Verify link status')1861 for i in range(0,5):1862 1863 sleep(5)1864 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1865 logger.info(data)1866 if data["is_alive"] == True: 1867 logger.info('Link is Up') 1868 break1869 elif i == 4:1870 if data["is_alive"] == True:1871 logger.info('Link is Up')1872 else:1873 assert False1874@aetest.loop(etype = ['0x8100', '0x88A8'])1875class QinQ_Allow_untag_Drop_Singe_Tag(aetest.Testcase):1876 1877 @aetest.setup1878 def Configure_QinQ_Vlan_allowed_list(self,etype, steps,ctrl,server,client,**param):1879 1880 1881 with steps.start('Verifying links',continue_=True) as step: 1882 log.info('Verify link status')1883 for i in range(0,5):1884 1885 sleep(5)1886 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1887 logger.info(data)1888 if data["is_alive"] == True: 1889 logger.info('Link is Up') 1890 break1891 elif i == 4:1892 if data["is_alive"] == True:1893 logger.info('Link is Up')1894 else:1895 assert False1896 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:1897 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')1898 log.info('sucessful in Enabling Single VLAN on dn')1899 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:1900 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')1901 log.info('sucessful in configuring allowed QinQ VLAN on dn')1902 1903 with steps.start('Configure Allow untag packets in QinQ VLAN',continue_=True) as step:1904 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 1905 log.info('sucessful in configuring Allow untag ')1906 1907 with steps.start('Configure Drop Single packets in QinQ VLAN',continue_=True) as step:1908 assert api.config_drop_single_tag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='enable') 1909 log.info('sucessful in configuring Drop Singletag')1910 sleep(60)1911 with steps.start('Verifying links',continue_=True) as step: 1912 log.info('Verify link status')1913 for i in range(0,5):1914 1915 sleep(5)1916 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])1917 logger.info(data)1918 if data["is_alive"] == True: 1919 logger.info('Link is Up') 1920 break1921 elif i == 4:1922 if data["is_alive"] == True:1923 logger.info('Link is Up')1924 else:1925 assert False1926 1927 1928 1929 @ aetest.test1930 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):1931 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1932 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1933 log.info('Successful in configuring vlan in Server')1934 with steps.start('Configure IP in client',continue_=True) as step:1935 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])1936 log.info('Successful in configuring IP in Client')1937 1938 1939 with steps.start('Starting client iperf',continue_=True) as step:1940 sleep(20)1941 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1942 assert ((up != 0) and (down != 0))1943 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1944 1945 1946 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1947 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1948 log.info('Successful in Removing vlan in Server')1949 with steps.start('Removing IP in client',continue_=True) as step:1950 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')1951 log.info('Successful in Removing IP in Client') 1952 @ aetest.test1953 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,**param):1954 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1955 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)1956 log.info('Successful in configuring vlan in Server')1957 with steps.start('Configure Q VLAN in client',continue_=True) as step:1958 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'])1959 log.info('Successful in configuring vlan in client')1960 1961 with steps.start('Starting client iperf',continue_=True) as step:1962 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1963 result=((up != 0) and (down != 0))1964 if result == False:1965 log.info('Packets dropped due to drop config')1966 else:1967 assert False1968 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1969 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')1970 log.info('Successful in Removing vlan in Server')1971 with steps.start('Removing Q VLAN in client',continue_=True) as step:1972 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1973 log.info('Removing Q vlan in client')1974 @ aetest.test1975 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,**param):1976 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:1977 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)1978 log.info('Successful in configuring QinQ vlan in Server')1979 with steps.start('Configure Q VLAN in client',continue_=True) as step:1980 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)1981 log.info('Successful in configuring QinQ vlan in client')1982 with steps.start('Starting client iperf',continue_=True) as step:1983 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])1984 assert ((up != 0) and (down != 0))1985 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))1986 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:1987 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],status='disable')1988 log.info('Removing QinQ vlan in Server')1989 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:1990 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')1991 log.info('Removing QiNQ vlan in client')1992 1993 @aetest.cleanup1994 def Removing_configs_from_node(self,steps,ctrl,server,client,etype,**param):1995 1996 1997 with steps.start('Removing QinQ VLAN in dn',continue_=True) as step:1998 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='disable')1999 log.info('sucessful in Removing Single VLAN on dn')2000 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:2001 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')2002 log.info('sucessful in Removing allowed QinQ VLAN on dn')2003 2004 with steps.start('Removing drop Single tag packets in QinQ VLAN',continue_=True) as step:2005 assert api.config_drop_single_tag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 2006 log.info('sucessful in Removing Drop Single tag')2007 sleep(60)2008 with steps.start('Verifying links',continue_=True) as step: 2009 log.info('Verify link status')2010 for i in range(0,5):2011 2012 sleep(5)2013 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2014 logger.info(data)2015 if data["is_alive"] == True: 2016 logger.info('Link is Up') 2017 break2018 elif i == 4:2019 if data["is_alive"] == True:2020 logger.info('Link is Up')2021 else:2022 assert False2023 2024@aetest.loop(etype = ['0x8100', '0x88A8'])2025class QinQ_Drop_untag_Drop_Singe_Tag(aetest.Testcase):2026 2027 @aetest.setup2028 def Configure_QinQ_Vlan_allowed_list(self,etype, steps,ctrl,server,client,**param):2029 2030 with steps.start('Verifying links',continue_=True) as step: 2031 log.info('Verify link status')2032 for i in range(0,5):2033 2034 sleep(5)2035 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2036 logger.info(data)2037 if data["is_alive"] == True: 2038 logger.info('Link is Up') 2039 break2040 elif i == 4:2041 if data["is_alive"] == True:2042 logger.info('Link is Up')2043 else:2044 assert False2045 client.disconnect()2046 client.connect()2047 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:2048 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='enable')2049 log.info('sucessful in Enabling Single VLAN on dn')2050 with steps.start('Configure Allowed QinQ VLAN in dn',continue_=True) as step:2051 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='enable')2052 log.info('sucessful in configuring allowed QinQ VLAN on dn')2053 2054 with steps.start('Configure Drop untag packets in QinQ VLAN',continue_=True) as step:2055 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='enable') 2056 log.info('sucessful in configuring Drop untag ')2057 2058 with steps.start('Configure Drop Single packets in QinQ VLAN',continue_=True) as step:2059 assert api.config_drop_single_tag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='enable') 2060 log.info('sucessful in configuring Drop Singletag')2061 2062 sleep(60)2063 with steps.start('Verifying links',continue_=True) as step: 2064 log.info('Verify link status')2065 for i in range(0,5):2066 2067 sleep(5)2068 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2069 logger.info(data)2070 if data["is_alive"] == True: 2071 logger.info('Link is Up') 2072 break2073 elif i == 4:2074 if data["is_alive"] == True:2075 logger.info('Link is Up')2076 else:2077 assert False2078 2079 @ aetest.test2080 def test_untagged_packets(self,steps,ctrl,server,client,etype,**param):2081 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:2082 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)2083 log.info('Successful in configuring vlan in Server')2084 with steps.start('Configure IP in client',continue_=True) as step:2085 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2086 log.info('Successful in configuring IP in Client')2087 2088 2089 with steps.start('Starting client iperf',continue_=True) as step:2090 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2091 result=((up != 0) and (down != 0))2092 if result == False:2093 log.info('Packets dropped due to drop config')2094 else:2095 assert False2096 2097 2098 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:2099 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])-1),str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')2100 log.info('Successful in Removing vlan in Server')2101 with steps.start('Removing IP in client',continue_=True) as step:2102 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2103 log.info('Successful in Removing IP in Client') 2104 @ aetest.test2105 def test_single_tagged_packets(self,steps,ctrl,server,client,etype,**param):2106 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:2107 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype)2108 log.info('Successful in configuring vlan in Server')2109 with steps.start('Configure Q VLAN in client',continue_=True) as step:2110 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'])2111 log.info('Successful in configuring vlan in client')2112 2113 with steps.start('Starting client iperf',continue_=True) as step:2114 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2115 result=((up != 0) and (down != 0))2116 if result == False:2117 log.info('Packets dropped due to drop config')2118 else:2119 assert False2120 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:2121 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],str(int(param['dn1_svlan'])-1),param['server_data_ipv4'],ethertype=etype,status='disable')2122 log.info('Successful in Removing vlan in Server')2123 with steps.start('Removing Q VLAN in client',continue_=True) as step:2124 assert misc.config_Q(client,param['client_inf'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')2125 log.info('Removing Q vlan in client')2126 @ aetest.test2127 def test_double_tagged_packets(self,steps,ctrl,server,client,etype,**param):2128 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:2129 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)2130 log.info('Successful in configuring QinQ vlan in Server')2131 with steps.start('Configure Q VLAN in client',continue_=True) as step:2132 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)2133 log.info('Successful in configuring QinQ vlan in client')2134 with steps.start('Starting client iperf',continue_=True) as step:2135 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2136 assert ((up != 0) and (down != 0))2137 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2138 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:2139 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],status='disable')2140 log.info('Removing QinQ vlan in Server')2141 with steps.start('Removing QinQ VLAN in client',continue_=True) as step:2142 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],status='disable')2143 log.info('Removing QiNQ vlan in client')2144 2145 @aetest.cleanup2146 def Removing_configs_from_node(self,steps,ctrl,server,client,etype,**param):2147 2148 2149 with steps.start('Removing QinQ VLAN in dn',continue_=True) as step:2150 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],svlan=str(int(param['dn1_svlan'])-1),cvlan=str(int(param['dn1_cvlan'])-1),ethertype=etype,status='disable')2151 log.info('sucessful in Removing Single VLAN on dn')2152 with steps.start('Removing Allowed QinQ VLAN in dn',continue_=True) as step:2153 assert api.config_vlan_allowed_list(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_list=param['dn1_svlan'],status='disable')2154 log.info('sucessful in Removing allowed QinQ VLAN on dn')2155 with steps.start('Removing drop untag packets in QinQ VLAN',continue_=True) as step:2156 assert api.config_vlan_drop_untag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 2157 log.info('sucessful in Removing Drop untag') 2158 2159 with steps.start('Removing drop Single tag packets in QinQ VLAN',continue_=True) as step:2160 assert api.config_drop_single_tag(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],status='disable') 2161 log.info('sucessful in Removing Drop Single tag')2162 sleep(60)2163 with steps.start('Verifying links',continue_=True) as step: 2164 log.info('Verify link status')2165 for i in range(0,5):2166 2167 sleep(5)2168 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2169 logger.info(data)2170 if data["is_alive"] == True: 2171 logger.info('Link is Up') 2172 break2173 elif i == 4:2174 if data["is_alive"] == True:2175 logger.info('Link is Up')2176 else:2177 assert False2178@aetest.loop(etype = ['0x8100', '0x88A8'])2179class Same_S_And_C_QinQ_Vlan(aetest.Testcase):2180 def Capturing_Server_interface(self,server,server_inf,server_file):2181 assert misc.capture_interface(server,server_inf,server_file)2182 def Verify_traffic(self,client,server_data_ipv4):2183 log.info('Starting iperf client')2184 up,down=misc.config_iperf_client(client,server_data_ipv4)2185 assert ((up != 0.0) and (down != 0.0))2186 #log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2187 2188 @aetest.setup2189 def Configure_QinQ_Vlan(self, etype, steps,ctrl,server,client,**param):2190 2191 with steps.start('Verifying links',continue_=True) as step: 2192 log.info('Verify link status')2193 for i in range(0,5):2194 2195 sleep(5)2196 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2197 logger.info(data)2198 if data["is_alive"] == True: 2199 logger.info('Link is Up') 2200 break2201 elif i == 4:2202 if data["is_alive"] == True:2203 logger.info('Link is Up')2204 else:2205 assert False2206 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:2207 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_svlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 2208 log.info('sucessful in Enabling Double VLAN on dn')2209 sleep(60)2210 with steps.start('Verifying links',continue_=True) as step: 2211 log.info('Verify link status')2212 for i in range(0,5):2213 2214 sleep(5)2215 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2216 logger.info(data)2217 if data["is_alive"] == True: 2218 logger.info('Link is Up') 2219 break2220 elif i == 4:2221 if data["is_alive"] == True:2222 logger.info('Link is Up')2223 else:2224 assert False2225 2226 2227 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:2228 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)2229 log.info('Successful in configuring vlan in Server')2230 2231 #Configure IP on client PC2232 with steps.start('Configure IP in client',continue_=True) as step: 2233 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2234 log.info('Successful in configuring IP in Client')2235 2236 2237 with steps.start('Capturing and verifying traffic',continue_=True) as step:2238 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))2239 p1.start()2240 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))2241 p2.start()2242 p1.join()2243 p2.join()2244 with steps.start('Analyse Capture',continue_=True) as step:2245 if etype =='0x8100':2246 ip = param['client_data_ipv4'].rsplit('/', 1)[0]2247 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id == {}&&vlan.priority==5&&vlan.priority==3'.format(ip,param['dn1_svlan'],param['dn1_svlan'])2248 else:2249 ip = param['client_data_ipv4'].rsplit('/', 1)[0]2250 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==5&&vlan.priority==3'.format(ip,param['dn1_svlan'],param['dn1_svlan'])2251 res=misc.analyse_capture(server,filter,param['server_file'])2252 if res > 0:2253 log.info('Successful in QinQ VLAN tagging')2254 else:2255 assert False2256 2257 2258 2259 @aetest.cleanup2260 def Disabling_QinQ_VLAN(self,etype,steps,ctrl,server,client,**param):2261 2262 log.info('Disabling Double VLAN in dn')2263 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:2264 assert misc.config_QinQ(server,param['server_inf'],param['dn1_svlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')2265 log.info('Successful in Removing vlan in Server')2266 sleep(60)2267 with steps.start('Verifying links',continue_=True) as step: 2268 log.info('Verify link status')2269 for i in range(0,5):2270 2271 sleep(5)2272 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2273 logger.info(data)2274 if data["is_alive"] == True: 2275 logger.info('Link is Up') 2276 break2277 elif i == 4:2278 if data["is_alive"] == True:2279 logger.info('Link is Up')2280 else:2281 assert False2282 with steps.start('Removing vlan configs from server',continue_=True) as step:2283 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_svlan'],svlan=param['dn1_svlan'],ethertype=etype,status='disable') 2284 log.info('sucessful in Removing QinQ VLAN on dn')2285 with steps.start('Configure IP in client',continue_=True) as step:2286 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2287 log.info('Successful in configuring IP in Client')2288@aetest.skip(reason = 'Failure in client3 reachability')2289class POP_Bridge_Q_Vlan(aetest.Testcase):2290 def Capturing_Server_interface(self,server,server_inf,server_file):2291 assert misc.capture_interface(server,server_inf,server_file)2292 2293 def Verify_traffic(self,client,server_data_ipv4):2294 log.info('Starting iperf client')2295 up,down=misc.config_iperf_client(client,server_data_ipv4)2296 assert ((up != 0.0) and (down != 0.0))2297 #log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2298 2299 @aetest.setup2300 def Setup(self, steps,ctrl,server,client3,**param):2301 with steps.start('Verifying links',continue_=True) as step: 2302 log.info('Verify link status')2303 for i in range(0,5):2304 2305 sleep(5)2306 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2307 logger.info(data)2308 if data["is_alive"] == True: 2309 logger.info('Link is Up') 2310 break2311 elif i == 4:2312 if data["is_alive"] == True:2313 logger.info('Link is Up')2314 else:2315 assert False2316 2317 client3.connect()2318 with steps.start('Configure Q VLAN in POP',continue_=True) as step:2319 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['pop_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 2320 log.info('sucessful in Enabling Single VLAN on POP')2321 sleep(60)2322 with steps.start('Verifying links',continue_=True) as step: 2323 log.info('Verify link status')2324 for i in range(0,5):2325 2326 sleep(5)2327 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2328 logger.info(data)2329 if data["is_alive"] == True: 2330 logger.info('Link is Up') 2331 break2332 elif i == 4:2333 if data["is_alive"] == True:2334 logger.info('Link is Up')2335 else:2336 assert False2337 2338 2339 with steps.start('Configure Q VLAN in Server',continue_=True) as step:2340 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])2341 log.info('Successful in configuring vlan in Server')2342 2343 #Configure IP on client PC2344 with steps.start('Configure IP in client',continue_=True) as step: 2345 assert misc.config_ip(client3,param['client3_inf'],param['client3_data_ipv4'])2346 log.info('Successful in configuring IP in Client')2347 2348 2349 2350 with steps.start('Capturing and verifying traffic',continue_=True) as step:2351 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))2352 p1.start()2353 p2 = Process(target=self.Verify_traffic,args=(client3,param['server_data_ipv4']))2354 p2.start()2355 p1.join()2356 p2.join()2357 with steps.start('Analyse Capture',continue_=True) as step:2358 ip = param['client_data_ipv4'].rsplit('/', 1)[0]2359 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])2360 res=misc.analyse_capture(server,filter,param['server_file'])2361 if res > 0:2362 log.info('Successful in VLAN tagging')2363 else:2364 assert False2365 @aetest.cleanup2366 def Disabling_Q_VLAN(self,steps,ctrl,server,client3,**param):2367 2368 log.info('Disabling Single VLAN in POP')2369 with steps.start('Configure Q VLAN in Server',continue_=True) as step:2370 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')2371 log.info('Successful in configuring vlan in Server')2372 with steps.start('Removing vlan configs from server',continue_=True) as step:2373 assert api.config_single_vlan(param['ctrl_ip'],param['pop_name'],param['pop_inf1'],vlan_id=param['dn1_cvlan'],status='disable') 2374 log.info('sucessful in Enabling Single VLAN on POP')2375 sleep(60)2376 with steps.start('Verifying links',continue_=True) as step: 2377 log.info('Verify link status')2378 for i in range(0,5):2379 2380 sleep(5)2381 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2382 logger.info(data)2383 if data["is_alive"] == True: 2384 logger.info('Link is Up') 2385 break2386 elif i == 4:2387 if data["is_alive"] == True:2388 logger.info('Link is Up')2389 else:2390 assert False2391 with steps.start('Configure IP in client',continue_=True) as step:2392 assert misc.config_ip(client3,param['client_inf'],param['client_data_ipv4'],status='disable')2393 log.info('Successful in configuring IP in Client')2394 client3.disconnect()2395 2396class Transparent_Port(aetest.Testcase):2397 @aetest.setup2398 def Configure_Transparent(self, steps,ctrl,server,client,**param):2399 2400 with steps.start('Verifying links',continue_=True) as step: 2401 log.info('Verify link status')2402 for i in range(0,5):2403 2404 sleep(5)2405 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2406 logger.info(data)2407 if data["is_alive"] == True: 2408 logger.info('Link is Up') 2409 break2410 elif i == 4:2411 if data["is_alive"] == True:2412 logger.info('Link is Up')2413 else:2414 assert False2415 with steps.start('Configure Transparent in dn',continue_=True) as step:2416 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2417 log.info('sucessful in Enabling Transparent on dn')2418 sleep(60)2419 with steps.start('Verifying links',continue_=True) as step: 2420 log.info('Verify link status')2421 for i in range(0,5):2422 2423 sleep(5)2424 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2425 logger.info(data)2426 if data["is_alive"] == True: 2427 logger.info('Link is Up') 2428 break2429 elif i == 4:2430 if data["is_alive"] == True:2431 logger.info('Link is Up')2432 else:2433 assert False2434 2435 with steps.start('Configure IP in Server',continue_=True) as step: 2436 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'])2437 log.info('Successful in configuring IP in Server')2438 2439 #Configure IP on client PC2440 with steps.start('Configure IP in client',continue_=True) as step: 2441 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2442 log.info('Successful in configuring IP in Client')2443 2444 2445 @ aetest.test2446 def verify_traffic(self,steps,ctrl,server,client,**param):2447 sleep(20) 2448 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2449 assert ((up != 0) and (down != 0))2450 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2451 @aetest.cleanup2452 def Removing_Ips(self,steps,ctrl,server,client,**param):2453 2454 2455 with steps.start('Removing IP in Server',continue_=True) as step: 2456 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'],status='disable')2457 log.info('Successful in Removing IP in Server')2458 2459 #Configure IP on client PC2460 with steps.start('Removing IP in client',continue_=True) as step: 2461 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2462 log.info('Successful in Removing IP in Client')2463class Transparent_Port_With_Q_Packets(aetest.Testcase):2464 @aetest.setup2465 def Configure_Transparent_port(self, steps,ctrl,server,client,**param):2466 with steps.start('Verifying links',continue_=True) as step: 2467 log.info('Verify link status')2468 for i in range(0,5):2469 2470 sleep(5)2471 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2472 logger.info(data)2473 if data["is_alive"] == True: 2474 logger.info('Link is Up') 2475 break2476 elif i == 4:2477 if data["is_alive"] == True:2478 logger.info('Link is Up')2479 else:2480 assert False2481 with steps.start('Configure Transparent port',continue_=True) as step:2482 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2483 log.info('sucessful in Enabling Transparent port on dn')2484 2485 sleep(60)2486 with steps.start('Verifying links',continue_=True) as step: 2487 log.info('Verify link status')2488 for i in range(0,5):2489 2490 sleep(5)2491 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2492 logger.info(data)2493 if data["is_alive"] == True: 2494 logger.info('Link is Up') 2495 break2496 elif i == 4:2497 if data["is_alive"] == True:2498 logger.info('Link is Up')2499 else:2500 assert False2501 with steps.start('Configure Q VLAN in Server',continue_=True) as step:2502 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])2503 log.info('Successful in configuring vlan in Server')2504 2505 with steps.start('Configure Q VLAN in client',continue_=True) as step:2506 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'])2507 log.info('Successful in configuring vlan in client')2508 2509 @ aetest.test2510 def verify_traffic(self,steps,ctrl,server,client,**param):2511 sleep(20) 2512 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2513 assert ((up != 0) and (down != 0))2514 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2515 @aetest.cleanup2516 def Disabling_VLAN_in_Server(self,steps,ctrl,server,client,**param):2517 2518 2519 with steps.start('Removing Q VLAN in Server',continue_=True) as step:2520 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')2521 log.info('Successful in Removing vlan in Server')2522 2523 with steps.start('Removing Q VLAN in client',continue_=True) as step:2524 assert misc.config_Q(client,param['client_inf'],param['dn1_cvlan'],param['client_data_ipv4'],status='disable')2525 log.info('Successful in Removing vlan in client')2526@aetest.loop(etype = ['0x8100', '0x88A8'])2527class Transparent_Port_With_QinQ_Packets(aetest.Testcase):2528 @aetest.setup2529 def Configure_Transparent_Port(self, etype, steps,ctrl,server,client,**param):2530 2531 with steps.start('Verifying links',continue_=True) as step: 2532 log.info('Verify link status')2533 for i in range(0,5):2534 2535 sleep(5)2536 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2537 logger.info(data)2538 if data["is_alive"] == True: 2539 logger.info('Link is Up') 2540 break2541 elif i == 4:2542 if data["is_alive"] == True:2543 logger.info('Link is Up')2544 else:2545 assert False2546 with steps.start('Configure Transparent port',continue_=True) as step:2547 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2548 log.info('sucessful in Enabling Transparent port on dn')2549 2550 sleep(60)2551 with steps.start('Verifying links',continue_=True) as step: 2552 log.info('Verify link status')2553 for i in range(0,5):2554 2555 sleep(5)2556 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2557 logger.info(data)2558 if data["is_alive"] == True: 2559 logger.info('Link is Up') 2560 break2561 elif i == 4:2562 if data["is_alive"] == True:2563 logger.info('Link is Up')2564 else:2565 assert False2566 2567 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:2568 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)2569 log.info('Successful in configuring vlan in Server')2570 2571 with steps.start('Configure QinQ VLAN in Client',continue_=True) as step:2572 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype)2573 log.info('Successful in configuring vlan in client') 2574 2575 2576 @ aetest.test2577 def verify_traffic(self,etype,steps,ctrl,server,client,**param):2578 sleep(20) 2579 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2580 assert ((up != 0) and (down != 0))2581 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2582 2583 @aetest.cleanup2584 def Removing_VLAN(self,etype,steps,ctrl,server,client,**param):2585 2586 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:2587 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')2588 log.info('Successful in Removing vlan in Server')2589 2590 with steps.start('Removnig QinQ VLAN in Client',continue_=True) as step:2591 assert misc.config_QinQ(client,param['client_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['client_data_ipv4'],ethertype=etype,status='disable')2592 log.info('Successful in Removing vlan in client')2593class Two_Interface_Transaprent(aetest.Testcase):2594 @aetest.setup2595 def Configure_Transparent(self, steps,ctrl,server,client,client2,**param):2596 client2.connect()2597 misc.execute_command(client2,'sudo ifconfig {} mtu 1492'.format(param['client2_inf']))2598 with steps.start('Verifying links',continue_=True) as step: 2599 log.info('Verify link status')2600 for i in range(0,5):2601 2602 sleep(5)2603 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2604 logger.info(data)2605 if data["is_alive"] == True: 2606 logger.info('Link is Up') 2607 break2608 elif i == 4:2609 if data["is_alive"] == True:2610 logger.info('Link is Up')2611 else:2612 assert False2613 2614 with steps.start('Configure Transparent in dn port1',continue_=True) as step:2615 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2616 log.info('sucessful in Enabling Transparent on dn')2617 with steps.start('Configure Transparent in dn port2',continue_=True) as step:2618 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2619 log.info('sucessful in Enabling Transparent on dn')2620 sleep(60)2621 with steps.start('Verifying links',continue_=True) as step: 2622 log.info('Verify link status')2623 for i in range(0,5):2624 2625 sleep(5)2626 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2627 logger.info(data)2628 if data["is_alive"] == True: 2629 logger.info('Link is Up') 2630 break2631 elif i == 4:2632 if data["is_alive"] == True:2633 logger.info('Link is Up')2634 else:2635 assert False2636 2637 with steps.start('Configure IP in Server',continue_=True) as step: 2638 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'])2639 log.info('Successful in configuring IP in Server')2640 2641 #Configure IP on client PC2642 with steps.start('Configure IP in client',continue_=True) as step: 2643 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2644 log.info('Successful in configuring IP in Client')2645 with steps.start('Configure IP in client2',continue_=True) as step: 2646 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])2647 log.info('Successful in configuring IP in Client')2648 2649 2650 @ aetest.test2651 def verify_traffic(self,steps,ctrl,server,client,client2,**param):2652 sleep(20) 2653 with steps.start('client1 traffic',continue_=True) as step:2654 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2655 assert ((up != 0) and (down != 0))2656 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2657 with steps.start('client2 traffic',continue_=True) as step:2658 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])2659 assert ((up != 0) and (down != 0))2660 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2661 @aetest.cleanup2662 def Removing_Ips(self,steps,ctrl,server,client,client2,**param):2663 2664 2665 with steps.start('Removing IP in Server',continue_=True) as step: 2666 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'],status='disable')2667 log.info('Successful in Removing IP in Server')2668 2669 #Configure IP on client PC2670 with steps.start('Removing IP in client',continue_=True) as step: 2671 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2672 log.info('Successful in Removing IP in Client')2673 with steps.start('Removing IP in client2',continue_=True) as step: 2674 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')2675 log.info('Successful in Removing IP in Client2')2676 misc.execute_command(client2,'sudo ifconfig {} mtu 1500'.format(param['client2_inf']))2677 client2.disconnect()2678class Two_Interface_Transaprent_Q(aetest.Testcase):2679 @aetest.setup2680 def Configure_Transparent(self, steps,ctrl,server,client,client2,**param):2681 with steps.start('Verifying links',continue_=True) as step: 2682 log.info('Verify link status')2683 for i in range(0,5):2684 2685 sleep(5)2686 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2687 logger.info(data)2688 if data["is_alive"] == True: 2689 logger.info('Link is Up') 2690 break2691 elif i == 4:2692 if data["is_alive"] == True:2693 logger.info('Link is Up')2694 else:2695 assert False2696 client2.connect()2697 with steps.start('Configure Transparent in dn port1',continue_=True) as step:2698 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2699 log.info('sucessful in Enabling Transparent on dn')2700 with steps.start('Configure Qvlan in dn port2',continue_=True) as step:2701 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 2702 log.info('sucessful in Enabling Qvlan on dn')2703 2704 sleep(60)2705 with steps.start('Verifying links',continue_=True) as step: 2706 log.info('Verify link status')2707 for i in range(0,5):2708 2709 sleep(5)2710 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2711 logger.info(data)2712 if data["is_alive"] == True: 2713 logger.info('Link is Up') 2714 break2715 elif i == 4:2716 if data["is_alive"] == True:2717 logger.info('Link is Up')2718 else:2719 assert False2720 2721 #Configure IP on client PC2722 with steps.start('Configure IP in client',continue_=True) as step: 2723 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2724 log.info('Successful in configuring IP in Client')2725 with steps.start('Configure IP in client2',continue_=True) as step: 2726 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])2727 log.info('Successful in configuring IP in Client')2728 2729 2730 @ aetest.test2731 def verify_traffic(self,steps,ctrl,server,client,client2,**param):2732 with steps.start('Configure IP in Server',continue_=True) as step: 2733 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'])2734 log.info('Successful in configuring IP in Server')2735 sleep(20) 2736 with steps.start('client1 traffic',continue_=True) as step:2737 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2738 assert ((up != 0) and (down != 0))2739 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2740 with steps.start('Removing IP in Server',continue_=True) as step: 2741 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'],status='disable')2742 log.info('Successful in Removing IP in Server')2743 with steps.start('Configure Q VLAN in Server',continue_=True) as step:2744 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])2745 log.info('Successful in configuring vlan in Server')2746 2747 sleep(20)2748 with steps.start('client2 traffic',continue_=True) as step:2749 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])2750 assert ((up != 0) and (down != 0))2751 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2752 with steps.start('Removing Q VLAN in Server',continue_=True) as step:2753 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')2754 log.info('Successful in Removing vlan in Server')2755 @aetest.cleanup2756 def Removing_Ips(self,steps,ctrl,server,client,client2,**param):2757 2758 2759 with steps.start('Configure Qvlan in dn port2',continue_=True) as step:2760 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2761 log.info('sucessful in Enabling Qvlan on dn')2762 sleep(60)2763 with steps.start('Verifying links',continue_=True) as step: 2764 log.info('Verify link status')2765 for i in range(0,5):2766 2767 sleep(5)2768 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2769 logger.info(data)2770 if data["is_alive"] == True: 2771 logger.info('Link is Up') 2772 break2773 elif i == 4:2774 if data["is_alive"] == True:2775 logger.info('Link is Up')2776 else:2777 assert False2778 2779 #Configure IP on client PC2780 with steps.start('Removing IP in client',continue_=True) as step: 2781 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2782 log.info('Successful in Removing IP in Client')2783 with steps.start('Removing IP in client2',continue_=True) as step: 2784 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')2785 log.info('Successful in Removing IP in Client2')2786 client2.disconnect()2787@aetest.loop(etype = ['0x8100', '0x88A8'])2788class Two_Interface_Transaprent_QinQ(aetest.Testcase):2789 @aetest.setup2790 def Configure_Transparent(self, steps,ctrl,server,client,client2,etype,**param):2791 with steps.start('Verifying links',continue_=True) as step: 2792 log.info('Verify link status')2793 for i in range(0,5):2794 2795 sleep(5)2796 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2797 logger.info(data)2798 if data["is_alive"] == True: 2799 logger.info('Link is Up') 2800 break2801 elif i == 4:2802 if data["is_alive"] == True:2803 logger.info('Link is Up')2804 else:2805 assert False2806 client2.connect()2807 with steps.start('Configure Transparent in dn port1',continue_=True) as step:2808 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2809 log.info('sucessful in Enabling Transparent on dn')2810 with steps.start('Configure QinQ VLAN in dn port2',continue_=True) as step:2811 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 2812 log.info('sucessful in Enabling Double VLAN on dn')2813 sleep(60)2814 with steps.start('Verifying links',continue_=True) as step: 2815 log.info('Verify link status')2816 for i in range(0,5):2817 2818 sleep(5)2819 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2820 logger.info(data)2821 if data["is_alive"] == True: 2822 logger.info('Link is Up') 2823 break2824 elif i == 4:2825 if data["is_alive"] == True:2826 logger.info('Link is Up')2827 else:2828 assert False2829 2830 #Configure IP on client PC2831 with steps.start('Configure IP in client',continue_=True) as step: 2832 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2833 log.info('Successful in configuring IP in Client')2834 with steps.start('Configure IP in client2',continue_=True) as step: 2835 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])2836 log.info('Successful in configuring IP in Client')2837 2838 2839 @ aetest.test2840 def verify_traffic(self,steps,ctrl,server,client,client2,etype,**param):2841 with steps.start('Configure IP in Server',continue_=True) as step: 2842 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'])2843 log.info('Successful in configuring IP in Server')2844 sleep(20) 2845 with steps.start('client1 traffic',continue_=True) as step:2846 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2847 assert ((up != 0) and (down != 0))2848 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2849 with steps.start('Removing IP in Server',continue_=True) as step: 2850 assert misc.config_ip(server,param['server_inf'],param['server_data_ipv4'],status='disable')2851 log.info('Successful in Removing IP in Server')2852 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:2853 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)2854 log.info('Successful in configuring vlan in Server')2855 2856 sleep(20)2857 with steps.start('client2 traffic',continue_=True) as step:2858 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])2859 assert ((up != 0) and (down != 0))2860 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2861 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:2862 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')2863 log.info('Removing vlan in Server')2864 2865 @aetest.cleanup2866 def Removing_Ips(self,steps,ctrl,server,client,client2,etype,**param):2867 2868 with steps.start('Removing QinQ VLAN in dn port2',continue_=True) as step:2869 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='disable') 2870 log.info('sucessful in Removing Double VLAN on dn')2871 2872 sleep(60)2873 with steps.start('Verifying links',continue_=True) as step: 2874 log.info('Verify link status')2875 for i in range(0,5):2876 2877 sleep(5)2878 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2879 logger.info(data)2880 if data["is_alive"] == True: 2881 logger.info('Link is Up') 2882 break2883 elif i == 4:2884 if data["is_alive"] == True:2885 logger.info('Link is Up')2886 else:2887 assert False2888 #Configure IP on client PC2889 with steps.start('Removing IP in client',continue_=True) as step: 2890 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2891 log.info('Successful in Removing IP in Client')2892 with steps.start('Removing IP in client2',continue_=True) as step: 2893 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')2894 log.info('Successful in Removing IP in Client2')2895 client2.disconnect()2896class Two_Interface_Same_Q_Vlan(aetest.Testcase):2897 @aetest.setup2898 def Configure_Transparent(self, steps,ctrl,server,client,client2,**param):2899 with steps.start('Verifying links',continue_=True) as step: 2900 log.info('Verify link status')2901 for i in range(0,5):2902 2903 sleep(5)2904 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2905 logger.info(data)2906 if data["is_alive"] == True: 2907 logger.info('Link is Up') 2908 break2909 elif i == 4:2910 if data["is_alive"] == True:2911 logger.info('Link is Up')2912 else:2913 assert False2914 client2.connect()2915 with steps.start('Configure Qvlan in dn port1',continue_=True) as step:2916 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 2917 log.info('sucessful in Enabling Qvlan on dn')2918 with steps.start('Configure Qvlan in dn port2',continue_=True) as step:2919 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 2920 log.info('sucessful in Enabling Qvlan on dn')2921 sleep(60)2922 with steps.start('Verifying links',continue_=True) as step: 2923 log.info('Verify link status')2924 for i in range(0,5):2925 2926 sleep(5)2927 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2928 logger.info(data)2929 if data["is_alive"] == True: 2930 logger.info('Link is Up') 2931 break2932 elif i == 4:2933 if data["is_alive"] == True:2934 logger.info('Link is Up')2935 else:2936 assert False2937 2938 with steps.start('Configure Q VLAN in Server',continue_=True) as step:2939 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])2940 log.info('Successful in configuring vlan in Server')2941 2942 #Configure IP on client PC2943 with steps.start('Configure IP in client',continue_=True) as step: 2944 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])2945 log.info('Successful in configuring IP in Client')2946 with steps.start('Configure IP in client2',continue_=True) as step: 2947 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])2948 log.info('Successful in configuring IP in Client')2949 2950 2951 @ aetest.test2952 def verify_traffic(self,steps,ctrl,server,client,client2,**param):2953 2954 sleep(20) 2955 with steps.start('client1 traffic',continue_=True) as step:2956 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])2957 assert ((up != 0) and (down != 0))2958 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 2959 sleep(20)2960 with steps.start('client2 traffic',continue_=True) as step:2961 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])2962 assert ((up != 0) and (down != 0))2963 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))2964 2965 @aetest.cleanup2966 def Removing_Ips(self,steps,ctrl,server,client,client2,**param):2967 with steps.start('Removing Qvlan in dn port1',continue_=True) as step:2968 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2969 log.info('sucessful in Removing Qvlan on dn')2970 with steps.start('Removing Qvlan in dn port2',continue_=True) as step:2971 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 2972 log.info('sucessful in Removing Qvlan on dn')2973 sleep(60)2974 with steps.start('Verifying links',continue_=True) as step: 2975 log.info('Verify link status')2976 for i in range(0,5):2977 2978 sleep(5)2979 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])2980 logger.info(data)2981 if data["is_alive"] == True: 2982 logger.info('Link is Up') 2983 break2984 elif i == 4:2985 if data["is_alive"] == True:2986 logger.info('Link is Up')2987 else:2988 assert False2989 with steps.start('Removing Q VLAN in Server',continue_=True) as step:2990 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')2991 log.info('Successful in Removing vlan in Server')2992 2993 #Configure IP on client PC2994 with steps.start('Removing IP in client',continue_=True) as step: 2995 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')2996 log.info('Successful in Removing IP in Client')2997 with steps.start('Removing IP in client2',continue_=True) as step: 2998 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')2999 log.info('Successful in Removing IP in Client2')3000 client2.disconnect()3001class Two_Interface_Different_Q_Vlan(aetest.Testcase):3002 3003 @aetest.setup3004 def Configure_Transparent(self, steps,ctrl,server,client,client2,**param):3005 3006 with steps.start('Verifying links',continue_=True) as step: 3007 log.info('Verify link status')3008 for i in range(0,5):3009 3010 sleep(5)3011 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3012 logger.info(data)3013 if data["is_alive"] == True: 3014 logger.info('Link is Up') 3015 break3016 elif i == 4:3017 if data["is_alive"] == True:3018 logger.info('Link is Up')3019 else:3020 assert False3021 client2.connect()3022 with steps.start('Configure Qvlan in dn port1',continue_=True) as step:3023 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 3024 log.info('sucessful in Enabling Qvlan on dn')3025 with steps.start('Configure Qvlan in dn port2',continue_=True) as step:3026 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=str(int(param['dn1_cvlan'])+1),vlan_prio='7',status='enable') 3027 log.info('sucessful in Enabling Qvlan on dn')3028 sleep(60)3029 with steps.start('Verifying links',continue_=True) as step: 3030 log.info('Verify link status')3031 for i in range(0,5):3032 3033 sleep(5)3034 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3035 logger.info(data)3036 if data["is_alive"] == True: 3037 logger.info('Link is Up') 3038 break3039 elif i == 4:3040 if data["is_alive"] == True:3041 logger.info('Link is Up')3042 else:3043 assert False 3044 3045 3046 #Configure IP on client PC3047 with steps.start('Configure IP in client',continue_=True) as step: 3048 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])3049 log.info('Successful in configuring IP in Client')3050 with steps.start('Configure IP in client2',continue_=True) as step: 3051 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])3052 log.info('Successful in configuring IP in Client')3053 3054 3055 @ aetest.test3056 def verify_traffic(self,steps,ctrl,server,client,client2,**param):3057 3058 with steps.start('Configure Q VLAN in Server',continue_=True) as step:3059 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])3060 log.info('Successful in configuring vlan in Server')3061 sleep(20) 3062 with steps.start('client1 traffic',continue_=True) as step:3063 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])3064 assert ((up != 0) and (down != 0))3065 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 3066 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3067 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')3068 log.info('Successful in Removing vlan in Server')3069 with steps.start('Configure Q VLAN in Server',continue_=True) as step:3070 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])+1),param['server_data_ipv4'])3071 log.info('Successful in configuring vlan in Server')3072 sleep(20)3073 with steps.start('client2 traffic',continue_=True) as step:3074 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])3075 assert ((up != 0) and (down != 0))3076 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))3077 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3078 assert misc.config_Q(server,param['server_inf'],str(int(param['dn1_cvlan'])+1),param['server_data_ipv4'],status='disable')3079 log.info('Successful in Removing vlan in Server')3080 3081 @aetest.cleanup3082 def Removing_Ips(self,steps,ctrl,server,client,client2,**param):3083 with steps.start('Removing Qvlan in dn port1',continue_=True) as step:3084 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 3085 log.info('sucessful in Removing Qvlan on dn')3086 3087 3088 with steps.start('Removing Qvlan in dn port2',continue_=True) as step:3089 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 3090 log.info('sucessful in Removing Qvlan on dn')3091 sleep(60)3092 with steps.start('Verifying links',continue_=True) as step: 3093 log.info('Verify link status')3094 for i in range(0,5):3095 3096 sleep(5)3097 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3098 logger.info(data)3099 if data["is_alive"] == True: 3100 logger.info('Link is Up') 3101 break3102 elif i == 4:3103 if data["is_alive"] == True:3104 logger.info('Link is Up')3105 else:3106 assert False3107 3108 #Configure IP on client PC3109 with steps.start('Removing IP in client',continue_=True) as step: 3110 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')3111 log.info('Successful in Removing IP in Client')3112 with steps.start('Removing IP in client2',continue_=True) as step: 3113 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')3114 log.info('Successful in Removing IP in Client2')3115 client2.disconnect()3116@aetest.loop(etype = ['0x8100', '0x88A8'])3117class Two_Interface_Q_QinQ(aetest.Testcase):3118 @aetest.setup3119 def Configure_Transparent(self, steps,ctrl,server,client,client2,etype,**param):3120 with steps.start('Verifying links',continue_=True) as step: 3121 log.info('Verify link status')3122 for i in range(0,5):3123 3124 sleep(5)3125 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3126 logger.info(data)3127 if data["is_alive"] == True: 3128 logger.info('Link is Up') 3129 break3130 elif i == 4:3131 if data["is_alive"] == True:3132 logger.info('Link is Up')3133 else:3134 assert False3135 client2.connect()3136 with steps.start('Configure Qvlan in dn port1',continue_=True) as step:3137 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 3138 log.info('sucessful in Enabling Qvlan on dn')3139 with steps.start('Configure QinQ VLAN in dn port2',continue_=True) as step:3140 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 3141 log.info('sucessful in Enabling Double VLAN on dn')3142 sleep(60)3143 with steps.start('Verifying links',continue_=True) as step: 3144 log.info('Verify link status')3145 for i in range(0,5):3146 3147 sleep(5)3148 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3149 logger.info(data)3150 if data["is_alive"] == True: 3151 logger.info('Link is Up') 3152 break3153 elif i == 4:3154 if data["is_alive"] == True:3155 logger.info('Link is Up')3156 else:3157 assert False3158 3159 #Configure IP on client PC3160 with steps.start('Configure IP in client',continue_=True) as step: 3161 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])3162 log.info('Successful in configuring IP in Client')3163 with steps.start('Configure IP in client2',continue_=True) as step: 3164 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])3165 log.info('Successful in configuring IP in Client')3166 3167 3168 @ aetest.test3169 def verify_traffic(self,steps,ctrl,server,client,client2,etype,**param):3170 with steps.start('Configure Q VLAN in Server',continue_=True) as step:3171 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])3172 log.info('Successful in configuring vlan in Server')3173 sleep(20) 3174 with steps.start('client1 traffic',continue_=True) as step:3175 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])3176 assert ((up != 0) and (down != 0))3177 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 3178 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3179 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')3180 log.info('Successful in Removing vlan in Server')3181 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:3182 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)3183 log.info('Successful in configuring vlan in Server')3184 3185 sleep(20)3186 with steps.start('client2 traffic',continue_=True) as step:3187 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])3188 assert ((up != 0) and (down != 0))3189 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))3190 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:3191 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')3192 log.info('Removing vlan in Server')3193 3194 @aetest.cleanup3195 def Removing_Ips(self,steps,ctrl,server,client,client2,etype,**param):3196 3197 with steps.start('Removing Qvlan in dn port1',continue_=True) as step:3198 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='disable') 3199 log.info('sucessful in Removing Qvlan on dn')3200 with steps.start('Removing QinQ VLAN in dn port2',continue_=True) as step:3201 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='disable') 3202 log.info('sucessful in Removing Double VLAN on dn')3203 sleep(60)3204 with steps.start('Verifying links',continue_=True) as step: 3205 log.info('Verify link status')3206 for i in range(0,5):3207 3208 sleep(5)3209 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3210 logger.info(data)3211 if data["is_alive"] == True: 3212 logger.info('Link is Up') 3213 break3214 elif i == 4:3215 if data["is_alive"] == True:3216 logger.info('Link is Up')3217 else:3218 assert False3219 3220 #Configure IP on client PC3221 with steps.start('Removing IP in client',continue_=True) as step: 3222 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')3223 log.info('Successful in Removing IP in Client')3224 with steps.start('Removing IP in client2',continue_=True) as step: 3225 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')3226 log.info('Successful in Removing IP in Client2')3227 client2.disconnect()3228@aetest.loop(etype = ['0x8100', '0x88A8'])3229class Two_Interface_Same_QinQ(aetest.Testcase):3230 @aetest.setup3231 def Configure_QinQ(self, steps,ctrl,server,client,client2,etype,**param):3232 with steps.start('Verifying links',continue_=True) as step: 3233 log.info('Verify link status')3234 for i in range(0,5):3235 3236 sleep(5)3237 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3238 logger.info(data)3239 if data["is_alive"] == True: 3240 logger.info('Link is Up') 3241 break3242 elif i == 4:3243 if data["is_alive"] == True:3244 logger.info('Link is Up')3245 else:3246 assert False3247 client2.connect()3248 with steps.start('Configure QinQ VLAN in dn port1',continue_=True) as step:3249 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 3250 log.info('sucessful in Enabling Double VLAN on dn')3251 with steps.start('Configure QinQ VLAN in dn port2',continue_=True) as step:3252 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 3253 log.info('sucessful in Enabling Double VLAN on dn')3254 sleep(60)3255 with steps.start('Verifying links',continue_=True) as step: 3256 log.info('Verify link status')3257 for i in range(0,5):3258 3259 sleep(5)3260 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3261 logger.info(data)3262 if data["is_alive"] == True: 3263 logger.info('Link is Up') 3264 break3265 elif i == 4:3266 if data["is_alive"] == True:3267 logger.info('Link is Up')3268 else:3269 assert False3270 3271 #Configure IP on client PC3272 with steps.start('Configure IP in client',continue_=True) as step: 3273 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])3274 log.info('Successful in configuring IP in Client')3275 with steps.start('Configure IP in client2',continue_=True) as step: 3276 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])3277 log.info('Successful in configuring IP in Client')3278 3279 3280 @ aetest.test3281 def verify_traffic(self,steps,ctrl,server,client,client2,etype,**param):3282 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:3283 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)3284 log.info('Successful in configuring vlan in Server')3285 sleep(20) 3286 with steps.start('client1 traffic',continue_=True) as step:3287 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])3288 assert ((up != 0) and (down != 0))3289 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 3290 '''with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:3291 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')3292 log.info('Removing vlan in Server')'''3293 '''with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:3294 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)3295 log.info('Successful in configuring vlan in Server')'''3296 3297 sleep(20)3298 with steps.start('client2 traffic',continue_=True) as step:3299 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])3300 assert ((up != 0) and (down != 0))3301 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))3302 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:3303 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')3304 log.info('Removing vlan in Server')3305 3306 @aetest.cleanup3307 def Removing_Ips(self,steps,ctrl,server,client,client2,etype,**param):3308 3309 with steps.start('Removing QinQ VLAN in dn port2',continue_=True) as step:3310 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='disable') 3311 log.info('sucessful in Removing Double VLAN on dn')3312 with steps.start('Removing QinQ VLAN in dn port2',continue_=True) as step:3313 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='disable') 3314 log.info('sucessful in Removing Double VLAN on dn')3315 sleep(60)3316 with steps.start('Verifying links',continue_=True) as step: 3317 log.info('Verify link status')3318 for i in range(0,5):3319 3320 sleep(5)3321 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3322 logger.info(data)3323 if data["is_alive"] == True: 3324 logger.info('Link is Up') 3325 break3326 elif i == 4:3327 if data["is_alive"] == True:3328 logger.info('Link is Up')3329 else:3330 assert False3331 3332 #Configure IP on client PC3333 with steps.start('Removing IP in client',continue_=True) as step: 3334 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')3335 log.info('Successful in Removing IP in Client')3336 with steps.start('Removing IP in client2',continue_=True) as step: 3337 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')3338 log.info('Successful in Removing IP in Client2')3339 client2.disconnect()3340@aetest.loop(etype = ['0x8100', '0x88A8'])3341class Two_Interface_Different_QinQ(aetest.Testcase):3342 @aetest.setup3343 def Configure_Transparent(self, steps,ctrl,server,client,client2,etype,**param):3344 3345 with steps.start('Verifying links',continue_=True) as step: 3346 log.info('Verify link status')3347 for i in range(0,5):3348 3349 sleep(5)3350 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3351 logger.info(data)3352 if data["is_alive"] == True: 3353 logger.info('Link is Up') 3354 break3355 elif i == 4:3356 if data["is_alive"] == True:3357 logger.info('Link is Up')3358 else:3359 assert False3360 client2.connect()3361 with steps.start('Configure QinQ VLAN in dn port1',continue_=True) as step:3362 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 3363 log.info('sucessful in Enabling Double VLAN on dn')3364 with steps.start('Configure QinQ VLAN in dn port2',continue_=True) as step:3365 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=str(int(param['dn1_cvlan'])+1),svlan=str(int(param['dn1_svlan'])+1),ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 3366 log.info('sucessful in Enabling Double VLAN on dn')3367 sleep(60)3368 with steps.start('Verifying links',continue_=True) as step: 3369 log.info('Verify link status')3370 for i in range(0,5):3371 3372 sleep(5)3373 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3374 logger.info(data)3375 if data["is_alive"] == True: 3376 logger.info('Link is Up') 3377 break3378 elif i == 4:3379 if data["is_alive"] == True:3380 logger.info('Link is Up')3381 else:3382 assert False3383 3384 #Configure IP on client PC3385 with steps.start('Configure IP in client',continue_=True) as step: 3386 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])3387 log.info('Successful in configuring IP in Client')3388 with steps.start('Configure IP in client2',continue_=True) as step: 3389 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'])3390 log.info('Successful in configuring IP in Client')3391 3392 3393 @ aetest.test3394 def verify_traffic(self,steps,ctrl,server,client,client2,etype,**param):3395 3396 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:3397 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)3398 log.info('Successful in configuring vlan in Server')3399 sleep(20) 3400 with steps.start('client1 traffic',continue_=True) as step:3401 up,down=misc.config_iperf_client(client,param['server_data_ipv4'])3402 assert ((up != 0) and (down != 0))3403 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down)) 3404 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:3405 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')3406 log.info('Removing vlan in Server')3407 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:3408 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])+1),str(int(param['dn1_svlan'])+1),param['server_data_ipv4'],ethertype=etype)3409 log.info('Successful in configuring vlan in Server')3410 3411 sleep(20)3412 with steps.start('client2 traffic',continue_=True) as step:3413 up,down=misc.config_iperf_client(client2,param['server_data_ipv4'])3414 assert ((up != 0) and (down != 0))3415 log.info('Successful in Running Bidirectional traffic up {}, down {}'.format(up,down))3416 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:3417 assert misc.config_QinQ(server,param['server_inf'],str(int(param['dn1_cvlan'])+1),str(int(param['dn1_svlan'])+1),param['server_data_ipv4'],ethertype=etype,status='disable')3418 log.info('Removing vlan in Server')3419 3420 @aetest.cleanup3421 def Removing_Ips(self,steps,ctrl,server,client,client2,etype,**param):3422 3423 3424 with steps.start('Removing QinQ VLAN in dn port2',continue_=True) as step:3425 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='disable') 3426 log.info('sucessful in Removing Double VLAN on dn')3427 with steps.start('Removing QinQ VLAN in dn port2',continue_=True) as step:3428 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf1'],cvlan=str(int(param['dn1_cvlan'])+1),svlan=str(int(param['dn1_svlan'])+1),ethertype=etype,svlan_prio='5',cvlan_prio='3',status='disable') 3429 log.info('sucessful in Removing Double VLAN on dn')3430 sleep(60)3431 with steps.start('Verifying links',continue_=True) as step: 3432 log.info('Verify link status')3433 for i in range(0,5):3434 3435 sleep(5)3436 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3437 logger.info(data)3438 if data["is_alive"] == True: 3439 logger.info('Link is Up') 3440 break3441 elif i == 4:3442 if data["is_alive"] == True:3443 logger.info('Link is Up')3444 else:3445 assert False3446 3447 #Configure IP on client PC3448 with steps.start('Removing IP in client',continue_=True) as step: 3449 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')3450 log.info('Successful in Removing IP in Client')3451 with steps.start('Removing IP in client2',continue_=True) as step: 3452 assert misc.config_ip(client2,param['client2_inf'],param['client2_data_ipv4'],status='disable')3453 log.info('Successful in Removing IP in Client2')3454 client2.disconnect()3455class Same_Mvlan(aetest.Testcase):3456 @aetest.setup3457 def setup_management_vlan(self,steps,ctrl,server,**param):3458 with steps.start('Verifying links',continue_=True) as step: 3459 log.info('Verify link status')3460 for i in range(0,5):3461 3462 sleep(5)3463 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3464 logger.info(data)3465 if data["is_alive"] == True: 3466 logger.info('Link is Up') 3467 break3468 elif i == 4:3469 if data["is_alive"] == True:3470 logger.info('Link is Up')3471 else:3472 assert False3473 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:3474 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])3475 log.info('Successful in configuring mvlan in DN')3476 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'])3477 log.info('Successful in configuring mvlan in POP')3478 3479 3480 with steps.start('Configuring MVLAN on Server',continue_=True) as step:3481 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])3482 log.info('Successful in configuring vlan in Server')3483 sleep(60)3484 with steps.start('Verifying links',continue_=True) as step: 3485 log.info('Verify link status')3486 for i in range(0,5):3487 3488 sleep(5)3489 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3490 logger.info(data)3491 if data["is_alive"] == True: 3492 logger.info('Link is Up') 3493 break3494 elif i == 4:3495 if data["is_alive"] == True:3496 logger.info('Link is Up')3497 else:3498 assert False3499 @ aetest.test3500 def verify_gui_page(self,steps,ctrl,server,**param):3501 sleep(10)3502 with steps.start('Verifying GUI page of POP',continue_=True) as step:3503 assert misc.verify_web_page(server,param['pop_management_ip'])3504 log.info('Successful in verifying POP GUI with MVLAN')3505 with steps.start('Verifying GUI page of DN',continue_=True) as step:3506 assert misc.verify_web_page(server,param['dn1_management_ip'])3507 log.info('Successful in verifying DN1 GUI with MVLAN')3508 @aetest.cleanup3509 def removing_vlan_config(self,steps,ctrl,server,**param):3510 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3511 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')3512 log.info('Successful in Removing vlan in Server')3513 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:3514 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')3515 log.info('Successful in Removing mvlan in DN')3516 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],status='disable')3517 log.info('Successful in Removing mvlan in POP')3518 sleep(60)3519 with steps.start('Verifying links',continue_=True) as step: 3520 log.info('Verify link status')3521 for i in range(0,5):3522 3523 sleep(5)3524 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3525 logger.info(data)3526 if data["is_alive"] == True: 3527 logger.info('Link is Up') 3528 break3529 elif i == 4:3530 if data["is_alive"] == True:3531 logger.info('Link is Up')3532 else:3533 assert False3534class Different_Mvlan(aetest.Testcase):3535 @aetest.setup3536 def setup_management_vlan(self,steps,ctrl,server,**param):3537 with steps.start('Verifying links',continue_=True) as step: 3538 log.info('Verify link status')3539 for i in range(0,5):3540 3541 sleep(5)3542 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3543 logger.info(data)3544 if data["is_alive"] == True: 3545 logger.info('Link is Up') 3546 break3547 elif i == 4:3548 if data["is_alive"] == True:3549 logger.info('Link is Up')3550 else:3551 assert False3552 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:3553 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])3554 log.info('Successful in configuring mvlan in DN')3555 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'])3556 log.info('Successful in configuring mvlan in POP')3557 3558 sleep(60)3559 with steps.start('Verifying links',continue_=True) as step: 3560 log.info('Verify link status')3561 for i in range(0,5):3562 3563 sleep(5)3564 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3565 logger.info(data)3566 if data["is_alive"] == True: 3567 logger.info('Link is Up') 3568 break3569 elif i == 4:3570 if data["is_alive"] == True:3571 logger.info('Link is Up')3572 else:3573 assert False3574 3575 @ aetest.test3576 def verify_gui_page(self,steps,ctrl,server,**param):3577 with steps.start('Configuring MVLAN on Server',continue_=True) as step:3578 assert misc.config_Q(server,param['server_inf'],param['pop_mcvlan'],param['server_mgmt_ipv4'])3579 log.info('Successful in configuring vlan in Server')3580 sleep(10)3581 with steps.start('Verifying GUI page of POP',continue_=True) as step:3582 assert misc.verify_web_page(server,param['pop_management_ip'])3583 log.info('Successful in verifying POP GUI with MVLAN')3584 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3585 assert misc.config_Q(server,param['server_inf'],param['pop_mcvlan'],param['server_mgmt_ipv4'],status='disable')3586 log.info('Successful in Removing vlan in Server')3587 with steps.start('Configuring MVLAN on Server',continue_=True) as step:3588 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])3589 log.info('Successful in configuring vlan in Server')3590 sleep(10)3591 with steps.start('Verifying GUI page of DN',continue_=True) as step:3592 assert misc.verify_web_page(server,param['dn1_management_ip'])3593 log.info('Successful in verifying DN1 GUI with MVLAN')3594 3595 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3596 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')3597 log.info('Successful in Removing vlan in Server')3598 @aetest.cleanup3599 def removing_vlan_config(self,steps,ctrl,server,**param):3600 3601 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:3602 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')3603 log.info('Successful in Removing mvlan in DN')3604 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'],status='disable')3605 log.info('Successful in Removing mvlan in POP') 3606 sleep(60)3607 with steps.start('Verifying links',continue_=True) as step: 3608 log.info('Verify link status')3609 for i in range(0,5):3610 3611 sleep(5)3612 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3613 logger.info(data)3614 if data["is_alive"] == True: 3615 logger.info('Link is Up') 3616 break3617 elif i == 4:3618 if data["is_alive"] == True:3619 logger.info('Link is Up')3620 else:3621 assert False3622@aetest.loop(etype = ['0x8100', '0x88A8'])3623class Same_Mqinq_Vlan(aetest.Testcase):3624 @aetest.setup3625 def config_qinq_vlan(self,steps,ctrl,server,etype,**param):3626 with steps.start('Verifying links',continue_=True) as step: 3627 log.info('Verify link status')3628 for i in range(0,5):3629 3630 sleep(5)3631 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3632 logger.info(data)3633 if data["is_alive"] == True: 3634 logger.info('Link is Up') 3635 break3636 elif i == 4:3637 if data["is_alive"] == True:3638 logger.info('Link is Up')3639 else:3640 assert False3641 with steps.start('Configuring QinQ Management VLAN on POP and DN',continue_=True) as step:3642 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')3643 log.info('Successful in configuring QinQ mvlan on DN1')3644 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')3645 log.info('Successful in configuring QinQ mvlan on POP')3646 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:3647 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')3648 sleep(60)3649 with steps.start('Verifying links',continue_=True) as step: 3650 log.info('Verify link status')3651 for i in range(0,5):3652 3653 sleep(5)3654 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3655 logger.info(data)3656 if data["is_alive"] == True: 3657 logger.info('Link is Up') 3658 break3659 elif i == 4:3660 if data["is_alive"] == True:3661 logger.info('Link is Up')3662 else:3663 assert False3664 @ aetest.test3665 def test_QinQ_management_vlan(self,steps,ctrl,server,etype,**param):3666 sleep(10)3667 with steps.start('Verifying POP GUI access',continue_=True) as step:3668 assert misc.verify_web_page(server,param['pop_management_ip'])3669 log.info('Successful in verifying POP GUI with MVLAN')3670 with steps.start('Verifying GUI page of DN',continue_=True) as step:3671 assert misc.verify_web_page(server,param['dn1_management_ip'])3672 log.info('Successful in verifying DN1 GUI with MVLAN')3673 @aetest.cleanup3674 def removing_vlan_configs(self,steps,ctrl,server,etype,**param):3675 with steps.start('Removing QinQ Management VLAN on POP and DN',continue_=True) as step:3676 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')3677 log.info('Successful in configuring QinQ mvlan on DN1')3678 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')3679 log.info('Successful in configuring QinQ mvlan on POP')3680 with steps.start('Removing QinQ Vlan in Server',continue_=True) as step:3681 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable')3682 sleep(60)3683 with steps.start('Verifying links',continue_=True) as step: 3684 log.info('Verify link status')3685 for i in range(0,5):3686 3687 sleep(5)3688 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3689 logger.info(data)3690 if data["is_alive"] == True: 3691 logger.info('Link is Up') 3692 break3693 elif i == 4:3694 if data["is_alive"] == True:3695 logger.info('Link is Up')3696 else:3697 assert False3698@aetest.loop(etype = ['0x8100', '0x88A8'])3699class Different_Mqinq_Vlan(aetest.Testcase):3700 @aetest.setup3701 def config_qinq_vlan(self,steps,ctrl,server,etype,**param):3702 with steps.start('Verifying links',continue_=True) as step: 3703 log.info('Verify link status')3704 for i in range(0,5):3705 3706 sleep(5)3707 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3708 logger.info(data)3709 if data["is_alive"] == True: 3710 logger.info('Link is Up') 3711 break3712 elif i == 4:3713 if data["is_alive"] == True:3714 logger.info('Link is Up')3715 else:3716 assert False3717 with steps.start('Configuring QinQ Management VLAN on POP and DN',continue_=True) as step:3718 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')3719 log.info('Successful in configuring QinQ mvlan on DN1')3720 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'],param['pop_msvlan'],ethertype=etype,status='enable')3721 log.info('Successful in configuring QinQ mvlan on POP')3722 sleep(60)3723 with steps.start('Verifying links',continue_=True) as step: 3724 log.info('Verify link status')3725 for i in range(0,5):3726 3727 sleep(5)3728 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3729 logger.info(data)3730 if data["is_alive"] == True: 3731 logger.info('Link is Up') 3732 break3733 elif i == 4:3734 if data["is_alive"] == True:3735 logger.info('Link is Up')3736 else:3737 assert False3738 3739 @ aetest.test3740 def test_QinQ_management_vlan(self,steps,ctrl,server,etype,**param):3741 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:3742 assert misc.config_QinQ(server,param['server_inf'],param['pop_mcvlan'],param['pop_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')3743 sleep(10)3744 with steps.start('Verifying POP GUI access',continue_=True) as step:3745 assert misc.verify_web_page(server,param['pop_management_ip'])3746 log.info('Successful in verifying POP GUI with MVLAN')3747 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:3748 assert misc.config_QinQ(server,param['server_inf'],param['pop_mcvlan'],param['pop_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable')3749 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:3750 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')3751 sleep(10)3752 with steps.start('Verifying GUI page of DN',continue_=True) as step:3753 assert misc.verify_web_page(server,param['dn1_management_ip'])3754 log.info('Successful in verifying DN1 GUI with MVLAN')3755 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:3756 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable')3757 @aetest.cleanup3758 def removing_vlan_configs(self,steps,ctrl,server,etype,**param):3759 with steps.start('Removing QinQ Management VLAN on POP and DN',continue_=True) as step:3760 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')3761 log.info('Successful in configuring QinQ mvlan on DN1')3762 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'],param['pop_msvlan'],ethertype=etype,status='disable')3763 log.info('Successful in configuring QinQ mvlan on POP')3764 sleep(60)3765 with steps.start('Verifying links',continue_=True) as step: 3766 log.info('Verify link status')3767 for i in range(0,5):3768 3769 sleep(5)3770 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3771 logger.info(data)3772 if data["is_alive"] == True: 3773 logger.info('Link is Up') 3774 break3775 elif i == 4:3776 if data["is_alive"] == True:3777 logger.info('Link is Up')3778 else:3779 assert False3780class Single_Data_Vlan_Single_Same_Management_Vlan(aetest.Testcase):3781 def Capturing_Server_interface(self,server,server_inf,server_file):3782 assert misc.capture_interface(server,server_inf,server_file)3783 3784 def Verify_traffic(self,client,server_data_ipv4):3785 log.info('Starting iperf client')3786 up,down=misc.config_iperf_client(client,server_data_ipv4)3787 assert ((up != 0.0) and (down != 0.0))3788 @aetest.setup3789 def setup_vlan(self,steps,ctrl,server,client,**param):3790 with steps.start('Verifying links',continue_=True) as step: 3791 log.info('Verify link status')3792 for i in range(0,5):3793 3794 sleep(5)3795 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3796 logger.info(data)3797 if data["is_alive"] == True: 3798 logger.info('Link is Up') 3799 break3800 elif i == 4:3801 if data["is_alive"] == True:3802 logger.info('Link is Up')3803 else:3804 assert False3805 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:3806 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])3807 log.info('Successful in configuring mvlan in DN')3808 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'])3809 log.info('Successful in configuring mvlan in POP')3810 with steps.start('Configure Q VLAN in dn',continue_=True) as step:3811 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 3812 log.info('sucessful in Enabling Single VLAN on dn')3813 sleep(60)3814 with steps.start('Verifying links',continue_=True) as step: 3815 log.info('Verify link status')3816 for i in range(0,5):3817 3818 sleep(5)3819 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3820 logger.info(data)3821 if data["is_alive"] == True: 3822 logger.info('Link is Up') 3823 break3824 elif i == 4:3825 if data["is_alive"] == True:3826 logger.info('Link is Up')3827 else:3828 assert False3829 3830 with steps.start('Configuring MVLAN on Server',continue_=True) as step:3831 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])3832 log.info('Successful in configuring vlan in Server')3833 3834 3835 3836 with steps.start('Configure Q VLAN in Server',continue_=True) as step:3837 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])3838 log.info('Successful in configuring vlan in Server')3839 3840 #Configure IP on client PC3841 with steps.start('Configure IP in client',continue_=True) as step: 3842 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])3843 log.info('Successful in configuring IP in Client')3844 3845 3846 @ aetest.test3847 def verify_gui_page(self,steps,ctrl,server,client,**param):3848 with steps.start('Verifying GUI page of POP',continue_=True) as step:3849 assert misc.verify_web_page(server,param['pop_management_ip'])3850 log.info('Successful in verifying POP GUI with MVLAN')3851 sleep(10)3852 with steps.start('Verifying GUI page of DN',continue_=True) as step:3853 assert misc.verify_web_page(server,param['dn1_management_ip'])3854 log.info('Successful in verifying DN1 GUI with MVLAN')3855 with steps.start('Capturing and verifying traffic',continue_=True) as step:3856 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))3857 p1.start()3858 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))3859 p2.start()3860 p1.join()3861 p2.join()3862 with steps.start('Analyse Capture',continue_=True) as step:3863 ip = param['client_data_ipv4'].rsplit('/', 1)[0]3864 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])3865 res=misc.analyse_capture(server,filter,param['server_file'])3866 if res > 0:3867 log.info('Successful in VLAN tagging')3868 else:3869 assert False3870 @aetest.cleanup3871 def removing_vlan_config(self,steps,ctrl,server,client,**param):3872 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3873 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')3874 log.info('Successful in Removing vlan in Server')3875 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:3876 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')3877 log.info('Successful in Removing mvlan in DN')3878 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],status='disable')3879 log.info('Successful in Removing mvlan in POP') 3880 with steps.start('Removing vlan configs from ctrl',continue_=True) as step:3881 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],status='disable') 3882 log.info('sucessful in removing Single VLAN on dn')3883 sleep(60)3884 with steps.start('Verifying links',continue_=True) as step: 3885 log.info('Verify link status')3886 for i in range(0,5):3887 3888 sleep(5)3889 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3890 logger.info(data)3891 if data["is_alive"] == True: 3892 logger.info('Link is Up') 3893 break3894 elif i == 4:3895 if data["is_alive"] == True:3896 logger.info('Link is Up')3897 else:3898 assert False3899 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3900 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')3901 log.info('Successful in configuring vlan in Server')3902 3903 with steps.start('Removing IP in client',continue_=True) as step:3904 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')3905 log.info('Successful in Removing IP in Client')3906class Single_Data_Vlan_Single_Different_Management_Vlan(aetest.Testcase):3907 def Capturing_Server_interface(self,server,server_inf,server_file):3908 assert misc.capture_interface(server,server_inf,server_file)3909 3910 def Verify_traffic(self,client,server_data_ipv4):3911 log.info('Starting iperf client')3912 up,down=misc.config_iperf_client(client,server_data_ipv4)3913 assert ((up != 0.0) and (down != 0.0))3914 @aetest.setup3915 def setup_vlan(self,steps,ctrl,server,client,**param):3916 with steps.start('Verifying links',continue_=True) as step: 3917 log.info('Verify link status')3918 for i in range(0,5):3919 3920 sleep(5)3921 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3922 logger.info(data)3923 if data["is_alive"] == True: 3924 logger.info('Link is Up') 3925 break3926 elif i == 4:3927 if data["is_alive"] == True:3928 logger.info('Link is Up')3929 else:3930 assert False3931 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:3932 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])3933 log.info('Successful in configuring mvlan in DN')3934 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'])3935 log.info('Successful in configuring mvlan in POP')3936 with steps.start('Configure Q VLAN in dn',continue_=True) as step:3937 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 3938 log.info('sucessful in Enabling Single VLAN on dn')3939 sleep(60)3940 with steps.start('Verifying links',continue_=True) as step: 3941 log.info('Verify link status')3942 for i in range(0,5):3943 3944 sleep(5)3945 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])3946 logger.info(data)3947 if data["is_alive"] == True: 3948 logger.info('Link is Up') 3949 break3950 elif i == 4:3951 if data["is_alive"] == True:3952 logger.info('Link is Up')3953 else:3954 assert False3955 3956 with steps.start('Configuring MVLAN on Server',continue_=True) as step:3957 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])3958 log.info('Successful in configuring vlan in Server')3959 3960 3961 3962 with steps.start('Configure Q VLAN in Server',continue_=True) as step:3963 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])3964 log.info('Successful in configuring vlan in Server')3965 3966 #Configure IP on client PC3967 with steps.start('Configure IP in client',continue_=True) as step: 3968 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])3969 log.info('Successful in configuring IP in Client')3970 3971 3972 @ aetest.test3973 def verification(self,steps,ctrl,server,client,**param):3974 3975 sleep(10)3976 with steps.start('Verifying GUI page of DN',continue_=True) as step:3977 assert misc.verify_web_page(server,param['dn1_management_ip'])3978 log.info('Successful in verifying DN1 GUI with MVLAN')3979 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3980 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')3981 log.info('Successful in Removing vlan in Server')3982 3983 with steps.start('Configuring MVLAN on Server',continue_=True) as step:3984 assert misc.config_Q(server,param['server_inf'],param['pop_mcvlan'],param['server_mgmt_ipv4'])3985 log.info('Successful in configuring vlan in Server')3986 sleep(10)3987 with steps.start('Verifying GUI page of POP',continue_=True) as step:3988 assert misc.verify_web_page(server,param['pop_management_ip'])3989 log.info('Successful in verifying POP GUI with MVLAN')3990 with steps.start('Removing Q VLAN in Server',continue_=True) as step:3991 assert misc.config_Q(server,param['server_inf'],param['pop_mcvlan'],param['server_mgmt_ipv4'],status='disable')3992 log.info('Successful in Removing vlan in Server')3993 with steps.start('Capturing and verifying traffic',continue_=True) as step:3994 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))3995 p1.start()3996 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))3997 p2.start()3998 p1.join()3999 p2.join()4000 with steps.start('Analyse Capture',continue_=True) as step:4001 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4002 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])4003 res=misc.analyse_capture(server,filter,param['server_file'])4004 if res > 0:4005 log.info('Successful in VLAN tagging')4006 else:4007 assert False4008 @aetest.cleanup4009 def removing_vlan_config(self,steps,ctrl,server,client,**param):4010 4011 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:4012 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')4013 log.info('Successful in Removing mvlan in DN')4014 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'],status='disable')4015 log.info('Successful in Removing mvlan in POP') 4016 with steps.start('Removing vlan configs from ctrl',continue_=True) as step:4017 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],status='disable') 4018 log.info('sucessful in removing Single VLAN on dn')4019 sleep(60)4020 with steps.start('Verifying links',continue_=True) as step: 4021 log.info('Verify link status')4022 for i in range(0,5):4023 4024 sleep(5)4025 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4026 logger.info(data)4027 if data["is_alive"] == True: 4028 logger.info('Link is Up') 4029 break4030 elif i == 4:4031 if data["is_alive"] == True:4032 logger.info('Link is Up')4033 else:4034 assert False4035 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4036 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')4037 log.info('Successful in configuring vlan in Server')4038 4039 with steps.start('Removing IP in client',continue_=True) as step:4040 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4041 log.info('Successful in Removing IP in Client')4042@aetest.loop(etype = ['0x8100', '0x88A8'])4043class Single_Data_Vlan_Double_Same_Management_Vlan(aetest.Testcase):4044 def Capturing_Server_interface(self,server,server_inf,server_file):4045 assert misc.capture_interface(server,server_inf,server_file)4046 4047 def Verify_traffic(self,client,server_data_ipv4):4048 log.info('Starting iperf client')4049 up,down=misc.config_iperf_client(client,server_data_ipv4)4050 assert ((up != 0.0) and (down != 0.0))4051 @aetest.setup4052 def setup_vlan(self,steps,ctrl,server,client,etype,**param):4053 with steps.start('Verifying links',continue_=True) as step: 4054 log.info('Verify link status')4055 for i in range(0,5):4056 4057 sleep(5)4058 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4059 logger.info(data)4060 if data["is_alive"] == True: 4061 logger.info('Link is Up') 4062 break4063 elif i == 4:4064 if data["is_alive"] == True:4065 logger.info('Link is Up')4066 else:4067 assert False4068 with steps.start('Configuring QinQ Management VLAN on POP and DN',continue_=True) as step:4069 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')4070 log.info('Successful in configuring QinQ mvlan on DN1')4071 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')4072 log.info('Successful in configuring QinQ mvlan on POP')4073 with steps.start('Configure Q VLAN in dn',continue_=True) as step:4074 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 4075 log.info('sucessful in Enabling Single VLAN on dn')4076 sleep(60)4077 with steps.start('Verifying links',continue_=True) as step: 4078 log.info('Verify link status')4079 for i in range(0,5):4080 4081 sleep(5)4082 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4083 logger.info(data)4084 if data["is_alive"] == True: 4085 logger.info('Link is Up') 4086 break4087 elif i == 4:4088 if data["is_alive"] == True:4089 logger.info('Link is Up')4090 else:4091 assert False4092 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:4093 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')4094 4095 4096 4097 with steps.start('Configure Q VLAN in Server',continue_=True) as step:4098 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])4099 log.info('Successful in configuring vlan in Server')4100 4101 #Configure IP on client PC4102 with steps.start('Configure IP in client',continue_=True) as step: 4103 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])4104 log.info('Successful in configuring IP in Client')4105 4106 4107 @ aetest.test4108 def verify_gui_page(self,steps,ctrl,server,client,etype,**param):4109 sleep(10)4110 with steps.start('Verifying GUI page of POP',continue_=True) as step:4111 assert misc.verify_web_page(server,param['pop_management_ip'])4112 log.info('Successful in verifying POP GUI with MVLAN')4113 with steps.start('Verifying GUI page of DN',continue_=True) as step:4114 assert misc.verify_web_page(server,param['dn1_management_ip'])4115 log.info('Successful in verifying DN1 GUI with MVLAN')4116 with steps.start('Capturing and verifying traffic',continue_=True) as step:4117 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))4118 p1.start()4119 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))4120 p2.start()4121 p1.join()4122 p2.join()4123 with steps.start('Analyse Capture',continue_=True) as step:4124 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4125 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])4126 res=misc.analyse_capture(server,filter,param['server_file'])4127 if res > 0:4128 log.info('Successful in VLAN tagging')4129 else:4130 assert False4131 @aetest.cleanup4132 def removing_vlan_config(self,steps,ctrl,server,client,etype,**param):4133 with steps.start('Removing QinQ Management VLAN on POP and DN',continue_=True) as step:4134 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')4135 log.info('Successful in configuring QinQ mvlan on DN1')4136 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')4137 log.info('Successful in configuring QinQ mvlan on POP')4138 with steps.start('Removing vlan configs from ctrl',continue_=True) as step:4139 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],status='disable') 4140 log.info('sucessful in removing Single VLAN on dn')4141 4142 sleep(60)4143 with steps.start('Verifying links',continue_=True) as step: 4144 log.info('Verify link status')4145 for i in range(0,5):4146 4147 sleep(5)4148 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4149 logger.info(data)4150 if data["is_alive"] == True: 4151 logger.info('Link is Up') 4152 break4153 elif i == 4:4154 if data["is_alive"] == True:4155 logger.info('Link is Up')4156 else:4157 assert False4158 with steps.start('Removing QinQ Vlan in Server',continue_=True) as step:4159 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable') 4160 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4161 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')4162 log.info('Successful in configuring vlan in Server')4163 4164 with steps.start('Removing IP in client',continue_=True) as step:4165 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4166 log.info('Successful in Removing IP in Client')4167@aetest.loop(etype = ['0x8100', '0x88A8'])4168class Single_Data_Vlan_Double_Different_Management_Vlan(aetest.Testcase):4169 def Capturing_Server_interface(self,server,server_inf,server_file):4170 assert misc.capture_interface(server,server_inf,server_file)4171 4172 def Verify_traffic(self,client,server_data_ipv4):4173 log.info('Starting iperf client')4174 up,down=misc.config_iperf_client(client,server_data_ipv4)4175 assert ((up != 0.0) and (down != 0.0))4176 @aetest.setup4177 def setup_vlan(self,steps,ctrl,server,client,etype,**param):4178 with steps.start('Verifying links',continue_=True) as step: 4179 log.info('Verify link status')4180 for i in range(0,5):4181 4182 sleep(5)4183 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4184 logger.info(data)4185 if data["is_alive"] == True: 4186 logger.info('Link is Up') 4187 break4188 elif i == 4:4189 if data["is_alive"] == True:4190 logger.info('Link is Up')4191 else:4192 assert False4193 with steps.start('Configuring QinQ Management VLAN on POP and DN',continue_=True) as step:4194 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')4195 log.info('Successful in configuring QinQ mvlan on DN1')4196 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'],param['pop_msvlan'],ethertype=etype,status='enable')4197 log.info('Successful in configuring QinQ mvlan on POP')4198 with steps.start('Configure Q VLAN in dn',continue_=True) as step:4199 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],vlan_prio='7',status='enable') 4200 log.info('sucessful in Enabling Single VLAN on dn')4201 sleep(60)4202 with steps.start('Verifying links',continue_=True) as step: 4203 log.info('Verify link status')4204 for i in range(0,5):4205 4206 sleep(5)4207 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4208 logger.info(data)4209 if data["is_alive"] == True: 4210 logger.info('Link is Up') 4211 break4212 elif i == 4:4213 if data["is_alive"] == True:4214 logger.info('Link is Up')4215 else:4216 assert False4217 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:4218 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')4219 4220 4221 4222 with steps.start('Configure Q VLAN in Server',continue_=True) as step:4223 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'])4224 log.info('Successful in configuring vlan in Server')4225 4226 #Configure IP on client PC4227 with steps.start('Configure IP in client',continue_=True) as step: 4228 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])4229 log.info('Successful in configuring IP in Client')4230 4231 4232 @ aetest.test4233 def verify_gui_page(self,steps,ctrl,server,client,etype,**param):4234 sleep(10)4235 with steps.start('Verifying GUI page of DN',continue_=True) as step:4236 assert misc.verify_web_page(server,param['dn1_management_ip'])4237 log.info('Successful in verifying DN1 GUI with MVLAN')4238 with steps.start('Removing QinQ Vlan in Server',continue_=True) as step:4239 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable') 4240 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:4241 assert misc.config_QinQ(server,param['server_inf'],param['pop_mcvlan'],param['pop_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')4242 sleep(10)4243 with steps.start('Verifying GUI page of POP',continue_=True) as step:4244 assert misc.verify_web_page(server,param['pop_management_ip'])4245 log.info('Successful in verifying POP GUI with MVLAN')4246 with steps.start('Removing QinQ Vlan in Server',continue_=True) as step:4247 assert misc.config_QinQ(server,param['server_inf'],param['pop_mcvlan'],param['pop_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable') 4248 with steps.start('Capturing and verifying traffic',continue_=True) as step:4249 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))4250 p1.start()4251 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))4252 p2.start()4253 p1.join()4254 p2.join()4255 with steps.start('Analyse Capture',continue_=True) as step:4256 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4257 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_cvlan'])4258 res=misc.analyse_capture(server,filter,param['server_file'])4259 if res > 0:4260 log.info('Successful in VLAN tagging')4261 else:4262 assert False4263 @aetest.cleanup4264 def removing_vlan_config(self,steps,ctrl,server,client,etype,**param):4265 with steps.start('Removing QinQ Management VLAN on POP and DN',continue_=True) as step:4266 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')4267 log.info('Successful in configuring QinQ mvlan on DN1')4268 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')4269 log.info('Successful in configuring QinQ mvlan on POP')4270 with steps.start('Removing vlan configs from ctrl',continue_=True) as step:4271 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_cvlan'],status='disable') 4272 log.info('sucessful in removing Single VLAN on dn')4273 4274 sleep(60)4275 with steps.start('Verifying links',continue_=True) as step: 4276 log.info('Verify link status')4277 for i in range(0,5):4278 4279 sleep(5)4280 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4281 logger.info(data)4282 if data["is_alive"] == True: 4283 logger.info('Link is Up') 4284 break4285 elif i == 4:4286 if data["is_alive"] == True:4287 logger.info('Link is Up')4288 else:4289 assert False4290 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4291 assert misc.config_Q(server,param['server_inf'],param['dn1_cvlan'],param['server_data_ipv4'],status='disable')4292 log.info('Successful in configuring vlan in Server')4293 4294 with steps.start('Removing IP in client',continue_=True) as step:4295 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4296 log.info('Successful in Removing IP in Client')4297class Same_Single_Vlan_On_Data_Management(aetest.Testcase):4298 def Capturing_Server_interface(self,server,server_inf,server_file):4299 assert misc.capture_interface(server,server_inf,server_file)4300 4301 def Verify_traffic(self,client,server_data_ipv4):4302 log.info('Starting iperf client')4303 up,down=misc.config_iperf_client(client,server_data_ipv4)4304 assert ((up != 0.0) and (down != 0.0))4305 @aetest.setup4306 def setup_vlan(self,steps,ctrl,server,**param):4307 with steps.start('Verifying links',continue_=True) as step: 4308 log.info('Verify link status')4309 for i in range(0,5):4310 4311 sleep(5)4312 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4313 logger.info(data)4314 if data["is_alive"] == True: 4315 logger.info('Link is Up') 4316 break4317 elif i == 4:4318 if data["is_alive"] == True:4319 logger.info('Link is Up')4320 else:4321 assert False4322 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:4323 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])4324 log.info('Successful in configuring mvlan in DN')4325 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'])4326 log.info('Successful in configuring mvlan in POP')4327 sleep(60)4328 with steps.start('Verifying links',continue_=True) as step: 4329 log.info('Verify link status')4330 for i in range(0,5):4331 4332 sleep(5)4333 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4334 logger.info(data)4335 if data["is_alive"] == True: 4336 logger.info('Link is Up') 4337 break4338 elif i == 4:4339 if data["is_alive"] == True:4340 logger.info('Link is Up')4341 else:4342 assert False4343 4344 with steps.start('Configuring MVLAN on Server',continue_=True) as step:4345 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])4346 log.info('Successful in configuring vlan in Server')4347 4348 4349 @ aetest.test4350 def verify_gui_page(self,steps,ctrl,server,client,**param):4351 sleep(10)4352 with steps.start('Verifying GUI page of POP',continue_=True) as step:4353 assert misc.verify_web_page(server,param['pop_management_ip'])4354 log.info('Successful in verifying POP GUI with MVLAN')4355 with steps.start('Verifying GUI page of DN',continue_=True) as step:4356 assert misc.verify_web_page(server,param['dn1_management_ip'])4357 log.info('Successful in verifying DN1 GUI with MVLAN')4358 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4359 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')4360 log.info('Successful in Removing vlan in Server')4361 with steps.start('Configure Q VLAN in dn',continue_=True) as step:4362 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_mcvlan'],vlan_prio='7',status='enable') 4363 log.info('sucessful in Enabling Single VLAN on dn')4364 sleep(60)4365 with steps.start('Verifying links',continue_=True) as step: 4366 log.info('Verify link status')4367 for i in range(0,5):4368 4369 sleep(5)4370 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4371 logger.info(data)4372 if data["is_alive"] == True: 4373 logger.info('Link is Up') 4374 break4375 elif i == 4:4376 if data["is_alive"] == True:4377 logger.info('Link is Up')4378 else:4379 assert False4380 4381 4382 with steps.start('Configure Q VLAN in Server',continue_=True) as step:4383 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_data_ipv4'])4384 log.info('Successful in configuring vlan in Server')4385 4386 #Configure IP on client PC4387 with steps.start('Configure IP in client',continue_=True) as step: 4388 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])4389 log.info('Successful in configuring IP in Client')4390 4391 with steps.start('Capturing and verifying traffic',continue_=True) as step:4392 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))4393 p1.start()4394 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))4395 p2.start()4396 p1.join()4397 p2.join()4398 with steps.start('Analyse Capture',continue_=True) as step:4399 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4400 filter = 'ip.src == {}&&vlan.id == {}&&vlan.priority==7'.format(ip,param['dn1_mcvlan'])4401 res=misc.analyse_capture(server,filter,param['server_file'])4402 if res > 0:4403 log.info('Successful in VLAN tagging')4404 else:4405 assert False4406 @aetest.cleanup4407 def removing_vlan_config(self,steps,ctrl,server,client,**param):4408 4409 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:4410 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')4411 log.info('Successful in Removing mvlan in DN')4412 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],status='disable')4413 log.info('Successful in Removing mvlan in POP') 4414 with steps.start('Removing vlan configs from ctrl',continue_=True) as step:4415 assert api.config_single_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],vlan_id=param['dn1_mcvlan'],status='disable') 4416 log.info('sucessful in removing Single VLAN on dn') 4417 sleep(60)4418 with steps.start('Verifying links',continue_=True) as step: 4419 log.info('Verify link status')4420 for i in range(0,5):4421 4422 sleep(5)4423 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4424 logger.info(data)4425 if data["is_alive"] == True: 4426 logger.info('Link is Up') 4427 break4428 elif i == 4:4429 if data["is_alive"] == True:4430 logger.info('Link is Up')4431 else:4432 assert False 4433 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4434 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_data_ipv4'],status='disable')4435 log.info('Successful in configuring vlan in Server')4436 4437 with steps.start('Removing IP in client',continue_=True) as step:4438 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4439 log.info('Successful in Removing IP in Client')4440@aetest.loop(etype = ['0x8100', '0x88A8'])4441class Double_Data_Vlan_Single_Same_Management_Vlan(aetest.Testcase):4442 def Capturing_Server_interface(self,server,server_inf,server_file):4443 assert misc.capture_interface(server,server_inf,server_file)4444 4445 def Verify_traffic(self,client,server_data_ipv4):4446 log.info('Starting iperf client')4447 up,down=misc.config_iperf_client(client,server_data_ipv4)4448 assert ((up != 0.0) and (down != 0.0))4449 4450 @aetest.setup4451 def setup_vlan(self,steps,ctrl,server,client,etype,**param):4452 with steps.start('Verifying links',continue_=True) as step: 4453 log.info('Verify link status')4454 for i in range(0,5):4455 4456 sleep(5)4457 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4458 logger.info(data)4459 if data["is_alive"] == True: 4460 logger.info('Link is Up') 4461 break4462 elif i == 4:4463 if data["is_alive"] == True:4464 logger.info('Link is Up')4465 else:4466 assert False4467 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:4468 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])4469 log.info('Successful in configuring mvlan in DN')4470 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'])4471 log.info('Successful in configuring mvlan in POP')4472 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:4473 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 4474 log.info('sucessful in Enabling Double VLAN on dn')4475 sleep(60)4476 with steps.start('Verifying links',continue_=True) as step: 4477 log.info('Verify link status')4478 for i in range(0,5):4479 4480 sleep(5)4481 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4482 logger.info(data)4483 if data["is_alive"] == True: 4484 logger.info('Link is Up') 4485 break4486 elif i == 4:4487 if data["is_alive"] == True:4488 logger.info('Link is Up')4489 else:4490 assert False 4491 4492 with steps.start('Configuring MVLAN on Server',continue_=True) as step:4493 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])4494 log.info('Successful in configuring vlan in Server')4495 4496 4497 4498 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:4499 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)4500 log.info('Successful in configuring vlan in Server')4501 4502 #Configure IP on client PC4503 with steps.start('Configure IP in client',continue_=True) as step: 4504 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])4505 log.info('Successful in configuring IP in Client')4506 4507 4508 4509 4510 4511 @ aetest.test4512 def verifyication(self,steps,ctrl,server,client,etype,**param):4513 sleep(10)4514 with steps.start('Verifying GUI page of POP',continue_=True) as step:4515 assert misc.verify_web_page(server,param['pop_management_ip'])4516 log.info('Successful in verifying POP GUI with MVLAN')4517 with steps.start('Verifying GUI page of DN',continue_=True) as step:4518 assert misc.verify_web_page(server,param['dn1_management_ip'])4519 log.info('Successful in verifying DN1 GUI with MVLAN')4520 with steps.start('Capturing and verifying traffic',continue_=True) as step:4521 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))4522 p1.start()4523 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))4524 p2.start()4525 p1.join()4526 p2.join()4527 with steps.start('Analyse Capture',continue_=True) as step:4528 if etype =='0x8100':4529 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4530 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id == {}&&vlan.priority==5&&vlan.priority==3'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])4531 else:4532 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4533 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==5&&vlan.priority==3'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])4534 res=misc.analyse_capture(server,filter,param['server_file'])4535 if res > 0:4536 log.info('Successful in QinQ VLAN tagging')4537 else:4538 assert False4539 @aetest.cleanup4540 def removing_vlan_config(self,steps,ctrl,server,client,etype,**param):4541 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4542 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')4543 log.info('Successful in Removing vlan in Server')4544 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:4545 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')4546 log.info('Successful in Removing mvlan in DN')4547 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],status='disable')4548 log.info('Successful in Removing mvlan in POP') 4549 with steps.start('Removing vlan configs from DN',continue_=True) as step:4550 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,status='disable') 4551 log.info('sucessful in Removing QinQ VLAN on dn')4552 sleep(60)4553 with steps.start('Verifying links',continue_=True) as step: 4554 log.info('Verify link status')4555 for i in range(0,5):4556 4557 sleep(5)4558 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4559 logger.info(data)4560 if data["is_alive"] == True: 4561 logger.info('Link is Up') 4562 break4563 elif i == 4:4564 if data["is_alive"] == True:4565 logger.info('Link is Up')4566 else:4567 assert False 4568 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:4569 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')4570 log.info('Successful in Removing vlan in Server')4571 4572 with steps.start('Configure IP in client',continue_=True) as step:4573 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4574 log.info('Successful in configuring IP in Client')4575@aetest.loop(etype = ['0x8100', '0x88A8'])4576class Double_Data_Vlan_Single_Different_Management_Vlan(aetest.Testcase):4577 def Capturing_Server_interface(self,server,server_inf,server_file):4578 assert misc.capture_interface(server,server_inf,server_file)4579 4580 def Verify_traffic(self,client,server_data_ipv4):4581 log.info('Starting iperf client')4582 up,down=misc.config_iperf_client(client,server_data_ipv4)4583 assert ((up != 0.0) and (down != 0.0))4584 4585 @aetest.setup4586 def setup_vlan(self,steps,ctrl,server,client,etype,**param):4587 with steps.start('Verifying links',continue_=True) as step: 4588 log.info('Verify link status')4589 for i in range(0,5):4590 4591 sleep(5)4592 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4593 logger.info(data)4594 if data["is_alive"] == True: 4595 logger.info('Link is Up') 4596 break4597 elif i == 4:4598 if data["is_alive"] == True:4599 logger.info('Link is Up')4600 else:4601 assert False4602 with steps.start('Configuring MVLAN on POP and DN',continue_=True) as step:4603 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'])4604 log.info('Successful in configuring mvlan in DN')4605 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'])4606 log.info('Successful in configuring mvlan in POP')4607 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:4608 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 4609 log.info('sucessful in Enabling Double VLAN on dn')4610 sleep(60)4611 with steps.start('Verifying links',continue_=True) as step: 4612 log.info('Verify link status')4613 for i in range(0,5):4614 4615 sleep(5)4616 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4617 logger.info(data)4618 if data["is_alive"] == True: 4619 logger.info('Link is Up') 4620 break4621 elif i == 4:4622 if data["is_alive"] == True:4623 logger.info('Link is Up')4624 else:4625 assert False4626 4627 with steps.start('Configuring MVLAN on Server',continue_=True) as step:4628 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'])4629 log.info('Successful in configuring vlan in Server')4630 4631 4632 4633 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:4634 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype)4635 log.info('Successful in configuring vlan in Server')4636 4637 #Configure IP on client PC4638 with steps.start('Configure IP in client',continue_=True) as step: 4639 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])4640 log.info('Successful in configuring IP in Client')4641 @ aetest.test4642 def verifyication(self,steps,ctrl,server,client,etype,**param):4643 4644 sleep(10)4645 with steps.start('Verifying GUI page of DN',continue_=True) as step:4646 assert misc.verify_web_page(server,param['dn1_management_ip'])4647 log.info('Successful in verifying DN1 GUI with MVLAN')4648 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4649 assert misc.config_Q(server,param['server_inf'],param['dn1_mcvlan'],param['server_mgmt_ipv4'],status='disable')4650 log.info('Successful in Removing vlan in Server')4651 with steps.start('Configuring MVLAN on Server',continue_=True) as step:4652 assert misc.config_Q(server,param['server_inf'],param['pop_mcvlan'],param['server_mgmt_ipv4'])4653 log.info('Successful in configuring vlan in Server')4654 sleep(10)4655 with steps.start('Verifying GUI page of POP',continue_=True) as step:4656 assert misc.verify_web_page(server,param['pop_management_ip'])4657 log.info('Successful in verifying POP GUI with MVLAN')4658 with steps.start('Removing Q VLAN in Server',continue_=True) as step:4659 assert misc.config_Q(server,param['server_inf'],param['pop_mcvlan'],param['server_mgmt_ipv4'],status='disable')4660 log.info('Successful in Removing vlan in Server')4661 4662 with steps.start('Capturing and verifying traffic',continue_=True) as step:4663 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))4664 p1.start()4665 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))4666 p2.start()4667 p1.join()4668 p2.join()4669 with steps.start('Analyse Capture',continue_=True) as step:4670 if etype =='0x8100':4671 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4672 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id == {}&&vlan.priority==5&&vlan.priority==3'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])4673 else:4674 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4675 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==5&&vlan.priority==3'.format(ip,param['dn1_cvlan'],param['dn1_svlan'])4676 res=misc.analyse_capture(server,filter,param['server_file'])4677 if res > 0:4678 log.info('Successful in QinQ VLAN tagging')4679 else:4680 assert False4681 @aetest.cleanup4682 def removing_vlan_config(self,steps,ctrl,server,client,etype,**param):4683 4684 with steps.start('Removing MVLAN on POP and DN',continue_=True) as step:4685 assert api.config_single_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],status='disable')4686 log.info('Successful in Removing mvlan in DN')4687 assert api.config_single_mvlan(param['ctrl_ip'],param['pop_name'],param['pop_mcvlan'],status='disable')4688 log.info('Successful in Removing mvlan in POP') 4689 with steps.start('Removing vlan configs from server',continue_=True) as step:4690 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_cvlan'],svlan=param['dn1_svlan'],ethertype=etype,status='disable') 4691 log.info('sucessful in Removing QinQ VLAN on dn') 4692 sleep(60)4693 with steps.start('Verifying links',continue_=True) as step: 4694 log.info('Verify link status')4695 for i in range(0,5):4696 4697 sleep(5)4698 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4699 logger.info(data)4700 if data["is_alive"] == True: 4701 logger.info('Link is Up') 4702 break4703 elif i == 4:4704 if data["is_alive"] == True:4705 logger.info('Link is Up')4706 else:4707 assert False4708 4709 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:4710 assert misc.config_QinQ(server,param['server_inf'],param['dn1_cvlan'],param['dn1_svlan'],param['server_data_ipv4'],ethertype=etype,status='disable')4711 log.info('Successful in Removing vlan in Server')4712 4713 with steps.start('Configure IP in client',continue_=True) as step:4714 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4715 log.info('Successful in configuring IP in Client')4716@aetest.loop(etype = ['0x8100', '0x88A8'])4717class Same_Double_Vlan_On_Data_Management(aetest.Testcase):4718 def Capturing_Server_interface(self,server,server_inf,server_file):4719 assert misc.capture_interface(server,server_inf,server_file)4720 4721 def Verify_traffic(self,client,server_data_ipv4):4722 log.info('Starting iperf client')4723 up,down=misc.config_iperf_client(client,server_data_ipv4)4724 assert ((up != 0.0) and (down != 0.0))4725 4726 @aetest.setup4727 def setup_vlan(self,steps,ctrl,server,client,etype,**param):4728 with steps.start('Verifying links',continue_=True) as step: 4729 log.info('Verify link status')4730 for i in range(0,5):4731 4732 sleep(5)4733 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4734 logger.info(data)4735 if data["is_alive"] == True: 4736 logger.info('Link is Up') 4737 break4738 elif i == 4:4739 if data["is_alive"] == True:4740 logger.info('Link is Up')4741 else:4742 assert False4743 with steps.start('Configuring QinQ Management VLAN on POP and DN',continue_=True) as step:4744 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')4745 log.info('Successful in configuring QinQ mvlan on DN1')4746 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='enable')4747 log.info('Successful in configuring QinQ mvlan on POP')4748 sleep(60)4749 with steps.start('Verifying links',continue_=True) as step: 4750 log.info('Verify link status')4751 for i in range(0,5):4752 4753 sleep(5)4754 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4755 logger.info(data)4756 if data["is_alive"] == True: 4757 logger.info('Link is Up') 4758 break4759 elif i == 4:4760 if data["is_alive"] == True:4761 logger.info('Link is Up')4762 else:4763 assert False4764 with steps.start('Configuring QinQ Vlan in Server',continue_=True) as step:4765 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='enable')4766 4767 @ aetest.test4768 def verifyication(self,steps,ctrl,server,client,etype,**param):4769 sleep(10)4770 with steps.start('Verifying POP GUI access',continue_=True) as step:4771 assert misc.verify_web_page(server,param['pop_management_ip'])4772 log.info('Successful in verifying POP GUI with MVLAN')4773 with steps.start('Verifying GUI page of DN',continue_=True) as step:4774 assert misc.verify_web_page(server,param['dn1_management_ip'])4775 log.info('Successful in verifying DN1 GUI with MVLAN')4776 with steps.start('Removing QinQ Vlan in Server',continue_=True) as step:4777 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_mgmt_ipv4'],ethertype=etype,status='disable')4778 with steps.start('Configure QinQ VLAN in dn',continue_=True) as step:4779 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_mcvlan'],svlan=param['dn1_msvlan'],ethertype=etype,svlan_prio='5',cvlan_prio='3',status='enable') 4780 log.info('sucessful in Enabling Double VLAN on dn')4781 sleep(60)4782 with steps.start('Verifying links',continue_=True) as step: 4783 log.info('Verify link status')4784 for i in range(0,5):4785 4786 sleep(5)4787 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4788 logger.info(data)4789 if data["is_alive"] == True: 4790 logger.info('Link is Up') 4791 break4792 elif i == 4:4793 if data["is_alive"] == True:4794 logger.info('Link is Up')4795 else:4796 assert False4797 4798 4799 with steps.start('Configure QinQ VLAN in Server',continue_=True) as step:4800 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_data_ipv4'],ethertype=etype)4801 log.info('Successful in configuring vlan in Server')4802 4803 #Configure IP on client PC4804 with steps.start('Configure IP in client',continue_=True) as step: 4805 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'])4806 log.info('Successful in configuring IP in Client')4807 with steps.start('Capturing and verifying traffic',continue_=True) as step:4808 p1 = Process(target=self.Capturing_Server_interface,args=(server,param['server_inf'],param['server_file']))4809 p1.start()4810 p2 = Process(target=self.Verify_traffic,args=(client,param['server_data_ipv4']))4811 p2.start()4812 p1.join()4813 p2.join()4814 with steps.start('Analyse Capture',continue_=True) as step:4815 if etype =='0x8100':4816 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4817 filter = 'ip.src == {}&&vlan.id == {}&&vlan.id == {}&&vlan.priority==5&&vlan.priority==3'.format(ip,param['dn1_mcvlan'],param['dn1_msvlan'])4818 else:4819 ip = param['client_data_ipv4'].rsplit('/', 1)[0]4820 filter = 'ip.src == {}&&vlan.id == {}&&ieee8021ad.id == {}&&ieee8021ad.priority==5&&vlan.priority==3'.format(ip,param['dn1_mcvlan'],param['dn1_msvlan'])4821 res=misc.analyse_capture(server,filter,param['server_file'])4822 if res > 0:4823 log.info('Successful in QinQ VLAN tagging')4824 else:4825 assert False4826 @aetest.cleanup4827 def removing_vlan_config(self,steps,ctrl,server,client,etype,**param):4828 with steps.start('Removing QinQ Management VLAN on POP and DN',continue_=True) as step:4829 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['dn1_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')4830 log.info('Successful in configuring QinQ mvlan on DN1')4831 assert api.config_QinQ_mvlan(param['ctrl_ip'],param['pop_name'],param['dn1_mcvlan'],param['dn1_msvlan'],ethertype=etype,status='disable')4832 log.info('Successful in configuring QinQ mvlan on POP')4833 with steps.start('Removing vlan configs from ctrl',continue_=True) as step:4834 assert api.config_double_vlan(param['ctrl_ip'],param['dn1_name'],param['dn1_inf'],cvlan=param['dn1_mcvlan'],svlan=param['dn1_msvlan'],ethertype=etype,status='disable') 4835 log.info('sucessful in Removing QinQ VLAN on dn')4836 sleep(60)4837 with steps.start('Verifying links',continue_=True) as step: 4838 log.info('Verify link status')4839 for i in range(0,5):4840 4841 sleep(5)4842 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4843 logger.info(data)4844 if data["is_alive"] == True: 4845 logger.info('Link is Up') 4846 break4847 elif i == 4:4848 if data["is_alive"] == True:4849 logger.info('Link is Up')4850 else:4851 assert False4852 with steps.start('Removing QinQ VLAN in Server',continue_=True) as step:4853 assert misc.config_QinQ(server,param['server_inf'],param['dn1_mcvlan'],param['dn1_msvlan'],param['server_data_ipv4'],ethertype=etype,status='disable')4854 log.info('Successful in Removing vlan in Server')4855 4856 with steps.start('Configure IP in client',continue_=True) as step:4857 assert misc.config_ip(client,param['client_inf'],param['client_data_ipv4'],status='disable')4858 log.info('Successful in configuring IP in Client')4859class common_cleanup(aetest.CommonCleanup): 4860 @aetest.subsection4861 def Disabling_L2bridge(self,steps,ctrl,server,client,**param):4862 log.info('configuring l2bridge')4863 with steps.start('Disabling L2 bridge',continue_=True) as step:4864 assert api.config_l2_bridge(param['ctrl_ip'],status='false')4865 log.info('Successful in configuring l2bridge')4866 sleep(150) 4867 4868 4869 with steps.start('Verify link status',continue_=True) as step:4870 for i in range(0,5):4871 4872 sleep(5)4873 data = fetch_api.get_link_state(param['ctrl_ip'],param['link_name'])4874 logger.info(data)4875 if data["is_alive"] == True: 4876 logger.info('Link is Up') 4877 break4878 elif i == 4:4879 if data["is_alive"] == True:4880 logger.info('Link is Up')4881 else:4882 assert False4883 4884 @aetest.subsection4885 def deleting_node(self,steps,ctrl,server,client,**param):4886 assert api.del_node(param['ctrl_ip'],param['dn1_name']) 4887 log.info('Successful in deleting dn1')4888 4889 @aetest.subsection4890 def deleting_Site(self,steps,ctrl,server,client,**param):4891 assert api.del_site(param['ctrl_ip'],param['dn1_site'])4892 log.info('Successful in Deleting site')4893 4894 @aetest.subsection4895 def stopping_iperf_server(self,server,ctrl,client,**param):4896 assert misc.config_iperf_server(server,status='disable')4897 log.info('Successful in stopping iperf server')4898 4899 misc.execute_command(server,'rm index.html*')4900 misc.execute_command(server,'sudo ifconfig {} mtu 1500'.format(param['server_inf']))4901 misc.execute_command(client,'sudo ifconfig {} mtu 1500'.format(param['client_inf']))4902 server.disconnect()4903 client.disconnect()4904 4905 4906 4907if __name__ == '__main__': # pragma: no cover...

Full Screen

Full Screen

vlan_verify.py

Source:vlan_verify.py Github

copy

Full Screen

1# system imports2from os import chdir3from time import sleep4from datetime import datetime5import logging6import yaml7import sys8from pyats import aetest9from pyats.log.utils import banner10from genie import testbed11#from pyats.topology import loader12from multiprocessing import Process13log = logging.getLogger(__name__)14log.setLevel(logging.DEBUG)15#importing custom modules16from Config.config import *17from Fetch.fetch import *18from Misc.misc import misc19#Fetching input values from input.yaml20global lis21lis=[]22global lis123lis1=[]24class common_setup(aetest.CommonSetup): 25 @aetest.subsection26 def initial_configs(self,steps, testbed, **param):27 28 ref_pp = self.parent.parameters29 ref_pp['ctrl'] = testbed.devices[param['ctrl_alias']]30 ref_pp['dn'] = testbed.devices[param['dn_alias']]31 ref_pp['server'] = testbed.devices[param['server_alias']]32 ref_pp['client'] = testbed.devices[param['client_alias']]33 ref_pp['client2'] = testbed.devices[param['client2_alias']]34 ref_pp['client3'] = testbed.devices[param['client3_alias']]35 ref_pp['pop_name'] = ref_pp['ctrl'].custom['name']36 ref_pp['pop_mac'] = ref_pp['ctrl'].custom['mac']37 ref_pp['pop_iface'] = ref_pp['ctrl'].custom['iface']38 ref_pp['pop_iface'] = ref_pp['ctrl'].custom['iface']39 ref_pp['pop_mcvlan'] = ref_pp['ctrl'].custom['mcvlan']40 ref_pp['pop_msvlan'] = ref_pp['ctrl'].custom['msvlan']41 ref_pp['pop_management_ip']=ref_pp['ctrl'].custom['management_ip']42 ref_pp['path']=ref_pp['ctrl'].custom['location']43 44 ref_pp['dn1_name']=ref_pp['dn'].custom['name']45 ref_pp['dn1_site']=ref_pp['dn'].custom['site']46 ref_pp['dn1_lat'] = ref_pp['dn'].custom['lat']47 ref_pp['dn1_lon'] = ref_pp['dn'].custom['lon']48 ref_pp['dn1_alt'] = ref_pp['dn'].custom['alt']49 ref_pp['dn1_acc'] = ref_pp['dn'].custom['acc']50 ref_pp['dn1_inf'] = ref_pp['dn'].custom['inf']51 ref_pp['dn1_inf1'] = ref_pp['dn'].custom['inf1'] 52 ref_pp['dn1_mac'] = ref_pp['dn'].custom['mac']53 ref_pp['dn1_management_ip']=ref_pp['dn'].custom['management_ip']54 ref_pp['dn1_cvlan'] = ref_pp['dn'].custom['cvlan']55 ref_pp['dn1_svlan'] = ref_pp['dn'].custom['svlan']56 ref_pp['dn1_mcvlan'] = ref_pp['dn'].custom['mcvlan']57 ref_pp['dn1_msvlan'] = ref_pp['dn'].custom['msvlan']58 ref_pp['server_inf']=ref_pp['server'].custom['inf']59 ref_pp['server_data_ipv6']=ref_pp['server'].custom['ipv6']60 ref_pp['server_data_ipv4']=ref_pp['server'].custom['ipv4']61 ref_pp['server_mgmt_ipv4']=ref_pp['server'].custom['mgmt_ipv4']62 ref_pp['server_file']=ref_pp['server'].custom['capture_file']63 ref_pp['client_inf']=ref_pp['client'].custom['inf']64 ref_pp['client_data_ipv4']=ref_pp['client'].custom['ipv4']65 ref_pp['client2_inf']=ref_pp['client2'].custom['inf']66 ref_pp['client2_data_ipv4']=ref_pp['client2'].custom['ipv4']67