def __init__(self, objs_uuid): self.gbpcfg = gbpCfgCli(super_hdr.cntlr_ip, cntrlr_username=cntlr_user, cntrlr_passwd=cntlr_passwd, rcfile=rcfile) self.gbpdeftraff = gbpFabTraff() stack_name = super_hdr.stack_name heat_temp = super_hdr.heat_temp self.ntk_node = super_hdr.network_node self.pausetodebug = super_hdr.pausetodebug self.ptg_1 = objs_uuid['demo_diff_ptg_same_l2p_l3p_ptg1_id'] self.ptg_2 = objs_uuid['demo_diff_ptg_same_l2p_l3p_ptg2_id'] self.test_2_prs = objs_uuid['demo_ruleset_norule_id'] self.test_3_prs = objs_uuid['demo_ruleset_icmp_id'] self.test_4_prs = objs_uuid['demo_ruleset_tcp_id'] self.test_5_prs = objs_uuid['demo_ruleset_icmp_tcp_id'] self.test_6_prs = objs_uuid['demo_ruleset_icmp_udp_id'] self.test_7_prs = objs_uuid['demo_ruleset_all_id'] self.vm4_ip = self.gbpcfg.get_vm_subnet('VM4')[0] self.vm4_subn = self.gbpcfg.get_vm_subnet('VM4')[1] #self.dhcp_ns = self.gbpcfg.get_netns(self.ntk_node, self.vm4_subn) self.dhcp_ns = self.gbpcfg.get_netns('VM4') self.udp_rule = 'demo_rule_udp' # JISHNU: name appears as in heat template self.icmp_rule = 'demo_rule_icmp' self.tcp_rule = 'demo_rule_tcp'
def __init__(self, objs_uuid): self.gbpcfg = gbpCfgCli(super_hdr.cntlr_ip, cntrlr_username=cntlr_user, cntrlr_passwd=cntlr_passwd, rcfile=rcfile) self.gbpdeftraff = gbpFabTraff() stack_name = super_hdr.stack_name heat_temp = super_hdr.heat_temp self.ntk_node = super_hdr.network_node self.apic_ip = super_hdr.apic_ip self.apic_passwd = super_hdr.apic_passwd self.pausetodebug = super_hdr.pausetodebug self.plugin_mode = super_hdr.plugin self.gbpaci = gbpApic(self.apic_ip, password=self.apic_passwd, apicsystemID=super_hdr.apicsystemID) self.ptg = objs_uuid['demo_same_ptg_l2p_l3p_ptg_id'] self.test_2_prs = objs_uuid['demo_ruleset_norule_id'] self.test_3_prs = objs_uuid['demo_ruleset_icmp_id'] self.test_4_prs = objs_uuid['demo_ruleset_tcp_id'] self.test_5_prs = objs_uuid['demo_ruleset_icmp_tcp_id'] self.test_6_prs = objs_uuid['demo_ruleset_icmp_udp_id'] self.test_7_prs = objs_uuid['demo_ruleset_all_id'] self.vm1_ip = self.gbpcfg.get_vm_subnet('VM1')[0] self.vm1_subn = self.gbpcfg.get_vm_subnet('VM1')[1] #self.dhcp_ns = self.gbpcfg.get_netns(self.ntk_node, self.vm1_subn) self.dhcp_ns = self.gbpcfg.get_netns('VM1')
def __init__(self, ostack_cntrlr_ip, vm_list, ntk_node): self.ntk_node = ntk_node self.gbpcfg = gbpCfgCli(ostack_cntrlr_ip, cntrlr_username=CNTRLR_USR, cntrlr_passwd=CNTRLR_PASSWD, rcfile=RCFILE) self.gbpnova = gbpNova(ostack_cntrlr_ip,cntrlr_uname=CNTRLR_USR,cntrlr_passwd=CNTRLR_PASSWD, keystone_user=KEY_USER,keystone_password=KEY_PASSWD) self.vm_list = vm_list #print " List of VMs passed from the testsuite ", vm_list self.vm_to_ip_ns = {} """
def verify_traff(ntk_node,vm_loc='default',proto=['all']): """ Verifies the expected traffic result per testcase """ #Incase of Diff PTG Same L2 & L3P all traffic is dis-allowed by default unless Policy-Ruleset is applied # Hence verify_traff will check for all protocols including the implicit ones gbpcfg = gbpCfgCli() vm4_ip = gbpcfg.get_vm_subnet('VM4')[0] vm4_subn = gbpcfg.get_vm_subnet('VM4')[1] #dhcp_ns = gbpcfg.get_netns(ntk_node,vm4_subn) dhcp_ns = gbpcfg.get_netns('VM4') vm5_ip = gbpcfg.get_vm_subnet('VM5',ret='ip') vm6_ip = gbpcfg.get_vm_subnet('VM6',ret='ip') print "VM4_IP = %s, VM4_SUBN = %s, VM5_IP = %s, VM6_IP = %s, DHCP_NS = %s" %(vm4_ip,vm4_subn,vm5_ip,vm6_ip,dhcp_ns) if vm_loc == 'diff_host_same_leaf': gbppexptraff = Gbp_pexp_traff(ntk_node,dhcp_ns,vm4_ip,vm6_ip) if vm_loc == 'same_host': gbppexptraff = Gbp_pexp_traff(ntk_node,dhcp_ns,vm4_ip,vm5_ip) if vm_loc == 'default': samehosttrf = Gbp_pexp_traff(ntk_node,dhcp_ns,vm4_ip,vm5_ip) result_samehost = samehosttrf.test_run() if result_samehost == 2: return 0 diffhosttrf = Gbp_pexp_traff(ntk_node,dhcp_ns,vm4_ip,vm6_ip) result_diffhost = diffhosttrf.test_run() if result_diffhost == 2: return 0 results = {'same_host': result_samehost,\ 'diff_host_same_leaf': result_diffhost} if vm_loc != 'default': results = gbppexptraff.test_run() if results == 2: return 0 print 'Results from the Testcase == ', results failed={} if proto[0] == 'all' and vm_loc != 'default': failed = {key: val for key,val in results.iteritems() if val == 0} if len(failed) > 0: print 'Following traffic_types %s = Failed' %(failed) return 0 else: return 1 if proto[0] == 'all' and vm_loc == 'default': _fail = 0 for loc,trf_reslt in results.iteritems(): failed = {key: val for key,val in trf_reslt.iteritems() if val == 0} if len(failed) > 0: print 'Following traffic_types %s = Failed for %s' %(failed,loc.upper()) _fail += 1 if _fail > 0: return 0 else: return 1
class super_hdr(object): # Name of the config file is static nova_az = conf['nova_az_name'] cntlr_ip = conf['controller_ip'] cntlr_user = conf.get('controller_user') or 'root' cntlr_passwd = conf.get('controller_password') or 'noir0123' apic_ip = conf['apic_ip'] apic_passwd = conf['apic_passwd'] num_host = conf['num_comp_nodes'] heat_temp = conf['main_setup_heat_temp'] stack_name = conf['heat_dp_stack_name'] vm_image = conf['vm_image'] sshkeyname = conf['key_name'] network_node = conf['network_node'] apicsystemID = conf['apic_system_id'] pausetodebug = conf['pausetodebug'] plugin = conf['plugin-type'] gbpcfg = gbpCfgCli(cntlr_ip, cntrlr_username=cntlr_user, cntrlr_passwd=cntlr_passwd, rcfile=rcfile) gbpnova = gbpNova(cntlr_ip) gbpheat = gbpHeat(cntlr_ip) def vm_create(self, ptgs, vmlist): """ Create VMs """ # ptg_id should be a dict with keys as 'data' & 'mgmt' # vm_list: list of dicts for vm in vmlist: for key, val in ptgs.iteritems(): port = self.gbpcfg.gbp_policy_cfg_all( 1, 'target', 'vm_%s' % (key), policy_target_group='%s' % (val)) if port != 0: vm[key] = port[1] else: raise TestSuiteAbort("Policy Targets creation Failed") print vm # removed mgmt_nic if self.gbpnova.vm_create_cli(vm['name'], self.vm_image, vm['data'], avail_zone=vm['az']) == 0: return 0
def __init__(self,params): self.gbpcfg = gbpCfgCli() self.gbpaci = Gbp_Aci() self.heat_stack_name = 'gbpleaf5' cntlr_ip = params['cntlr_ip'] self.heat_temp_test = params['heat_temp_file'] self.gbpheat = gbpHeat(cntlr_ip) self.gbpnova = gbpNova(cntlr_ip) self.leaf_ip = params['leaf1_ip'] self.apic_ip = params['apic_ip'] self.network_node = params['network_node'] self.az_comp_node = params['az_comp_node'] self.nova_agg = params['nova_agg'] self.nova_az = params['nova_az'] self.comp_nodes = params['comp_node_ips']
def __init__(self, ostack_cntrlr_ip, vm_list, ntk_node): self.ntk_node = ntk_node self.gbpcfg = gbpCfgCli(ostack_cntrlr_ip, cntrlr_username=CNTRLR_USR, cntrlr_passwd=CNTRLR_PASSWD, rcfile=RCFILE) self.gbpnova = gbpNova(ostack_cntrlr_ip, cntrlr_uname=CNTRLR_USR, cntrlr_passwd=CNTRLR_PASSWD, keystone_user=KEY_USER, keystone_password=KEY_PASSWD) self.vm_list = vm_list #print " List of VMs passed from the testsuite ", vm_list self.vm_to_ip_ns = {} """
def __init__(self, ostack_cntrlr_ip, vm_list, ntk_node): self.ntk_node = ntk_node gbpcfg = gbpCfgCli(ostack_cntrlr_ip) gbpnova = gbpNova(ostack_cntrlr_ip) self.vm_list = vm_list print " List of VMs passed from the testsuite ", vm_list self.vm_to_ip_ns = {} for vm in self.vm_list: #vm_to_ip_list = gbpnova.get_any_vm_property(vm)['networks'][0] vm_to_ip_list = gbpnova.get_any_vm_property(vm)[0] vm_to_ip_list = [ip.encode('ascii') for ip in vm_to_ip_list] src_vm_pvt_ip_subnet = re.search('(\d+.\d+.\d+).\d+', vm_to_ip_list[0].encode('ascii'), re.I).group(1) src_vm_dhcp_ns = gbpcfg.get_netns(vm) #src_vm_dhcp_ns = gbpcfg.get_netns( # self.ntk_node, src_vm_pvt_ip_subnet) self.vm_to_ip_ns[vm] = [vm_to_ip_list, src_vm_dhcp_ns] print 'VM-to-IP-NS == %s' % (self.vm_to_ip_ns)
def __init__(self, params): self.gbpcfg = gbpCfgCli() self.gbpverify = Gbp_Verify() self.gbpdeftraff = Gbp_def_traff() self.gbpaci = Gbp_Aci() self.heat_stack_name = 'gbpapic3' self.cntlr_ip = params['cntlr_ip'] self.heat_temp_test = params['heat_temp_file'] self.gbpheat = gbpHeat(self.cntlr_ip) self.gbpnova = gbpNova(self.cntlr_ip) self.leaf_ip = params['leaf1_ip'] self.apic_ip = params['apic_ip'] self.network_node = params['network_node'] self.az_comp_node = params['az_comp_node'] self.nova_agg = params['nova_agg'] self.nova_az = params['nova_az'] self.debug = param['pausetodebug'] self.test_name = 'DISCONN_APIC_UPDATECFG_RECONN_APIC' self._log.info( "\nSteps of the TESTCASE_GBP_INTG_APIC_2_DISCONN_APIC_UPDATECFG_RECONN_APIC to be executed\n" ) if self.test_step_SetUpConfig() != 1: self._log.info("Test Failed at Step_1 == SetUpConfig") self.test_CleanUp() if self.test_step_VerifyTraffic() != 1: self._log.info("Test Failed at Step_2 == TestVerifyTraffic") self.test_CleanUp() objs_uuid = self.gbpverify.get_uuid_from_stack(self.heat_temp_test, self.heat_stack_name) self.ptg_1 = objs_uuid['server_ptg_id'] self.ptg_2 = objs_uuid['client_ptg_id'] self.test_1_prs = objs_uuid['demo_ruleset_icmp_id'] self.test_2_prs = objs_uuid['demo_ruleset_tcp_id'] self.test_3_prs = objs_uuid['demo_ruleset_udp_id'] self.test_4_prs = objs_uuid['demo_ruleset_icmp_tcp_id'] self.test_5_prs = objs_uuid['demo_ruleset_icmp_udp_id'] self.test_6_prs = objs_uuid['demo_ruleset_tcp_udp_id'] self.prs_proto = {self.test_1_prs:['icmp'],self.test_2_prs:['tcp'],self.test_3_prs:['udp'],\ self.test_4_prs:['icmp','tcp'],self.test_5_prs:['icmp','udp'],self.test_6_prs:['tcp','udp']}
def __init__(self,params): self.gbpcfg = gbpCfgCli() self.gbpverify = Gbp_Verify() self.gbpdeftraff = Gbp_def_traff() self.gbpaci = Gbp_Aci() self.heat_stack_name = 'gbpapic3' self.cntlr_ip = params['cntlr_ip'] self.heat_temp_test = params['heat_temp_file'] self.gbpheat = gbpHeat(self.cntlr_ip) self.gbpnova = gbpNova(self.cntlr_ip) self.leaf_ip = params['leaf1_ip'] self.apic_ip = params['apic_ip'] self.network_node = params['network_node'] self.az_comp_node = params['az_comp_node'] self.nova_agg = params['nova_agg'] self.nova_az = params['nova_az'] self.debug = param['pausetodebug'] self.test_name = 'DISCONN_APIC_UPDATECFG_RECONN_APIC' self._log.info("\nSteps of the TESTCASE_GBP_INTG_APIC_2_DISCONN_APIC_UPDATECFG_RECONN_APIC to be executed\n") if self.test_step_SetUpConfig()!=1: self._log.info("Test Failed at Step_1 == SetUpConfig") self.test_CleanUp() if self.test_step_VerifyTraffic() != 1: self._log.info("Test Failed at Step_2 == TestVerifyTraffic") self.test_CleanUp() objs_uuid = self.gbpverify.get_uuid_from_stack(self.heat_temp_test,self.heat_stack_name) self.ptg_1 = objs_uuid['server_ptg_id'] self.ptg_2 = objs_uuid['client_ptg_id'] self.test_1_prs = objs_uuid['demo_ruleset_icmp_id'] self.test_2_prs = objs_uuid['demo_ruleset_tcp_id'] self.test_3_prs = objs_uuid['demo_ruleset_udp_id'] self.test_4_prs = objs_uuid['demo_ruleset_icmp_tcp_id'] self.test_5_prs = objs_uuid['demo_ruleset_icmp_udp_id'] self.test_6_prs = objs_uuid['demo_ruleset_tcp_udp_id'] self.prs_proto = {self.test_1_prs:['icmp'],self.test_2_prs:['tcp'],self.test_3_prs:['udp'],\ self.test_4_prs:['icmp','tcp'],self.test_5_prs:['icmp','udp'],self.test_6_prs:['tcp','udp']}
def __init__(self, objs_uuid): self.gbpcfg = gbpCfgCli(super_hdr.cntlr_ip, cntrlr_username=cntlr_user, cntrlr_passwd=cntlr_passwd, rcfile=rcfile) self.gbpdeftraff = gbpFabTraff() stack_name = super_hdr.stack_name heat_temp = super_hdr.heat_temp self.ntk_node = super_hdr.network_node self.pausetodebug = super_hdr.pausetodebug self.ptg_1 = objs_uuid['demo_diff_ptg_l2p_same_l3p_ptg1_id'] self.ptg_2 = objs_uuid['demo_diff_ptg_l2p_same_l3p_ptg2_id'] self.test_2_prs = objs_uuid['demo_ruleset_norule_id'] self.test_3_prs = objs_uuid['demo_ruleset_icmp_id'] self.test_4_prs = objs_uuid['demo_ruleset_tcp_id'] self.test_5_prs = objs_uuid['demo_ruleset_icmp_tcp_id'] self.test_6_prs = objs_uuid['demo_ruleset_icmp_udp_id'] self.test_7_prs = objs_uuid['demo_ruleset_all_id'] self.udp_rule = 'demo_rule_udp' # JISHNU: name appears as in heat template self.icmp_rule = 'demo_rule_icmp' self.tcp_rule = 'demo_rule_tcp' self.vm7_ip = self.gbpcfg.get_vm_subnet('VM7')[0] self.vm7_subn = self.gbpcfg.get_vm_subnet('VM7')[1] #self.dhcp_ns = self.gbpcfg.get_netns(self.ntk_node, self.vm7_subn) self.dhcp_ns = self.gbpcfg.get_netns('VM7')
def __init__(self, objs_uuid): self.gbpcfg = gbpCfgCli(super_hdr.cntlr_ip, cntrlr_username=cntlr_user, cntrlr_passwd=cntlr_passwd, rcfile=rcfile) self.gbpdeftraff = gbpFabTraff() stack_name = super_hdr.stack_name heat_temp = super_hdr.heat_temp self.ntk_node = super_hdr.network_node self.ptg_1 = objs_uuid['demo_diff_ptg_l2p_l3p_ptg1_id'] self.ptg_2 = objs_uuid['demo_diff_ptg_l2p_l3p_ptg2_id'] self.test_2_prs = objs_uuid['demo_ruleset_norule_id'] self.test_3_prs = objs_uuid['demo_ruleset_icmp_id'] self.test_4_prs = objs_uuid['demo_ruleset_tcp_id'] self.test_5_prs = objs_uuid['demo_ruleset_udp_id'] self.test_6_prs = objs_uuid['demo_ruleset_icmp_tcp_id'] self.test_7_prs = objs_uuid['demo_ruleset_icmp_udp_id'] self.test_8_prs = objs_uuid['demo_ruleset_tcp_udp_id'] self.test_9_prs = objs_uuid['demo_ruleset_all_id'] self.vm10_ip = self.gbpcfg.get_vm_subnet('VM10')[0] self.vm10_subn = self.gbpcfg.get_vm_subnet('VM10')[1] #self.dhcp_ns = self.gbpcfg.get_netns(self.ntk_node, self.vm10_subn) self.dhcp_ns = self.gbpcfg.get_netns('VM10')