Ejemplo n.º 1
0
def UpdatePolicer(tc, workload):
    if not workload.IsNaples():
        return 0
    PolicerClient = EzAccessStore.GetConfigClient(
        agent_api.ObjectTypes.POLICER)
    policer = PolicerClient.GetMatchingPolicerObject(workload.node_name,\
            tc.iterators.direction, tc.iterators.policertype)
    if policer:
        spec = PolicerUpdateSpec(policer)
        workload.vnic.Update(spec)
        tokens = ((policer.rate * tc.duration) + policer.burst)
        vnic_id = workload.vnic.UUID.String()
        pdsctl.ExecutePdsctlCommand(workload.node_name,\
                f"clear vnic statistics -i {vnic_id}", None, yaml=False)
    else:
        tokens = 0
    return tokens
Ejemplo n.º 2
0
def UpdatePolicer(tc, workload):
    if not workload.IsNaples():
        return 0
    PolicerClient = EzAccessStore.GetConfigClient(
        agent_api.ObjectTypes.POLICER)
    if tc.iterators.policertype == 'pps':
        multiplier = tc.iterators.pktsize + 40  # pktsize is MSS
    else:
        multiplier = 1
    duration = 10  # default iperf run duration
    policer = PolicerClient.GetMatchingPolicerObject(workload.node_name, \
            tc.iterators.direction, tc.iterators.policertype)
    if policer:
        spec = PolicerUpdateSpec(policer)
        workload.vnic.Update(spec)
        rate = ((
            (policer.rate * duration) + policer.burst) * multiplier) / duration
    else:
        rate = 0
    return rate