Пример #1
0
def novlan_push_two_tables_tests(parent):
    """
    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    """
    wildcards = 0
    vid = -1
    pcp = 0
    vid_int = -1
    pcp_int = 0

    exp_vid = random.randint(0, 4094)
    exp_pcp = random.randint(0, 6)

    # Match condition on TBL0 (match)
    vid_match_tbl0 = ofp.OFPVID_NONE
    pcp_match_tbl0 = 0

    # Create action_list for TBL0
    action_list_tbl0 = []
    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN
    action_list_tbl0.append(act)

    act = action.action_set_vlan_vid()
    act.vlan_vid = exp_vid
    action_list_tbl0.append(act)
    act = action.action_set_vlan_pcp()
    act.vlan_pcp = exp_pcp
    action_list_tbl0.append(act)

    # Create action_list for TBL1
    vid_match_tbl1 = exp_vid
    pcp_match_tbl1 = exp_pcp

    # Output action for table1 will be set in the framework
    action_list_tbl1 = None

    flow_match_test_vlan_two_tables(parent,
                                    pa_port_map,
                                    dl_vlan=vid,
                                    dl_vlan_pcp=pcp,
                                    dl_vlan_int=vid_int,
                                    dl_vlan_pcp_int=pcp_int,
                                    vid_match_tbl0=vid_match_tbl0,
                                    pcp_match_tbl0=pcp_match_tbl0,
                                    action_list_tbl0=action_list_tbl0,
                                    match_exp_tbl0=True,
                                    vid_match_tbl1=vid_match_tbl1,
                                    pcp_match_tbl1=pcp_match_tbl1,
                                    action_list_tbl1=action_list_tbl1,
                                    match_exp_tbl1=True,
                                    exp_vid=exp_vid,
                                    exp_pcp=exp_pcp,
                                    add_tag_exp=True,
                                    wildcards=wildcards,
                                    max_test=1)
Пример #2
0
def novlan_push_two_tables_tests(parent):
    """
    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    """
    wildcards = 0
    vid = -1
    pcp = 0
    vid_int = -1
    pcp_int = 0

    exp_vid = random.randint(0, 4094)
    exp_pcp = random.randint(0, 6)

    # Match condition on TBL0 (match)
    vid_match_tbl0 = ofp.OFPVID_NONE
    pcp_match_tbl0 = 0

    # Create action_list for TBL0
    action_list_tbl0 = []
    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN
    action_list_tbl0.append(act)

    act = action.action_set_vlan_vid()
    act.vlan_vid = exp_vid
    action_list_tbl0.append(act)
    act = action.action_set_vlan_pcp()
    act.vlan_pcp = exp_pcp
    action_list_tbl0.append(act)

    # Create action_list for TBL1
    vid_match_tbl1 = exp_vid
    pcp_match_tbl1 = exp_pcp

    # Output action for table1 will be set in the framework
    action_list_tbl1 = None

    flow_match_test_vlan_two_tables(parent, pa_port_map,
                    dl_vlan=vid,
                    dl_vlan_pcp=pcp,
                    dl_vlan_int=vid_int,
                    dl_vlan_pcp_int=pcp_int,
                    vid_match_tbl0=vid_match_tbl0,
                    pcp_match_tbl0=pcp_match_tbl0,
                    action_list_tbl0 = action_list_tbl0,
                    match_exp_tbl0 = True,
                    vid_match_tbl1=vid_match_tbl1,
                    pcp_match_tbl1=pcp_match_tbl1,
                    action_list_tbl1 = action_list_tbl1,
                    match_exp_tbl1 = True,
                    exp_vid=exp_vid,
                    exp_pcp=exp_pcp,
                    add_tag_exp=True,
                    wildcards=wildcards,
                    max_test=1)
Пример #3
0
    def runTest(self):
        of_ports = pa_port_map.keys()
        of_ports.sort()
        self.assertTrue(len(of_ports) > 2, "Not enough ports for test")
        # For making the test simpler...
        ing_port = of_ports[0]
        egr_port = of_ports[1]

        pktlen = 104
        dl_vlan = 0xa5a # no specific meaning
        dl_vlan_pcp=3
        pkt = testutils.simple_tcp_packet(pktlen=pktlen,
                                          dl_vlan_enable=True,
                                          dl_vlan=dl_vlan,
                                          dl_vlan_pcp=dl_vlan_pcp)

        match = parse.packet_to_flow_match(pkt)
        wildcards = 0

        exp_pkt = testutils.simple_tcp_packet(pktlen=pktlen,
                                              dl_vlan_enable=True)

        # Create parameters for each table
        act_list = []
        next_avail = []
        chk_expire = []

        #Table 0
        act = action.action_output()
        act.port = egr_port
        act_list.append([act])
        next_avail.append(True)
        chk_expire.append(False)

        #Table 1
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN
        act_list.append([act])
        next_avail.append(True)
        chk_expire.append(False)

        #Table 2
        act = action.action_pop_vlan()
        act_list.append([act])
        next_avail.append(False)
        chk_expire.append(False)

        write_action_test_multi_tables(self, ing_port, egr_port,
            match = match,
            wildcards = wildcards,
            act_list = act_list,
            next_avail = next_avail,
            chk_expire = chk_expire,
            pkt = pkt,
            exp_pkt = exp_pkt)
