def __init__(self, exeCore): """onboard the test framework""" self.execore = exeCore self.perl_script = os.path.join(self.execore.productDir,'core/tstcore/tvm/resources','voip_testcalls.pl') self.test_group = "VoIPTest" args = {'network': 'tvm_comms', 'subnet_name': 'tvm_comms-sub', 'cidr': '192.168.99.0/24'} comms_nw_id = self.execore.createNetwork(**args) args = {'network': 'tvm_test', 'subnet_name': 'tvm_test-sub', 'cidr': '192.168.2.0/24', 'enable_dhcp': False} test_nw_id = self.execore.createNetwork(**args) args = {'network': 'tvm_mgmt', 'subnet_name': 'tvm_mgmt-sub', 'cidr': '192.168.0.0/24'} mgmt_nw_id = self.execore.createNetwork(**args) #TODO: Router ID should be from config file instead of hardcoding args = {'router_name': 'Router', 'external_network_name': 'public'} #args = {'router_name': 'R1', 'external_network_name': 'public'} router_id = self.execore.createRouter(**args) self.NSD = os.path.join(self.execore.productDir,'core/tstcore/tvm/descriptor','TVM.zip') self.templateID = self.execore.onBoard('teravm', self.NSD) csObj = self.execore.createServiceRequestObject(router='Router', networks= {'comms-network': comms_nw_id, 'test-network': test_nw_id, 'mgmt-if': mgmt_nw_id}) csObj['name'] = 'Tvm' csObj['qos'] = 'Voip' tvm_srv = self.execore.createService(self.templateID, **csObj) self.tvmc_host = utils.getVduParameter(tvm_srv['vdus']['Tvm']['vTVMC'][0], 'comms-network') self.tvmc_username = utils.getVduParameter(tvm_srv['vdus']['Tvm']['vTVMC'][0], 'username') self.tvmc_password = utils.getVduParameter(tvm_srv['vdus']['Tvm']['vTVMC'][0], 'password') self.sip1_ip = self._get_ip(tvm_srv['vdus']['Tvm']['vTVMT1'][0], 'test-network') self.sip2_ip = self._get_ip(tvm_srv['vdus']['Tvm']['vTVMT2'][0], 'test-network') self.gateway_ip = '.'.join(self.sip1_ip.split('.')[:-1])+'.1' #get_networks function required Hardcoded as the n/w created by the TF and no gateway specified. So default-considered. self.local_path = self.execore.sessionDir self.testCaseMap = { 'TEST_SIP_CALLS' : '__exec_sip_calls__'} super(TestCore, self).__init__()
def enable_taas(self): #Extract the ports for the requested VDU network ifaces ntwInterfaces = [] diagsDict = dict() for vdu in self.taas_data.keys(): vduInfo = utils.getVdu(self.nsInfo, vdu) if vduInfo: utils.getVduParameter(vduInfo[0], self.taas_data[vdu]).update({"name": vdu}) ntwIF = utils.getVduParameter(vduInfo[0], self.taas_data[vdu]) ntwInterfaces.append(ntwIF) diagsDict[ntwIF['ips']] = {"name": vdu, "interface": self.taas_data[vdu]} portsList = [] for interface in ntwInterfaces: portID = self._get_port_ID(interface) portsList.append(portID) #Create tap service on DPDK in-port tapServiceParams = { "tap_service": { "description": "Tap service for diagnostic", "name": "Diagnostics", "network_id": "b5878681-83eb-44a3-84c2-169934bd879c", "port_id": "948448ed-337e-4789-81e3-7da2a6cc2217", } } tapSvcData = self.API.__create_tap_service__(tapServiceParams) self.tapServiceID = tapSvcData['tap_service']['id'] print tapSvcData #Create tap flows for all the requested vdu network interfaces for port in portsList: tapFlowParams = { "tap_flow": { "description": "Test_flow1", "direction": "BOTH", "name": "flow"+port[:8], "source_port": port, "tap_service_id": tapSvcData['tap_service']['id'], } } tapFlowData = self.API.__create_tap_flow__(tapFlowParams) print tapFlowData self.tapFlows.append(tapFlowData['tap_flow']['id']) startAnalyser = requests.get("http://60.0.0.11:9999/startDPI")
def _enable_taas(self, service): #Extract the ports for the requested VDU network ifaces ntwInterfaces = [] #self.diagsDict = {} for ns in self.taas_data.keys(): if ns == service['id']: for vdu in self.taas_data[ns].keys(): vduInfo = utils.getVdu(service, vdu) if vduInfo: utils.getVduParameter(vduInfo[0], self.taas_data[ns][vdu]).update({"name": vdu}) ntwIF = utils.getVduParameter(vduInfo[0], self.taas_data[ns][vdu]) ntwInterfaces.append(ntwIF) portsList = [] for interface in ntwInterfaces: portID = self._get_port_ID(interface) portsList.append(portID) #Create tap service on DPDK in-port tapServiceParams = { "tap_service": { "description": "Tap service for diagnostic", "name": "Diagnostics", "network_id": "f3200048-6c40-470e-86ec-239100d58d11", "port_id": "34ec955d-4f11-47e2-893a-dcd957cbed22", } } tapSvcData = self.API.__create_tap_service__(tapServiceParams) self.tapServices.append(tapSvcData['tap_service']['id']) print tapSvcData #Create tap flows for all the requested vdu network interfaces for port in portsList: tapFlowParams = { "tap_flow": { "description": "Test_flow1", "direction": "BOTH", "name": "flow"+port[:8], "source_port": port, "tap_service_id": tapSvcData['tap_service']['id'], } } tapFlowData = self.API.__create_tap_flow__(tapFlowParams) print tapFlowData self.tapFlows.append(tapFlowData['tap_flow']['id'])
def __init__(self, exeCore): """onboard the test framework""" import pdb;pdb.set_trace() sipp_config = {} self.execore = exeCore self.sipp_cfg = sipputils._get_sipp_config() self._base = self.sipp_cfg['base_number'] args = {'network': 'sip-network', 'subnet_name': 'sip_subnet', 'cidr': self.sipp_cfg['sipp_network']} sip_nw_id = self.execore.createNetwork(**args) args = {'network': 'sip-mgmt', 'subnet_name': 'sip_mgmt_subnet', 'cidr': self.sipp_cfg['mgmt_network']} mgmt_nw_id = self.execore.createNetwork(**args) #TODO: Router ID should be from config file instead of hardcoding args = {'router_name': self.sipp_cfg['sipp_router'], 'external_network_name': 'public'} router_id = self.execore.createRouter(**args) self.NSD = os.path.join(self.execore.productDir,'core/tstcore/sipp/descriptor','sipp.zip') self.templateID = self.execore.onBoard('sipp', self.NSD) csObj = self.execore.createServiceRequestObject(router=self.sipp_cfg['sipp_router'], networks= {'sip-network': sip_nw_id, 'mgmt-if': mgmt_nw_id}) csObj['name'] = 'Sipp' csObj['qos'] = 'Voip' sipp_svc = self.execore.createService(self.templateID, **csObj) import pdb;pdb.set_trace() #Need to obtain below configuration from service object self.sip1_ip = utils.getVduParameter(tvm_srv['vdus']['Sipp']['vSipp'][0], 'mgmt-if') self.sip1_username = utils.getVduParameter(tvm_srv['vdus']['Sipp']['vSipp'][0], 'username') self.sip1_password = utils.getVduParameter(tvm_srv['vdus']['Sipp']['vSipp'][0], 'password') self.sip2_ip = utils.getVduParameter(tvm_srv['vdus']['Sipp']['vSipp'][1], 'mgmt-if') self.sip2_username = utils.getVduParameter(tvm_srv['vdus']['Sipp']['vSipp'][1], 'username') self.sip2_password= utils.getVduParameter(tvm_srv['vdus']['Sipp']['vSipp'][1], 'password') self._udp_ports = [] for i in range(16376, 32767): self._udp_ports.append(i) self.sip1_client = utils.get_ssh_conn(self.sip1_ip, self.sip1_username, self.sip1_password) self.sip2_client = utils.get_ssh_conn(self.sip2_ip, self.sip2_username, self.sip2_password) self.report = sipputils._init_report() self.testCaseMap = { 'TEST_SIP_WITH_RTP' : '__exec_sip_rtp__', 'TEST_SIP_WITHOUT_RTP' : '__exec_sip_no_rtp'} super(TestCore, self).__init__()
def run(self, execore): execore.set_report_title("TeraVM VOIP Execution with Clearwater IMS.") args = {'network': 'mgmt-if', 'subnet_name': 'mgmt-sub', 'cidr': '192.168.10.0/24'} mgmt_nw_id = execore.createNetwork(**args) args = {'network': 'ims-private', 'subnet_name': 'private-sub', 'cidr': '192.168.11.0/24'} private_nw_id = execore.createNetwork(**args) args = {'router_name': 'Router', 'external_network_name': 'public'} router_id = execore.createRouter(**args) ims_templateID = execore.onBoard('ims','/home/tcs/templates/Ims/zip/ims.zip') #ims_templateID = execore.onBoard('ims','/home/openstack/urvika/templates/Ims/zip/ims.zip') csObj = execore.createServiceRequestObject(router='Router', networks= {'mgmt-if': mgmt_nw_id, 'private': private_nw_id}) csObj['name'] = 'Ims' csObj['qos'] = 'Silver' #TOCHK: Is Template ID required for create service?? ims_srv = execore.createService(ims_templateID,**csObj) import pdb;pdb.set_trace() sip_external_proxy = utils.getVduParameter(ims_srv['vdus']['Ims']['vBono'][0], 'pkt-in') ellis_ip = utils.getVduParameter(ims_srv['vdus']['Ims']['vEllis'][0], 'mgmt-ip') import pdb;pdb.set_trace() tstCore = execore.initTest('tvm') import pdb;pdb.set_trace() tvm_ctl = tstCore.__dict__['tvmc_host'] tvmc_username = tstCore.__dict__['tvmc_username'] tvmc_password = tstCore.__dict__['tvmc_password'] users = 5 base = 6505550000 sip1_ip = tstCore.__dict__['sip1_ip'] sip2_ip = tstCore.__dict__['sip2_ip'] gateway_ip = tstCore.__dict__['gateway_ip'] file_name = "servers" fb = open(execore.sessionDir+'/'+file_name+'.ini', 'wb') test_group = "VoIPTest" fb.write("TestGroup_Name:"+test_group+"\nTVM1:"+sip1_ip+"/24\nTVM2:"+sip2_ip+"/24\nGateway_IP:"+gateway_ip+"\nSIPProxy_IP:"+sip_external_proxy); fb.close() cmd = "python /home/tcs/tvm_code/EllisClient.py --ellis_ip " + ellis_ip + " --call_count " + \ str(users) + " --base_number " + base + "--Dir_path "+execore.sessionDir result, error = utils.exec_command(cmd) args1 = {} args1['tvmc_host'] = tvm_ctl args1['tvmc_username'] = tvmc_username args1['tvmc_password'] = tvmc_password args1['tvm_config_file'] = execore.sessionDir+'/'+file_name+'.ini' args1['caller_list'] = execore.sessionDir+'/callerlist.ini' args1['callee_list'] = execore.sessionDir+'/calleelist.ini' args1['test_group'] = test_group import pdb;pdb.set_trace() tstCore.execute('TEST_SIP_CALLS', **args1) base = base + users users = 10 cmd = "python /home/tcs/tvm_code/EllisClient.py --ellis_ip " + ellis_ip + " --call_count " + \ str(users) + " --base_number " + base + "--Dir_path "+execore.sessionDir result, error = utils.exec_command(cmd) tstCore.execute('TEST_SIP_CALLS', **args1) base = base + users users = 20 cmd = "python /home/tcs/tvm_code/EllisClient.py --ellis_ip " + ellis_ip + " --call_count " + \ str(users) + " --base_number " + base + "--Dir_path "+execore.sessionDir result, error = utils.exec_command(cmd) tstCore.execute('TEST_SIP_CALLS', **args1) base = base + users users = 50 cmd = "python /home/tcs/tvm_code/EllisClient.py --ellis_ip " + ellis_ip + " --call_count " + \ str(users) + " --base_number " + base + "--Dir_path "+execore.sessionDir result, error = utils.exec_command(cmd) tstCore.execute('TEST_SIP_CALLS', **args1) base = base + users users = 100 cmd = "python /home/tcs/tvm_code/EllisClient.py --ellis_ip " + ellis_ip + " --call_count " + \ str(users) + " --base_number " + base + "--Dir_path "+execore.sessionDir result, error = utils.exec_command(cmd) tstCore.execute('TEST_SIP_CALLS', **args1) #flavor_args = {'vcpus':'10','disk':'2048','name':'symphony','ram':'1024'} #import pdb;pdb.set_trace() #execore.createFlavor(**flavor_args) #execore.deleteTemplate(templateID) pass