Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 1 | package org.onosproject.pcepio.types; |
| 2 | |
| 3 | import java.util.LinkedList; |
| 4 | import java.util.ListIterator; |
| 5 | |
| 6 | import org.onosproject.pcepio.protocol.PcepLabelObject; |
| 7 | import org.onosproject.pcepio.protocol.PcepLspObject; |
| 8 | import org.onosproject.pcepio.protocol.PcepSrpObject; |
| 9 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; |
| 11 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 12 | import com.google.common.base.MoreObjects; |
| 13 | |
| 14 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 15 | * Provides Pcep Label. |
| 16 | * REference :draft-zhao-pce-pcep-extension-for-pce-controller-01. |
| 17 | */ |
| 18 | public class PcepLabelDownload { |
| 19 | |
| 20 | protected static final Logger log = LoggerFactory.getLogger(PcepLabelDownload.class); |
| 21 | |
| 22 | //PCEP SPR Object |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 23 | private PcepSrpObject srpObject; |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 24 | //PCEP LSP Object |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 25 | private PcepLspObject lspObject; |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 26 | //LinkList of Labels |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 27 | private LinkedList<PcepLabelObject> llLabelList; |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 28 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 29 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 30 | * Returns SRP Object. |
| 31 | * |
| 32 | * @return PCEP SRP Object |
| 33 | */ |
| 34 | public PcepSrpObject getSrpObject() { |
| 35 | return srpObject; |
| 36 | } |
| 37 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 38 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 39 | * Sets the Pcep Srp Object. |
| 40 | * |
| 41 | * @param srpobj PCEP SRP Object |
| 42 | */ |
| 43 | public void setSrpObject(PcepSrpObject srpobj) { |
| 44 | this.srpObject = srpobj; |
| 45 | } |
| 46 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 47 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 48 | * Returns LSP Object. |
| 49 | * |
| 50 | * @return PCEP LSP Object |
| 51 | */ |
| 52 | public PcepLspObject getLspObject() { |
| 53 | return lspObject; |
| 54 | } |
| 55 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 56 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 57 | * Sets the Pcep LSP Object. |
| 58 | * |
| 59 | * @param lspObject PCEP LSP Object |
| 60 | */ |
| 61 | public void setLspObject(PcepLspObject lspObject) { |
| 62 | this.lspObject = lspObject; |
| 63 | } |
| 64 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 65 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 66 | * Returns a list of labels. |
| 67 | * |
| 68 | * @return llLabelList list of pcep label objects |
| 69 | */ |
| 70 | public LinkedList<PcepLabelObject> getLabelList() { |
| 71 | return llLabelList; |
| 72 | } |
| 73 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 74 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 75 | * set the llLabelList list of type PcepLableObject. |
| 76 | * |
| 77 | * @param llLabelList list of pcep label objects |
| 78 | */ |
| 79 | public void setLabelList(LinkedList<PcepLabelObject> llLabelList) { |
| 80 | this.llLabelList = llLabelList; |
| 81 | } |
| 82 | |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 83 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 84 | * Prints the attribute of PcepLableObject. |
| 85 | */ |
| 86 | public void print() { |
| 87 | log.debug("LABEL DOWNLOAD:"); |
| 88 | srpObject.print(); |
| 89 | lspObject.print(); |
| 90 | |
| 91 | log.debug("label-list:"); |
| 92 | ListIterator<PcepLabelObject> listIterator = llLabelList.listIterator(); |
| 93 | while (listIterator.hasNext()) { |
| 94 | listIterator.next().print(); |
| 95 | } |
| 96 | } |
bharat saraswal | f7364db | 2015-08-11 13:39:31 +0530 | [diff] [blame^] | 97 | |
| 98 | @Override |
| 99 | public String toString() { |
| 100 | return MoreObjects.toStringHelper(getClass()) |
| 101 | .add("SRP object", srpObject) |
| 102 | .add("LSP object", lspObject) |
| 103 | .add("label object list", llLabelList) |
| 104 | .toString(); |
| 105 | } |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 106 | } |