Пример #4
0
    def runTest(self):
        of_ports = pa_port_map.keys()
        of_ports.sort()
        self.assertTrue(len(of_ports) > 2, "Not enough ports for test")
        # For making the test simpler...
        ing_port = of_ports[0]
        egr_port = of_ports[1]

        dl_vlan = random.randint(1,0x7ff)
        dl_vlan_pcp = random.randint(0,7)
        pkt = testutils.simple_tcp_packet(vlan_tags=[{'vid': dl_vlan, 'pcp': dl_vlan_pcp}])

        match_ls = parse.packet_to_flow_match(pkt)
        wildcards = 0

        new_dl_vlan = random.randint(0x800,0xfff)
        exp_pkt = testutils.simple_tcp_packet(vlan_tags=[{'type': ETHERTYPE_VLAN, 'vid': new_dl_vlan, 'pcp': dl_vlan_pcp},
                                                         {'vid': dl_vlan, 'pcp': dl_vlan_pcp}])

        # Create parameters for each table
        act_list = []
        next_avail = []
        chk_expire = []

        #Table 0
        act = action.action_output()
        act.port = egr_port
        act_list.append([act])
        next_avail.append(True)
        chk_expire.append(False)

        #Table 1
        #act = action.action_set_vlan_vid()
        #act.vlan_vid = new_dl_vlan
        act = action.action_set_field()
        act.field = match.vlan_vid(new_dl_vlan + ofp.OFPVID_PRESENT)
        act_list.append([act])
        next_avail.append(True)
        chk_expire.append(False)

        #Table 2
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN
        act_list.append([act])
        next_avail.append(False)
        chk_expire.append(False)

        write_action_test_multi_tables(self, ing_port, egr_port,
            match_fields = match_ls,
            wildcards = wildcards,
            act_list = act_list,
            next_avail = next_avail,
            chk_expire = chk_expire,
            pkt = pkt,
            exp_pkt = exp_pkt)
Пример #5
0
 def runTest(self):
     new_vid = 4002
     # sup_acts = supported_actions_get(self)
     # if not(sup_acts & 1<<ofp.OFPXMT_OFB_VLAN_VID):
         # testutils.skip_message_emit(self, "Add VLAN tag test")
         # return
     pkt = testutils.simple_tcp_packet()
     exp_pkt = testutils.simple_tcp_packet(
                                 vlan_tags=[{'vid': new_vid}])
     push_act = action.action_push_vlan()
     push_act.ethertype = 0x8100
     vid_act = action.action_set_field()
     vid_act.field=match.vlan_vid(new_vid + ofp.OFPVID_PRESENT)
     #vid_act = action.action_set_vlan_vid()
     #vid_act.vlan_vid = new_vid
     testutils.flow_match_test(self, pa_port_map, pkt=pkt,
                     exp_pkt=exp_pkt, apply_action_list=[push_act, vid_act])
Пример #6
0
    def runTest(self):
        new_vid = 4002
        sup_acts = supported_actions_get(self)
        if not(sup_acts & 1<<ofp.OFPAT_SET_VLAN_VID):
            testutils.skip_message_emit(self, "Add VLAN tag test")
            return

        pkt = testutils.simple_tcp_packet()
        exp_pkt = testutils.simple_tcp_packet(
                                    vlan_tags=[{'vid': new_vid}])
        push_act = action.action_push_vlan()
        push_act.ethertype = 0x8100
        

        vid_act = action.action_set_vlan_vid()
        vid_act.vlan_vid = new_vid

        testutils.flow_match_test(self, pa_port_map, pkt=pkt, 
                        exp_pkt=exp_pkt, apply_action_list=[push_act, vid_act])
Пример #7
0
 def runTest(self):
     new_vid = 4002
     # sup_acts = supported_actions_get(self)
     # if not(sup_acts & 1<<ofp.OFPXMT_OFB_VLAN_VID):
     # testutils.skip_message_emit(self, "Add VLAN tag test")
     # return
     pkt = testutils.simple_tcp_packet()
     exp_pkt = testutils.simple_tcp_packet(vlan_tags=[{'vid': new_vid}])
     push_act = action.action_push_vlan()
     push_act.ethertype = 0x8100
     vid_act = action.action_set_field()
     vid_act.field = match.vlan_vid(new_vid + ofp.OFPVID_PRESENT)
     #vid_act = action.action_set_vlan_vid()
     #vid_act.vlan_vid = new_vid
     testutils.flow_match_test(self,
                               pa_port_map,
                               pkt=pkt,
                               exp_pkt=exp_pkt,
                               apply_action_list=[push_act, vid_act])
