YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.ovsdb.rfc.table; |
| 17 | |
| 18 | import java.util.Map; |
| 19 | import java.util.Set; |
| 20 | |
| 21 | import org.onosproject.ovsdb.rfc.notation.Column; |
| 22 | import org.onosproject.ovsdb.rfc.notation.Row; |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 23 | import org.onosproject.ovsdb.rfc.notation.Uuid; |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 24 | import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; |
| 25 | import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService; |
| 26 | import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; |
| 27 | |
| 28 | /** |
| 29 | * This class provides operations of Mirror Table. |
| 30 | */ |
| 31 | public class Mirror extends AbstractOvsdbTableService { |
| 32 | /** |
| 33 | * Mirror table column name. |
| 34 | */ |
| 35 | public enum MirrorColumn { |
| 36 | NAME("name"), SELECTSRCPORT("select_src_port"), SELECTDSTPORT("select_dst_port"), |
| 37 | SELECTVLAN("select_vlan"), OUTPUTPORT("output_port"), EXTERNALIDS("external_ids"), |
| 38 | OUTPUTVLAN("output_vlan"), STATISTICS("statistics"), SELECTALL("select_all"); |
| 39 | |
| 40 | private final String columnName; |
| 41 | |
| 42 | private MirrorColumn(String columnName) { |
| 43 | this.columnName = columnName; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Returns the table column name for MirrorColumn. |
| 48 | * @return the table column name |
| 49 | */ |
| 50 | public String columnName() { |
| 51 | return columnName; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Constructs a Mirror object. Generate Mirror Table Description. |
| 57 | * @param dbSchema DatabaseSchema |
| 58 | * @param row Row |
| 59 | */ |
| 60 | public Mirror(DatabaseSchema dbSchema, Row row) { |
| 61 | super(dbSchema, row, OvsdbTable.MIRROR, VersionNum.VERSION100); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Get the Column entity which column name is "name" from the Row entity of |
| 66 | * attributes. |
| 67 | * @return the Column entity which column name is "name" |
| 68 | */ |
| 69 | public Column getNameColumn() { |
| 70 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.NAME.columnName(), |
| 71 | "getNameColumn", |
| 72 | VersionNum.VERSION100); |
| 73 | return (Column) super.getColumnHandler(columndesc); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Add a Column entity which column name is "name" to the Row entity of |
| 78 | * attributes. |
| 79 | * @param name the column data which column name is "name" |
| 80 | */ |
Pier Ventre | bee9de8 | 2016-08-04 17:03:36 +0200 | [diff] [blame] | 81 | public void setName(String name) { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 82 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.NAME.columnName(), |
| 83 | "setName", |
| 84 | VersionNum.VERSION100); |
| 85 | super.setDataHandler(columndesc, name); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Get the column data which column name is "name" from the Row entity of |
| 90 | * attributes. |
| 91 | * @return the column data which column name is "name" |
| 92 | */ |
Pier Ventre | bee9de8 | 2016-08-04 17:03:36 +0200 | [diff] [blame] | 93 | public String getName() { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 94 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.NAME.columnName(), |
| 95 | "getName", |
| 96 | VersionNum.VERSION100); |
Pier Ventre | bee9de8 | 2016-08-04 17:03:36 +0200 | [diff] [blame] | 97 | return (String) super.getDataHandler(columndesc); |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Get the Column entity which column name is "select_src_port" from the Row |
| 102 | * entity of attributes. |
| 103 | * @return the Column entity which column name is "select_src_port" |
| 104 | */ |
| 105 | public Column getSelectSrcPortColumn() { |
| 106 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTSRCPORT.columnName(), |
| 107 | "getSelectSrcPortColumn", VersionNum.VERSION100); |
| 108 | return (Column) super.getColumnHandler(columndesc); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Add a Column entity which column name is "select_src_port" to the Row |
| 113 | * entity of attributes. |
| 114 | * @param selectSrcPort the column data which column name is |
| 115 | * "select_src_port" |
| 116 | */ |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 117 | public void setSelectSrcPort(Set<Uuid> selectSrcPort) { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 118 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTSRCPORT.columnName(), |
| 119 | "setSelectSrcPort", VersionNum.VERSION100); |
| 120 | super.setDataHandler(columndesc, selectSrcPort); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Get the Column entity which column name is "select_dst_port" from the Row |
| 125 | * entity of attributes. |
| 126 | * @return the Column entity which column name is "select_dst_port" |
| 127 | */ |
| 128 | public Column getSelectDstPortColumn() { |
| 129 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTDSTPORT.columnName(), |
| 130 | "getSelectDstPortColumn", VersionNum.VERSION100); |
| 131 | return (Column) super.getColumnHandler(columndesc); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Add a Column entity which column name is "select_dst_port" to the Row |
| 136 | * entity of attributes. |
| 137 | * @param selectDstPrt the column data which column name is |
| 138 | * "select_dst_port" |
| 139 | */ |
Jonathan Hart | 51539b8 | 2015-10-29 09:53:04 -0700 | [diff] [blame] | 140 | public void setSelectDstPort(Set<Uuid> selectDstPrt) { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 141 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTDSTPORT.columnName(), |
| 142 | "setSelectDstPort", VersionNum.VERSION100); |
| 143 | super.setDataHandler(columndesc, selectDstPrt); |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Get the Column entity which column name is "select_vlan" from the Row |
| 148 | * entity of attributes. |
| 149 | * @return the Column entity which column name is "select_vlan" |
| 150 | */ |
| 151 | public Column getSelectVlanColumn() { |
| 152 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTVLAN.columnName(), |
| 153 | "getSelectVlanColumn", VersionNum.VERSION100); |
| 154 | return (Column) super.getColumnHandler(columndesc); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Add a Column entity which column name is "select_vlan" to the Row entity |
| 159 | * of attributes. |
| 160 | * @param selectVlan the column data which column name is "select_vlan" |
| 161 | */ |
Pier Ventre | bee9de8 | 2016-08-04 17:03:36 +0200 | [diff] [blame] | 162 | public void setSelectVlan(Set<Short> selectVlan) { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 163 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTVLAN.columnName(), |
| 164 | "setSelectVlan", VersionNum.VERSION100); |
| 165 | super.setDataHandler(columndesc, selectVlan); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Get the Column entity which column name is "output_port" from the Row |
| 170 | * entity of attributes. |
| 171 | * @return the Column entity which column name is "output_port" |
| 172 | */ |
| 173 | public Column getOutputPortColumn() { |
| 174 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTPORT.columnName(), |
| 175 | "getOutputPortColumn", VersionNum.VERSION100); |
| 176 | return (Column) super.getColumnHandler(columndesc); |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Add a Column entity which column name is "output_port" to the Row entity |
| 181 | * of attributes. |
| 182 | * @param outputPort the column data which column name is "output_port" |
| 183 | */ |
Pier Ventre | bee9de8 | 2016-08-04 17:03:36 +0200 | [diff] [blame] | 184 | public void setOutputPort(Uuid outputPort) { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 185 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTPORT.columnName(), |
| 186 | "setOutputPort", VersionNum.VERSION100); |
| 187 | super.setDataHandler(columndesc, outputPort); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Get the Column entity which column name is "output_vlan" from the Row |
| 192 | * entity of attributes. |
| 193 | * @return the Column entity which column name is "output_vlan" |
| 194 | */ |
| 195 | public Column getOutputVlanColumn() { |
| 196 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTVLAN.columnName(), |
| 197 | "getOutputVlanColumn", VersionNum.VERSION100); |
| 198 | return (Column) super.getColumnHandler(columndesc); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Add a Column entity which column name is "output_vlan" to the Row entity |
| 203 | * of attributes. |
| 204 | * @param outputVlan the column data which column name is "output_vlan" |
| 205 | */ |
Pier Ventre | f5d7236 | 2016-07-17 12:02:14 +0200 | [diff] [blame] | 206 | public void setOutputVlan(Short outputVlan) { |
YuanyouZhang | 362c7ab | 2015-08-03 17:07:20 +0800 | [diff] [blame] | 207 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTVLAN.columnName(), |
| 208 | "setOutputVlan", VersionNum.VERSION100); |
| 209 | super.setDataHandler(columndesc, outputVlan); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * Get the Column entity which column name is "statistics" from the Row |
| 214 | * entity of attributes. |
| 215 | * @return the Column entity which column name is "statistics" |
| 216 | */ |
| 217 | public Column getStatisticsColumn() { |
| 218 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.STATISTICS.columnName(), |
| 219 | "getStatisticsColumn", VersionNum.VERSION640); |
| 220 | return (Column) super.getColumnHandler(columndesc); |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Add a Column entity which column name is "statistics" to the Row entity |
| 225 | * of attributes. |
| 226 | * @param statistics the column data which column name is "statistics" |
| 227 | */ |
| 228 | public void setStatistics(Map<String, Long> statistics) { |
| 229 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.STATISTICS.columnName(), |
| 230 | "setStatistics", VersionNum.VERSION640); |
| 231 | super.setDataHandler(columndesc, statistics); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Get the Column entity which column name is "external_ids" from the Row |
| 236 | * entity of attributes. |
| 237 | * @return the Column entity which column name is "external_ids" |
| 238 | */ |
| 239 | public Column getExternalIdsColumn() { |
| 240 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.EXTERNALIDS.columnName(), |
| 241 | "getExternalIdsColumn", VersionNum.VERSION100); |
| 242 | return (Column) super.getColumnHandler(columndesc); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Add a Column entity which column name is "external_ids" to the Row entity |
| 247 | * of attributes. |
| 248 | * @param externalIds the column data which column name is "external_ids" |
| 249 | */ |
| 250 | public void setExternalIds(Map<String, String> externalIds) { |
| 251 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.EXTERNALIDS.columnName(), |
| 252 | "setExternalIds", VersionNum.VERSION100); |
| 253 | super.setDataHandler(columndesc, externalIds); |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Get the Column entity which column name is "select_all" from the Row |
| 258 | * entity of attributes. |
| 259 | * @return the Column entity which column name is "select_all" |
| 260 | */ |
| 261 | public Column getSelectAllColumn() { |
| 262 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTALL.columnName(), |
| 263 | "getSelectAllColumn", VersionNum.VERSION620); |
| 264 | return (Column) super.getColumnHandler(columndesc); |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Add a Column entity which column name is "select_all" to the Row entity |
| 269 | * of attributes. |
| 270 | * @param selectAll the column data which column name is "select_all" |
| 271 | */ |
| 272 | public void setSelectAll(Boolean selectAll) { |
| 273 | ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTALL.columnName(), |
| 274 | "setSelectAll", VersionNum.VERSION620); |
| 275 | super.setDataHandler(columndesc, selectAll); |
| 276 | } |
| 277 | } |