Neale Ranns | 9ef1c0a | 2017-11-03 04:39:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #ifndef __VOM_ROUTE_DOMAIN_CMDS_H__ |
| 17 | #define __VOM_ROUTE_DOMAIN_CMDS_H__ |
| 18 | |
| 19 | #include "vom/route_domain.hpp" |
| 20 | #include "vom/rpc_cmd.hpp" |
| 21 | |
| 22 | #include <vapi/ip.api.vapi.hpp> |
| 23 | |
| 24 | namespace VOM { |
| 25 | namespace route_domain_cmds { |
| 26 | |
| 27 | /** |
| 28 | * A command class that creates the IP table |
| 29 | */ |
| 30 | class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del> |
| 31 | { |
| 32 | public: |
| 33 | /** |
| 34 | * Constructor |
| 35 | */ |
| 36 | create_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id); |
| 37 | |
| 38 | /** |
| 39 | * Issue the command to VPP/HW |
| 40 | */ |
| 41 | rc_t issue(connection& con); |
| 42 | |
| 43 | /** |
| 44 | * convert to string format for debug purposes |
| 45 | */ |
| 46 | std::string to_string() const; |
| 47 | |
| 48 | /** |
| 49 | * Comparison operator - only used for UT |
| 50 | */ |
| 51 | bool operator==(const create_cmd& i) const; |
| 52 | |
| 53 | private: |
| 54 | /** |
| 55 | * table-ID to create |
| 56 | */ |
| 57 | route::table_id_t m_id; |
| 58 | |
| 59 | /** |
| 60 | * L3 protocol of the table |
| 61 | */ |
| 62 | l3_proto_t m_proto; |
| 63 | }; |
| 64 | |
| 65 | /** |
| 66 | * A cmd class that Deletes the IP Table |
| 67 | */ |
| 68 | class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Ip_table_add_del> |
| 69 | { |
| 70 | public: |
| 71 | /** |
| 72 | * Constructor |
| 73 | */ |
| 74 | delete_cmd(HW::item<bool>& item, l3_proto_t proto, route::table_id_t id); |
| 75 | |
| 76 | /** |
| 77 | * Issue the command to VPP/HW |
| 78 | */ |
| 79 | rc_t issue(connection& con); |
| 80 | |
| 81 | /** |
| 82 | * convert to string format for debug purposes |
| 83 | */ |
| 84 | std::string to_string() const; |
| 85 | |
| 86 | /** |
| 87 | * Comparison operator - only used for UT |
| 88 | */ |
| 89 | bool operator==(const delete_cmd& i) const; |
| 90 | |
| 91 | private: |
| 92 | /** |
| 93 | * table-ID to create |
| 94 | */ |
| 95 | route::table_id_t m_id; |
| 96 | |
| 97 | /** |
| 98 | * L3 protocol of the table |
| 99 | */ |
| 100 | l3_proto_t m_proto; |
| 101 | }; |
| 102 | |
| 103 | }; // namespace route_domain_cmds |
| 104 | }; // namespace VOM |
| 105 | |
| 106 | /* |
| 107 | * fd.io coding-style-patch-verification: ON |
| 108 | * |
| 109 | * Local Variables: |
| 110 | * eval: (c-set-style "mozilla") |
| 111 | * End: |
| 112 | */ |
| 113 | |
| 114 | #endif |