Пример #8
0
def vlan_push_two_tables_tests(parent, test_condition=0, match_exp = True):
    """
    @param parent must implement controller, dataplane, asserttrue, assertequal
    and logger
    """
    wildcards = 0
    vid = random.randint(1, 4094)
    pcp = random.randint(0, 6)
    vid_int = -1
    pcp_int = 0

    if (test_condition == 0):
        exp_vid = vid
        exp_pcp = pcp
    elif (test_condition == 1):
        exp_vid = vid + 1
        exp_pcp = pcp
    elif (test_condition == 2):
        exp_vid = vid
        exp_pcp = pcp + 1
    elif (test_condition == 3):
        exp_vid = vid + 1
        exp_pcp = pcp + 1
    else:
        return

    # match condition on tbl0 (match)
    vid_match_tbl0 = vid
    pcp_match_tbl0 = pcp

    # create action_list for tbl0
    action_list_tbl0 = []
    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN
    action_list_tbl0.append(act)
    if (match_exp):
        # push-only for test0
        if (test_condition == 1):
            #act = action.action_set_vlan_vid()
            #act.vlan_vid = exp_vid
            vlan_vid = match.vlan_vid(exp_vid + ofp.OFPVID_PRESENT)
            act = action.action_set_field()
            act.field = vlan_vid
            action_list_tbl0.append(act)
        elif (test_condition == 2):
            #act = action.action_set_vlan_pcp()
            #act.vlan_pcp = exp_pcp
            vlan_pcp = match.vlan_pcp(exp_pcp)
            act = action.action_set_field()
            act.field = vlan_pcp
            action_list_tbl0.append(act)
        elif (test_condition == 3):
            #act = action.action_set_vlan_vid()
            #act.vlan_vid = exp_vid
            vlan_vid = match.vlan_vid(exp_vid + ofp.OFPVID_PRESENT)
            act = action.action_set_field()
            act.field = vlan_vid
            action_list_tbl0.append(act)
            #act = action.action_set_vlan_pcp()
            #act.vlan_pcp = exp_pcp
            vlan_pcp = match.vlan_pcp(exp_pcp)
            act = action.action_set_field()
            act.field = vlan_pcp
            action_list_tbl0.append(act)
    else:
        if (test_condition == 0):
            #act = action.action_set_vlan_vid()
            #act.vlan_vid = vid + 1
            vlan_vid = match.vlan_vid(vid + 1 + ofp.OFPVID_PRESENT)
            act = action.action_set_field()
            act.field = vlan_vid
            action_list_tbl0.append(act)

    # Create action_list for TBL1
    vid_match_tbl1 = exp_vid
    pcp_match_tbl1 = exp_pcp

    # Output action for table1 will be set in the framework
    action_list_tbl1 = None

    flow_match_test_vlan_two_tables(parent, pa_port_map,
                    dl_vlan=vid,
                    dl_vlan_pcp=pcp,
                    dl_vlan_int=vid_int,
                    dl_vlan_pcp_int=pcp_int,
                    vid_match_tbl0=vid_match_tbl0,
                    pcp_match_tbl0=pcp_match_tbl0,
                    action_list_tbl0 = action_list_tbl0,
                    match_exp_tbl0 = True,
                    vid_match_tbl1=vid_match_tbl1,
                    pcp_match_tbl1=pcp_match_tbl1,
                    action_list_tbl1 = action_list_tbl1,
                    match_exp_tbl1 = match_exp,
                    exp_vid=exp_vid,
                    exp_pcp=exp_pcp,
                    add_tag_exp=True,
                    wildcards=wildcards,
                    max_test=1)
