Mohsin Kazmi | ed76ee2 | 2018-03-02 12:31:37 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2018 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_BOND_INTERFACE_CMDS_H__ |
| 17 | #define __VOM_BOND_INTERFACE_CMDS_H__ |
| 18 | |
| 19 | #include "vom/bond_interface.hpp" |
| 20 | #include "vom/dump_cmd.hpp" |
| 21 | #include "vom/interface.hpp" |
| 22 | #include "vom/rpc_cmd.hpp" |
| 23 | |
| 24 | #include <vapi/bond.api.vapi.hpp> |
| 25 | #include <vapi/interface.api.vapi.hpp> |
| 26 | |
| 27 | namespace VOM { |
| 28 | namespace bond_interface_cmds { |
| 29 | |
| 30 | /** |
| 31 | * A functor class that creates an interface |
| 32 | */ |
| 33 | class create_cmd : public interface::create_cmd<vapi::Bond_create> |
| 34 | { |
| 35 | public: |
| 36 | create_cmd(HW::item<handle_t>& item, |
| 37 | const std::string& name, |
| 38 | const bond_interface::mode_t& mode, |
| 39 | const bond_interface::lb_t& lb, |
| 40 | const l2_address_t& l2_address); |
| 41 | |
| 42 | /** |
| 43 | * Issue the command to VPP/HW |
| 44 | */ |
| 45 | rc_t issue(connection& con); |
| 46 | /** |
| 47 | * convert to string format for debug purposes |
| 48 | */ |
| 49 | std::string to_string() const; |
| 50 | |
| 51 | private: |
| 52 | const bond_interface::mode_t m_mode; |
| 53 | const bond_interface::lb_t m_lb; |
| 54 | const l2_address_t m_l2_address; |
| 55 | }; |
| 56 | |
| 57 | /** |
| 58 | * A functor class that deletes a Tap interface |
| 59 | */ |
| 60 | class delete_cmd : public interface::delete_cmd<vapi::Bond_delete> |
| 61 | { |
| 62 | public: |
| 63 | delete_cmd(HW::item<handle_t>& item); |
| 64 | |
| 65 | /** |
| 66 | * Issue the command to VPP/HW |
| 67 | */ |
| 68 | rc_t issue(connection& con); |
| 69 | /** |
| 70 | * convert to string format for debug purposes |
| 71 | */ |
| 72 | std::string to_string() const; |
| 73 | }; |
| 74 | |
| 75 | /** |
| 76 | * A cmd class that Dumps all the Vpp Interfaces |
| 77 | */ |
| 78 | class dump_cmd : public VOM::dump_cmd<vapi::Sw_interface_bond_dump> |
| 79 | { |
| 80 | public: |
| 81 | /** |
| 82 | * Default Constructor |
| 83 | */ |
| 84 | dump_cmd(); |
| 85 | |
| 86 | /** |
| 87 | * Issue the command to VPP/HW |
| 88 | */ |
| 89 | rc_t issue(connection& con); |
| 90 | /** |
| 91 | * convert to string format for debug purposes |
| 92 | */ |
| 93 | std::string to_string() const; |
| 94 | |
| 95 | /** |
| 96 | * Comparison operator - only used for UT |
| 97 | */ |
| 98 | bool operator==(const dump_cmd& i) const; |
| 99 | }; |
| 100 | |
| 101 | }; // namespace bond_interface_cmds |
| 102 | }; // namespace VOM |
| 103 | |
| 104 | /* |
| 105 | * fd.io coding-style-patch-verification: ON |
| 106 | * |
| 107 | * Local Variables: |
| 108 | * eval: (c-set-style "mozilla") |
| 109 | * End: |
| 110 | */ |
| 111 | #endif |