Carmelo Cascone | 37d5dbf | 2016-04-18 15:15:48 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 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 | |
| 17 | package org.onosproject.bmv2.api.runtime; |
| 18 | |
| 19 | import java.util.Collection; |
| 20 | |
| 21 | /** |
| 22 | * RPC client to control a BMv2 device. |
| 23 | */ |
| 24 | public interface Bmv2Client { |
| 25 | /** |
| 26 | * Adds a new table entry. |
| 27 | * |
| 28 | * @param entry a table entry value |
| 29 | * @return table-specific entry ID |
| 30 | * @throws Bmv2RuntimeException if any error occurs |
| 31 | */ |
| 32 | long addTableEntry(Bmv2TableEntry entry) throws Bmv2RuntimeException; |
| 33 | |
| 34 | /** |
| 35 | * Modifies a currently installed entry by updating its action. |
| 36 | * |
| 37 | * @param tableName string value of table name |
| 38 | * @param entryId long value of entry ID |
| 39 | * @param action an action value |
| 40 | * @throws Bmv2RuntimeException if any error occurs |
| 41 | */ |
| 42 | void modifyTableEntry(String tableName, |
| 43 | long entryId, Bmv2Action action) |
| 44 | throws Bmv2RuntimeException; |
| 45 | |
| 46 | /** |
| 47 | * Deletes currently installed entry. |
| 48 | * |
| 49 | * @param tableName string value of table name |
| 50 | * @param entryId long value of entry ID |
| 51 | * @throws Bmv2RuntimeException if any error occurs |
| 52 | */ |
| 53 | void deleteTableEntry(String tableName, |
| 54 | long entryId) throws Bmv2RuntimeException; |
| 55 | |
| 56 | /** |
| 57 | * Sets table default action. |
| 58 | * |
| 59 | * @param tableName string value of table name |
| 60 | * @param action an action value |
| 61 | * @throws Bmv2RuntimeException if any error occurs |
| 62 | */ |
| 63 | void setTableDefaultAction(String tableName, Bmv2Action action) |
| 64 | throws Bmv2RuntimeException; |
| 65 | |
| 66 | /** |
| 67 | * Returns information of the ports currently configured in the switch. |
| 68 | * |
| 69 | * @return collection of port information |
| 70 | * @throws Bmv2RuntimeException if any error occurs |
| 71 | */ |
| 72 | Collection<Bmv2PortInfo> getPortsInfo() throws Bmv2RuntimeException; |
| 73 | |
| 74 | /** |
| 75 | * Return a string representation of a table content. |
| 76 | * |
| 77 | * @param tableName string value of table name |
| 78 | * @return table string dump |
| 79 | * @throws Bmv2RuntimeException if any error occurs |
| 80 | */ |
| 81 | String dumpTable(String tableName) throws Bmv2RuntimeException; |
| 82 | |
| 83 | /** |
| 84 | * Reset the state of the switch (e.g. delete all entries, etc.). |
| 85 | * |
| 86 | * @throws Bmv2RuntimeException if any error occurs |
| 87 | */ |
| 88 | void resetState() throws Bmv2RuntimeException; |
| 89 | } |