Пример #9
0
def vlan_singlepush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 2
    """
    parent.assertTrue(((parent.num_tags >= 0) and (parent.num_tags <= 2)),
                      "Parameter num_tags not within an acceptable range")
    #print("parent vid="+str(parent.vid))
    #print("parent pcp="+str(parent.pcp))
    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid,
     sup_set_vlan_pcp) = (True, True, True, True)
    #    vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(
            parent, "Vlan single push action test. SET VLAN VID not supported")
        return

    if test_condition == 0:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 1
            exp_pcp = 0
            vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = 1
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
            vlan_vid = match.vlan_vid(parent.vid + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = parent.vid
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0  #NOT_EXPECTED
        exp_msg_code = 0  #NOT_EXPECTED

    elif test_condition == 1:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN_PBB
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 1
            exp_pcp = 0
            vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = 1
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
            vlan_vid = match.vlan_vid(parent.vid + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = parent.vid


#        parent.vid_2nd = parent.vid
#        parent.pcp_2nd = parent.pcp
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0  #NOT_EXPECTED
        exp_msg_code = 0  #NOT_EXPECTED

    elif test_condition == 2:
        act = action.action_push_vlan()
        act.ethertype = 0xaaa  #Other than 0x8100 and 0x88a8
        match_exp = False
        add_tag_exp = False
        exp_vid = 1
        exp_pcp = 0
        vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
        act2 = action.action_set_field()
        act2.field = vlan_vid
        #act2 = action.action_set_vlan_vid()
        #act2.vlan_vid = 1
        exp_msg = ofp.OFPT_ERROR
        exp_msg_type = ofp.OFPET_BAD_ACTION
        exp_msg_code = ofp.OFPBAC_BAD_ARGUMENT

    else:
        return

    #NOTE need to set a VLAN vid value, as vid=0 is stripped by the system
    action_list = [act, act2]
    wildcards = 0
    if parent.num_tags == 0:
        wildcards |= 1 << ofp.OFPXMT_OFB_VLAN_VID
        wildcards |= 1 << ofp.OFPXMT_OFB_VLAN_PCP

    testutils.flow_match_test_vlan(parent,
                                   pa_port_map,
                                   wildcards=wildcards,
                                   dl_vlan=parent.vid,
                                   dl_vlan_pcp=parent.pcp,
                                   dl_vlan_type=parent.vlan_type,
                                   dl_vlan_int=parent.vid_2nd,
                                   dl_vlan_pcp_int=parent.pcp_2nd,
                                   vid_match=parent.vid_match,
                                   pcp_match=parent.pcp_match,
                                   exp_vid=exp_vid,
                                   exp_pcp=exp_pcp,
                                   exp_vlan_type=act.ethertype,
                                   match_exp=match_exp,
                                   add_tag_exp=add_tag_exp,
                                   exp_msg=exp_msg,
                                   exp_msg_type=exp_msg_type,
                                   exp_msg_code=exp_msg_code,
                                   action_list=action_list,
                                   max_test=1)
Пример #10
0
def vlan_singlepush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 2
    """
    parent.assertTrue(((parent.num_tags>=0) and (parent.num_tags<=2)),
        "Parameter num_tags not within an acceptable range")
    #print("parent vid="+str(parent.vid))
    #print("parent pcp="+str(parent.pcp))
    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid, sup_set_vlan_pcp) = (True, True, True, True)
    #    vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(parent,
            "Vlan single push action test. SET VLAN VID not supported")
        return

    if test_condition == 0:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 1
            exp_pcp = 0
            vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = 1
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
            vlan_vid = match.vlan_vid(parent.vid + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = parent.vid
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0 #NOT_EXPECTED
        exp_msg_code = 0 #NOT_EXPECTED

    elif test_condition == 1:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN_PBB
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 1
            exp_pcp = 0
            vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = 1
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
            vlan_vid = match.vlan_vid(parent.vid + ofp.OFPVID_PRESENT)
            act2 = action.action_set_field()
            act2.field = vlan_vid
            #act2 = action.action_set_vlan_vid()
            #act2.vlan_vid = parent.vid
#        parent.vid_2nd = parent.vid
#        parent.pcp_2nd = parent.pcp
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0 #NOT_EXPECTED
        exp_msg_code = 0 #NOT_EXPECTED

    elif test_condition == 2:
        act = action.action_push_vlan()
        act.ethertype = 0xaaa  #Other than 0x8100 and 0x88a8
        match_exp = False
        add_tag_exp = False
        exp_vid = 1
        exp_pcp = 0
        vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
        act2 = action.action_set_field()
        act2.field = vlan_vid
        #act2 = action.action_set_vlan_vid()
        #act2.vlan_vid = 1
        exp_msg = ofp.OFPT_ERROR
        exp_msg_type = ofp.OFPET_BAD_ACTION
        exp_msg_code = ofp.OFPBAC_BAD_ARGUMENT

    else:
        return

    #NOTE need to set a VLAN vid value, as vid=0 is stripped by the system
    action_list=[act, act2]
    wildcards = 0
    if parent.num_tags == 0:
        wildcards |= 1<<ofp.OFPXMT_OFB_VLAN_VID
        wildcards |= 1<<ofp.OFPXMT_OFB_VLAN_PCP

    testutils.flow_match_test_vlan(parent, pa_port_map,
                    wildcards=wildcards,
                    dl_vlan=parent.vid,
                    dl_vlan_pcp=parent.pcp,
                    dl_vlan_type=parent.vlan_type,
                    dl_vlan_int=parent.vid_2nd,
                    dl_vlan_pcp_int=parent.pcp_2nd,
                    vid_match=parent.vid_match,
                    pcp_match=parent.pcp_match,
                    exp_vid=exp_vid,
                    exp_pcp=exp_pcp,
                    exp_vlan_type=act.ethertype,
                    match_exp=match_exp,
                    add_tag_exp=add_tag_exp,
                    exp_msg=exp_msg,
                    exp_msg_type=exp_msg_type,
                    exp_msg_code=exp_msg_code,
                    action_list=action_list,
                    max_test=1)
Пример #11
0
def vlan_push_two_tables_tests(parent, test_condition=0, match_exp = True):
    """
    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    """
    wildcards = 0
    vid = random.randint(0, 4094)
    pcp = random.randint(0, 6)
    vid_int = -1
    pcp_int = 0

    if (test_condition == 0):
        exp_vid = vid
        exp_pcp = pcp
    elif (test_condition == 1):
        exp_vid = vid + 1
        exp_pcp = pcp
    elif (test_condition == 2):
        exp_vid = vid
        exp_pcp = pcp + 1
    else: # test_condition == 3
        exp_vid = vid + 1
        exp_pcp = pcp + 1

    # Match condition on TBL0 (match)
    vid_match_tbl0 = vid
    pcp_match_tbl0 = pcp

    # Create action_list for TBL0
    action_list_tbl0 = []
    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN
    action_list_tbl0.append(act)
    if (match_exp):
        # PUSH-only for test0
        if (test_condition == 1):
            act = action.action_set_vlan_vid()
            act.vlan_vid = exp_vid
            action_list_tbl0.append(act)
        elif (test_condition == 2):
            act = action.action_set_vlan_pcp()
            act.vlan_pcp = exp_pcp
            action_list_tbl0.append(act)
        elif (test_condition == 3):
            act = action.action_set_vlan_vid()
            act.vlan_vid = exp_vid
            action_list_tbl0.append(act)
            act = action.action_set_vlan_pcp()
            act.vlan_pcp = exp_pcp
            action_list_tbl0.append(act)
    else:
        if (test_condition == 0):
            act = action.action_set_vlan_vid()
            act.vlan_vid = vid + 1
            action_list_tbl0.append(act)

    # Create action_list for TBL1
    vid_match_tbl1 = exp_vid
    pcp_match_tbl1 = exp_pcp

    # Output action for table1 will be set in the framework
    action_list_tbl1 = None

    flow_match_test_vlan_two_tables(parent, pa_port_map,
                    dl_vlan=vid,
                    dl_vlan_pcp=pcp,
                    dl_vlan_int=vid_int,
                    dl_vlan_pcp_int=pcp_int,
                    vid_match_tbl0=vid_match_tbl0,
                    pcp_match_tbl0=pcp_match_tbl0,
                    action_list_tbl0 = action_list_tbl0,
                    match_exp_tbl0 = True,
                    vid_match_tbl1=vid_match_tbl1,
                    pcp_match_tbl1=pcp_match_tbl1,
                    action_list_tbl1 = action_list_tbl1,
                    match_exp_tbl1 = match_exp,
                    exp_vid=exp_vid,
                    exp_pcp=exp_pcp,
                    add_tag_exp=True,
                    wildcards=wildcards,
                    max_test=1)
Пример #12
0
def vlan_singlepush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 2
    """
    parent.assertTrue(((parent.num_tags >= 0) and (parent.num_tags <= 2)),
                      "Parameter num_tags not within an acceptable range")

    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid, sup_set_vlan_pcp) = \
        vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(
            parent, "Vlan single push action test. SET VLAN VID not supported")
        return

    if test_condition == 0:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 0
            exp_pcp = 0
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0  #NOT_EXPECTED
        exp_msg_code = 0  #NOT_EXPECTED

    elif test_condition == 1:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN_PBB
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 0
            exp_pcp = 0
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0  #NOT_EXPECTED
        exp_msg_code = 0  #NOT_EXPECTED

    elif test_condition == 2:
        act = action.action_push_vlan()
        act.ethertype = 0xaaa  #Other than 0x8100 and 0x88a8
        match_exp = False
        add_tag_exp = False
        exp_vid = 0
        exp_pcp = 0
        exp_msg = ofp.OFPT_ERROR
        exp_msg_type = ofp.OFPET_BAD_ACTION
        exp_msg_code = ofp.OFPBAC_BAD_ARGUMENT

    else:
        return

    action_list = [act]

    testutils.flow_match_test_vlan(parent,
                                   pa_port_map,
                                   wildcards=0,
                                   dl_vlan=parent.vid,
                                   dl_vlan_pcp=parent.pcp,
                                   dl_vlan_type=parent.vlan_type,
                                   dl_vlan_int=parent.vid_2nd,
                                   dl_vlan_pcp_int=parent.pcp_2nd,
                                   vid_match=parent.vid_match,
                                   pcp_match=parent.pcp_match,
                                   exp_vid=exp_vid,
                                   exp_pcp=exp_pcp,
                                   exp_vlan_type=act.ethertype,
                                   match_exp=match_exp,
                                   add_tag_exp=add_tag_exp,
                                   exp_msg=exp_msg,
                                   exp_msg_type=exp_msg_type,
                                   exp_msg_code=exp_msg_code,
                                   action_list=action_list,
                                   max_test=1)
Пример #13
0
def vlan_multipush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 3
    """
    parent.assertTrue(((parent.num_tags >= 0) and (parent.num_tags <= 2)),
                      "Parameter num_tags not within an acceptable range")

    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid, sup_set_vlan_pcp) = \
        vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(
            parent, "Vlan multiple push action test. PUSH not supported")
        return
    if sup_pop_vlan == False:
        testutils.skip_message_emit(
            parent, "Vlan multiple push action test. POP not supported")
        return
    if sup_set_vlan_vid == False:
        testutils.skip_message_emit(
            parent,
            "Vlan multiple push action test. SET VLAN VID not supported")
        return
    if sup_set_vlan_pcp == False:
        testutils.skip_message_emit(
            parent,
            "Vlan multiple push action test. SET VLAN PCP not supported")
        return

    new_vid = parent.vid + 2
    new_pcp = parent.pcp + 2

    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN

    act3 = None
    if test_condition == 0:
        act2 = action.action_set_vlan_vid()
        act2.vlan_vid = new_vid
        add_tag_exp = True
        exp_vid = new_vid
        exp_vlan_type = act.ethertype
        if parent.num_tags == 0:
            exp_pcp = 0
        else:
            exp_pcp = parent.pcp

    elif test_condition == 1:
        act2 = action.action_set_vlan_pcp()
        act2.vlan_pcp = new_pcp
        add_tag_exp = True
        exp_pcp = new_pcp
        exp_vlan_type = act.ethertype
        if parent.num_tags == 0:
            exp_vid = 0
        else:
            exp_vid = parent.vid

    elif test_condition == 2:
        act2 = action.action_set_vlan_vid()
        act2.vlan_vid = new_vid
        act3 = action.action_set_vlan_pcp()
        act3.vlan_pcp = new_pcp
        add_tag_exp = True
        exp_vid = new_vid
        exp_pcp = new_pcp
        exp_vlan_type = act.ethertype

    elif test_condition == 3:
        act2 = action.action_pop_vlan()
        add_tag_exp = False
        exp_vid = parent.vid
        exp_pcp = parent.pcp
        exp_vlan_type = parent.vlan_type

    else:
        return

    match_exp = True
    exp_msg = ofp.OFPT_FLOW_REMOVED
    exp_msg_type = 0  #NOT_EXPECTED
    exp_msg_code = 0  #NOT_EXPECTED

    action_list = [act, act2]
    if act3 is not None:
        action_list.append(act3)

    testutils.flow_match_test_vlan(parent,
                                   pa_port_map,
                                   wildcards=0,
                                   dl_vlan=parent.vid,
                                   dl_vlan_pcp=parent.pcp,
                                   dl_vlan_type=parent.vlan_type,
                                   dl_vlan_int=parent.vid_2nd,
                                   dl_vlan_pcp_int=parent.pcp_2nd,
                                   vid_match=parent.vid_match,
                                   pcp_match=parent.pcp_match,
                                   exp_vid=exp_vid,
                                   exp_pcp=exp_pcp,
                                   exp_vlan_type=exp_vlan_type,
                                   match_exp=match_exp,
                                   add_tag_exp=add_tag_exp,
                                   exp_msg=exp_msg,
                                   exp_msg_type=exp_msg_type,
                                   exp_msg_code=exp_msg_code,
                                   action_list=action_list,
                                   max_test=1)
