def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create section name: OFPInstruction...
        ins_classes = {}
        for inst in ofp_parser.OFPInstruction._INSTRUCTION_TYPES.values():
            key = create_section_name(inst.__name__, "OFPInstruction")
            ins_classes[key] = inst

        # create instructions.
        instructions = []
        for insts in params:
            for ins_type, ins_val in insts.items():
                if ins_type in ["apply_actions", "write_actions", "clear_actions"]:
                    # create actions.
                    actions = []
                    if SCE_ACTIONS in ins_val:
                        actions = OfpActionCreator.create(test_case_obj, dp,
                                                          ofproto, ofp_parser,
                                                          ins_val[SCE_ACTIONS])
                    ins_val[SCE_ACTIONS] = actions
                    ins_val["type_"] = getattr(
                        ofproto, "OFPIT_%s" % ins_type.upper())
                    # changed to OFPInstructionActions class.
                    ins_type = "actions"

                # create instructions.
                ins_obj = ins_classes[ins_type](**ins_val)
                ins_obj._set_targets(get_attrs_without_len(ins_obj))
                instructions.append(ins_obj)

        return instructions
Example #2
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create section name: OFPInstruction...
        ins_classes = {}
        for inst in ofp_parser.OFPInstruction._INSTRUCTION_TYPES.values():
            key = create_section_name(inst.__name__, "OFPInstruction")
            ins_classes[key] = inst

        # create instructions.
        instructions = []
        for insts in params:
            for ins_type, ins_val in insts.items():
                if ins_type in [
                        "apply_actions", "write_actions", "clear_actions"
                ]:
                    # create actions.
                    actions = []
                    if SCE_ACTIONS in ins_val:
                        actions = OfpActionCreator.create(
                            test_case_obj, dp, ofproto, ofp_parser,
                            ins_val[SCE_ACTIONS])
                    ins_val[SCE_ACTIONS] = actions
                    ins_val["type_"] = getattr(ofproto,
                                               "OFPIT_%s" % ins_type.upper())
                    # changed to OFPInstructionActions class.
                    ins_type = "actions"

                # create instructions.
                ins_obj = ins_classes[ins_type](**ins_val)
                ins_obj._set_targets(get_attrs_without_len(ins_obj))
                instructions.append(ins_obj)

        return instructions
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # FeaturesReply.
        kws = copy.deepcopy(params)

        # create FeaturesReply.
        msg = ofp_parser.OFPSwitchFeatures(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # GroupFeatures_Stats.
        kws = copy.deepcopy(params)

        # create GroupFeaturesStats.
        msg = ofp_parser.OFPGroupFeaturesStats(**kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #5
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # MeterFeatures_Stats.
        kws = copy.deepcopy(params)

        # create MeterFeaturesStats.
        msg = ofp_parser.OFPMeterFeaturesStats(**kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #6
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # RoleReply.
        kws = copy.deepcopy(params)

        # create RoleReply.
        msg = ofp_parser.OFPRoleReply(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # GetConfigReply.
        kws = copy.deepcopy(params)

        # create GetConfigReply.
        msg = ofp_parser.OFPGetConfigReply(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        bucket_counters = []

        for bc in params:
            if SCE_BUCKET_COUNTER in bc:
                bucket_counter = ofp_parser.OFPBucketCounter(**bc[SCE_BUCKET_COUNTER])
                bucket_counter._set_targets(get_attrs_without_len(bucket_counter))
                bucket_counters.append(bucket_counter)

        return bucket_counters
Example #9
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        band_stats = []

        for bc in params:
            if SCE_BAND_STATS in bc:
                band_obj = ofp_parser.OFPMeterBandStats(**bc[SCE_BAND_STATS])
                band_obj._set_targets(get_attrs_without_len(band_obj))
                band_stats.append(band_obj)

        return band_stats
Example #10
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        bucket_counters = []

        for bc in params:
            if SCE_BUCKET_COUNTER in bc:
                bucket_counter = ofp_parser.OFPBucketCounter(
                    **bc[SCE_BUCKET_COUNTER])
                bucket_counter._set_targets(
                    get_attrs_without_len(bucket_counter))
                bucket_counters.append(bucket_counter)

        return bucket_counters
Example #11
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # EchoReply
        kws = copy.deepcopy(params)

        data = None
        if SCE_ECHO_DATA in params:
            data = base64.b16decode(params[SCE_ECHO_DATA].replace(" ",
                                                                  "").upper())

        kws[SCE_ECHO_DATA] = data

        # create EchoReply.
        msg = ofp_parser.OFPEchoReply(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #12
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create section name: OFPAction...
        act_classes = {}
        for act in ofp_parser.OFPAction._ACTION_TYPES.values():
            key = create_section_name(act.__name__, "OFPAction")
            act_classes[key] = act

        # create actions.
        actions = []
        for act in params:
            for act_type, act_val in act.items():
                act_obj = act_classes[act_type](**act_val)
                act_obj._set_targets(get_attrs_without_len(act_obj))
                actions.append(act_obj)

        return actions
Example #13
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create section name: OFPBand...
        bd_classes = {}
        for bd in ofp_parser.OFPMeterBandHeader._METER_BAND.values():
            key = create_section_name(bd.__name__, "OFPMeterBand")
            bd_classes[key] = bd

        # create bands.
        bands = []
        for bd in params:
            for bd_type, bd_val in bd.items():
                bd_obj = bd_classes[bd_type](**bd_val)
                bd_obj._set_targets(get_attrs_without_len(bd_obj))
                bands.append(bd_obj)

        return bands
Example #14
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # EchoReply
        kws = copy.deepcopy(params)

        data = None
        if SCE_ECHO_DATA in params:
            data = base64.b16decode(
                params[SCE_ECHO_DATA].replace(" ", "").upper())

        kws[SCE_ECHO_DATA] = data

        # create EchoReply.
        msg = ofp_parser.OFPEchoReply(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # MeterConfigStats.
        kws = copy.deepcopy(params)

        # bands.
        bands = []
        if SCE_BANDS in params:
            bands = OfpBandCreator.create(test_case_obj, dp, ofproto,
                                          ofp_parser, params[SCE_BANDS])
        kws[SCE_BANDS] = bands

        # create MeterConfigStats.
        msg = ofp_parser.OFPMeterConfigStats(**kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #16
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # PortStatus.
        kws = copy.deepcopy(params)

        desc = None
        if SCE_PORT_STATUS_DESC in params:
            if SCE_PORT in params[SCE_PORT_STATUS_DESC]:
                port_obj = OfpPortCreator.create(
                    test_case_obj, dp, ofproto, ofp_parser,
                    params[SCE_PORT_STATUS_DESC][SCE_PORT])
        kws[SCE_PORT_STATUS_DESC] = port_obj

        # create PortStatus.
        msg = ofp_parser.OFPPortStatus(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #17
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create buckets.
        buckets = []
        for bt in params:
            bt_val = bt[SCE_BUCKET]

            if SCE_ACTIONS in bt_val:
                actions = OfpActionCreator.create(test_case_obj, dp, ofproto,
                                                  ofp_parser,
                                                  bt_val[SCE_ACTIONS])
                bt_val[SCE_ACTIONS] = actions

            # create buckets.
            bucket_obj = ofp_parser.OFPBucket(**bt_val)
            bucket_obj._set_targets(get_attrs_without_len(bucket_obj))
            buckets.append(bucket_obj)

        return buckets
Example #18
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create buckets.
        buckets = []
        for bt in params:
            bt_val = bt[SCE_BUCKET]

            if SCE_ACTIONS in bt_val:
                actions = OfpActionCreator.create(test_case_obj, dp,
                                                  ofproto, ofp_parser,
                                                  bt_val[SCE_ACTIONS])
                bt_val[SCE_ACTIONS] = actions

            # create buckets.
            bucket_obj = ofp_parser.OFPBucket(**bt_val)
            bucket_obj._set_targets(get_attrs_without_len(bucket_obj))
            buckets.append(bucket_obj)

        return buckets
Example #19
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # GroupDesc_Stats.
        kws = copy.deepcopy(params)

        # buckets.
        buckets = []
        if SCE_BUCKETS in params:
            buckets = OfpBucketCreator.create(test_case_obj,
                                              dp, ofproto,
                                              ofp_parser,
                                              params[SCE_BUCKETS])
        kws[SCE_BUCKETS] = buckets

        # create GroupDescStats.
        msg = ofp_parser.OFPGroupDescStats(**kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #20
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # PortStatus.
        kws = copy.deepcopy(params)

        desc = None
        if SCE_PORT_STATUS_DESC in params:
            if SCE_PORT in params[SCE_PORT_STATUS_DESC]:
                port_obj = OfpPortCreator.create(
                    test_case_obj, dp,
                    ofproto, ofp_parser,
                    params[SCE_PORT_STATUS_DESC][SCE_PORT])
        kws[SCE_PORT_STATUS_DESC] = port_obj

        # create PortStatus.
        msg = ofp_parser.OFPPortStatus(dp, **kws)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #21
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        match = ofp_parser.OFPMatch(**params)
        match._set_targets(get_attrs_without_len(match))

        return match
Example #22
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        match = ofp_parser.OFPMatch(**params)
        match._set_targets(get_attrs_without_len(match))

        return match
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create BarrierReply.
        msg = ofp_parser.OFPBarrierReply(dp)
        msg._set_targets(get_attrs_without_len(msg))

        return msg
Example #24
0
    def create(cls, test_case_obj, dp, ofproto, ofp_parser, params):
        # create BarrierReply.
        msg = ofp_parser.OFPBarrierReply(dp)
        msg._set_targets(get_attrs_without_len(msg))

        return msg