aboutsummaryrefslogtreecommitdiffstats
path: root/cos/cosbase/src/main/java/com/cablelabs/vcpe/cos/cosbase/model/CoS.java
blob: 9cbc90389ce9a85464532ad83ef30f483d5407b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*******************************************************************************
* Copyright (c) 2015 CableLabs Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*******************************************************************************/

package com.cablelabs.vcpe.cos.cosbase.model;

import com.cablelabs.vcpe.common.Dbg;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

/**
 * Created by steve on 5/24/15.
 */

@XmlRootElement
public class CoS
{
    private String id;

    // private BandwidthProfile ingressBWProfile;
    // private BandwidthProfile egressBWProfile;
    // Above should be integrated at some point
    // ... for now we will support commitedInfoRate in Lie of BW Profiles
    private int    commitedInfoRate; // MBPS

    private double availbility;      // percentage
    private double frameDelay;       // milli-seconds
    private double jitter;           // milli-seconds
    private double frameLoss;        // percentage

    // no argument constructor required for JAX-RS
    public CoS() {
        commitedInfoRate = 0;
        availbility = 0.0;
        frameDelay = 0.0;
        jitter = 0.0;
        frameLoss = 0.0;
    }


    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

    public int getCommitedInfoRate() { return commitedInfoRate; }
    public void setCommitedInfoRate(int commitedInfoRate) { this.commitedInfoRate = commitedInfoRate; }

    public double getAvailbility() { return availbility; }
    public void setAvailbility(double availbility) { this.availbility = availbility; }

    public double getFrameDelay() { return frameDelay; }
    public void setFrameDelay(double frameDelay) { this.frameDelay = frameDelay; }

    public double getJitter() { return jitter; }
    public void setJitter(double jitter) { this.jitter = jitter; }

    public double getFrameLoss() { return frameLoss; }
    public void setFrameLoss(double frameLoss) { this.frameLoss = frameLoss; }

    public void setAllProps(String id, int commitedInfoRate, double availbility, double frameDelay, double jitter, double frameLoss)
    {
        this.id = id;
        this.commitedInfoRate = commitedInfoRate;
        this.availbility = availbility;
        this.frameDelay = frameDelay;
        this.jitter = jitter;
        this.frameLoss = frameLoss;
    }

    public void dump() { dump(0); }
    public void dump(int tab) {
        Dbg.p(tab, "id:           " + this.id);
        Dbg.p(tab, "commInfoRate: " + this.commitedInfoRate);
        Dbg.p(tab, "availbility:  " + this.availbility);
        Dbg.p(tab, "frameDelay:   " + this.frameDelay);
        Dbg.p(tab, "jitter:       " + this.jitter);
        Dbg.p(tab, "frameLoss:    " + this.frameLoss);
    }

    public static void dumpList(List<CoS> cosList) { dumpList(0, cosList); }
    public static void dumpList(int tab, List<CoS> cosList) {
        int numCos = 0;
        Dbg.p("----- CoS List : [" + cosList.size() + "] elements");
        for (CoS curCos : cosList) {
            numCos++;
            Dbg.p(tab+1, "<Entry " + numCos+">");
            curCos.dump(tab+2);
        }
    }
}