Пример #14
0
def vlan_multipush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 3
    """
    parent.assertTrue(
        ((parent.num_tags >= 0) and (parent.num_tags <= 2)), "Parameter num_tags not within an acceptable range"
    )

    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid, sup_set_vlan_pcp) = vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(parent, "Vlan multiple push action test. PUSH not supported")
        return
    if sup_pop_vlan == False:
        testutils.skip_message_emit(parent, "Vlan multiple push action test. POP not supported")
        return
    if sup_set_vlan_vid == False:
        testutils.skip_message_emit(parent, "Vlan multiple push action test. SET VLAN VID not supported")
        return
    if sup_set_vlan_pcp == False:
        testutils.skip_message_emit(parent, "Vlan multiple push action test. SET VLAN PCP not supported")
        return

    new_vid = parent.vid + 2
    new_pcp = parent.pcp + 2

    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN

    act3 = None
    if test_condition == 0:
        act2 = action.action_set_vlan_vid()
        act2.vlan_vid = new_vid
        add_tag_exp = True
        exp_vid = new_vid
        exp_vlan_type = act.ethertype
        if parent.num_tags == 0:
            exp_pcp = 0
        else:
            exp_pcp = parent.pcp

    elif test_condition == 1:
        act2 = action.action_set_vlan_pcp()
        act2.vlan_pcp = new_pcp
        add_tag_exp = True
        exp_pcp = new_pcp
        exp_vlan_type = act.ethertype
        if parent.num_tags == 0:
            exp_vid = 0
        else:
            exp_vid = parent.vid

    elif test_condition == 2:
        act2 = action.action_set_vlan_vid()
        act2.vlan_vid = new_vid
        act3 = action.action_set_vlan_pcp()
        act3.vlan_pcp = new_pcp
        add_tag_exp = True
        exp_vid = new_vid
        exp_pcp = new_pcp
        exp_vlan_type = act.ethertype

    elif test_condition == 3:
        act2 = action.action_pop_vlan()
        add_tag_exp = False
        exp_vid = parent.vid
        exp_pcp = parent.pcp
        exp_vlan_type = parent.vlan_type

    else:
        return

    match_exp = True
    exp_msg = ofp.OFPT_FLOW_REMOVED
    exp_msg_type = 0  # NOT_EXPECTED
    exp_msg_code = 0  # NOT_EXPECTED

    action_list = [act, act2]
    if act3 is not None:
        action_list.append(act3)

    testutils.flow_match_test_vlan(
        parent,
        pa_port_map,
        wildcards=0,
        dl_vlan=parent.vid,
        dl_vlan_pcp=parent.pcp,
        dl_vlan_type=parent.vlan_type,
        dl_vlan_int=parent.vid_2nd,
        dl_vlan_pcp_int=parent.pcp_2nd,
        vid_match=parent.vid_match,
        pcp_match=parent.pcp_match,
        exp_vid=exp_vid,
        exp_pcp=exp_pcp,
        exp_vlan_type=exp_vlan_type,
        match_exp=match_exp,
        add_tag_exp=add_tag_exp,
        exp_msg=exp_msg,
        exp_msg_type=exp_msg_type,
        exp_msg_code=exp_msg_code,
        action_list=action_list,
        max_test=1,
    )
Пример #15
0
def vlan_singlepush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 2
    """
    parent.assertTrue(
        ((parent.num_tags >= 0) and (parent.num_tags <= 2)), "Parameter num_tags not within an acceptable range"
    )

    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid, sup_set_vlan_pcp) = vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(parent, "Vlan single push action test. SET VLAN VID not supported")
        return

    if test_condition == 0:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 0
            exp_pcp = 0
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0  # NOT_EXPECTED
        exp_msg_code = 0  # NOT_EXPECTED

    elif test_condition == 1:
        act = action.action_push_vlan()
        act.ethertype = ETHERTYPE_VLAN_PBB
        match_exp = True
        add_tag_exp = True
        if parent.num_tags == 0:
            exp_vid = 0
            exp_pcp = 0
        else:
            exp_vid = parent.vid
            exp_pcp = parent.pcp
        exp_msg = ofp.OFPT_FLOW_REMOVED
        exp_msg_type = 0  # NOT_EXPECTED
        exp_msg_code = 0  # NOT_EXPECTED

    elif test_condition == 2:
        act = action.action_push_vlan()
        act.ethertype = 0xAAA  # Other than 0x8100 and 0x88a8
        match_exp = False
        add_tag_exp = False
        exp_vid = 0
        exp_pcp = 0
        exp_msg = ofp.OFPT_ERROR
        exp_msg_type = ofp.OFPET_BAD_ACTION
        exp_msg_code = ofp.OFPBAC_BAD_ARGUMENT

    else:
        return

    action_list = [act]

    testutils.flow_match_test_vlan(
        parent,
        pa_port_map,
        wildcards=0,
        dl_vlan=parent.vid,
        dl_vlan_pcp=parent.pcp,
        dl_vlan_type=parent.vlan_type,
        dl_vlan_int=parent.vid_2nd,
        dl_vlan_pcp_int=parent.pcp_2nd,
        vid_match=parent.vid_match,
        pcp_match=parent.pcp_match,
        exp_vid=exp_vid,
        exp_pcp=exp_pcp,
        exp_vlan_type=act.ethertype,
        match_exp=match_exp,
        add_tag_exp=add_tag_exp,
        exp_msg=exp_msg,
        exp_msg_type=exp_msg_type,
        exp_msg_code=exp_msg_code,
        action_list=action_list,
        max_test=1,
    )
