From 49c7f0ca1770304183a8bdfa23a5df751a056401 Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Wed, 7 Feb 2018 20:20:36 +0100 Subject: VOM: ACL: Add Object Model for acl ethertype Change-Id: I2b572ebd4b7bb26381f127912a4cc0825c04fc34 Signed-off-by: Mohsin Kazmi --- src/vpp-api/vom/types.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/vpp-api/vom/types.cpp') diff --git a/src/vpp-api/vom/types.cpp b/src/vpp-api/vom/types.cpp index 4f8884615e2..82f0aec20b2 100644 --- a/src/vpp-api/vom/types.cpp +++ b/src/vpp-api/vom/types.cpp @@ -274,6 +274,55 @@ operator<<(std::ostream& os, const direction_t& dir) return os; } +const ethertype_t ethertype_t::ARP(0x0806, "arp"); +const ethertype_t ethertype_t::FCOE(0x8906, "fcoe"); +const ethertype_t ethertype_t::IPV4(0x0800, "ipv4"); +const ethertype_t ethertype_t::IPV6(0x86DD, "ipv6"); +const ethertype_t ethertype_t::MAC_SECURITY(0x88E5, "mac-security"); +const ethertype_t ethertype_t::MPLS_UNICAST(0x8847, "mpls-unicast"); +const ethertype_t ethertype_t::TRILL(0x22F3, "trill"); +const ethertype_t ethertype_t::UNSPECIFIED(0x0, "unspecified"); + +ethertype_t::ethertype_t(int v, const std::string s) + : enum_base(v, s) +{ +} + +std::ostream& +operator<<(std::ostream& os, const ethertype_t& ether) +{ + os << ether.to_string(); + return os; +} + +const ethertype_t& +ethertype_t::from_numeric_val(uint16_t numeric) +{ + if (0x0806 == numeric) { + return (ethertype_t::ARP); + } + if (0x8906 == numeric) { + return (ethertype_t::FCOE); + } + if (0x0800 == numeric) { + return (ethertype_t::IPV4); + } + if (0x86DD == numeric) { + return (ethertype_t::IPV6); + } + if (0x88E5 == numeric) { + return (ethertype_t::MAC_SECURITY); + } + if (0x8847 == numeric) { + return (ethertype_t::MPLS_UNICAST); + } + if (0x22F3 == numeric) { + return (ethertype_t::TRILL); + } + + return (ethertype_t::UNSPECIFIED); +} + }; // namespace VOM /* -- cgit 1.2.3-korg