Пример #16
0
def vlan_push_two_tables_tests(parent, test_condition=0, match_exp=True):
    """
    @param parent must implement controller, dataplane, asserttrue, assertequal
    and logger
    """
    wildcards = 0
    vid = random.randint(1, 4094)
    pcp = random.randint(0, 6)
    vid_int = -1
    pcp_int = 0

    if (test_condition == 0):
        exp_vid = vid
        exp_pcp = pcp
    elif (test_condition == 1):
        exp_vid = vid + 1
        exp_pcp = pcp
    elif (test_condition == 2):
        exp_vid = vid
        exp_pcp = pcp + 1
    elif (test_condition == 3):
        exp_vid = vid + 1
        exp_pcp = pcp + 1
    else:
        return

    # match condition on tbl0 (match)
    vid_match_tbl0 = vid
    pcp_match_tbl0 = pcp

    # create action_list for tbl0
    action_list_tbl0 = []
    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN
    action_list_tbl0.append(act)
    if (match_exp):
        # push-only for test0
        if (test_condition == 1):
            #act = action.action_set_vlan_vid()
            #act.vlan_vid = exp_vid
            vlan_vid = match.vlan_vid(exp_vid + ofp.OFPVID_PRESENT)
            act = action.action_set_field()
            act.field = vlan_vid
            action_list_tbl0.append(act)
        elif (test_condition == 2):
            #act = action.action_set_vlan_pcp()
            #act.vlan_pcp = exp_pcp
            vlan_pcp = match.vlan_pcp(exp_pcp)
            act = action.action_set_field()
            act.field = vlan_pcp
            action_list_tbl0.append(act)
        elif (test_condition == 3):
            #act = action.action_set_vlan_vid()
            #act.vlan_vid = exp_vid
            vlan_vid = match.vlan_vid(exp_vid + ofp.OFPVID_PRESENT)
            act = action.action_set_field()
            act.field = vlan_vid
            action_list_tbl0.append(act)
            #act = action.action_set_vlan_pcp()
            #act.vlan_pcp = exp_pcp
            vlan_pcp = match.vlan_pcp(exp_pcp)
            act = action.action_set_field()
            act.field = vlan_pcp
            action_list_tbl0.append(act)
    else:
        if (test_condition == 0):
            #act = action.action_set_vlan_vid()
            #act.vlan_vid = vid + 1
            vlan_vid = match.vlan_vid(vid + 1 + ofp.OFPVID_PRESENT)
            act = action.action_set_field()
            act.field = vlan_vid
            action_list_tbl0.append(act)

    # Create action_list for TBL1
    vid_match_tbl1 = exp_vid
    pcp_match_tbl1 = exp_pcp

    # Output action for table1 will be set in the framework
    action_list_tbl1 = None

    flow_match_test_vlan_two_tables(parent,
                                    pa_port_map,
                                    dl_vlan=vid,
                                    dl_vlan_pcp=pcp,
                                    dl_vlan_int=vid_int,
                                    dl_vlan_pcp_int=pcp_int,
                                    vid_match_tbl0=vid_match_tbl0,
                                    pcp_match_tbl0=pcp_match_tbl0,
                                    action_list_tbl0=action_list_tbl0,
                                    match_exp_tbl0=True,
                                    vid_match_tbl1=vid_match_tbl1,
                                    pcp_match_tbl1=pcp_match_tbl1,
                                    action_list_tbl1=action_list_tbl1,
                                    match_exp_tbl1=match_exp,
                                    exp_vid=exp_vid,
                                    exp_pcp=exp_pcp,
                                    add_tag_exp=True,
                                    wildcards=wildcards,
                                    max_test=1)
Пример #17
0
def vlan_multipush_act_tests(parent, test_condition=0):
    """
    Test vlan push action for the packets with/without tags

    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    @param test_condition Value between 0 and 3
    """
    parent.assertTrue(((parent.num_tags>=0) and (parent.num_tags<=2)),
        "Parameter num_tags not within an acceptable range")

    (sup_pop_vlan, sup_push_vlan, sup_set_vlan_vid, sup_set_vlan_pcp) = (True, True, True, True)
    #    vlan_action_support_check(parent)

    if sup_push_vlan == False:
        testutils.skip_message_emit(parent,
            "Vlan multiple push action test. PUSH not supported")
        return
    if sup_pop_vlan == False:
        testutils.skip_message_emit(parent,
            "Vlan multiple push action test. POP not supported")
        return
    if sup_set_vlan_vid == False:
        testutils.skip_message_emit(parent,
            "Vlan multiple push action test. SET VLAN VID not supported")
        return
    if sup_set_vlan_pcp == False:
        testutils.skip_message_emit(parent,
            "Vlan multiple push action test. SET VLAN PCP not supported")
        return
    inst_app_flag = testutils.WRITE_ACTIONS_INSTRUCTION

    new_vid = parent.vid + 2;
    new_pcp = parent.pcp + 2;

    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN

    act3 = None
    if test_condition == 0:
        vlan_vid = match.vlan_vid(new_vid + ofp.OFPVID_PRESENT)
        act2 = action.action_set_field()
        act2.field = vlan_vid
        #act2 = action.action_set_vlan_vid()
        #act2.vlan_vid = new_vid
        add_tag_exp = True
        exp_vid = new_vid
        exp_vlan_type = act.ethertype

        if parent.num_tags == 0:
            exp_pcp = 0
        else:
            exp_pcp = parent.pcp

    elif test_condition == 1:
        #act2 = action.action_set_vlan_pcp()
        #act2.vlan_pcp = new_pcp
        vlan_pcp = match.vlan_pcp(new_pcp)
        act2 = action.action_set_field()
        act2.field = vlan_pcp
        add_tag_exp = True
        exp_pcp = new_pcp

        exp_vlan_type = act.ethertype
        #exp_vid = 0

        if parent.num_tags == 0:
            exp_vid = 0
        else:
            exp_vid = parent.vid

    elif test_condition == 2:
        vlan_vid = match.vlan_vid(new_vid + ofp.OFPVID_PRESENT)
        act2 = action.action_set_field()
        act2.field = vlan_vid
        #act2 = action.action_set_vlan_vid()
        #act2.vlan_vid = new_vid
        #act3 = action.action_set_vlan_pcp()
        #act3.vlan_pcp = new_pcp
        vlan_pcp = match.vlan_pcp(new_pcp)
        act3 = action.action_set_field()
        act3.field = vlan_pcp
        add_tag_exp = True
        exp_vid = new_vid
        exp_pcp = new_pcp
        exp_vlan_type = act.ethertype

    elif test_condition == 3:
        act2 = action.action_pop_vlan()
        add_tag_exp = False
        exp_vid = parent.vid
        exp_pcp = parent.pcp
        exp_vlan_type = parent.vlan_type
        inst_app_flag = testutils.APPLY_ACTIONS_INSTRUCTION

    elif test_condition == 4:
        vlan_vid = match.vlan_vid(1 + ofp.OFPVID_PRESENT)
        act3 = action.action_set_field()
        act3.field = vlan_vid

        #act2 = action.action_set_vlan_pcp()
        #act2.vlan_pcp = new_pcp
        vlan_pcp = match.vlan_pcp(new_pcp)
        act2 = action.action_set_field()
        act2.field = vlan_pcp
        add_tag_exp = True
        exp_pcp = new_pcp

        exp_vlan_type = act.ethertype
        #exp_vid = 0

        if parent.num_tags == 0:
            exp_vid = 1
        else:
            exp_vid = parent.vid
    else:
        return

    match_exp = True
    exp_msg = ofp.OFPT_FLOW_REMOVED
    exp_msg_type = 0 #NOT_EXPECTED
    exp_msg_code = 0 #NOT_EXPECTED

    action_list=[act, act2]
    if act3 is not None:
        action_list.append(act3)

    wildcards = 0
    if parent.num_tags == 0:
        wildcards |= 1<<ofp.OFPXMT_OFB_VLAN_VID
        wildcards |= 1<<ofp.OFPXMT_OFB_VLAN_PCP

    testutils.flow_match_test_vlan(parent, pa_port_map,
                    wildcards=wildcards,
                    dl_vlan=parent.vid,
                    dl_vlan_pcp=parent.pcp,
                    dl_vlan_type=parent.vlan_type,
                    dl_vlan_int=parent.vid_2nd,
                    dl_vlan_pcp_int=parent.pcp_2nd,
                    vid_match=parent.vid_match,
                    pcp_match=parent.pcp_match,
                    exp_vid=exp_vid,
                    exp_pcp=exp_pcp,
                    exp_vlan_type=exp_vlan_type,
                    match_exp=match_exp,
                    add_tag_exp=add_tag_exp,
                    exp_msg=exp_msg,
                    exp_msg_type=exp_msg_type,
                    exp_msg_code=exp_msg_code,
                    action_list=action_list,
                    inst_app_flag=inst_app_flag,
                    max_test=1)
Пример #18
0
def vlan_push_two_tables_tests(parent, test_condition=0, match_exp=True):
    """
    @param parent Must implement controller, dataplane, assertTrue, assertEqual
    and logger
    """
    wildcards = 0
    vid = random.randint(0, 4094)
    pcp = random.randint(0, 6)
    vid_int = -1
    pcp_int = 0

    if (test_condition == 0):
        exp_vid = vid
        exp_pcp = pcp
    elif (test_condition == 1):
        exp_vid = vid + 1
        exp_pcp = pcp
    elif (test_condition == 2):
        exp_vid = vid
        exp_pcp = pcp + 1
    else:  # test_condition == 3
        exp_vid = vid + 1
        exp_pcp = pcp + 1

    # Match condition on TBL0 (match)
    vid_match_tbl0 = vid
    pcp_match_tbl0 = pcp

    # Create action_list for TBL0
    action_list_tbl0 = []
    act = action.action_push_vlan()
    act.ethertype = ETHERTYPE_VLAN
    action_list_tbl0.append(act)
    if (match_exp):
        # PUSH-only for test0
        if (test_condition == 1):
            act = action.action_set_vlan_vid()
            act.vlan_vid = exp_vid
            action_list_tbl0.append(act)
        elif (test_condition == 2):
            act = action.action_set_vlan_pcp()
            act.vlan_pcp = exp_pcp
            action_list_tbl0.append(act)
        elif (test_condition == 3):
            act = action.action_set_vlan_vid()
            act.vlan_vid = exp_vid
            action_list_tbl0.append(act)
            act = action.action_set_vlan_pcp()
            act.vlan_pcp = exp_pcp
            action_list_tbl0.append(act)
    else:
        if (test_condition == 0):
            act = action.action_set_vlan_vid()
            act.vlan_vid = vid + 1
            action_list_tbl0.append(act)

    # Create action_list for TBL1
    vid_match_tbl1 = exp_vid
    pcp_match_tbl1 = exp_pcp

    # Output action for table1 will be set in the framework
    action_list_tbl1 = None

    flow_match_test_vlan_two_tables(parent,
                                    pa_port_map,
                                    dl_vlan=vid,
                                    dl_vlan_pcp=pcp,
                                    dl_vlan_int=vid_int,
                                    dl_vlan_pcp_int=pcp_int,
                                    vid_match_tbl0=vid_match_tbl0,
                                    pcp_match_tbl0=pcp_match_tbl0,
                                    action_list_tbl0=action_list_tbl0,
                                    match_exp_tbl0=True,
                                    vid_match_tbl1=vid_match_tbl1,
                                    pcp_match_tbl1=pcp_match_tbl1,
                                    action_list_tbl1=action_list_tbl1,
                                    match_exp_tbl1=match_exp,
                                    exp_vid=exp_vid,
                                    exp_pcp=exp_pcp,
                                    add_tag_exp=True,
                                    wildcards=wildcards,
                                    max_test=1)